Public report of PrefectHQ/prefect, published 4 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.2). 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, 4 November 2026, 22:09 UTC · Survey ID cd_6c139a577a864078a8517db484776d3f
PrefectHQ/prefect
Measured 4 November 2026, 22:06 UTC, at code version 96b7e6c
CAI scoreAt riskUp 5 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 366,759 lines of product code in 23 projects, tests not counted · Estimated rebuild effort: about 4.8 person-years · Weakest lens: Accessibility, 51
Findings by how serious they are
67 critical1826 serious264 minor
11 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
4 November 2026, 22:06 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
90of 90 dimensions measured by tools.
2122of 2157 findings point to an exact file and line, so you can open each one in the code. The other 35 concern the repository as a whole, such as missing documentation.
90dimensions across 8 lenses, read from 366,759 lines of product code in 23 projects.
PrefectHQ/prefect is rated At risk because critical security findings are open. It scores 57 out of 100, which the At risk rating leaves unchanged.
Accessibility, at 51, is the weakest lens and counts most in the score. The best first step for the work it takes is replacing the two exposed passwords or keys and switching the old ones off, worth about 3 points. Making the controls keyboard-usable would lift Accessibility itself, worth about 4 points. Raising Accessibility to 70 would lift the score to about 61.
Fourteen passwords or keys in the code's history and two in the code are open to anyone who can read the repository. Twelve settings leave the servers or containers unsafe, and eleven places in the code run text as code, which an attacker could use. Replacing each exposed password or key, correcting the unsafe settings and replacing text run as code with direct calls would close these risks. Limiting each secret to its own step would fix the six secrets exposed to more of the pipeline than needed, and setting a waiting period for automatic updates would deal with the two automatic dependency updates that take new releases at once. The five loops of files that import each other need breaking.
The product code is 366,759 lines, about €700,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.
Large Files · ui-v2/src/routes/dashboard.tsx: 1094 lines of code ui-v2/src/routes/dashboard.tsx
Large Files · ui-v2/src/routes/runs/index.tsx: 796 lines of code ui-v2/src/routes/runs/index.tsx
Large Files · ui-v2/src/components/schemas/stories/properties.stories.tsx: 706 lines of code ui-v2/src/components/schemas/stories/properties.stories.tsx
Large Files · ui-v2/src/routes/flows/flow.$id.tsx: 606 lines of code ui-v2/src/routes/flows/flow.$id.tsx
Large Files · ui-v2/src/api/flow-runs/index.ts: 571 lines of code ui-v2/src/api/flow-runs/index.ts
Large Files · ui-v2/src/components/runs/runs-page.tsx: 476 lines of code ui-v2/src/components/runs/runs-page.tsx
Large Files · ui-v2/src/api/deployments/index.ts: 464 lines of code ui-v2/src/api/deployments/index.ts
Large Files · ui-v2/src/components/automations/trigger-details/trigger-utils.ts: 464 lines of code ui-v2/src/components/automations/trigger-details/trigger-utils.ts
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 725 findings
These 725 critical or serious findings were in the previous survey, on 20 October 2026, and are gone from this one. The first 100 are listed here.
€230,000 to €1,200,000, for 3,894 to 12,355 hours of work, about 4.8 person-years for 2 to 10 engineers
Difficulty of the problem
Low, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 57. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 366,759 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, REDACTED.
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 €700,000 to build again, about 4.8 person-years of work. Its weakest lens is Accessibility, at 51 (Adequate). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility 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 3 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
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.
870 modules, with 565 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 830 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.
51 pairs of types, where a type in prefect.client.schemas.objects uses a type in prefect._internal.schemas.bases. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
prefect.client.schemas.objects uses prefect._internal.schemas.bases, so a change to prefect._internal.schemas.bases can break prefect.client.schemas.objects, while a change to prefect.client.schemas.objects can't break prefect._internal.schemas.bases.
Position
Below the diagonal: prefect.client.schemas.objects uses a module listed above it, which is the healthy direction.
prefect.client.schemas.objects uses prefect.utilities.collections, so a change to prefect.utilities.collections can break prefect.client.schemas.objects, while a change to prefect.client.schemas.objects can't break prefect.utilities.collections.
Position
Below the diagonal: prefect.client.schemas.objects uses a module listed above it, which is the healthy direction.
prefect.events.schemas.events uses prefect._internal.schemas.bases, so a change to prefect._internal.schemas.bases can break prefect.events.schemas.events, while a change to prefect.events.schemas.events can't break prefect._internal.schemas.bases.
Position
Below the diagonal: prefect.events.schemas.events uses a module listed above it, which is the healthy direction.
prefect.server.api.ui uses prefect.server.database.interface, so a change to prefect.server.database.interface can break prefect.server.api.ui, while a change to prefect.server.api.ui can't break prefect.server.database.interface.
Position
Below the diagonal: prefect.server.api.ui uses a module listed above it, which is the healthy direction.
prefect.server.api.ui uses prefect.server.schemas.states, so a change to prefect.server.schemas.states can break prefect.server.api.ui, while a change to prefect.server.api.ui can't break prefect.server.schemas.states.
Position
Below the diagonal: prefect.server.api.ui uses a module listed above it, which is the healthy direction.
prefect.server.events.schemas.events uses prefect.server.utilities.schemas.bases, so a change to prefect.server.utilities.schemas.bases can break prefect.server.events.schemas.events, while a change to prefect.server.events.schemas.events can't break prefect.server.utilities.schemas.bases.
Position
Below the diagonal: prefect.server.events.schemas.events uses a module listed above it, which is the healthy direction.
prefect._internal uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect._internal, while a change to prefect._internal can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect._internal uses a module listed above it, which is the healthy direction.
prefect.blocks.core uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.blocks.core, while a change to prefect.blocks.core can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.blocks.core uses a module listed above it, which is the healthy direction.
prefect.client.orchestration uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.client.orchestration, while a change to prefect.client.orchestration can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.client.orchestration uses a module listed above it, which is the healthy direction.
prefect.client.schemas.responses uses prefect._internal.schemas.bases, so a change to prefect._internal.schemas.bases can break prefect.client.schemas.responses, while a change to prefect.client.schemas.responses can't break prefect._internal.schemas.bases.
Position
Below the diagonal: prefect.client.schemas.responses uses a module listed above it, which is the healthy direction.
prefect.client.schemas.responses uses prefect.utilities.collections, so a change to prefect.utilities.collections can break prefect.client.schemas.responses, while a change to prefect.client.schemas.responses can't break prefect.utilities.collections.
Position
Below the diagonal: prefect.client.schemas.responses uses a module listed above it, which is the healthy direction.
prefect.client.schemas.responses uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.client.schemas.responses, while a change to prefect.client.schemas.responses can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.client.schemas.responses uses a module listed above it, which is the healthy direction.
prefect.server.events.filters uses prefect.server.database.interface, so a change to prefect.server.database.interface can break prefect.server.events.filters, while a change to prefect.server.events.filters can't break prefect.server.database.interface.
Position
Below the diagonal: prefect.server.events.filters uses a module listed above it, which is the healthy direction.
prefect.server.events.filters uses prefect.server.utilities.schemas.bases, so a change to prefect.server.utilities.schemas.bases can break prefect.server.events.filters, while a change to prefect.server.events.filters can't break prefect.server.utilities.schemas.bases.
Position
Below the diagonal: prefect.server.events.filters uses a module listed above it, which is the healthy direction.
prefect.server.events.filters uses prefect.utilities.collections, so a change to prefect.utilities.collections can break prefect.server.events.filters, while a change to prefect.server.events.filters can't break prefect.utilities.collections.
Position
Below the diagonal: prefect.server.events.filters uses a module listed above it, which is the healthy direction.
prefect.server.events.filters uses prefect.server.events.schemas.events, so a change to prefect.server.events.schemas.events can break prefect.server.events.filters, while a change to prefect.server.events.filters can't break prefect.server.events.schemas.events.
Position
Below the diagonal: prefect.server.events.filters uses a module listed above it, which is the healthy direction.
prefect.server.events.schemas.automations uses prefect.server.utilities.schemas.bases, so a change to prefect.server.utilities.schemas.bases can break prefect.server.events.schemas.automations, while a change to prefect.server.events.schemas.automations can't break prefect.server.utilities.schemas.bases.
Position
Below the diagonal: prefect.server.events.schemas.automations uses a module listed above it, which is the healthy direction.
prefect.server.events.schemas.automations uses prefect.utilities.collections, so a change to prefect.utilities.collections can break prefect.server.events.schemas.automations, while a change to prefect.server.events.schemas.automations can't break prefect.utilities.collections.
Position
Below the diagonal: prefect.server.events.schemas.automations uses a module listed above it, which is the healthy direction.
prefect.server.events.schemas.automations uses prefect.server.events.schemas.events, so a change to prefect.server.events.schemas.events can break prefect.server.events.schemas.automations, while a change to prefect.server.events.schemas.automations can't break prefect.server.events.schemas.events.
Position
Below the diagonal: prefect.server.events.schemas.automations uses a module listed above it, which is the healthy direction.
prefect.blocks.abstract uses prefect.blocks.core, so a change to prefect.blocks.core can break prefect.blocks.abstract, while a change to prefect.blocks.abstract can't break prefect.blocks.core.
Position
Below the diagonal: prefect.blocks.abstract uses a module listed above it, which is the healthy direction.
prefect.cli uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.cli, while a change to prefect.cli can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.cli uses a module listed above it, which is the healthy direction.
prefect.cli uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.cli, while a change to prefect.cli can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.cli uses a module listed above it, which is the healthy direction.
prefect.cli uses prefect.client.schemas.responses, so a change to prefect.client.schemas.responses can break prefect.cli, while a change to prefect.cli can't break prefect.client.schemas.responses.
Position
Below the diagonal: prefect.cli uses a module listed above it, which is the healthy direction.
prefect.context uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.context, while a change to prefect.context can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.context uses a module listed above it, which is the healthy direction.
prefect.context uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.context, while a change to prefect.context can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.context uses a module listed above it, which is the healthy direction.
prefect.filesystems uses prefect.blocks.core, so a change to prefect.blocks.core can break prefect.filesystems, while a change to prefect.filesystems can't break prefect.blocks.core.
Position
Below the diagonal: prefect.filesystems uses a module listed above it, which is the healthy direction.
prefect.runner._state_proposer uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.runner._state_proposer, while a change to prefect.runner._state_proposer can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.runner._state_proposer uses a module listed above it, which is the healthy direction.
prefect.runner._state_proposer uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.runner._state_proposer, while a change to prefect.runner._state_proposer can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.runner._state_proposer uses a module listed above it, which is the healthy direction.
prefect.server.events uses prefect.server.database.interface, so a change to prefect.server.database.interface can break prefect.server.events, while a change to prefect.server.events can't break prefect.server.database.interface.
Position
Below the diagonal: prefect.server.events uses a module listed above it, which is the healthy direction.
prefect.server.events uses prefect.server.schemas.core, so a change to prefect.server.schemas.core can break prefect.server.events, while a change to prefect.server.events can't break prefect.server.schemas.core.
Position
Below the diagonal: prefect.server.events uses a module listed above it, which is the healthy direction.
prefect.server.events uses prefect.server.events.schemas.events, so a change to prefect.server.events.schemas.events can break prefect.server.events, while a change to prefect.server.events can't break prefect.server.events.schemas.events.
Position
Below the diagonal: prefect.server.events uses a module listed above it, which is the healthy direction.
prefect.server.events uses prefect.blocks.core, so a change to prefect.blocks.core can break prefect.server.events, while a change to prefect.server.events can't break prefect.blocks.core.
Position
Below the diagonal: prefect.server.events uses a module listed above it, which is the healthy direction.
prefect.server.events uses prefect.server.events.filters, so a change to prefect.server.events.filters can break prefect.server.events, while a change to prefect.server.events can't break prefect.server.events.filters.
Position
Below the diagonal: prefect.server.events uses a module listed above it, which is the healthy direction.
prefect.server.events uses prefect.server.events.schemas.automations, so a change to prefect.server.events.schemas.automations can break prefect.server.events, while a change to prefect.server.events can't break prefect.server.events.schemas.automations.
Position
Below the diagonal: prefect.server.events uses a module listed above it, which is the healthy direction.
integrations.prefect-aws.prefect_aws.credentials uses prefect.blocks.abstract, so a change to prefect.blocks.abstract can break integrations.prefect-aws.prefect_aws.credentials, while a change to integrations.prefect-aws.prefect_aws.credentials can't break prefect.blocks.abstract.
Position
Below the diagonal: integrations.prefect-aws.prefect_aws.credentials uses a module listed above it, which is the healthy direction.
integrations.prefect-dbt.prefect_dbt.cloud.credentials uses prefect.blocks.abstract, so a change to prefect.blocks.abstract can break integrations.prefect-dbt.prefect_dbt.cloud.credentials, while a change to integrations.prefect-dbt.prefect_dbt.cloud.credentials can't break prefect.blocks.abstract.
Position
Below the diagonal: integrations.prefect-dbt.prefect_dbt.cloud.credentials uses a module listed above it, which is the healthy direction.
integrations.prefect-gcp.prefect_gcp.credentials uses prefect.blocks.abstract, so a change to prefect.blocks.abstract can break integrations.prefect-gcp.prefect_gcp.credentials, while a change to integrations.prefect-gcp.prefect_gcp.credentials can't break prefect.blocks.abstract.
Position
Below the diagonal: integrations.prefect-gcp.prefect_gcp.credentials uses a module listed above it, which is the healthy direction.
prefect uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect, while a change to prefect can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect uses a module listed above it, which is the healthy direction.
prefect.runner uses prefect.logging.loggers, so a change to prefect.logging.loggers can break prefect.runner, while a change to prefect.runner can't break prefect.logging.loggers.
Position
Below the diagonal: prefect.runner uses a module listed above it, which is the healthy direction.
prefect.runner uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.runner, while a change to prefect.runner can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.runner uses a module listed above it, which is the healthy direction.
prefect.runner uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.runner, while a change to prefect.runner can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.runner uses a module listed above it, which is the healthy direction.
prefect.runner uses prefect.runner._state_proposer, so a change to prefect.runner._state_proposer can break prefect.runner, while a change to prefect.runner can't break prefect.runner._state_proposer.
Position
Below the diagonal: prefect.runner uses a module listed above it, which is the healthy direction.
prefect.runner._cancellation_manager uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.runner._cancellation_manager, while a change to prefect.runner._cancellation_manager can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.runner._cancellation_manager uses a module listed above it, which is the healthy direction.
prefect.runner._cancellation_manager uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.runner._cancellation_manager, while a change to prefect.runner._cancellation_manager can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.runner._cancellation_manager uses a module listed above it, which is the healthy direction.
prefect.runner._cancellation_manager uses prefect.runner._state_proposer, so a change to prefect.runner._state_proposer can break prefect.runner._cancellation_manager, while a change to prefect.runner._cancellation_manager can't break prefect.runner._state_proposer.
Position
Below the diagonal: prefect.runner._cancellation_manager uses a module listed above it, which is the healthy direction.
prefect.runner._flow_run_executor uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.runner._flow_run_executor, while a change to prefect.runner._flow_run_executor can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.runner._flow_run_executor uses a module listed above it, which is the healthy direction.
prefect.runner._flow_run_executor uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.runner._flow_run_executor, while a change to prefect.runner._flow_run_executor can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.runner._flow_run_executor uses a module listed above it, which is the healthy direction.
prefect.runner._flow_run_executor uses prefect.runner._state_proposer, so a change to prefect.runner._state_proposer can break prefect.runner._flow_run_executor, while a change to prefect.runner._flow_run_executor can't break prefect.runner._state_proposer.
Position
Below the diagonal: prefect.runner._flow_run_executor uses a module listed above it, which is the healthy direction.
prefect.server.events.actions uses prefect.server.schemas.core, so a change to prefect.server.schemas.core can break prefect.server.events.actions, while a change to prefect.server.events.actions can't break prefect.server.schemas.core.
Position
Below the diagonal: prefect.server.events.actions uses a module listed above it, which is the healthy direction.
prefect.server.events.actions uses prefect.server.schemas.states, so a change to prefect.server.schemas.states can break prefect.server.events.actions, while a change to prefect.server.events.actions can't break prefect.server.schemas.states.
Position
Below the diagonal: prefect.server.events.actions uses a module listed above it, which is the healthy direction.
prefect.server.events.actions uses prefect.server.utilities.schemas.bases, so a change to prefect.server.utilities.schemas.bases can break prefect.server.events.actions, while a change to prefect.server.events.actions can't break prefect.server.utilities.schemas.bases.
Position
Below the diagonal: prefect.server.events.actions uses a module listed above it, which is the healthy direction.
prefect.server.events.actions uses prefect.blocks.abstract, so a change to prefect.blocks.abstract can break prefect.server.events.actions, while a change to prefect.server.events.actions can't break prefect.blocks.abstract.
Position
Below the diagonal: prefect.server.events.actions uses a module listed above it, which is the healthy direction.
prefect.runner._scheduled_run_poller uses prefect.client.schemas.objects, so a change to prefect.client.schemas.objects can break prefect.runner._scheduled_run_poller, while a change to prefect.runner._scheduled_run_poller can't break prefect.client.schemas.objects.
Position
Below the diagonal: prefect.runner._scheduled_run_poller uses a module listed above it, which is the healthy direction.
prefect.runner._scheduled_run_poller uses prefect.client.orchestration, so a change to prefect.client.orchestration can break prefect.runner._scheduled_run_poller, while a change to prefect.runner._scheduled_run_poller can't break prefect.client.orchestration.
Position
Below the diagonal: prefect.runner._scheduled_run_poller uses a module listed above it, which is the healthy direction.
prefect.runner._scheduled_run_poller uses prefect.runner._state_proposer, so a change to prefect.runner._state_proposer can break prefect.runner._scheduled_run_poller, while a change to prefect.runner._scheduled_run_poller can't break prefect.runner._state_proposer.
Position
Below the diagonal: prefect.runner._scheduled_run_poller uses a module listed above it, which is the healthy direction.
prefect.runner._scheduled_run_poller uses prefect.runner._cancellation_manager, so a change to prefect.runner._cancellation_manager can break prefect.runner._scheduled_run_poller, while a change to prefect.runner._scheduled_run_poller can't break prefect.runner._cancellation_manager.
Position
Below the diagonal: prefect.runner._scheduled_run_poller uses a module listed above it, which is the healthy direction.
prefect.runner._scheduled_run_poller uses prefect.runner._flow_run_executor, so a change to prefect.runner._flow_run_executor can break prefect.runner._scheduled_run_poller, while a change to prefect.runner._scheduled_run_poller can't break prefect.runner._flow_run_executor.
Position
Below the diagonal: prefect.runner._scheduled_run_poller uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.database.interface, so a change to prefect.server.database.interface can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.database.interface.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.schemas.core, so a change to prefect.server.schemas.core can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.schemas.core.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.schemas.states, so a change to prefect.server.schemas.states can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.schemas.states.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.events.schemas.events, so a change to prefect.server.events.schemas.events can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.events.schemas.events.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.events.filters, so a change to prefect.server.events.filters can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.events.filters.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.events.schemas.automations, so a change to prefect.server.events.schemas.automations can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.events.schemas.automations.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
prefect.server.api uses prefect.server.events.actions, so a change to prefect.server.events.actions can break prefect.server.api, while a change to prefect.server.api can't break prefect.server.events.actions.
Position
Below the diagonal: prefect.server.api uses a module listed above it, which is the healthy direction.
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
44
High / Critical
A02:2025 — Security Misconfiguration
36
High / Critical
A03:2025 — Software Supply Chain Failures
28
Medium
A07:2025 — Authentication Failures
17
High / Critical
Roadmap
Top priorities: Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label; 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.
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, REDACTED.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
Enforce accessibility in the toolchain you already use: enable Biome's a11y rule group in your biome.json `linter.rules` (it is off whenever `recommended` is false and the group is unlisted), then run the suite that already asserts accessibility in CI so a regression blocks the merge.
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 — 67
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 — 1826
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 — 264
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 11
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 90 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 — 90 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, 2122 of 2157 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 vitest suite in ui-v2/ ran and not one test passed (Errors 371 errors), so the coverage would describe the failed run, not the code — but the repository pins Node 24.22.2 in .nvmrc and the analyzer image ran it on Node 22, so the failure describes our runtime, not the suite. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo. In the meantime, commit (or publish into the working tree) the lcov/Cobertura report your CI produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
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 3,169 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 803 test source file(s) (.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 SCORED: this repository's production source includes .py, and the python executor ran against the .py half and did not finish re-running within its tier budget — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (vitest via `npm ci --ignore-scripts` in ui/ (4 tests); vitest via `npm ci --ignore-scripts` in ui-v2/ (0 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
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 — 61 shipped Python distribution(s) were read, but the outdated signal needs pypi.org, and no declaration here carries an exact pin to ask about — a floor or a range installs the newest release it admits and cannot be behind one, so this dimension's own question is only partly answered. 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 Python distribution 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 — 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. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — 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. Tracing effort is measured over resolved call sites, and all 507 sampled here came from .py files. This repository's .tsx source is a material share of its production lines and contributed none, so the score above is a verdict about the part that was read. Not a finding that the unread half navigates well — it is unmeasured.
D31 IaC & Container Security — 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. Tests/docker/contexts/bad-base/REDACTED carries no `FROM` instruction, so it declares no build stage and every REDACTED rule this engine owns — the runtime-hardening, key-material, mutable-clone, no-op-shim, build-context, trust-anchor, install-guard, setuid and world-writable-path rules — is outside its own premise there and returned nothing. That silence is deliberate and correct: with no base image there is no image to reason about. It is reported here because it is NOT the same fact as a clean file, and coverage is stated as 35 of 36 Infrastructure-as-Code manifest(s) fully judged rather than as 100%. The vendor scanners (trivy, checkov) do read these files and their findings above stand; only this engine's own stage-keyed rules are absent. No owner action: a build file with no FROM is a legitimate include fragment.
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. `ui-v2/.storybook/preview.ts`, `ui-v2/src/api/admin/admin.ts`, `ui-v2/src/api/flow-runs/constants.ts`, `ui-v2/src/api/flow-runs/index.ts`, `ui-v2/src/api/flow-runs/use-paginate-flow-runs-with-flows/use-paginate-flow-runs-with-flows.ts`, … (+192 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.
AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in src/prefect/workers/_cleanup.py, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — 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. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Vue components is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Vue components is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P8 Schema migrations — 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. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
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. 323 further occurrence(s) are not listed individually; the score already reflects all 363.
R7 Dead Code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 12 further occurrence(s) are not listed individually; the score already reflects all 52.
S1 Web-Security Posture — 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. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — 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. 26 further occurrence(s) are not listed individually; the score already reflects all 66.
X4 Structured logging — 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. 269 further occurrence(s) are not listed individually; the score already reflects all 309.
Repo exclusion declarations: 4 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
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.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
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.
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.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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 REDACTED (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.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
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.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
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.
188 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was _core._run_single_deploy at 67. A further 2 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 use-edit-automation.transformActionToFormValue at 17 — they are counted neither in the figure above nor in this dimension's score. 2 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: ui-v2/src/components/automations/automations-wizard/use-edit-automation.ts (use-edit-automation.transformActionToFormValue at 17), ui-v2/src/components/automations/automations-wizard/actions-step/action-step.tsx (action-step.ActionTypeAdditionalFields at 16). 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.
+ 182 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 60 down to 60 or less in Cyclomatic Complexity — start with _core._run_single_deploy (cyclomatic 67). — Refactoring it lifts Cyclomatic Complexity from 6.4 to about 6.5/10.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
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.
+ 349 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 14 bodies over 60 down to 60 or less in Cognitive Complexity — start with IntervalSchedule._get_dates_generator (cognitive 111), importtools.safe_load_namespace (cognitive 104), _core._run_single_deploy (cognitive 97). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 14 together lifts Cognitive Complexity from 4.9 to about 5.9/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.9 / 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.
Resolve the 85 FileTooLong finding(s) in God Classes — start with filters.py (3), actions.py (3), REDACTED (3). — One of this dimension's main actionable groups (85 warning-level).
Resolve the 76 FunctionTooLong finding(s) in God Classes — start with index.tsx (8), rich-date-range-selector.tsx (2), data-table.tsx (2). — One of this dimension's main actionable groups (76 warning-level).
Resolve the 7 TooManyMethods finding(s) in God Classes — start with cleanup_queue.py, base.py, s3.py. — One of this dimension's main actionable groups (7 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
597 duplicated block group(s) detected. A further 41 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 11 of the 638 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. Measured on part of this repository only: .tsx (15% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
+ 272 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 23 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with client.py (6), observer.py, flow_run.py. — One of this dimension's main actionable groups (23 warning-level).
Resolve the 23 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with actions.py (3), REDACTED (2), events.py (2). — One of this dimension's main actionable groups (23 warning-level).
Resolve the 21 Duplicated block (15 lines × 2) finding(s) in Code Duplication — start with execute.py (2), repository.py (2), REDACTED (2). — One of this dimension's main actionable groups (21 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling9.3 / 10Stronggated by 2 serious findings✓ 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.
22 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence.
Off the main sequence: prefect-docker · ×2
What to do
Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
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.
Resolve the 5 Low cohesion finding(s) in Cohesion (LCOM4) — start with root.py, worker.py, query_components.py. — One of this dimension's main actionable groups (5 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
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).
What to do
Enforce Architectural Integrity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
18892 test methods: 15103 unit, 3628 integration, 0 BDD, 161 e2e. The JavaScript/TypeScript suite contributes 3169 `it`/`test` case(s) across 376 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 15723 test function(s) across 682 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality9.9 / 10Stronggated by 14 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.
15 skipped (2 with a documented reason), 1 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 3169 tests. Measured on the JavaScript/TypeScript suite only — at least 803 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: works without onPrefetchPage callbackui-v2/src/components/task-runs/task-runs-list/task-runs-pagination.test.tsx:346
Mock-dominated test: should allow a variable to be deleted · ×10ui-v2/tests/variables/variables.test.tsx:525
Skipped (documented): able to configure run a deployment action type · ×2ui-v2/src/components/automations/automations-wizard/actions-step/actions-step.test.tsx:330
What to do
Resolve the 13 Skipped test finding(s) in Test Quality — start with work-pools.spec.ts (2), blocks.spec.ts (2), variables.spec.ts. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 10 Mock-dominated test finding(s) in Test Quality — start with global-concurrency-limits-data-table.test.tsx (3), ui-version-switch-dialog.test.tsx (2), variables.test.tsx. — One of this dimension's main actionable groups (10 recommendation-level).
Resolve the 1 No assertions finding(s) in Test Quality — start with task-runs-pagination.test.tsx. — One of this dimension's main actionable groups (1 warning-level).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
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, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Enforce REDACTED Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
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.
2 of 208 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 61 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (147 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. 12 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. This repository publishes itself under Apache-2.0 / Apache License 2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution 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.
Banned license: python-gitlab · ×2
What to do
Resolve the 2 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (2 issue-level).
Enforce License Compliance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 28 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (2), data-table.tsx (2), schedules.py. — One of this dimension's main actionable groups (28 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 Factor9.4 / 10Exemplary✓ 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.
47 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src/integrations/prefect-aws/infra/worker/service_stack.py. Counted over 824 of the 2114 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)
✓ On the Gold path — maintain.
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.
132 deducted task-comment markers across 366759 LoC (0.0/KLoC) → score 9.9. 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.
Resolve the 132 TodoComment finding(s) in Explicit Debt — start with task_engine.py (8), states.py (7), flow_engine.py (6). — One of this dimension's main actionable groups (132 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 953 document(s) read across 3 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
1 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.
ADR has no Context and Decision and Consequences sectionplans/2026-01-06-custom-deployment-sdks.md:1detected by adr-integrity
What to do
Resolve the 1 ADR has no Context and Decision and Consequences section finding(s) in ADR Quality — start with 2026-01-06-custom-deployment-sdks.md. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether 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.
52 of 1687 judged comments only repeat the code they sit on (3.1 %). 33 comment(s) in another language or script were not judged.
redundant comment · ×41REDACTED:331
doc comments repeat the namesui-v2/src/api/work-pool-queues/work-pool-queues.ts:89
What to do
Resolve the 41 redundant comment finding(s) in Comment Value — start with trigger-utils.test.ts (4), dashboard.spec.ts (2), index.test.tsx (2). — One of this dimension's main actionable groups (41 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
3 of 23 build units (Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
82 % of calls cross a namespace and 0 % go through an interface, but 89 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated. Measured over the .py source only — this repository's .tsx was not sampled for call sites, so this score covers part of the tree, not all of it.
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.
14 finding(s): 0 critical, 14 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 9 High secret finding(s) in Secrets (history) — start with REDACTED (4), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (9 issue-level).
Resolve the 5 REDACTED finding(s) in Secrets (history) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (5 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).
44 finding(s): 0 critical, 24 high, 13 medium, 7 low. semgrep hit a parse error in 203 file(s) — `REDACTED` (line 222), `ui-v2/.storybook/preview.ts` (line 35), `ui-v2/e2e/fixtures/api-client.ts` (line 4), `ui-v2/src/api/admin/admin.ts` (line 111), `ui-v2/src/api/flow-runs/constants.ts` (line 13), … (+198 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 18 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
+ 15 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (6 issue-level).
Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (5), REDACTED. — One of this dimension's main actionable groups (6 issue-level).
Resolve the 5 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4), REDACTED. — One of this dimension's main actionable groups (5 issue-level).
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).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 21 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (10), REDACTED (5), REDACTED (3). — One of this dimension's main actionable groups (21 warning-level).
Resolve the 11 High IaC finding(s) in IaC & Container Security — start with REDACTED (3), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (11 issue-level).
Resolve the 1 Critical IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-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.
97 of 824 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is ui-v2/src/mocks/create-fake-block-schema.ts. Counted over 824 of the 2114 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 5 Orphaned knowledge finding(s) in Knowledge Freshness — start with create-fake-block-schema.ts, create-fake-block-type.ts, 2022_01_20_115236_9725c1cbee35_initial_migration.py. — One of this dimension's main actionable groups (5 issue-level).
Resolve the 92 Orphaned file finding(s) in Knowledge Freshness — start with client.py (8), dependencies.py (2), 2022_10_12_102048_22b7cb02e593_add_state_timestamp.py (2). — One of this dimension's main actionable groups (92 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 6 Change coupling finding(s) in Change Coupling — start with App.vue, flagResponse.ts, services.py. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with concurrency_limits_v2.py. — One of this dimension's main actionable groups (1 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 10 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 8 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 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 3 platform declaration(s) and 61 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 alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Do you agree with this assessment?
AC2 · Forms & labels3.7 / 10Weak✓ 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 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. (×19) — ui-v2/src/components/artifacts/artifact/detail-table.tsx:57, ui-v2/src/components/artifacts/artifacts-filter.tsx:78, ui-v2/src/components/automations/automations-wizard/trigger-step/event-resource-combobox/event-resource-combobox.tsx:212, …
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — ui-v2/src/components/blocks/block-types-multi-select/block-types-multi-select.tsx:105
This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it. — ui-v2/src/components/deployments/deployment-form/limit-collision-strategy-select.tsx:29
A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. — ui-v2/src/components/schemas/schema-form-property.tsx:207
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. (×2) — ui-v2/src/components/settings/theme-switch.tsx:13, ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:641
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.
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 mousedown, touchstart 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. — ui-v2/src/components/ui/data-table.tsx:44
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.
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — ui-v2/src/components/schemas/schema-form-input-array-item.tsx:88
<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). — ui-v2/src/components/ui/textarea.tsx:7
`viewport.animate()` moves (`Web Animations API keyframes`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — ui-v2/src/graphs/objects/viewport.ts:135
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 · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
Accessibility checks run in tests (Verified) but aren't gated in CI — run the suite that holds those checks in your pipeline so an accessibility regression blocks the merge (Prevented). What was searched, so you can tell an absence from a miss: the 599 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here. — ui-v2/package.json:106
What to do
Enforce accessibility in the toolchain you already use: enable Biome's a11y rule group in your biome.json `linter.rules` (it is off whenever `recommended` is false and the group is unlisted), then run the suite that already asserts accessibility in CI so a regression blocks the merge.
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.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
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 interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
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 · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
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.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 1 of 23 project(s) that lack one — worth up to 0.1 pts.
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 — `plans/2026-01-06-custom-deployment-sdks.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.
What to do
Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
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.
Only 16/18 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `client`, `src/integrations/prefect-kubernetes/integration_tests`.
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.
What to do
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 automation exists but no readiness/liveness probes, rolling-update strategy, lifecycle hooks or migration job were evidenced — a bad release is harder to detect and reverse.
What to do
Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.
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.
`httpx.Client(` 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) — src/integrations/prefect-dbt/prefect_dbt/cloud/_executor.py:99, src/prefect/blocks/notifications.py:1040
`httpx.AsyncClient(` 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. (×4) — src/prefect/_internal/version_checking.py:151, src/prefect/blocks/notifications.py:1022, src/prefect/server/api/collections.py:55, …
What to do
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): 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. Deterministic.
137 duplicated blocks under ui-v2/src/components/ have copies in at least two of the sibling directories artifacts, automations, blocks, concurrency, dashboard, deployments (+11 more sibling(s) not listed) — 91 of them are reported below, and 46 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 137 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 137 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 137 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. — ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs.tsx:1
30 duplicated blocks under ui-v2/src/api/ have copies in at least two of the sibling directories admin, artifacts, automations, block-documents, block-schemas, block-types (+12 more sibling(s) not listed) — 19 of them are reported below, and 11 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 30 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 30 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 30 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. — ui-v2/src/api/flow-runs/index.ts:117
30 duplicated blocks under ui-v2/src/routes/ have copies in at least two of the sibling directories artifacts, automations, blocks, deployments, events, flows (+3 more sibling(s) not listed) — 23 of them are reported below, and 7 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 30 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 30 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 30 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. — ui-v2/src/routes/deployments/index.tsx:97
25 duplicated blocks under ui-v2/src/components/work-pools/ have copies in at least two of the sibling directories create, edit, poll-status, work-pool-card, work-pool-deployments-tab, work-pool-details (+20 more sibling(s) not listed) — 18 of them are reported below, and 7 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 25 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 25 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 25 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. — ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:1
15 duplicated blocks under ui-v2/src/ have copies in at least two of the sibling directories api, components, hooks, routes — 10 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 15 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 15 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 15 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — ui-v2/src/api/flow-runs/constants.ts:27
7 of the duplicated blocks reported below have copies in at least two of the sibling directories global-concurrency-limits, task-run-concurrency-limits under ui-v2/src/components/concurrency/. That concentration is one structural fact, not 7 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 7 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. — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:72
6 duplicated blocks under ui-v2/src/components/deployments/ have copies in at least two of the sibling directories create-flow-run-form, deployment-form, deployment-schedules — 4 of them are reported below, and 2 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 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 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 6 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. — ui-v2/src/components/deployments/create-flow-run-form/create-flow-run-form.tsx:234
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:62 · ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx:135 — the two spans are one implementation copied and then locally edited — 796 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. — ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:62
ui-v2/src/components/deployments/deployment-details-runs-tab.tsx:22 · ui-v2/src/components/deployments/deployment-details-upcoming-tab.tsx:17 — the two spans are one implementation copied and then locally edited — 919 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. — ui-v2/src/components/deployments/deployment-details-runs-tab.tsx:22
ui-v2/src/components/ui/dropdown-menu.tsx:56 · ui-v2/src/components/ui/menubar.tsx:85 — the two spans are one implementation copied and then locally edited — 581 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. — ui-v2/src/components/ui/dropdown-menu.tsx:56
ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx:1 · ui-v2/src/components/automations/automations-wizard/actions-step/send-notification-fields.tsx:1 — these 2 files are line-for-line copies of one another — 148 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx:1
ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:1 · ui-v2/src/components/work-pools/work-pool-queue-runs-tab/work-pool-queue-runs-tab.tsx:1 — these 2 files are line-for-line copies of one another — 142 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:1
ui-v2/src/api/flow-runs/index.ts:117 · ui-v2/src/api/task-runs/index.ts:68 — the two spans are one implementation copied and then locally edited — 781 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. — ui-v2/src/api/flow-runs/index.ts:117
ui-v2/src/graphs/factories/flowRunState.ts:17 · ui-v2/src/graphs/factories/nodeFlowRunState.ts:27 — the two spans are one implementation copied and then locally edited — 635 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. — ui-v2/src/graphs/factories/flowRunState.ts:17
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/deployment-filter.tsx:19 · ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/flow-filter.tsx:16 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/deployment-filter.tsx:19
ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-subflows.tsx:26 · ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-task-runs.tsx:24 — the two spans are one implementation copied and then locally edited — 576 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. — ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-subflows.tsx:26
ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs.tsx:1 · ui-v2/src/components/task-runs/task-run-logs/index.tsx:1 — these 2 files are line-for-line copies of one another — 101 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs.tsx:1
ui-v2/src/components/deployments/data-table/index.tsx:186 · ui-v2/src/components/flows/data-table.tsx:80 — the two spans are one implementation copied and then locally edited — 518 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. — ui-v2/src/components/deployments/data-table/index.tsx:186
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx:35 · ui-v2/src/components/task-runs/task-run-state-filter.tsx:32 — the two spans are one implementation copied and then locally edited — 543 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. — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx:35
ui-v2/src/components/ui/dialog.tsx:7 · ui-v2/src/components/ui/sheet.tsx:7 — the two spans are one implementation copied and then locally edited — 465 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. — ui-v2/src/components/ui/dialog.tsx:7
ui-v2/src/components/dashboard/task-runs-card/task-runs-trends.tsx:33 · ui-v2/src/components/flows/detail/flow-stats-summary/cumulative-task-runs-card.tsx:40 — the two spans are one implementation copied and then locally edited — 376 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. — ui-v2/src/components/dashboard/task-runs-card/task-runs-trends.tsx:33
ui-v2/src/components/automations/automations-wizard/actions-step/select-automations-fields.tsx:51 · ui-v2/src/components/automations/automations-wizard/actions-step/select-work-pools-fields.tsx:51 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — ui-v2/src/components/automations/automations-wizard/actions-step/select-automations-fields.tsx:51
ui-v2/src/graphs/factories/runArtifacts.ts:12 · ui-v2/src/graphs/factories/runEvents.ts:13 — the two spans are one implementation copied and then locally edited — 521 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. — ui-v2/src/graphs/factories/runArtifacts.ts:12
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-pagination.tsx:9 · ui-v2/src/components/task-runs/task-runs-list/task-runs-pagination.tsx:9 — these 2 files are line-for-line copies of one another — 82 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-pagination.tsx:9
ui-v2/src/components/flows/data-table.tsx:83 · ui-v2/src/components/variables/data-table/data-table.tsx:112 — the two spans are one implementation copied and then locally edited — 407 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. — ui-v2/src/components/flows/data-table.tsx:83
ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:72 · ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-data-table/task-run-concurrency-limits-data-table.tsx:66 — the two spans are one implementation copied and then locally edited — 338 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. — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:72
ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-row-count.tsx:1 · ui-v2/src/components/task-runs/task-runs-list/task-runs-row-count.tsx:1 — these 2 files are line-for-line copies of one another — 69 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-row-count.tsx:1
ui-v2/src/api/deployments/index.ts:56 · ui-v2/src/api/variables/index.ts:39 — the two spans are one implementation copied and then locally edited — 386 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. — ui-v2/src/api/deployments/index.ts:56
ui-v2/src/components/automations/automations-wizard/trigger-step/work-pools-combobox.tsx:15 · ui-v2/src/components/work-pools/work-pool-multi-select/work-pool-multi-select.tsx:17 — the two spans are one implementation copied and then locally edited — 358 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. — ui-v2/src/components/automations/automations-wizard/trigger-step/work-pools-combobox.tsx:15
ui-v2/src/components/work-pools/work-pool-select/work-pool-select.tsx:48 · ui-v2/src/components/work-pools/work-queue-select/work-queue-select.tsx:54 — 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. — ui-v2/src/components/work-pools/work-pool-select/work-pool-select.tsx:48
ui-v2/src/graphs/factories/nodeFlowRun.ts:44 · ui-v2/src/graphs/factories/nodeTaskRun.ts:31 — the two spans are one implementation copied and then locally edited — 345 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. — ui-v2/src/graphs/factories/nodeFlowRun.ts:44
ui-v2/src/components/ui/json-input.tsx:3 · ui-v2/src/components/ui/markdown-input.tsx:3 · ui-v2/src/components/ui/python-input.tsx:3 — these 3 files are line-for-line copies of one another — 57 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/ui/json-input.tsx:3
ui-v2/src/components/work-pools/work-pool-details/work-pool-details.tsx:13 · ui-v2/src/components/work-pools/work-pool-queue-details/work-pool-queue-details.tsx:9 — the two spans are one implementation copied and then locally edited — 283 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. — ui-v2/src/components/work-pools/work-pool-details/work-pool-details.tsx:13
ui-v2/src/components/work-pools/work-pool-queue-create-dialog/work-pool-queue-create-dialog.tsx:62 · ui-v2/src/components/work-pools/work-pool-queue-form/work-pool-queue-form.tsx:44 — the 2 copies are spread across 2 files, 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. — ui-v2/src/components/work-pools/work-pool-queue-create-dialog/work-pool-queue-create-dialog.tsx:62
ui-v2/src/graphs/factories/flowRunEvent.ts:26 · ui-v2/src/graphs/factories/nodeFlowRunEvent.ts:28 — the two spans are one implementation copied and then locally edited — 329 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. — ui-v2/src/graphs/factories/flowRunEvent.ts:26
ui-v2/src/routes/deployments/index.tsx:97 · ui-v2/src/routes/variables/index.tsx:120 — the two spans are one implementation copied and then locally edited — 248 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. — ui-v2/src/routes/deployments/index.tsx:97
ui-v2/src/routes/runs/index.tsx:130 · ui-v2/src/routes/runs/index.tsx:268 — 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. — ui-v2/src/routes/runs/index.tsx:130
ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx:53 · ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx:151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx:53
ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-artifacts.tsx:1 · ui-v2/src/components/task-runs/task-run-artifacts/index.tsx:1 — these 2 files are line-for-line copies of one another — 54 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-artifacts.tsx:1
ui-v2/src/components/artifacts/artifact/artifact-detail-tabs.tsx:10 · ui-v2/src/components/deployments/deployment-details-tabs.tsx:14 — the two spans are one implementation copied and then locally edited — 307 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. — ui-v2/src/components/artifacts/artifact/artifact-detail-tabs.tsx:10
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
FlowRunHeader has cyclomatic complexity 47 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. — ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:57
ActionDetailsType has cyclomatic complexity 35 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 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. — ui-v2/src/components/automations/action-details/action-details.tsx:75
(anonymous) has cyclomatic complexity 26 and cognitive complexity 20; 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. — ui-v2/src/routes/runs/index.tsx:135
manualChunks has cyclomatic complexity 26 and cognitive complexity 17; 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. — ui-v2/vite.config.ts:42
transformActionToFormValue has cyclomatic complexity 26 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — ui-v2/src/components/automations/automations-wizard/use-edit-automation.ts:108
FlowRunsCard has cyclomatic complexity 25 and cognitive complexity 23; 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. — ui-v2/src/components/dashboard/flow-runs-card/index.tsx:51
FlowRunGraph has cyclomatic complexity 24 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph.tsx:58
TaskRunDetails has cyclomatic complexity 23 and cognitive complexity 22; 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. — ui-v2/src/components/task-runs/task-run-details/task-run-details.tsx:25
FlowRunDialogBody has cyclomatic complexity 22 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — ui-v2/src/components/flows/flow-run-action/flow-run-action.tsx:132
(anonymous) has cyclomatic complexity 21 and cognitive complexity 17; 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. — ui-v2/src/routes/runs/index.tsx:273
SchemaFormInput has cyclomatic complexity 20 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — ui-v2/src/components/schemas/schema-form-input.tsx:35
(anonymous) has cyclomatic complexity 19 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — ui-v2/src/routes/runs/index.tsx:210
getResourceSets has cyclomatic complexity 18 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — ui-v2/src/api/automations/use-get-automation-action-resources/use-get-automation-action-resources.ts:140
getResourceRoute has cyclomatic complexity 18 and cognitive complexity 12; 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. — ui-v2/src/components/events/event-resource-display/resource-routes.ts:33
isSelected has cyclomatic complexity 18 and cognitive complexity 9; 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. — ui-v2/src/graphs/objects/selection.ts:60
getDateRangeFromSearch has cyclomatic complexity 17 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — ui-v2/src/routes/dashboard.tsx:174
secondsToApproximateString has cyclomatic complexity 17 and cognitive complexity 9; 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. — ui-v2/src/utils/seconds.ts:118
(anonymous) has cyclomatic complexity 16 and cognitive complexity 12; 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. — ui-v2/src/routes/dashboard.tsx:792
(anonymous) has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — ui-v2/src/hooks/use-animated-reorder.ts:39
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files9.4 / 10Exemplary✓ 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.
ui-v2/src/mocks/create-fake-block-schema.ts has 8921 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/mocks/create-fake-block-schema.ts:1
ui-v2/src/routes/dashboard.tsx has 1094 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/routes/dashboard.tsx:1
ui-v2/src/routeTree.gen.ts has 911 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/routeTree.gen.ts:1
ui-v2/src/mocks/create-fake-block-type.ts has 908 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/mocks/create-fake-block-type.ts:1
ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx has 841 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:1
ui-v2/src/routes/runs/index.tsx has 796 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/routes/runs/index.tsx:1
ui-v2/src/components/ui/sidebar/sidebar.tsx has 738 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/ui/sidebar/sidebar.tsx:1
ui-v2/src/components/schemas/stories/properties.stories.tsx has 706 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/schemas/stories/properties.stories.tsx:1
ui-v2/src/components/dashboard/work-pools-card/work-pools-card.tsx has 655 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/dashboard/work-pools-card/work-pools-card.tsx:1
ui-v2/src/routes/flows/flow.$id.tsx has 606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/routes/flows/flow.$id.tsx:1
ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx has 597 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:1
ui-v2/src/api/flow-runs/index.ts has 571 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/api/flow-runs/index.ts:1
ui-v2/src/components/runs/runs-page.tsx has 476 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/runs/runs-page.tsx:1
ui-v2/src/api/deployments/index.ts has 464 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/api/deployments/index.ts:1
ui-v2/src/components/automations/trigger-details/trigger-utils.ts has 464 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/automations/trigger-details/trigger-utils.ts:1
ui-v2/src/routes/work-pools/work-pool.$workPoolName.tsx has 459 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/routes/work-pools/work-pool.$workPoolName.tsx:1
ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts has 432 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts:1
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx has 405 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.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.8 / 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. (×19) — ui-v2/src/components/ui/utils/spacing-utils.ts:1, ui-v2/src/components/work-pools/priority-management/priority-editor-dialog.tsx:1, ui-v2/src/components/flows/detail/runs-columns.tsx: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.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code8.7 / 10Strong✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 29 application, 20 tooling and 678 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 (29 application, 20 tooling, 678 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 (×23) — ui-v2/src/components/ui/utils/spacing-utils.ts, ui-v2/src/components/flows/detail/runs-columns.tsx, ui-v2/src/components/flows/table-count-header.tsx, …
no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/work-pools/priority-management/index.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui-v2/src/components/work-pools/priority-management/priority-editor-dialog.tsx
no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/flow-runs/flow-run-state-dialog/flow-run-state-dialog.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui-v2/src/components/flow-runs/flow-run-state-dialog/use-flow-run-state-dialog.tsx
no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/work-pools/priority-management/priority-editor-dialog.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui-v2/src/components/work-pools/priority-management/use-bulk-update-priorities-mutation.ts
no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/flows/detail/runs-columns.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui-v2/src/components/flows/detail/cells.tsx
no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/compositions/index.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — ui/src/compositions/useToast.ts
Nothing imports this binding — it is safe to review for removal. (×10) — ui-v2/src/api/task-runs/index.ts:368, ui-v2/src/components/automations/automations-wizard/automation-schema.ts:127, ui-v2/src/components/automations/automations-wizard/automation-schema.ts:242, …
Nothing ultimately consumes this binding: its only referrer is the re-export in ui-v2/src/graphs/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in ui-v2/src/graphs/index.ts in the same commit, or the barrel will import a name that no longer exists. — ui-v2/src/graphs/consts.ts:16
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. — ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:3
Declared in src/integrations/prefect-aws/infra/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.
Declared in ui-v2/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)
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.
ui-v2/src/components/schemas/schema-form-input.tsx → ui-v2/src/components/schemas/schema-form-input-all-of.tsx → ui-v2/src/components/schemas/schema-form-input.tsx (one verified cycle inside a mutually-dependent group of 13 files) — ui-v2/src/components/schemas/schema-form-input.tsx:2
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document1.6 / 10Critical✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`removePrefectKindValue` is exported and takes `value: unknown` from its caller, and it calls itself at line 46 (`removePrefectKindValue`) with a piece of `value` — and nowhere in `removePrefectKindValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `removePrefectKindValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — ui-v2/src/components/schemas/utilities/removePrefectKindValues.ts:46
`add_cloudpickle_reduction` is public and takes `kwargs: Any` from its caller, and it calls itself at line 90 (`add_cloudpickle_reduction`) with a piece of `kwargs` — and nowhere in `add_cloudpickle_reduction` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `add_cloudpickle_reduction` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/prefect/utilities/pydantic.py:90
`null_handler` is public, takes a document from its caller (line 191) and hands it to `_hydrate`, which calls itself at line 318 (`_hydrate`) with a piece of `obj` (and at line 324) — and nowhere in `_hydrate` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_hydrate` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/prefect/utilities/schema_tools/hydration.py:318
`redact_substr` is public and takes `obj: Any` from its caller, and it calls itself at line 54 (`redact_substr`) with a piece of `obj` (and at line 65) — and nowhere in `redact_substr` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `redact_substr` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/prefect/logging/filters.py:54
`serialize_parameters` is public, takes a document from its caller (line 586) and hands it to `convert_temporal`, which calls itself at line 599 (`convert_temporal`) with a piece of `v` (and at line 601) — and nowhere in `convert_temporal` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `convert_temporal` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/prefect/client/schemas/actions.py:599
`strip_kwargs` is public and takes `kwargs: Dict` from its caller, and it calls itself at line 63 (`strip_kwargs`) with a piece of `kwargs` — and nowhere in `strip_kwargs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `strip_kwargs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/integrations/prefect-github/prefect_github/utils.py:63
`serialize_model` is public and takes `obj: Any` from its caller, and it calls itself at line 45 (`serialize_model`) with a piece of `obj` (and at line 47) — and nowhere in `serialize_model` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `serialize_model` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/integrations/prefect-databricks/prefect_databricks/rest.py:45
`strip_kwargs` is public and takes `kwargs: Dict` from its caller, and it calls itself at line 71 (`strip_kwargs`) with a piece of `kwargs` — and nowhere in `strip_kwargs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `strip_kwargs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — src/integrations/prefect-databricks/prefect_databricks/rest.py:71
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 0/4 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`validateCredentials` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui-v2/src/auth/auth-provider.tsx:13
`checkApiHealth` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui-v2/src/auth/auth-provider.tsx:29
`fetchToken` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui-v2/src/api/csrf.ts:73
`load` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — ui-v2/src/api/ui-settings.ts:73
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 423 is called with an argument built by `sorted(str(f) for f in firing_ids)` (line 432), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/prefect/server/events/triggers.py:423
`debug` at line 362 is called with an argument built by `"…".join(local_modules)` (line 364), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/prefect/bundles/__init__.py:362
`debug` at line 664 is called with an argument built by `json.dumps(configuration.job_manifest, indent = 2, default = str)` (line 665), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py:664
`debug` at line 838 is called with an argument built by `json.dumps(task_definition, indent = 2, default = str)` (line 839), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:838
`debug` at line 850 is called with an argument built by `json.dumps(mask_api_key(task_run_request), indent = 2, default = str)` (line 852), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:850
`debug` at line 1101 is called with an argument built by `json.dumps(task_definition, indent = 2, default = str)` (line 1103), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1101
What to do
In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped4.3 / 10Weak✓ Tool-verified
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
`Object.entries(THEMES).map(([theme,prefix])=>`
${prefix} [data-chart=${id}] {
${colorConfig.map(([key,itemConfig])=>{…` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:91
`svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — ui-v2/src/components/ui/mermaid-diagram.tsx:71
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×2) — ui-v2/src/routes/dashboard.tsx:583, ui-v2/src/components/dashboard/flow-runs-accordion/flow-runs-accordion-content.tsx:117
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×17) — ui-v2/src/routes/deployments/index.tsx:238, ui-v2/src/components/ui/run-state-change-dialog/run-state-change-dialog.tsx:75, ui-v2/src/components/automations/automations-wizard/trigger-step/trigger-json-input.tsx:26, …
`except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×20) — src/prefect/exceptions.py:351, src/prefect/results.py:705, src/prefect/results.py:718, …
`except (httpx.HTTPStatusError, Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — src/prefect/cli/profile.py:433
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`warning` at line 323 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/artifacts.py:323
`warning` at line 327 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/artifacts.py:327
`error` at line 146 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/engine.py:146
`info` at line 586 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:586
`info` at line 820 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:820
`info` at line 864 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:864
`info` at line 894 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:894
`error` at line 907 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:907
`info` at line 1075 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1075
`error` at line 1084 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1084
`info` at line 1089 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1089
`debug` at line 1168 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1168
`info` at line 1183 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1183
`info` at line 1188 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1188
`log` at line 1305 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1305
`debug` at line 1344 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1344
`info` at line 1556 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1556
`info` at line 1597 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1597
`info` at line 1627 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1627
`error` at line 1644 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1644
`info` at line 1807 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1807
`error` at line 1816 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1816
`info` at line 1821 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1821
`debug` at line 1899 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1899
`info` at line 1913 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1913
`info` at line 1918 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1918
`info` at line 1944 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:1944
`log` at line 2061 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:2061
`debug` at line 2102 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/flow_engine.py:2102
`error` at line 700 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:700
`debug` at line 739 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:739
`info` at line 1202 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:1202
`warning` at line 2726 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:2726
`info` at line 3148 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:3148
`info` at line 3315 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:3315
`info` at line 3319 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:3319
`debug` at line 3337 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:3337
`debug` at line 3341 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:3341
`debug` at line 3352 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:3352
`debug` at line 51 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — src/prefect/main.py:51
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
1/3 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
~0.2 `!` null assertions per 1k TypeScript source lines — 22 assertion(s) across the 88645 source line(s) of the 976 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: ui-v2/src/graphs/factories/runEvents.ts (5), ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts (5), ui-v2/src/graphs/factories/runArtifacts.ts (4). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). A further 2 got runtime (rendered axe-core) evidence this scan: 1.4.1, 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 — 6 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 — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXI1 Runtime container hardening — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility (rendered) — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
P12 CI test-gate honesty — 1 observation(s) recorded · 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'.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 39 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AX1 Captive dependencies — not 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
AX4 Dependency direction — not applicable to a transaction-script/CRUD architecture (the inward-dependency rule is for layered/clean styles)
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
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 — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or MongoEngine model, a migration or a SQL schema — and no database or data-store client (Django ORM, SQLAlchemy, psycopg, PyMongo, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
D12 Dependency Hygiene — Not scored — 61 shipped Python distribution(s) were read, but the outdated signal needs pypi.org, and no declaration here carries an exact pin to ask about — a floor or a range installs the newest release it admits and cannot be behind one, so this dimension's own question is only partly answered. 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.
D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; JavaScript, Python not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Python surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (prefect), 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 0 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.
D32 Data Compliance (PII/GDPR) — 197 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
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
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P8 Schema migrations — Alembic, SQLAlchemy is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF2 Allocation hygiene — Not applicable: Python and TypeScript/JavaScript runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — 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.
Orphaned knowledge ui-v2/src/mocks/create-fake-block-schema.ts:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge ui-v2/src/mocks/create-fake-block-type.ts:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Banned license: python-gitlab — `python-gitlab` 8.6.0 is published on PyPI under `LGPL-3.0`, which this policy bans, and it is in the SHIPPED closure of this repository — so it is installed by everything that depends on this repository, not just by its test environment. A distribution offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: text-unidecode — `text-unidecode` 1.3 is published on PyPI under `GPL-2.0-or-later`, which this policy bans, and it is in the SHIPPED closure of this repository — so it is installed by everything that depends on this repository, not just by its test environment. A distribution offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception.
Import cycle (3 files) ui/src/components/ContextSidebar.vue:51— ui/src/components/ContextSidebar.vue → ui/src/router/index.ts → ui/src/pages/AppRouterView.vue → ui/src/components/ContextSidebar.vue (one verified cycle inside a mutually-dependent group of 12 files)
AC2 · Forms & labels· <input> without a programmatic label · ×1
<input> without a programmatic label ui-v2/src/components/blocks/block-types-multi-select/block-types-multi-select.tsx:105— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <div> · ×1
Double-click handler on a non-interactive <div> ui-v2/src/components/ui/data-table.tsx:44— This <div> binds mousedown, touchstart 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.
Unlisted import 'd3-scale' ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:3— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
TodoComment ui-v2/src/mocks/mock-json-input.tsx:6— // TODO: Ensure input into JsonInput is covered by Playwright tests. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/graphs/textures/icon.ts:7— // TODO: Clean this typing up — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/graphs/factories/data.ts:28— // todo: need a global way of stopping this when the graph is stopped — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/graphs/factories/eventData.ts:37— // todo: need a global way of stopping this when the graph is stopped — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/work-pools/work-pool-queues-table/components/work-pool-queues-table-toolbar.test.tsx:13— // Mock console.log since component has TODO logging — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/work-pools/work-pool-queue-status-icon/work-pool-queue-status-icon.tsx:57— // TODO: Get isPushPool from work pool context if needed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/work-pools/work-pool-menu/hooks/use-work-pool-menu.ts:53— // TODO: Check workPool.can?.update when permissions are available — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/work-pools/work-pool-menu/hooks/use-work-pool-menu.ts:59— // TODO: Check workPool.can?.delete when permissions are available — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment REDACTED:3— // TODO: Fix eslint errors. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/schemas/schema-form-property-description.tsx:16— // todo: support markdown — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/concurrency/concurrency-limits-tabs.tsx:32— // TODO: Move Tabs for navigation to a generic styled component — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limit-page/task-run-concurrency-limit-tab-navigation.tsx:42— // TODO: Move Tabs for navigation to a generic styled component — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/components/automations/automations-wizard/actions-step/action-type-select.tsx:112— // TODO: add these back in once we have field names for them — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/api/task-runs/task-runs.test.ts:241— // TODO: update this test when there's a list query to ensure the cache is invalidated — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment ui-v2/src/api/automations/use-get-automation-action-resources/use-get-automation-action-resources.ts:180— // TODO: add these back when the corresponding actions are implemented — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_artifacts.py:164— # TODO: uncomment this out once unique constraint is dropped on artifact key — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_artifacts.py:470— # TODO: uncomment this out once unique constraint is dropped on artifact key — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_background_tasks.py:198— # TODO: Add ways to inspect the task queue via the REST API — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_flows.py:253— # TODO: We should cover initialization with a task runner once introduced — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_states.py:85— # TODO: We may actually want to raise a "multi-error" here where we have several — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_tasks.py:1138— # TODO: The ids are not equal here, why? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/test_tasks.py:2884— # TODO: Running with the new engine causes the result call to return a coroutine — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/utilities/test_callables.py:32— # TODO: this test actually fails with pydantic v2 attributes like model_dump — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/testing/test_utilites.py:53— # TODO: This test fails intermittently with a directory error in Windows — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tests/server/utilities/test_messaging.py:455— # TODO: is there a way we can test that ephemeral subscriptions really have cleaned — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FileTooLong: schemas/graphql_schema.py src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py— FileTooLong — 18300 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 17800 over it, 36.60× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 2014 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1514 over it, 4.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: prefect/flow_engine.py src/prefect/flow_engine.py— FileTooLong — 1713 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1213 over it, 3.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: schemas/filters.py src/prefect/server/schemas/filters.py— FileTooLong — 1709 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1209 over it, 3.42× 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: prefect/task_engine.py src/prefect/task_engine.py— FileTooLong — 1465 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 965 over it, 2.93× 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: core/_orchestrator.py src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py— 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: workers/base.py src/prefect/workers/base.py— FileTooLong — 1414 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 914 over it, 2.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: orchestration/core_policy.py src/prefect/server/orchestration/core_policy.py— FileTooLong — 1347 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 847 over it, 2.69× 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: events/actions.py src/prefect/server/events/actions.py— FileTooLong — 1313 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 813 over it, 2.63× 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: deployments/runner.py src/prefect/deployments/runner.py— FileTooLong — 1287 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 787 over it, 2.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: prefect_redis/cleanup_queue.py src/integrations/prefect-redis/prefect_redis/cleanup_queue.py— FileTooLong — 1241 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 741 over it, 2.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: prefect/tasks.py src/prefect/tasks.py— FileTooLong — 1212 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 712 over it, 2.42× 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: blocks/core.py src/prefect/blocks/core.py— FileTooLong — 1195 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 695 over it, 2.39× 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: orchestration/__init__.py src/prefect/client/orchestration/__init__.py— FileTooLong — 1194 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 694 over it, 2.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/work_pool.py src/prefect/cli/work_pool.py— FileTooLong — 1164 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 664 over it, 2.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: schemas/objects.py src/prefect/client/schemas/objects.py— FileTooLong — 1113 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 613 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: database/orm_models.py src/prefect/server/database/orm_models.py— FileTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 551 over it, 2.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: prefect_gcp/cloud_storage.py src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py— FileTooLong — 992 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 492 over it, 1.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/runner.py src/integrations/prefect-dbt/prefect_dbt/core/runner.py— FileTooLong — 968 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 468 over it, 1.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: prefect_aws/s3.py src/integrations/prefect-aws/prefect_aws/s3.py— FileTooLong — 943 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 443 over it, 1.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: events/triggers.py src/prefect/server/events/triggers.py— FileTooLong — 940 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 440 over it, 1.88× 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: models/deployments.py src/prefect/server/models/deployments.py— FileTooLong — 919 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 419 over it, 1.84× 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: api/deployments.py src/prefect/server/api/deployments.py— FileTooLong — 916 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 416 over it, 1.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: api/workers.py src/prefect/server/api/workers.py— FileTooLong — 911 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 411 over it, 1.82× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: prefect_kubernetes/observer.py src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py— FileTooLong — 891 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 391 over it, 1.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FunctionTooLong: flow-run-state-type-empty-live-image.FlowRunStateTypeEmptyLiveImage ui-v2/src/components/dashboard/flow-runs-accordion/flow-run-state-type-empty-live-image.tsx:8— FunctionTooLong — FlowRunStateTypeEmptyLiveImage runs 345 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 245 over it, 3.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: nearestParentVertical.getVerticalNearestParentLayout ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts:8— FunctionTooLong — getVerticalNearestParentLayout runs 311 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 211 over it, 3.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: dashboard.RouteComponent ui-v2/src/routes/dashboard.tsx:778— FunctionTooLong — RouteComponent runs 304 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 204 over it, 3.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: flow-run-state-type-empty-bad-terminal-image.FlowRunStateTypeEmptyBadTerminalImage ui-v2/src/components/dashboard/flow-runs-accordion/flow-run-state-type-empty-bad-terminal-image.tsx:8— FunctionTooLong — FlowRunStateTypeEmptyBadTerminalImage runs 300 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 200 over it, 3.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: flow-run-state-type-empty-good-terminal-image.FlowRunStateTypeEmptyGoodTerminalImage ui-v2/src/components/dashboard/flow-runs-accordion/flow-run-state-type-empty-good-terminal-image.tsx:8— FunctionTooLong — FlowRunStateTypeEmptyGoodTerminalImage runs 300 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 200 over it, 3.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: runs-page.RunsPage ui-v2/src/components/runs/runs-page.tsx:123— FunctionTooLong — RunsPage runs 277 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 177 over it, 2.77× 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: flow-run-header.FlowRunHeader ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:57— FunctionTooLong — FlowRunHeader runs 275 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 175 over it, 2.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.
FunctionTooLong: nodes.nodesContainerFactory ui-v2/src/graphs/factories/nodes.ts:45— FunctionTooLong — nodesContainerFactory runs 264 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
FunctionTooLong: flow-run-state-type-empty-awaiting-image.FlowRunStateTypeEmptyAwaitingImage ui-v2/src/components/dashboard/flow-runs-accordion/flow-run-state-type-empty-awaiting-image.tsx:8— FunctionTooLong — FlowRunStateTypeEmptyAwaitingImage runs 255 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: index.FlowRunsCard ui-v2/src/components/dashboard/flow-runs-card/index.tsx:51— FunctionTooLong — FlowRunsCard runs 239 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: interval-schedule-form.IntervalScheduleForm ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx:146— FunctionTooLong — IntervalScheduleForm runs 229 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 129 over it, 2.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: nodeFlowRun.flowRunContainerFactory ui-v2/src/graphs/factories/nodeFlowRun.ts:38— FunctionTooLong — flowRunContainerFactory runs 219 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 119 over it, 2.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: create-flow-run-form.CreateFlowRunForm ui-v2/src/components/deployments/create-flow-run-form/create-flow-run-form.tsx:38— FunctionTooLong — CreateFlowRunForm runs 199 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
FunctionTooLong: deployment-form.DeploymentForm ui-v2/src/components/deployments/deployment-form/deployment-form.tsx:29— FunctionTooLong — DeploymentForm runs 191 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 91 over it, 1.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: app-sidebar.AppSidebar ui-v2/src/components/ui/app-sidebar.tsx:29— FunctionTooLong — AppSidebar runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
FunctionTooLong: index.FlowDetail ui-v2/src/components/flows/detail/index.tsx:28— FunctionTooLong — FlowDetail runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: flow-deployments-tab.FlowDeploymentsTab ui-v2/src/components/flows/detail/flow-deployments-tab.tsx:70— FunctionTooLong — FlowDeploymentsTab runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.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: rich-date-range-selector.RangeView ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:667— FunctionTooLong — RangeView runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.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: index.FlowRunDetailsPage ui-v2/src/components/flow-runs/flow-run-details-page/index.tsx:48— FunctionTooLong — FlowRunDetailsPage runs 177 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 77 over it, 1.77× 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: index.FlowRunTooltip ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:417— FunctionTooLong — FlowRunTooltip runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: rich-date-range-selector.RichDateRangeSelector ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:225— FunctionTooLong — RichDateRangeSelector runs 169 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 69 over it, 1.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: flow-run-graph.FlowRunGraph ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph.tsx:58— FunctionTooLong — FlowRunGraph runs 165 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 65 over it, 1.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: event-resource-combobox.EventResourceCombobox ui-v2/src/components/automations/automations-wizard/trigger-step/event-resource-combobox/event-resource-combobox.tsx:35— FunctionTooLong — EventResourceCombobox runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× 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: work-pool-create-wizard.WorkPoolCreateWizard ui-v2/src/components/work-pools/create/work-pool-create-wizard.tsx:37— FunctionTooLong — WorkPoolCreateWizard runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× 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: use-runs-filters.useRunsFilters ui-v2/src/hooks/use-runs-filters.ts:38— FunctionTooLong — useRunsFilters runs 162 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 62 over it, 1.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.
Hotspot: src/prefect/server/schemas/schedules.py src/prefect/server/schemas/schedules.py:221— src/prefect/server/schemas/schedules.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in IntervalSchedule._get_dates_generator at line 221. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/server/schemas/schedules.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/utilities/collections.py src/prefect/utilities/collections.py:312— src/prefect/utilities/collections.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in collections.visit_collection at line 312. 2 of those changes were fix/bug commits, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/utilities/collections.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/flow_engine.py src/prefect/flow_engine.py:1925— src/prefect/flow_engine.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in AsyncFlowRunEngine.initialize_run at line 1925. 1 of those changes was a fix/bug commit, and the other 6 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/flow_engine.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/integrations/prefect-docker/prefect_docker/worker.py src/integrations/prefect-docker/prefect_docker/worker.py:622— src/integrations/prefect-docker/prefect_docker/worker.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in DockerWorker._submit_adhoc_run at line 622. 2 of those changes were fix/bug commits, and the other 6 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/integrations/prefect-docker/prefect_docker/worker.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/server/services/task_run_recorder.py src/prefect/server/services/task_run_recorder.py:416— src/prefect/server/services/task_run_recorder.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in task_run_recorder._record_bulk_task_run_events at line 416. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/server/services/task_run_recorder.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/cli/deployment.py src/prefect/cli/deployment.py:616— src/prefect/cli/deployment.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in deployment.delete at line 616. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/cli/deployment.py`: 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: ui-v2/src/routes/dashboard.tsx ui-v2/src/routes/dashboard.tsx:778— ui-v2/src/routes/dashboard.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in dashboard.RouteComponent at line 778. 1 of those changes was a fix/bug commit, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/routes/dashboard.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/utilities/templating/__init__.py src/prefect/utilities/templating/__init__.py:132— src/prefect/utilities/templating/__init__.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in templating.apply_values at line 132. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/utilities/templating/__init__.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/tasks.py src/prefect/tasks.py:679— src/prefect/tasks.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in Task.with_options at line 679. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/tasks.py`: 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:681— REDACTED changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in callables._generate_signature_from_source at line 681. 2 of those changes were fix/bug commits, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06: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: ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:57— ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in flow-run-header.FlowRunHeader at line 57. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:392— src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in KubernetesJobRun.await_for_completion at line 392. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/runner/storage.py src/prefect/runner/storage.py:428— src/prefect/runner/storage.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in GitRepository._pull_code_locked at line 428. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/runner/storage.py`: 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: ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx:146— ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in interval-schedule-form.IntervalScheduleForm at line 146. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/flow_runs.py src/prefect/flow_runs.py:196— src/prefect/flow_runs.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in flow_runs.apause_flow_run at line 196. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/flow_runs.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/runner/_flow_run_executor.py src/prefect/runner/_flow_run_executor.py:116— src/prefect/runner/_flow_run_executor.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in FlowRunExecutor.submit at line 116. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/runner/_flow_run_executor.py`: 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: ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:225— ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in rich-date-range-selector.RichDateRangeSelector 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/ui/date-range-select/rich-date-range-selector.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: ui-v2/src/components/flows/data-table.tsx ui-v2/src/components/flows/data-table.tsx:42— ui-v2/src/components/flows/data-table.tsx changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in data-table.FlowsTable at line 42. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/flows/data-table.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: ui-v2/src/components/schemas/schema-form-property.tsx ui-v2/src/components/schemas/schema-form-property.tsx:38— ui-v2/src/components/schemas/schema-form-property.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in schema-form-property.SchemaFormProperty at line 38. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/schemas/schema-form-property.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/integrations/prefect-redis/prefect_redis/client.py src/integrations/prefect-redis/prefect_redis/client.py:194— src/integrations/prefect-redis/prefect_redis/client.py changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in client.get_async_redis_client at line 194. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/integrations/prefect-redis/prefect_redis/client.py`: 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: ui-v2/src/components/ui/data-table.tsx ui-v2/src/components/ui/data-table.tsx:61— ui-v2/src/components/ui/data-table.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in data-table.DataTable at line 61. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/ui/data-table.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: ui-v2/src/components/schemas/schema-form-input.tsx ui-v2/src/components/schemas/schema-form-input.tsx:35— ui-v2/src/components/schemas/schema-form-input.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in schema-form-input.SchemaFormInput at line 35. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/schemas/schema-form-input.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: ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx:26— ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in date-time-picker.DateTimePicker at line 26. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/cli/transfer/_migratable_resources/automations.py src/prefect/cli/transfer/_migratable_resources/automations.py:204— src/prefect/cli/transfer/_migratable_resources/automations.py changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in MigratableAutomation.migrate at line 204. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/cli/transfer/_migratable_resources/automations.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/prefect/client/base.py src/prefect/client/base.py:273— src/prefect/client/base.py changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in PrefectHttpxAsyncClient._send_with_retry at line 273. 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-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 15:17:00 -06:00' --until='2026-11-04 15:17:00 -06:00' --full-history --no-merges -- src/prefect/client/base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Duplicated block (12 lines × 2) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1067— src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1067-1078 | src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1090-1101 — both copies are in the same file, so extract the 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, `src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1066` calls `RuntimeError` and `src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1089` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) src/prefect/cli/flow_run.py:446— src/prefect/cli/flow_run.py:446-457 | src/prefect/cli/flow_run.py:503-514 — both copies are in the same file, so extract the 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) src/prefect/client/orchestration/__init__.py:655— src/prefect/client/orchestration/__init__.py:655-666 | src/prefect/client/orchestration/__init__.py:1908-1919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/__init__.py:655` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/prefect/client/orchestration/_blocks_documents/client.py:47— src/prefect/client/orchestration/_blocks_documents/client.py:47-58 | src/prefect/client/orchestration/_blocks_documents/client.py:205-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_documents/client.py:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/prefect/client/orchestration/_blocks_types/client.py:84— src/prefect/client/orchestration/_blocks_types/client.py:84-95 | src/prefect/client/orchestration/_blocks_types/client.py:264-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_types/client.py:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/prefect/client/orchestration/_concurrency_limits/client.py:416— src/prefect/client/orchestration/_concurrency_limits/client.py:416-427 | src/prefect/client/orchestration/_concurrency_limits/client.py:878-889 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_concurrency_limits/client.py:416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:434— src/prefect/client/orchestration/_flow_runs/client.py:434-445 | src/prefect/client/orchestration/_flow_runs/client.py:962-973 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_flow_runs/client.py:434` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/prefect/events/filters.py:81— src/prefect/events/filters.py:81-92 | src/prefect/server/events/filters.py:148-159 — before extracting anything, compare `src/prefect/events/filters.py` and `src/prefect/server/events/filters.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) src/prefect/results.py:827— src/prefect/results.py:827-838 | src/prefect/results.py:897-908 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) src/prefect/server/api/work_queues.py:114— src/prefect/server/api/work_queues.py:114-125 | src/prefect/server/api/work_queues.py:142-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/api/work_queues.py:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:23— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:23-34 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py:25-36 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:141— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:141-152 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:140-151 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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) src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:80— src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:80-91 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_132409_bfe42b7090d6_clean_up_work_queue_migration.py:89-100 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py: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 (12 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:161— src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:161-172 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:161-172 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 256 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) src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:141— src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:141-152 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:52-63 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:141` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/prefect/server/models/artifacts.py:553— src/prefect/server/models/artifacts.py:553-564 | src/prefect/server/services/db_vacuum.py:568-579 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/artifacts.py:553` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:721— src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:721-732 | REDACTED:985-998 — 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) src/integrations/prefect-redis/prefect_redis/ordering.py:377— src/integrations/prefect-redis/prefect_redis/ordering.py:377-388 | src/prefect/server/events/ordering/memory.py:303-314 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) src/prefect/_internal/schemas/bases.py:42— src/prefect/_internal/schemas/bases.py:42-53 | src/prefect/server/utilities/schemas/bases.py:79-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) src/prefect/client/schemas/objects.py:713— src/prefect/client/schemas/objects.py:713-724 | src/prefect/server/schemas/core.py:332-343 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) src/prefect/client/orchestration/_blocks_schemas/client.py:64— src/prefect/client/orchestration/_blocks_schemas/client.py:64-75 | src/prefect/client/orchestration/_blocks_types/client.py:147-158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/prefect/client/orchestration/_blocks_schemas/client.py:158— src/prefect/client/orchestration/_blocks_schemas/client.py:158-169 | src/prefect/client/orchestration/_blocks_types/client.py:327-338 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/prefect/server/models/deployments.py:1580— src/prefect/server/models/deployments.py:1580-1591 | src/prefect/server/models/workers.py:1350-1362 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `changed_fields` to `dict[str, dict[str, Any]]` in one and `Dict[str, Dict[str, Any]]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 2) src/integrations/prefect-docker/prefect_docker/deployments/steps.py:356— src/integrations/prefect-docker/prefect_docker/deployments/steps.py:356-363 | src/prefect/utilities/dockerutils.py:257-264 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-docker/prefect_docker/deployments/steps.py:356` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:416— src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:416-423 | REDACTED:388-395 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) src/prefect/cli/work_pool.py:572— src/prefect/cli/work_pool.py:572-579 | src/prefect/cli/work_queue.py:547-554 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) src/prefect/client/orchestration/__init__.py:558— src/prefect/client/orchestration/__init__.py:558-565 | src/prefect/client/orchestration/__init__.py:1811-1818 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/client/orchestration/__init__.py:749— src/prefect/client/orchestration/__init__.py:749-756 | src/prefect/client/orchestration/__init__.py:2002-2009 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/__init__.py:749` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/events/schemas/events.py:75— src/prefect/events/schemas/events.py:75-82 | src/prefect/server/events/schemas/events.py:79-86 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/events/schemas/events.py:230— src/prefect/events/schemas/events.py:230-237 | src/prefect/server/events/schemas/events.py:276-283 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) src/prefect/flow_engine.py:1643— src/prefect/flow_engine.py:1643-1650 | src/prefect/task_engine.py:1447-1454 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) src/prefect/results.py:517— src/prefect/results.py:517-524 | src/prefect/results.py:568-575 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src/prefect/results.py:542— src/prefect/results.py:542-549 | src/prefect/results.py:622-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:421— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:421-428 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:636-643 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:421` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:645` calls `create_index` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:430` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2024_04_23_094701_75c8f17b8b51_work_status_fields.py:52— src/prefect/server/database/_migrations/versions/sqlite/2024_04_23_094701_75c8f17b8b51_work_status_fields.py:52-59 | src/prefect/server/database/_migrations/versions/sqlite/2024_11_15_151042_5952a5498b51_add_labels_column_to_flow_flowrun_.py:60-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) src/prefect/server/schemas/filters.py:778— src/prefect/server/schemas/filters.py:778-785 | src/prefect/server/schemas/filters.py:1107-1114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src/prefect/settings/sources.py:222— src/prefect/settings/sources.py:222-229 | src/prefect/settings/sources.py:299-306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/_internal/waiters.py:247— src/prefect/_internal/waiters.py:247-254 | src/prefect/task_runs.py:262-269 — before extracting anything, compare `src/prefect/_internal/waiters.py` and `src/prefect/task_runs.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/client/schemas/objects.py:519— src/prefect/client/schemas/objects.py:519-526 | src/prefect/server/schemas/states.py:305-312 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) src/prefect/events/actions.py:57— src/prefect/events/actions.py:57-64 | src/prefect/server/events/actions.py:755-762 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/events/actions.py:230— src/prefect/events/actions.py:230-237 | src/prefect/server/events/actions.py:1639-1646 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/events/actions.py:272— src/prefect/events/actions.py:272-279 | src/prefect/server/events/actions.py:1758-1765 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/prefect/server/services/cancellation_cleanup.py:43— src/prefect/server/services/cancellation_cleanup.py:43-50 | src/prefect/server/services/cleanup_reconciler.py:28-35 — 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 (8 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py:66— src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py:66-74 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_21_145916_c8ff35f94028_add_block_spec_id_to_blocks.py:63-70 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_02_21_145916_c8ff35f94028_add_block_spec_id_to_blocks.py` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:495— src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:495-503 | src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:588-595 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) benches/bench_block_schemas.py:192— benches/bench_block_schemas.py:192-199 | REDACTED:353-360 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `benches/bench_block_schemas.py:191` calls `run_scenario` and `REDACTED:352` 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 (15 lines × 2) src/integrations/prefect-azure/prefect_azure/bundles/execute.py:37— src/integrations/prefect-azure/prefect_azure/bundles/execute.py:37-51 | src/integrations/prefect-azure/prefect_azure/bundles/upload.py:31-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:201— src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:201-215 | src/integrations/prefect-gitlab/prefect_gitlab/repositories.py:179-193 — before extracting anything, compare `src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py` and `src/integrations/prefect-gitlab/prefect_gitlab/repositories.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (15 lines × 2) src/integrations/prefect-gcp/prefect_gcp/bigquery.py:151— src/integrations/prefect-gcp/prefect_gcp/bigquery.py:151-165 | src/integrations/prefect-gcp/prefect_gcp/bigquery.py:278-292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/integrations/prefect-gcp/prefect_gcp/bigquery.py:148` calls `get_run_logger`, `info` and `src/integrations/prefect-gcp/prefect_gcp/bigquery.py:261` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) src/integrations/prefect-gcp/prefect_gcp/bundles/execute.py:37— src/integrations/prefect-gcp/prefect_gcp/bundles/execute.py:37-51 | src/integrations/prefect-gcp/prefect_gcp/bundles/upload.py:47-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/integrations/prefect-gcp/prefect_gcp/bundles/execute.py:53` calls `TemporaryDirectory`, `Path`, `basename` and `src/integrations/prefect-gcp/prefect_gcp/bundles/upload.py:63` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:584— src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:584-598 | REDACTED:600-614 — 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 (15 lines × 2) src/prefect/bundles/__init__.py:827— src/prefect/bundles/__init__.py:827-841 | src/prefect/bundles/__init__.py:895-909 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/bundles/__init__.py:827` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) src/prefect/client/schemas/actions.py:313— src/prefect/client/schemas/actions.py:313-327 | src/prefect/client/schemas/actions.py:398-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 (15 lines × 2) src/prefect/client/schemas/objects.py:483— src/prefect/client/schemas/objects.py:483-497 | src/prefect/server/schemas/states.py:271-285 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `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 (15 lines × 2) src/prefect/events/filters.py:179— src/prefect/events/filters.py:179-193 | src/prefect/server/events/filters.py:312-326 — before extracting anything, compare `src/prefect/events/filters.py` and `src/prefect/server/events/filters.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) src/prefect/infrastructure/provisioners/coiled.py:56— src/prefect/infrastructure/provisioners/coiled.py:56-70 | src/prefect/infrastructure/provisioners/modal.py:58-72 — before extracting anything, compare `src/prefect/infrastructure/provisioners/coiled.py` and `src/prefect/infrastructure/provisioners/modal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) src/prefect/locking/_filelock.py:195— src/prefect/locking/_filelock.py:195-209 | src/prefect/locking/_filelock.py:213-227 — both copies are in the same file, so extract the 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 (15 lines × 2) src/prefect/server/api/concurrency_limits.py:122— src/prefect/server/api/concurrency_limits.py:122-136 | src/prefect/server/api/concurrency_limits.py:165-179 — both copies are in the same file, so extract the 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 (15 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_19_160058_bb4dc90d3e29_renames_existing_block_types.py:38— src/prefect/server/database/_migrations/versions/postgresql/2022_07_19_160058_bb4dc90d3e29_renames_existing_block_types.py:38-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_19_153432_628a873f0d1a_renames_existing_block_types.py:38-52 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_07_19_160058_bb4dc90d3e29_renames_existing_block_types.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_07_19_153432_628a873f0d1a_renames_existing_block_types.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (15 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:136— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:136-150 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:51-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py: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 (15 lines × 2) src/prefect/server/schemas/actions.py:1051— src/prefect/server/schemas/actions.py:1051-1065 | src/prefect/server/schemas/core.py:1243-1257 — 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 (15 lines × 2) src/prefect/states.py:479— src/prefect/states.py:479-493 | src/prefect/states.py:565-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/states.py:494` calls `_from_metadata` and `src/prefect/states.py:581` 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 (15 lines × 2) src/prefect/task_engine.py:836— src/prefect/task_engine.py:836-850 | src/prefect/task_engine.py:1501-1515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) src/prefect/utilities/processutils/__init__.py:562— src/prefect/utilities/processutils/__init__.py:562-576 | src/prefect/utilities/processutils/__init__.py:582-596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:160— src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:160-176 | src/integrations/prefect-gitlab/prefect_gitlab/repositories.py:130-144 — before extracting anything, compare `src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py` and `src/integrations/prefect-gitlab/prefect_gitlab/repositories.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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 (15 lines × 2) src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:1503— src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:1503-1517 | src/prefect/server/worker_communication/cleanup_queue/memory.py:735-749 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) src/prefect/server/events/stream.py:122— src/prefect/server/events/stream.py:122-136 | src/prefect/server/logs/stream.py:203-217 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:2165— src/integrations/prefect-aws/prefect_aws/s3.py:2165-2177 | src/integrations/prefect-aws/prefect_aws/s3.py:2235-2247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:239— src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:239-251 | src/integrations/prefect-gitlab/prefect_gitlab/repositories.py:229-241 — before extracting anything, compare `src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py` and `src/integrations/prefect-gitlab/prefect_gitlab/repositories.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (13 lines × 2) src/prefect/_experimental/sla/client.py:37— src/prefect/_experimental/sla/client.py:37-49 | src/prefect/_experimental/sla/client.py:78-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/_experimental/sla/client.py:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) src/prefect/cli/work_queue.py:276— src/prefect/cli/work_queue.py:276-288 | src/prefect/cli/work_queue.py:321-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/work_queue.py:276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src/prefect/client/orchestration/_blocks_schemas/client.py:49— src/prefect/client/orchestration/_blocks_schemas/client.py:49-61 | src/prefect/client/orchestration/_blocks_schemas/client.py:143-155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_schemas/client.py:49` it begins part-way through the construct above it, so those 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 (13 lines × 2) src/prefect/client/orchestration/_variables/client.py:32— src/prefect/client/orchestration/_variables/client.py:32-44 | src/prefect/client/orchestration/_variables/client.py:104-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_variables/client.py:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) src/prefect/concurrency/_asyncio.py:104— src/prefect/concurrency/_asyncio.py:104-116 | src/prefect/concurrency/_asyncio.py:157-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/concurrency/_asyncio.py:155` calls `_release_lease_when_granted` and `src/prefect/concurrency/_asyncio.py:103` 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) src/prefect/events/filters.py:239— src/prefect/events/filters.py:239-251 | src/prefect/server/events/filters.py:508-520 — before extracting anything, compare `src/prefect/events/filters.py` and `src/prefect/server/events/filters.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) src/prefect/flow_engine.py:879— src/prefect/flow_engine.py:879-891 | src/prefect/flow_engine.py:1612-1624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src/prefect/server/api/deployments.py:539— src/prefect/server/api/deployments.py:539-551 | src/prefect/server/api/deployments.py:580-592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:125— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:125-137 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:128-140 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (13 lines × 2) src/prefect/server/models/work_queues.py:272— src/prefect/server/models/work_queues.py:272-284 | src/prefect/server/models/workers.py:292-304 — 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) src/prefect/server/orchestration/rules.py:322— src/prefect/server/orchestration/rules.py:322-334 | src/prefect/server/orchestration/rules.py:483-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/orchestration/rules.py:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) src/prefect/tasks.py:903— src/prefect/tasks.py:903-915 | src/prefect/tasks.py:1021-1033 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src/prefect/transactions.py:336— src/prefect/transactions.py:336-348 | src/prefect/transactions.py:496-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_09_25_121806_05ea6f882b1d_remove_flow_run_id_requirement_from_task_run.py:19— src/prefect/server/database/_migrations/versions/postgresql/2023_09_25_121806_05ea6f882b1d_remove_flow_run_id_requirement_from_task_run.py:19-31 | src/prefect/server/database/_migrations/versions/sqlite/2023_09_25_121806_8167af8df781_remove_flow_run_id_requirement_from_task_run.py:19-31 — 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 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_02_03_125146_c163acd7e8e3_add_parameters_column_to_deployment_.py:22— src/prefect/server/database/_migrations/versions/postgresql/2025_02_03_125146_c163acd7e8e3_add_parameters_column_to_deployment_.py:22-34 | src/prefect/server/database/_migrations/versions/sqlite/2025_02_03_125228_67f886da208e_add_parameters_column_to_deployment_.py:22-34 — 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 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_06_12_144500_add_automation_tags_aa1234567890.py:22— src/prefect/server/database/_migrations/versions/postgresql/2025_06_12_144500_add_automation_tags_aa1234567890.py:22-34 | src/prefect/server/database/_migrations/versions/sqlite/2025_06_12_144500_add_automation_tags_bb2345678901.py:22-34 — 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 lines × 2) src/prefect/_internal/analytics/enabled.py:11— src/prefect/_internal/analytics/enabled.py:11-33 | src/prefect/_internal/analytics/service.py:98-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) src/prefect/server/api/deployments.py:689— src/prefect/server/api/deployments.py:689-701 | src/prefect/server/api/flow_runs.py:264-276 — 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 (13 lines × 2) src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:259— src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:259-271 | src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:431-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Swallowed exception (caught, then discarded) src/prefect/exceptions.py:351— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/results.py:705— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/results.py:718— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/results.py:750— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/results.py:763— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/server/logs/stream.py:163— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/server/events/stream.py:87— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/server/database/interface.py:130— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/server/api/dependencies.py:143— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/runner/_state_proposer.py:84— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/runner/storage.py:362— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/runner/storage.py:375— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/runner/storage.py:387— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/runner/storage.py:409— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/concurrency/_asyncio.py:60— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/cli/profile.py:433— `except (httpx.HTTPStatusError, Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/cli/profile.py:449— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/cli/profile.py:467— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/cli/server.py:335— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/_internal/analytics/client.py:75— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) src/prefect/_internal/analytics/client.py:122— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
R4 · Test Coverage· No test reaches this file · ×19
No test reaches this file ui-v2/src/components/ui/utils/spacing-utils.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 ui-v2/src/components/work-pools/priority-management/priority-editor-dialog.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 ui-v2/src/components/flows/detail/runs-columns.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 ui-v2/src/components/flow-runs/flow-run-state-dialog/use-flow-run-state-dialog.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 ui-v2/src/components/work-pools/priority-management/use-bulk-update-priorities-mutation.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 ui-v2/src/components/flows/table-count-header.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 ui-v2/src/components/flows/detail/cells.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 ui-v2/src/components/schemas/schema-display/types.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 ui/src/main.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 ui/src/compositions/useToast.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 ui/src/utilities/units.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 ui-v2/src/main.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file ui-v2/src/components/flow-runs/flow-run-state-dialog/flow-run-state-dialog.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 ui/src/App.vue: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 ui/src/utilities/promises.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 ui/src/utilities/testing.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 ui-v2/src/components/blocks/block-document-details-page/index.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 ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/flow-runs-filters.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 ui-v2/src/components/work-pools/work-pool-card/components/constants.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.
Swallowed exception (empty catch) ui-v2/src/routes/dashboard.tsx:583— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) ui-v2/src/routes/deployments/index.tsx:238— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui-v2/src/components/ui/run-state-change-dialog/run-state-change-dialog.tsx:75— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui-v2/src/components/dashboard/flow-runs-accordion/flow-runs-accordion-content.tsx:117— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) ui-v2/src/components/automations/automations-wizard/trigger-step/trigger-json-input.tsx:26— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) ui-v2/src/api/automations/automations.ts:328— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/flow_engine.py:837— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/flow_engine.py:1572— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) REDACTED:424— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/server/events/actions.py:426— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/deployments/runner.py:532— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/deployments/runner.py:632— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/concurrency/_asyncio.py:127— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/concurrency/services.py:183— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/cli/server.py:171— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/cli/version.py:79— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/_internal/send_entrypoint_logs.py:55— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/_internal/analytics/client.py:86— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/prefect/_internal/analytics/client.py:131— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (11 lines × 2) src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:153— src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:153-164 | src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:282-292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/prefect/cli/automation.py:229— src/prefect/cli/automation.py:229-239 | src/prefect/cli/automation.py:289-299 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/prefect/cli/automation.py:376— src/prefect/cli/automation.py:376-386 | src/prefect/cli/automation.py:397-409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/prefect/client/orchestration/_blocks_documents/client.py:127— src/prefect/client/orchestration/_blocks_documents/client.py:127-137 | src/prefect/client/orchestration/_blocks_documents/client.py:284-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_documents/client.py:127` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src/prefect/client/orchestration/_blocks_types/client.py:188— src/prefect/client/orchestration/_blocks_types/client.py:188-198 | src/prefect/client/orchestration/_blocks_types/client.py:368-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_types/client.py:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src/prefect/client/orchestration/_concurrency_limits/client.py:385— src/prefect/client/orchestration/_concurrency_limits/client.py:385-395 | src/prefect/client/orchestration/_concurrency_limits/client.py:847-857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_concurrency_limits/client.py:385` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/prefect/deployments/runner.py:819— src/prefect/deployments/runner.py:819-829 | src/prefect/deployments/runner.py:885-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/runner.py:819` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src/prefect/input/run_input.py:609— src/prefect/input/run_input.py:609-619 | src/prefect/input/run_input.py:718-728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_214717_4ff2f2bf81f4_adds_block_type_slug.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_214717_4ff2f2bf81f4_adds_block_type_slug.py:23-33 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_142515_f335f9633eec_adds_block_type_slug.py:23-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:22— src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:22-32 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_132409_bfe42b7090d6_clean_up_work_queue_migration.py:22-32 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_132409_bfe42b7090d6_clean_up_work_queue_migration.py:20` calls `execute` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:21` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:77— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:77-87 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:79-90 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src/prefect/server/database/query_components.py:608— src/prefect/server/database/query_components.py:608-618 | src/prefect/server/database/query_components.py:911-921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/prefect/task_engine.py:962— src/prefect/task_engine.py:962-972 | src/prefect/task_engine.py:1627-1638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/task_engine.py:1627` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src/prefect/task_engine.py:1049— src/prefect/task_engine.py:1049-1059 | src/prefect/task_engine.py:1698-1708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/task_engine.py:1049` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) src/prefect/transactions.py:406— src/prefect/transactions.py:406-416 | src/prefect/transactions.py:566-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_06_20_123921_7296741dff68_add_protected_column_for_block_types.py:21— src/prefect/server/database/_migrations/versions/postgresql/2022_06_20_123921_7296741dff68_add_protected_column_for_block_types.py:21-31 | src/prefect/server/database/_migrations/versions/sqlite/2022_06_20_123823_dff8da7a6c2c_add_protected_column_for_block_types.py:21-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:569— src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:569-579 | REDACTED:577-594 — 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 (11 lines × 2) src/prefect/_internal/pydantic/v1_schema.py:42— src/prefect/_internal/pydantic/v1_schema.py:42-52 | src/prefect/_internal/pydantic/v2_schema.py:38-48 — 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 (18 lines × 2) src/integrations/prefect-gcp/prefect_gcp/deployments/steps.py:92— src/integrations/prefect-gcp/prefect_gcp/deployments/steps.py:92-109 | src/integrations/prefect-gcp/prefect_gcp/deployments/steps.py:194-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/prefect/cli/deploy/_core.py:476— src/prefect/cli/deploy/_core.py:476-493 | REDACTED:1623-1640 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/deploy/_core.py:476` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) src/prefect/cli/deploy/_sla.py:20— src/prefect/cli/deploy/_sla.py:20-37 | src/prefect/cli/deploy/_triggers.py:51-68 — 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 (18 lines × 2) src/prefect/client/base.py:315— src/prefect/client/base.py:315-332 | src/prefect/client/base.py:588-605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/prefect/client/orchestration/_deployments/client.py:358— src/prefect/client/orchestration/_deployments/client.py:358-375 | src/prefect/client/orchestration/_deployments/client.py:1072-1089 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_deployments/client.py:358` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18 lines × 2) src/prefect/client/orchestration/_work_pools/client.py:66— src/prefect/client/orchestration/_work_pools/client.py:66-83 | src/prefect/client/orchestration/_work_pools/client.py:394-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_work_pools/client.py:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) src/prefect/events/schemas/automations.py:220— src/prefect/events/schemas/automations.py:220-237 | src/prefect/server/events/schemas/automations.py:362-379 — before extracting anything, compare `src/prefect/events/schemas/automations.py` and `src/prefect/server/events/schemas/automations.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `data` to `Dict[str, Any]` in one and `Dict[str, Any] | Any` 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 lines × 2) src/prefect/flow_engine.py:1145— src/prefect/flow_engine.py:1145-1162 | src/prefect/flow_engine.py:1877-1894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:1145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) src/prefect/input/actions.py:37— src/prefect/input/actions.py:37-54 | src/prefect/input/actions.py:68-85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/prefect/input/run_input.py:623— src/prefect/input/run_input.py:623-640 | src/prefect/input/run_input.py:732-749 — both copies are in the same file, so extract the 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 (18 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:20— src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:20-37 | src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py:20-37 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:99— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:99-116 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:48-65 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) src/prefect/task_engine.py:663— src/prefect/task_engine.py:663-680 | src/prefect/task_engine.py:1322-1339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/prefect/task_engine.py:815— src/prefect/task_engine.py:815-832 | src/prefect/task_engine.py:1480-1497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/prefect/transactions.py:364— src/prefect/transactions.py:364-381 | src/prefect/transactions.py:524-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 `src/prefect/transactions.py:364` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_06_13_104234_61c76ee09e02_add_anonymous_column_for_block_documents.py:21— src/prefect/server/database/_migrations/versions/postgresql/2022_06_13_104234_61c76ee09e02_add_anonymous_column_for_block_documents.py:21-38 | src/prefect/server/database/_migrations/versions/sqlite/2022_06_13_103943_2d900af9cd07_add_anonymous_column_for_block_documents.py:21-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (18 lines × 2) src/prefect/server/models/flow_run_states.py:39— src/prefect/server/models/flow_run_states.py:39-56 | src/prefect/server/models/task_run_states.py:37-54 — 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 (16 lines × 2) scripts/prepare_integration_release_notes.py:399— scripts/prepare_integration_release_notes.py:399-414 | scripts/prepare_release_notes.py:357-372 — 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 (16 lines × 2) src/integrations/prefect-aws/prefect_aws/secrets_manager.py:134— src/integrations/prefect-aws/prefect_aws/secrets_manager.py:134-149 | src/integrations/prefect-aws/prefect_aws/secrets_manager.py:224-239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-aws/prefect_aws/secrets_manager.py:134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/integrations/prefect-aws/prefect_aws/secrets_manager.py:152` calls `pop` and `src/integrations/prefect-aws/prefect_aws/secrets_manager.py:242` 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 lines × 2) src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:664— src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:664-679 | src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:934-949 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:664` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (16 lines × 2) src/prefect/client/orchestration/_blocks_schemas/client.py:24— src/prefect/client/orchestration/_blocks_schemas/client.py:24-39 | src/prefect/client/orchestration/_blocks_schemas/client.py:118-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_schemas/client.py:24` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) src/prefect/client/orchestration/_deployments/client.py:262— src/prefect/client/orchestration/_deployments/client.py:262-277 | src/prefect/client/orchestration/_deployments/client.py:975-990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) src/prefect/deployments/flow_runs.py:215— src/prefect/deployments/flow_runs.py:215-230 | src/prefect/deployments/flow_runs.py:414-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/flow_runs.py: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) REDACTED:1788— REDACTED:1788-1803 | src/prefect/runner/runner.py:484-499 — 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:1788` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) REDACTED:2381— REDACTED:2381-2396 | src/prefect/tasks.py:2200-2215 — 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:2381` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src/prefect/results.py:137— src/prefect/results.py:137-152 | src/prefect/results.py:178-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/results.py:137` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) src/prefect/results.py:712— src/prefect/results.py:712-727 | src/prefect/results.py:757-772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/results.py:712` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_05_26_135743_724e6dcc6b5d_add_block_schema_capabilities.py:61— src/prefect/server/database/_migrations/versions/postgresql/2022_05_26_135743_724e6dcc6b5d_add_block_schema_capabilities.py:61-76 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_19_165808_33439667aeea_add_block_schema_capabilities.py:74-89 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) src/prefect/server/services/cancellation_cleanup.py:466— src/prefect/server/services/cancellation_cleanup.py:466-481 | src/prefect/server/services/cancellation_cleanup.py:520-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 `src/prefect/server/services/cancellation_cleanup.py:466` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) src/prefect/task_engine.py:1739— src/prefect/task_engine.py:1739-1754 | src/prefect/task_engine.py:1806-1821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) src/prefect/task_engine.py:1771— src/prefect/task_engine.py:1771-1786 | src/prefect/task_engine.py:1866-1881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) src/prefect/task_runners.py:179— src/prefect/task_runners.py:179-194 | REDACTED:894-909 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) src/integrations/prefect-dbt/benches/bench_orchestrator.py:250— src/integrations/prefect-dbt/benches/bench_orchestrator.py:250-265 | src/integrations/prefect-dbt/benches/bench_orchestrator.py:278-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-dbt/benches/bench_orchestrator.py:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:219— src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:219-232 | src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:308-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:1707— src/integrations/prefect-aws/prefect_aws/s3.py:1707-1720 | src/integrations/prefect-aws/prefect_aws/s3.py:1777-1790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) src/integrations/prefect-gcp/prefect_gcp/bigquery.py:168— src/integrations/prefect-gcp/prefect_gcp/bigquery.py:168-181 | src/integrations/prefect-gcp/prefect_gcp/bigquery.py:294-307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/prefect/cli/server.py:407— src/prefect/cli/server.py:407-420 | src/prefect/cli/server.py:491-504 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/prefect/cli/work_pool.py:1174— src/prefect/cli/work_pool.py:1174-1187 | src/prefect/cli/work_queue.py:728-741 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/work_pool.py:1174` it does not close everything it opens, so those 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) src/prefect/client/orchestration/_blocks_types/client.py:63— src/prefect/client/orchestration/_blocks_types/client.py:63-76 | src/prefect/client/orchestration/_blocks_types/client.py:243-256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_types/client.py:63` it begins part-way through the construct above it, so those 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) src/prefect/filesystems.py:191— src/prefect/filesystems.py:191-204 | src/prefect/filesystems.py:282-295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/prefect/flow_engine.py:1006— src/prefect/flow_engine.py:1006-1019 | src/prefect/flow_engine.py:1740-1753 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/prefect/input/run_input.py:767— src/prefect/input/run_input.py:767-780 | src/prefect/input/run_input.py:793-806 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:126— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:126-139 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:140-153 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 184 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py:23-36 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_151028_88c2112b668f_update_deployments_to_include_more_.py:22-35 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_151028_88c2112b668f_update_deployments_to_include_more_.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_05_21_101457_94622c1663e8_json_variables.py:24— src/prefect/server/database/_migrations/versions/postgresql/2024_05_21_101457_94622c1663e8_json_variables.py:24-37 | src/prefect/server/database/_migrations/versions/sqlite/2024_05_21_123101_2ac65f1758c2_json_variables.py:24-37 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) src/prefect/task_engine.py:793— src/prefect/task_engine.py:793-806 | src/prefect/task_engine.py:1458-1471 — both copies are in the same file, so extract the 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 `client` to `Optional[SyncPrefectClient] = None` in one and `Optional[PrefectClient] = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (14 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_04_094418_bd6efa529f03_add_deployment_version_to_flow_run.py:20— src/prefect/server/database/_migrations/versions/postgresql/2024_04_04_094418_bd6efa529f03_add_deployment_version_to_flow_run.py:20-34 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_04_114538_8644a9595a08_add_deployment_version_to_flow_run.py:20-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) src/prefect/_internal/schemas/bases.py:86— src/prefect/_internal/schemas/bases.py:86-99 | src/prefect/server/utilities/schemas/bases.py:110-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) src/prefect/server/schemas/states.py:441— src/prefect/server/schemas/states.py:441-454 | src/prefect/states.py:871-884 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `cls` to `type[_State] = State` in one and `Type["State[R]"] = State` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:2190— src/integrations/prefect-aws/prefect_aws/s3.py:2190-2198 | src/integrations/prefect-aws/prefect_aws/s3.py:2256-2264 — both copies are in the same file, so extract the 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 `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 before the matched lines, `src/integrations/prefect-aws/prefect_aws/s3.py:2188` calls `gather` and `src/integrations/prefect-aws/prefect_aws/s3.py:2254` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:357— src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:357-365 | src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:460-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src/prefect/blocks/core.py:1579— src/prefect/blocks/core.py:1579-1587 | src/prefect/blocks/core.py:1676-1684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/blocks/core.py:1579` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src/prefect/blocks/notifications.py:60— src/prefect/blocks/notifications.py:60-68 | src/prefect/blocks/notifications.py:83-91 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src/prefect/cli/work_pool.py:707— src/prefect/cli/work_pool.py:707-715 | src/prefect/cli/work_queue.py:473-481 — 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 (9 lines × 2) src/prefect/logging/handlers.py:285— src/prefect/logging/handlers.py:285-293 | src/prefect/logging/handlers.py:303-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:79— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:79-88 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:90-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src/prefect/utilities/dockerutils.py:418— src/prefect/utilities/dockerutils.py:418-426 | src/prefect/utilities/dockerutils.py:439-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/utilities/dockerutils.py:418` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src/prefect/_internal/waiters.py:157— src/prefect/_internal/waiters.py:157-165 | src/prefect/task_runs.py:165-173 — before extracting anything, compare `src/prefect/_internal/waiters.py` and `src/prefect/task_runs.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src/prefect/events/clients.py:264— src/prefect/events/clients.py:264-272 | src/prefect/logging/clients.py:86-94 — `src/prefect/events/clients.py` and `src/prefect/logging/clients.py` 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 43 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. 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 (9 lines × 2) src/prefect/events/schemas/automations.py:401— src/prefect/events/schemas/automations.py:401-409 | src/prefect/server/events/schemas/automations.py:208-216 — before extracting anything, compare `src/prefect/events/schemas/automations.py` and `src/prefect/server/events/schemas/automations.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (9 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:185— src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:185-193 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:198-206 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src/prefect/server/events/stream.py:110— src/prefect/server/events/stream.py:110-118 | src/prefect/server/logs/stream.py:191-199 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) src/prefect/server/api/deployments.py:709— src/prefect/server/api/deployments.py:709-719 | src/prefect/server/api/flows.py:159-167 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:197— src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:197-203 | src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:207-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.
Duplicated block (7 lines × 2) src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1624— src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1624-1630 | src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1697-1703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) src/integrations/prefect-redis/prefect_redis/blocks.py:197— src/integrations/prefect-redis/prefect_redis/blocks.py:197-203 | src/integrations/prefect-redis/prefect_redis/blocks.py:216-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-redis/prefect_redis/blocks.py:197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src/prefect/__init__.py:210— src/prefect/__init__.py:210-216 | src/prefect/client/schemas/__init__.py:88-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) src/prefect/_internal/pydantic/validated_func.py:206— src/prefect/_internal/pydantic/validated_func.py:206-213 | src/prefect/_internal/pydantic/validated_func.py:219-225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/_internal/pydantic/validated_func.py: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. 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) src/prefect/cli/global_concurrency_limit.py:78— src/prefect/cli/global_concurrency_limit.py:78-84 | src/prefect/cli/variable.py:83-89 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/global_concurrency_limit.py:78` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src/prefect/cli/work_pool.py:736— src/prefect/cli/work_pool.py:736-742 | src/prefect/cli/work_queue.py:484-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) src/prefect/client/orchestration/__init__.py:1846— src/prefect/client/orchestration/__init__.py:1846-1853 | src/prefect/client/orchestration/__init__.py:1939-1945 — both copies are in the same file, so extract the 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 `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 (7 lines × 2) src/prefect/flow_engine.py:1111— src/prefect/flow_engine.py:1111-1117 | src/prefect/flow_engine.py:1843-1849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:1111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_09_06_085747_50f8c182c3ca_.py:20— src/prefect/server/database/_migrations/versions/postgresql/2023_09_06_085747_50f8c182c3ca_.py:20-26 | src/prefect/server/database/_migrations/versions/postgresql/2024_08_14_150111_97429116795e_add_deployment_concurrency_limit.py:20-26 — 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) scripts/generate_prefect_yaml_schema.py:11— scripts/generate_prefect_yaml_schema.py:11-17 | scripts/generate_settings_schema.py:11-17 — 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 (7 lines × 2) src/prefect/server/schemas/actions.py:457— src/prefect/server/schemas/actions.py:457-463 | src/prefect/server/schemas/states.py:168-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 (7 lines × 2) src/prefect/server/schemas/actions.py:467— src/prefect/server/schemas/actions.py:467-473 | src/prefect/server/schemas/states.py:178-184 — 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 (7 lines × 2) src/prefect/server/api/flow_runs.py:672— src/prefect/server/api/flow_runs.py:672-678 | src/prefect/server/api/task_runs.py:300-306 — 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.
AC2 · Forms & labels· <SearchInput> field component without a label · ×13
<SearchInput> field component without a label ui-v2/src/components/artifacts/artifact/detail-table.tsx:57— 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.
<SearchInput> field component without a label ui-v2/src/components/artifacts/artifacts-filter.tsx:78— 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.
<SearchInput> field component without a label ui-v2/src/components/blocks/blocks-catalog-page/block-types-grid.tsx:35— 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.
<SearchInput> field component without a label ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:161— 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.
<SearchInput> field component without a label ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-data-table/task-run-concurrency-limits-data-table.tsx:152— 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.
<SearchInput> field component without a label ui-v2/src/components/deployments/data-table/index.tsx:267— 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.
<SearchInput> field component without a label ui-v2/src/components/deployments/deployment-parameters-table/deployment-parameters-table.tsx:161— 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.
<SearchInput> field component without a label ui-v2/src/components/flows/data-table.tsx:160— 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.
<SearchInput> field component without a label ui-v2/src/components/flows/detail/index.tsx:164— 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.
<SearchInput> field component without a label ui-v2/src/components/variables/data-table/data-table.tsx:169— 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.
<SearchInput> field component without a label ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:219— 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.
<SearchInput> field component without a label ui-v2/src/components/work-pools/work-pool-queue-runs-tab/work-pool-queue-runs-tab.tsx:236— 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.
<SearchInput> field component without a label ui-v2/src/routes/work-pools/index.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.
Duplicated block (17 lines × 2) src/prefect/_internal/observers.py:233— src/prefect/_internal/observers.py:233-249 | src/prefect/_internal/observers.py:402-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) src/prefect/cli/work_pool.py:1189— src/prefect/cli/work_pool.py:1189-1205 | src/prefect/cli/work_queue.py:743-759 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/work_pool.py:1189` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) src/prefect/client/orchestration/__init__.py:439— src/prefect/client/orchestration/__init__.py:439-455 | src/prefect/client/orchestration/__init__.py:1366-1382 — both copies are in the same file, so extract the 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) src/prefect/client/orchestration/_concurrency_limits/client.py:82— src/prefect/client/orchestration/_concurrency_limits/client.py:82-98 | src/prefect/client/orchestration/_concurrency_limits/client.py:543-559 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_concurrency_limits/client.py:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (17 lines × 2) src/prefect/events/filters.py:141— src/prefect/events/filters.py:141-157 | src/prefect/server/events/filters.py:232-248 — before extracting anything, compare `src/prefect/events/filters.py` and `src/prefect/server/events/filters.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (17 lines × 2) src/prefect/flow_engine.py:698— src/prefect/flow_engine.py:698-714 | src/prefect/flow_engine.py:1437-1453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:698` it begins part-way through the construct above it, so those 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 (17 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:199— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:199-215 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:234-250 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py: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) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:763— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:763-779 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:787-803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:763` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:41— src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:41-57 | src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py:41-57 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (17 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:106— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:106-122 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:129-145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) src/prefect/server/database/query_components.py:712— src/prefect/server/database/query_components.py:712-728 | src/prefect/server/database/query_components.py:1004-1020 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:712` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/query_components.py:1023` calls `distinct` and `src/prefect/server/database/query_components.py:731` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) src/prefect/server/models/work_queues.py:110— src/prefect/server/models/work_queues.py:110-126 | src/prefect/server/models/workers.py:541-557 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/work_queues.py: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. 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 (17 lines × 2) src/prefect/_internal/waiters.py:217— src/prefect/_internal/waiters.py:217-233 | src/prefect/task_runs.py:232-248 — before extracting anything, compare `src/prefect/_internal/waiters.py` and `src/prefect/task_runs.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) src/prefect/automations.py:213— src/prefect/automations.py:213-222 | src/prefect/automations.py:260-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) src/prefect/cli/cloud/webhook.py:44— src/prefect/cli/cloud/webhook.py:44-53 | src/prefect/cli/cloud/webhook.py:79-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/prefect/client/orchestration/_deployments/client.py:743— src/prefect/client/orchestration/_deployments/client.py:743-752 | src/prefect/client/orchestration/_deployments/client.py:1457-1466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_deployments/client.py:743` it begins part-way through the construct above it, so those 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 (10 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:219— src/prefect/client/orchestration/_flow_runs/client.py:219-228 | src/prefect/client/orchestration/_flow_runs/client.py:747-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_flow_runs/client.py:219` it begins part-way through the construct above it, so those 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 (10 lines × 2) src/prefect/events/schemas/events.py:175— src/prefect/events/schemas/events.py:175-184 | src/prefect/server/events/schemas/events.py:194-203 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) src/prefect/filesystems.py:645— src/prefect/filesystems.py:645-654 | src/prefect/filesystems.py:660-669 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/prefect/server/schemas/filters.py:2316— src/prefect/server/schemas/filters.py:2316-2325 | src/prefect/server/schemas/filters.py:2465-2474 — both copies are in the same file, so extract the 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 `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 (10 lines × 2) src/prefect/task_engine.py:769— src/prefect/task_engine.py:769-778 | src/prefect/task_engine.py:1432-1441 — both copies are in the same file, so extract the 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) REDACTED:749— REDACTED:749-758 | REDACTED:775-784 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_111050_d115556a8ab6_index_flowrun_flow_runner_type.py:19— src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_111050_d115556a8ab6_index_flowrun_flow_runner_type.py:19-28 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_21_111238_f327e877e423_index_flowrun_flow_runner_type.py:19-28 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) src/prefect/events/schemas/automations.py:139— src/prefect/events/schemas/automations.py:139-148 | src/prefect/server/events/schemas/automations.py:266-275 — before extracting anything, compare `src/prefect/events/schemas/automations.py` and `src/prefect/server/events/schemas/automations.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:79— src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:79-88 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:87-96 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 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.
AXH1 · Runtime security headers· Runtime security header not set · ×11
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-content-type-options — The live app's responses did not include x-content-type-options (stops MIME-sniffing (expects 'nosniff')). 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.
Duplicated block (22 lines × 2) src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:130— src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:130-151 | src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:231-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:130` it begins part-way through the construct above it, so those 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 (22 lines × 2) src/prefect/_internal/states.py:152— src/prefect/_internal/states.py:152-173 | src/prefect/states.py:284-305 — before extracting anything, compare `src/prefect/_internal/states.py` and `src/prefect/states.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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 (22 lines × 2) src/prefect/client/base.py:471— src/prefect/client/base.py:471-492 | src/prefect/client/base.py:744-765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (22 lines × 2) src/prefect/deployments/runner.py:437— src/prefect/deployments/runner.py:437-458 | src/prefect/deployments/runner.py:543-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) src/prefect/server/api/flow_runs.py:361— src/prefect/server/api/flow_runs.py:361-382 | src/prefect/server/api/task_runs.py:152-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/api/flow_runs.py:361` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (22 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:84— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:84-105 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:98-119 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_05_26_135743_724e6dcc6b5d_add_block_schema_capabilities.py:25— src/prefect/server/database/_migrations/versions/postgresql/2022_05_26_135743_724e6dcc6b5d_add_block_schema_capabilities.py:25-46 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_19_165808_33439667aeea_add_block_schema_capabilities.py:27-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_26_135743_724e6dcc6b5d_add_block_schema_capabilities.py:25` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) src/prefect/server/events/actions.py:134— src/prefect/server/events/actions.py:134-155 | src/prefect/server/events/actions.py:229-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) src/prefect/task_engine.py:444— src/prefect/task_engine.py:444-465 | src/prefect/task_engine.py:1092-1113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) src/prefect/client/orchestration/_deployments/client.py:390— src/prefect/client/orchestration/_deployments/client.py:390-436 | src/prefect/client/orchestration/_work_pools/client.py:153-174 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 (22 lines × 2) src/prefect/client/orchestration/_deployments/client.py:1104— src/prefect/client/orchestration/_deployments/client.py:1104-1150 | src/prefect/client/orchestration/_work_pools/client.py:481-502 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) src/prefect/cli/work_pool.py:1163— src/prefect/cli/work_pool.py:1163-1168 | src/prefect/cli/work_queue.py:692-697 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) src/prefect/flow_engine.py:907— src/prefect/flow_engine.py:907-912 | src/prefect/task_engine.py:784-789 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) REDACTED:3692— REDACTED:3692-3697 | REDACTED:583-588 — 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:3692` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) src/prefect/server/database/query_components.py:759— src/prefect/server/database/query_components.py:759-764 | src/prefect/server/database/query_components.py:1047-1052 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:759` it begins part-way through the construct above it, so those 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/query_components.py:1044` calls `type_coerce` and `src/prefect/server/database/query_components.py:758` 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) src/prefect/settings/base.py:65— src/prefect/settings/base.py:65-70 | src/prefect/settings/base.py:77-82 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) src/prefect/events/schemas/events.py:264— src/prefect/events/schemas/events.py:264-269 | src/prefect/server/events/schemas/events.py:310-315 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) src/prefect/events/schemas/events.py:274— src/prefect/events/schemas/events.py:274-279 | src/prefect/server/events/schemas/events.py:320-325 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) src/prefect/events/schemas/events.py:284— src/prefect/events/schemas/events.py:284-289 | src/prefect/server/events/schemas/events.py:330-335 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) src/prefect/server/database/_migrations/versions/sqlite/2022_10_19_093542_fa319f214160_add_created_by.py:59— src/prefect/server/database/_migrations/versions/sqlite/2022_10_19_093542_fa319f214160_add_created_by.py:59-64 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_25_155120_a8e62d4c72cf_worker_status_field.py:42-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) src/prefect/concurrency/_events.py:45— src/prefect/concurrency/_events.py:45-50 | src/prefect/concurrency/v1/_events.py:45-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2023_03_15_123850_cf1159bd0d3c_add_artifact_description_col.py:20— src/prefect/server/database/_migrations/versions/sqlite/2023_03_15_123850_cf1159bd0d3c_add_artifact_description_col.py:20-25 | src/prefect/server/database/_migrations/versions/sqlite/2023_09_06_084729_c2d001b7dd06_.py:20-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (24 lines × 2) src/integrations/prefect-azure/prefect_azure/credentials.py:46— src/integrations/prefect-azure/prefect_azure/credentials.py:46-69 | src/integrations/prefect-gcp/prefect_gcp/credentials.py:47-70 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/integrations/prefect-azure/prefect_azure/credentials.py:71` calls `ValueError`, `format` and `src/integrations/prefect-gcp/prefect_gcp/credentials.py:72` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 2) src/integrations/prefect-docker/prefect_docker/worker.py:703— src/integrations/prefect-docker/prefect_docker/worker.py:703-726 | src/prefect/workers/process.py:234-257 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-docker/prefect_docker/worker.py:703` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) src/prefect/_internal/waiters.py:94— src/prefect/_internal/waiters.py:94-117 | src/prefect/task_runs.py:90-113 — before extracting anything, compare `src/prefect/_internal/waiters.py` and `src/prefect/task_runs.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (24 lines × 2) src/prefect/client/orchestration/__init__.py:1133— src/prefect/client/orchestration/__init__.py:1133-1156 | src/prefect/client/orchestration/__init__.py:1524-1547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) src/prefect/flow_engine.py:654— src/prefect/flow_engine.py:654-677 | src/prefect/flow_engine.py:1393-1416 — both copies are in the same file, so extract the 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 (24 lines × 2) src/prefect/flow_engine.py:1119— src/prefect/flow_engine.py:1119-1142 | src/prefect/flow_engine.py:1851-1874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:1119` it begins part-way through the construct above it, so those 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 `client` to `Optional[SyncPrefectClient] = None` in one and `Optional[PrefectClient] = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (24 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:77— src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:77-100 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:94-117 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (24 lines × 2) src/prefect/server/events/filters.py:632— src/prefect/server/events/filters.py:632-655 | src/prefect/server/schemas/filters.py:1517-1540 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (24 lines × 2) src/prefect/server/models/block_schemas.py:350— src/prefect/server/models/block_schemas.py:350-373 | src/prefect/server/models/block_schemas.py:801-824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/block_schemas.py:350` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) src/prefect/concurrency/_events.py:15— src/prefect/concurrency/_events.py:15-38 | src/prefect/concurrency/v1/_events.py:15-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/_freshness.py:210— src/integrations/prefect-dbt/prefect_dbt/core/_freshness.py:210-229 | src/integrations/prefect-dbt/prefect_dbt/core/_manifest.py:601-620 — 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 (20 lines × 2) src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:681— src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:681-700 | src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:756-775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:681` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) src/prefect/deployments/runner.py:1104— src/prefect/deployments/runner.py:1104-1123 | src/prefect/deployments/runner.py:1255-1274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/runner.py:1104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) src/prefect/events/schemas/labelling.py:28— src/prefect/events/schemas/labelling.py:28-47 | src/prefect/server/events/schemas/labelling.py:28-47 — before extracting anything, compare `src/prefect/events/schemas/labelling.py` and `src/prefect/server/events/schemas/labelling.py` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) REDACTED:2075— REDACTED:2075-2094 | REDACTED:2128-2147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:2075` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) src/prefect/locking/memory.py:80— src/prefect/locking/memory.py:80-99 | src/prefect/locking/memory.py:133-152 — both copies are in the same file, so extract the 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 (20 lines × 2) src/prefect/server/models/artifacts.py:209— src/prefect/server/models/artifacts.py:209-228 | src/prefect/server/models/artifacts.py:256-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/artifacts.py:209` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) src/prefect/server/orchestration/rules.py:296— src/prefect/server/orchestration/rules.py:296-315 | src/prefect/server/orchestration/rules.py:453-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) src/prefect/_internal/schemas/serializers.py:7— src/prefect/_internal/schemas/serializers.py:7-26 | src/prefect/server/utilities/schemas/serializers.py:11-30 — before extracting anything, compare `src/prefect/_internal/schemas/serializers.py` and `src/prefect/server/utilities/schemas/serializers.py` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/_internal/schemas/serializers.py:7` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) src/prefect/server/models/flow_runs.py:155— src/prefect/server/models/flow_runs.py:155-174 | src/prefect/server/models/task_runs.py:157-176 — 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.
Dead file (~1 LoC) ui-v2/src/api/collections/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/auth/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/automations/automations-delete-dialog/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/blocks/block-document-create-dialog/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/blocks/blocks-catalog-page/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/deployments/deployment-schedules/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/schemas/types/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/task-runs/task-run-details/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/work-pools/priority-management/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui/src/compositions/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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
Duplicated block (19 lines × 2) src/integrations/prefect-docker/prefect_docker/worker.py:733— src/integrations/prefect-docker/prefect_docker/worker.py:733-751 | src/prefect/workers/process.py:261-279 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `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 (19 lines × 2) src/prefect/cli/transfer/_migratable_resources/automations.py:163— src/prefect/cli/transfer/_migratable_resources/automations.py:163-181 | src/prefect/cli/transfer/_migratable_resources/automations.py:183-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:399— src/prefect/client/orchestration/_flow_runs/client.py:399-417 | src/prefect/client/orchestration/_flow_runs/client.py:927-945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_flow_runs/client.py:399` it begins part-way through the construct above it, so those 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 (19 lines × 2) src/prefect/states.py:495— src/prefect/states.py:495-513 | src/prefect/states.py:596-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) src/prefect/task_engine.py:643— src/prefect/task_engine.py:643-661 | src/prefect/task_engine.py:1302-1320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/task_engine.py:643` it begins part-way through the construct above it, so those 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 `transaction` to `Transaction` in one and `AsyncTransaction` 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 (19 lines × 2) src/prefect/transactions.py:431— src/prefect/transactions.py:431-449 | src/prefect/transactions.py:591-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/transactions.py:431` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) REDACTED:700— REDACTED:700-718 | REDACTED:830-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 (19 lines × 2) src/prefect/events/clients.py:958— src/prefect/events/clients.py:958-976 | src/prefect/logging/clients.py:369-388 — `src/prefect/events/clients.py` and `src/prefect/logging/clients.py` 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 43 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 (19 lines × 2) REDACTED:440— REDACTED:440-458 | src/prefect/tasks.py:659-677 — 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.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×8
Recursive walk over a caller-supplied document has no depth cap ui-v2/src/components/schemas/utilities/removePrefectKindValues.ts:46— `removePrefectKindValue` is exported and takes `value: unknown` from its caller, and it calls itself at line 46 (`removePrefectKindValue`) with a piece of `value` — and nowhere in `removePrefectKindValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `removePrefectKindValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/prefect/utilities/pydantic.py:90— `add_cloudpickle_reduction` is public and takes `kwargs: Any` from its caller, and it calls itself at line 90 (`add_cloudpickle_reduction`) with a piece of `kwargs` — and nowhere in `add_cloudpickle_reduction` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `add_cloudpickle_reduction` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/prefect/utilities/schema_tools/hydration.py:318— `null_handler` is public, takes a document from its caller (line 191) and hands it to `_hydrate`, which calls itself at line 318 (`_hydrate`) with a piece of `obj` (and at line 324) — and nowhere in `_hydrate` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_hydrate` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/prefect/logging/filters.py:54— `redact_substr` is public and takes `obj: Any` from its caller, and it calls itself at line 54 (`redact_substr`) with a piece of `obj` (and at line 65) — and nowhere in `redact_substr` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `redact_substr` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/prefect/client/schemas/actions.py:599— `serialize_parameters` is public, takes a document from its caller (line 586) and hands it to `convert_temporal`, which calls itself at line 599 (`convert_temporal`) with a piece of `v` (and at line 601) — and nowhere in `convert_temporal` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `convert_temporal` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/integrations/prefect-github/prefect_github/utils.py:63— `strip_kwargs` is public and takes `kwargs: Dict` from its caller, and it calls itself at line 63 (`strip_kwargs`) with a piece of `kwargs` — and nowhere in `strip_kwargs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `strip_kwargs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/integrations/prefect-databricks/prefect_databricks/rest.py:45— `serialize_model` is public and takes `obj: Any` from its caller, and it calls itself at line 45 (`serialize_model`) with a piece of `obj` (and at line 47) — and nowhere in `serialize_model` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `serialize_model` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap src/integrations/prefect-databricks/prefect_databricks/rest.py:71— `strip_kwargs` is public and takes `kwargs: Dict` from its caller, and it calls itself at line 71 (`strip_kwargs`) with a piece of `kwargs` — and nowhere in `strip_kwargs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `strip_kwargs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
TooManyMethods: WorkerCleanupQueue src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:144— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseWorker src/prefect/workers/base.py:630— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× 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: S3Bucket src/integrations/prefect-aws/prefect_aws/s3.py:810— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Task src/prefect/tasks.py:317— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PrefectDbtRunner src/integrations/prefect-dbt/prefect_dbt/core/runner.py:138— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: GcsBucket src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1068— 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: PrefectClient src/prefect/client/orchestration/__init__.py:281— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (23 lines × 2) src/prefect/client/orchestration/_artifacts/client.py:46— src/prefect/client/orchestration/_artifacts/client.py:46-68 | src/prefect/client/orchestration/_artifacts/client.py:149-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_artifacts/client.py:46` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) src/prefect/filesystems.py:129— src/prefect/filesystems.py:129-151 | src/prefect/filesystems.py:166-188 — both copies are in the same file, so extract the 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 (23 lines × 2) src/prefect/flow_engine.py:981— src/prefect/flow_engine.py:981-1003 | src/prefect/flow_engine.py:1715-1737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:981` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (23 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_08_06_145817_60e428f92a75_expand_deployment_schema_for_improved_ux.py:22— src/prefect/server/database/_migrations/versions/postgresql/2022_08_06_145817_60e428f92a75_expand_deployment_schema_for_improved_ux.py:22-44 | src/prefect/server/database/_migrations/versions/sqlite/2022_08_06_130009_296e2665785f_expand_deployment_schema_for_improved_ux.py:22-44 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_08_06_145817_60e428f92a75_expand_deployment_schema_for_improved_ux.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_08_06_130009_296e2665785f_expand_deployment_schema_for_improved_ux.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:22— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:22-44 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:25-47 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) src/prefect/server/database/orm_models.py:618— src/prefect/server/database/orm_models.py:618-640 | src/prefect/server/database/orm_models.py:759-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/orm_models.py:618` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_06_17_204409_d335ad57d5ba_add_block_schema_indexes.py:20— src/prefect/server/database/_migrations/versions/postgresql/2022_06_17_204409_d335ad57d5ba_add_block_schema_indexes.py:20-42 | src/prefect/server/database/_migrations/versions/sqlite/2022_06_17_204530_9e2a1c08c6f1_add_block_schema_indexes.py:20-42 — 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.
AC2 · Forms & labels· <Combobox> field component without a label · ×6
<Combobox> field component without a label ui-v2/src/components/automations/automations-wizard/trigger-step/event-resource-combobox/event-resource-combobox.tsx:212— 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.
<Combobox> field component without a label ui-v2/src/components/automations/automations-wizard/trigger-step/events-combobox/events-combobox.tsx:115— 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.
<Combobox> field component without a label ui-v2/src/components/automations/automations-wizard/trigger-step/work-pools-combobox.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.
<Combobox> field component without a label ui-v2/src/components/automations/automations-wizard/trigger-step/work-queues-combobox.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.
<Combobox> field component without a label ui-v2/src/components/blocks/block-types-multi-select/block-types-multi-select.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.
<Combobox> field component without a label ui-v2/src/components/work-pools/work-pool-multi-select/work-pool-multi-select.tsx:70— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
Change coupling: App.vue ↔ AppRouterView.vue ui/src/App.vue:1— `ui/src/App.vue` and `ui/src/pages/AppRouterView.vue` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `53a83ebc` Add basic auth UI (#16411); `0cf9cbf9` pulling in api (and other) patterns from cloud (#8564); `d1624b46` Chore: Bump orion and prefect design to 1.2.0 (#8163) (at that commit the files were still `orion-ui/src/App.vue` and `orion-ui/src/pages/AppRouterView.vue`) — run `git show` on any of them.
Change coupling: flagResponse.ts ↔ permissions.ts ui/src/types/flagResponse.ts:1— `ui/src/types/flagResponse.ts` and `ui/src/utilities/permissions.ts` change together 64% of the time (9 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `658b3735` Remove UI usage of deployment status & work queue status feature flag…; `48fc8e51` [UI] Fix missing work pools nav item (#13717); `1e1bfd27` Expose flow run job vars on page (#12206) — run `git show` on any of them.
Change coupling: services.py ↔ sync.py src/prefect/concurrency/services.py:1— `src/prefect/concurrency/services.py` and `src/prefect/concurrency/sync.py` change together 60% of the time (9 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `c2d440c3` Remove code past its marked deprecation date (#17632); `968c55bf` Concurrency limit UX enhancements: add `strict` mode (#15297); `a2680627` Workers enforce `Deployment.concurrency_limits` (#15022) — run `git show` on any of them.
Change coupling: filters.py ↔ sorting.py src/prefect/server/schemas/filters.py:1— `src/prefect/server/schemas/filters.py` and `src/prefect/server/schemas/sorting.py` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency 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 `aec08ffb` Fix compatibility with `fastapi==0.123.7` (#19626); `0746ef92` Remove many circular imports (#17003); `238c250e` `Variables` (#9088) — run `git show` on any of them.
Change coupling: event_persister.py ↔ triggers.py src/prefect/server/events/services/event_persister.py:1— `src/prefect/server/events/services/event_persister.py` and `src/prefect/server/events/services/triggers.py` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `884b1fd8` Mitigate memory leak in in-memory messaging system (#19136); `6b373052` Improve multi-server scaling for triggers (#18820); `084c399b` multi-server setup fixes pt1 (#18149) — run `git show` on any of them.
Change coupling: REDACTED ↔ core.py src/prefect/server/models/__init__.py:1— `src/prefect/server/models/__init__.py` and `src/prefect/server/schemas/core.py` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 `d49fdd0d` Add server default result storage config surface (#21532); `162faba6` Create `CsrfToken` model and utilities (#12289); `88f1f2e2` Add data model and methods for FlowRunInput (#11342) — run `git show` on any of them.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (4 members, 50+ identical tokens) src/integrations/prefect-aws/prefect_aws/s3.py:1021— src/integrations/prefect-aws/prefect_aws/s3.py:1021-1067 | src/integrations/prefect-aws/prefect_aws/s3.py:1076-1122 | src/integrations/prefect-azure/prefect_azure/blob_storage.py:645-685 | src/integrations/prefect-azure/prefect_azure/deployments/steps.py:80-157 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src/prefect/client/orchestration/_blocks_documents/client.py:106— src/prefect/client/orchestration/_blocks_documents/client.py:106-139 | src/prefect/client/orchestration/_blocks_documents/client.py:264-296 | src/prefect/client/orchestration/_blocks_types/client.py:166-200 | src/prefect/client/orchestration/_blocks_types/client.py:346-380 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src/prefect/flow_engine.py:1044— src/prefect/flow_engine.py:1044-1089 | src/prefect/flow_engine.py:1776-1821 | src/prefect/task_engine.py:485-519 | src/prefect/task_engine.py:1130-1164 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src/prefect/server/database/_migrations/versions/postgresql/2022_04_21_095519_14dc68cc5853_backfill_state_name.py:20— src/prefect/server/database/_migrations/versions/postgresql/2022_04_21_095519_14dc68cc5853_backfill_state_name.py:20-59 | src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:22-78 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_21_113057_db6bde582447_backfill_state_name.py:20-53 | src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:22-72 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:19— src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:19-73 | src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:77-131 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:20-90 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:94-148 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py:22— src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py:22-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:22-56 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_151028_88c2112b668f_update_deployments_to_include_more_.py:22-53 | src/prefect/server/database/_migrations/versions/sqlite/2024_09_16_162719_4ad4658cbefe_add_deployment_to_global_concurrency_.py:22-54 — 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.
Duplicated block (31 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:945— src/integrations/prefect-aws/prefect_aws/s3.py:945-975 | src/integrations/prefect-aws/prefect_aws/s3.py:982-1012 — both copies are in the same file, so extract the 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 (31 lines × 2) src/prefect/client/orchestration/__init__.py:522— src/prefect/client/orchestration/__init__.py:522-552 | src/prefect/client/orchestration/__init__.py:1775-1805 — both copies are in the same file, so extract the 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 (31 lines × 2) src/prefect/infrastructure/provisioners/coiled.py:141— src/prefect/infrastructure/provisioners/coiled.py:141-171 | src/prefect/infrastructure/provisioners/modal.py:150-180 — before extracting anything, compare `src/prefect/infrastructure/provisioners/coiled.py` and `src/prefect/infrastructure/provisioners/modal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/infrastructure/provisioners/coiled.py:141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_214717_4ff2f2bf81f4_adds_block_type_slug.py:42— src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_214717_4ff2f2bf81f4_adds_block_type_slug.py:42-72 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_142515_f335f9633eec_adds_block_type_slug.py:45-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (31 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:22— src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:22-52 | src/prefect/server/database/_migrations/versions/sqlite/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:22-52 — `src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py` 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 162 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 (31 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:40— src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:40-70 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:47-77 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:40` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Outbound HTTP without resilience src/integrations/prefect-dbt/prefect_dbt/cloud/_executor.py:99— `httpx.Client(` 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 src/prefect/_internal/version_checking.py:151— `httpx.AsyncClient(` 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 src/prefect/blocks/notifications.py:1022— `httpx.AsyncClient(` 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 src/prefect/blocks/notifications.py:1040— `httpx.Client(` 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 src/prefect/server/api/collections.py:55— `httpx.AsyncClient(` 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 src/prefect/server/services/telemetry.py:103— `httpx.AsyncClient(` 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.
Duplicated block (39 lines × 2) src/prefect/_internal/states.py:80— src/prefect/_internal/states.py:80-118 | src/prefect/states.py:214-252 — before extracting anything, compare `src/prefect/_internal/states.py` and `src/prefect/states.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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 (39 lines × 2) src/prefect/infrastructure/provisioners/cloud_run.py:314— src/prefect/infrastructure/provisioners/cloud_run.py:314-352 | src/prefect/infrastructure/provisioners/container_instance.py:898-936 — 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 (39 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py:88— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py:88-126 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c26_migrate_artifact_data.py:90-128 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c26_migrate_artifact_data.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (39 lines × 2) REDACTED:24— REDACTED:24-62 | REDACTED:26-64 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (39 lines × 2) src/prefect/server/events/filters.py:704— src/prefect/server/events/filters.py:704-742 | src/prefect/server/schemas/filters.py:1557-1595 — 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 (37 lines × 2) src/integrations/prefect-aws/infra/worker/events_stack.py:103— src/integrations/prefect-aws/infra/worker/events_stack.py:103-139 | src/integrations/prefect-aws/infra/worker/service_stack.py:536-572 — 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 (37 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:1021— src/integrations/prefect-aws/prefect_aws/s3.py:1021-1057 | src/integrations/prefect-aws/prefect_aws/s3.py:1076-1112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-aws/prefect_aws/s3.py:1021` it does not close everything it opens, so those 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 (37 lines × 2) src/prefect/flow_engine.py:941— src/prefect/flow_engine.py:941-977 | src/prefect/flow_engine.py:1675-1711 — both copies are in the same file, so extract the 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 (37 lines × 2) src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:66— src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:66-102 | src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py:63-99 — before extracting anything, compare `src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py` and `src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 189 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (37 lines × 2) src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:239— src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:239-275 | src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py:304-340 — before extracting anything, compare `src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py` and `src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 189 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 2) src/prefect/cli/automation.py:196— src/prefect/cli/automation.py:196-227 | src/prefect/cli/automation.py:256-287 — both copies are in the same file, so extract the 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 (32 lines × 2) src/prefect/client/base.py:240— src/prefect/client/base.py:240-271 | src/prefect/client/base.py:513-544 — both copies are in the same file, so extract the 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 (32 lines × 2) src/prefect/server/api/deployments.py:958— src/prefect/server/api/deployments.py:958-989 | src/prefect/server/api/deployments.py:1165-1196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/api/deployments.py:958` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/api/deployments.py:991` calls `now` and `src/prefect/server/api/deployments.py:1198` 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 (32 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2022_05_30_100855_d76326ed0d06_rename_run_alerts_to_run_notifications.py:20— src/prefect/server/database/_migrations/versions/sqlite/2022_05_30_100855_d76326ed0d06_rename_run_alerts_to_run_notifications.py:20-51 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_30_100855_d76326ed0d06_rename_run_alerts_to_run_notifications.py:56-87 — both copies are in the same file, so extract the 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 (32 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2026_07_20_000000_50737cdaee36_add_event_resources_event_id_index.py:30— src/prefect/server/database/_migrations/versions/postgresql/2026_07_20_000000_50737cdaee36_add_event_resources_event_id_index.py:30-61 | src/prefect/server/database/_migrations/versions/postgresql/2026_08_20_000000_9e9dadc36797_add_flow_run_deployment_id_index.py:32-63 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (21 lines × 2) src/prefect/_internal/waiters.py:120— src/prefect/_internal/waiters.py:120-140 | src/prefect/task_runs.py:116-136 — before extracting anything, compare `src/prefect/_internal/waiters.py` and `src/prefect/task_runs.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) src/prefect/cli/automation.py:457— src/prefect/cli/automation.py:457-477 | src/prefect/cli/automation.py:571-591 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) src/prefect/cli/flow_run.py:184— src/prefect/cli/flow_run.py:184-204 | src/prefect/cli/task_run.py:67-87 — before extracting anything, compare `src/prefect/cli/flow_run.py` and `src/prefect/cli/task_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) src/prefect/flow_runs.py:249— src/prefect/flow_runs.py:249-269 | src/prefect/flow_runs.py:406-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.
Duplicated block (21 lines × 2) src/prefect/results.py:573— src/prefect/results.py:573-593 | src/prefect/results.py:627-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/results.py:573` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) src/prefect/cli/block.py:345— src/prefect/cli/block.py:345-356 | src/prefect/cli/block.py:447-459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/block.py:447` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) src/prefect/client/orchestration/_concurrency_limits/client.py:367— src/prefect/client/orchestration/_concurrency_limits/client.py:367-378 | src/prefect/client/orchestration/_concurrency_limits/client.py:828-840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_concurrency_limits/client.py:367` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–13 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:22— src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:22-33 | src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py:22-34 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:65— src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:65-76 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:63-75 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:65` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) src/prefect/task_engine.py:1003— src/prefect/task_engine.py:1003-1015 | src/prefect/task_engine.py:1669-1680 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1738— src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1738-1742 | src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:2215-2219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) src/prefect/events/schemas/events.py:168— src/prefect/events/schemas/events.py:168-172 | src/prefect/server/events/schemas/events.py:166-170 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) src/prefect/events/schemas/events.py:248— src/prefect/events/schemas/events.py:248-252 | src/prefect/server/events/schemas/events.py:294-298 — before extracting anything, compare `src/prefect/events/schemas/events.py` and `src/prefect/server/events/schemas/events.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:105— src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:105-109 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:119-123 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 80 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) benches/bench_block_schemas.py:176— benches/bench_block_schemas.py:176-180 | REDACTED:334-338 — 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 `benches/bench_block_schemas.py: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.
Low cohesion: Settings (LCOM4 5) src/prefect/settings/models/root.py:94— Settings'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: DockerWorker (LCOM4 4) src/integrations/prefect-docker/prefect_docker/worker.py:497— DockerWorker'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: BaseQueryComponents (LCOM4 4) src/prefect/server/database/query_components.py:67— BaseQueryComponents'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: EventTrigger (LCOM4 4) src/prefect/server/events/schemas/automations.py:293— EventTrigger'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: Task (LCOM4 4) src/prefect/tasks.py:317— Task'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.
Duplicated block (47 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:132— src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:132-178 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:146-192 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (47 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:111— src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:111-157 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:111-157 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 256 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (47 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:272— src/prefect/client/orchestration/_flow_runs/client.py:272-319 | src/prefect/client/orchestration/_flows/client.py:119-165 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (47 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:800— src/prefect/client/orchestration/_flow_runs/client.py:800-847 | src/prefect/client/orchestration/_flows/client.py:279-325 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (26 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:2317— src/integrations/prefect-aws/prefect_aws/s3.py:2317-2342 | src/integrations/prefect-aws/prefect_aws/s3.py:2359-2384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) src/prefect/client/schemas/objects.py:1476— src/prefect/client/schemas/objects.py:1476-1501 | src/prefect/server/schemas/core.py:1045-1070 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `last_polled` to `datetime.datetime | None = None` in one and `Optional[DateTime] = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (26 lines × 2) REDACTED:1953— REDACTED:1953-1978 | REDACTED:2016-2041 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1953` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) src/prefect/task_engine.py:485— src/prefect/task_engine.py:485-510 | src/prefect/task_engine.py:1130-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.
Duplicated block (25 lines × 2) src/integrations/prefect-databricks/prefect_databricks/flows.py:204— src/integrations/prefect-databricks/prefect_databricks/flows.py:204-228 | src/integrations/prefect-databricks/prefect_databricks/flows.py:548-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 `src/integrations/prefect-databricks/prefect_databricks/flows.py:204` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 2) src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1160— src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1160-1184 | src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1213-1237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) REDACTED:861— REDACTED:861-885 | REDACTED:1006-1030 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:861` it begins part-way through the construct above it, so those 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 (25 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:34— src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:34-58 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:43-67 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:34` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:70` calls `batch_alter_table` and `src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:61` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–21 lines × 2) src/integrations/prefect-databricks/prefect_databricks/flows.py:183— src/integrations/prefect-databricks/prefect_databricks/flows.py:183-201 | src/integrations/prefect-databricks/prefect_databricks/flows.py:526-546 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-databricks/prefect_databricks/flows.py:183` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–21 lines × 2) src/prefect/locking/memory.py:106— src/prefect/locking/memory.py:106-124 | src/prefect/locking/memory.py:159-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/locking/memory.py:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19–21 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:143— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:143-161 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:199-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py: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. 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 (19–21 lines × 2) src/prefect/server/models/work_queues.py:387— src/prefect/server/models/work_queues.py:387-407 | src/prefect/server/models/workers.py:792-810 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/work_queues.py:387` it begins part-way through the construct above it, so those 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–15 lines × 2) src/prefect/cli/flow_run.py:488— src/prefect/cli/flow_run.py:488-501 | src/prefect/cli/flow_run.py:542-556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/flow_run.py:542` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) src/prefect/client/orchestration/_blocks_documents/client.py:69— src/prefect/client/orchestration/_blocks_documents/client.py:69-83 | src/prefect/client/orchestration/_blocks_documents/client.py:228-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_documents/client.py: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–15 lines × 2) src/prefect/client/orchestration/_blocks_types/client.py:106— src/prefect/client/orchestration/_blocks_types/client.py:106-120 | src/prefect/client/orchestration/_blocks_types/client.py:287-300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_types/client.py:287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:40— src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:40-54 | src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:66-79 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:40` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) REDACTED:3498— REDACTED:3498-3510 | REDACTED:3519-3532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:3498` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–14 lines × 2) src/prefect/server/api/automations.py:58— src/prefect/server/api/automations.py:58-71 | src/prefect/server/api/automations.py:110-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/api/automations.py: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 (13–14 lines × 2) src/prefect/server/models/deployments.py:538— src/prefect/server/models/deployments.py:538-550 | src/prefect/server/models/flows.py:196-209 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/deployments.py:538` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:330— src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:330-342 | src/prefect/testing/standard_test_suites/worker_cleanup_queue.py:371-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/testing/standard_test_suites/worker_cleanup_queue.py: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 (10 lines × 4) src/integrations/prefect-aws/prefect_aws/s3.py:1050— src/integrations/prefect-aws/prefect_aws/s3.py:1050-1059 | src/integrations/prefect-aws/prefect_aws/s3.py:1105-1114 | src/integrations/prefect-azure/prefect_azure/blob_storage.py:671-680 | src/integrations/prefect-azure/prefect_azure/deployments/steps.py:142-151 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. 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 × 4) src/prefect/client/orchestration/_blocks_documents/client.py:130— src/prefect/client/orchestration/_blocks_documents/client.py:130-139 | src/prefect/client/orchestration/_blocks_documents/client.py:287-296 | src/prefect/client/orchestration/_blocks_types/client.py:191-200 | src/prefect/client/orchestration/_blocks_types/client.py:371-380 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_documents/client.py:130` it begins part-way through the construct above it, so those 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 (10 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:106— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:106-117 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:116-127 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:338-349 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:79-88 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:78` calls `PrimaryKeyConstraint`, `f` and `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:106` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 4) src/prefect/server/api/block_schemas.py:126— src/prefect/server/api/block_schemas.py:126-135 | src/prefect/server/api/block_types.py:51-60 | src/prefect/server/api/block_types.py:68-77 | src/prefect/server/api/task_runs.py:182-191 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. 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.
Dead file (~2 LoC) ui-v2/src/components/schemas/utilities/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/ui/date-range-picker/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui-v2/src/components/work-pools/poll-status/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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) ui/src/utilities/testing.ts— no import path from any entry point (29 application, 20 tooling, 678 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
X2 · Cancellation propagation· Async function without AbortSignal · ×4
Async function without AbortSignal: validateCredentials ui-v2/src/auth/auth-provider.tsx:13— `validateCredentials` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: checkApiHealth ui-v2/src/auth/auth-provider.tsx:29— `checkApiHealth` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: fetchToken ui-v2/src/api/csrf.ts:73— `fetchToken` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: load ui-v2/src/api/ui-settings.ts:73— `load` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Duplicated block (44 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:238— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:238-281 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:286-329 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (44 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:24— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:24-67 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:26-69 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:24` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:73` calls `execute` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:71` 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 (44 lines × 2) src/prefect/task_engine.py:184— src/prefect/task_engine.py:184-227 | src/prefect/tasks.py:1082-1125 — 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 (41–42 lines × 2) src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:2365— src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:2365-2406 | src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:2424-2464 — both copies are in the same file, so extract the 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 (41–42 lines × 2) src/prefect/client/base.py:334— src/prefect/client/base.py:334-374 | src/prefect/client/base.py:606-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/base.py:334` it begins part-way through the construct above it, so those 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 (41–42 lines × 2) src/prefect/deployments/runner.py:1378— src/prefect/deployments/runner.py:1378-1419 | src/prefect/deployments/runner.py:1518-1558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/runner.py:1378` it begins part-way through the construct above it, so those 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 (38 lines × 2) src/integrations/prefect-aws/infra/worker/events_stack.py:61— src/integrations/prefect-aws/infra/worker/events_stack.py:61-98 | src/integrations/prefect-aws/infra/worker/service_stack.py:494-531 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 (38 lines × 2) src/prefect/filesystems.py:525— src/prefect/filesystems.py:525-562 | src/prefect/filesystems.py:581-618 — both copies are in the same file, so extract the 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 (38 lines × 2) src/prefect/flow_engine.py:1044— src/prefect/flow_engine.py:1044-1081 | src/prefect/flow_engine.py:1776-1813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) src/prefect/results.py:1076— src/prefect/results.py:1076-1108 | src/prefect/results.py:1140-1172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:39— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:39-71 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py:43-75 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py:41` calls `execute` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:38` 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 (33 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py:23-55 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_21_145916_c8ff35f94028_add_block_spec_id_to_blocks.py:23-55 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_21_150017_b68b3cad6b8a_add_block_spec_id_to_blocks.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_02_21_145916_c8ff35f94028_add_block_spec_id_to_blocks.py` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (28 lines × 2) src/prefect/_internal/engine.py:121— src/prefect/_internal/engine.py:121-148 | src/prefect/runner/_workspace_runtime_bootstrap.py:121-148 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/runner/_workspace_runtime_bootstrap.py:150` calls `getattr` and `src/prefect/_internal/engine.py:150` 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 (28 lines × 2) src/prefect/_internal/states.py:282— src/prefect/_internal/states.py:282-309 | src/prefect/states.py:412-439 — before extracting anything, compare `src/prefect/_internal/states.py` and `src/prefect/states.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 2) src/prefect/task_engine.py:702— src/prefect/task_engine.py:702-729 | src/prefect/task_engine.py:1363-1390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–24 lines × 2) src/prefect/_internal/states.py:127— src/prefect/_internal/states.py:127-150 | src/prefect/states.py:261-282 — before extracting anything, compare `src/prefect/_internal/states.py` and `src/prefect/states.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22–24 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:95— src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:95-116 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:94-117 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–24 lines × 2) src/prefect/server/events/triggers.py:1112— src/prefect/server/events/triggers.py:1112-1133 | src/prefect/server/events/triggers.py:1180-1203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/events/triggers.py:1112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) src/prefect/_internal/concurrency/calls.py:418— src/prefect/_internal/concurrency/calls.py:418-433 | src/prefect/_internal/concurrency/calls.py:452-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) src/prefect/task_engine.py:734— src/prefect/task_engine.py:734-750 | src/prefect/task_engine.py:1396-1411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–17 lines × 2) src/prefect/task_engine.py:1817— src/prefect/task_engine.py:1817-1833 | src/prefect/task_engine.py:1878-1893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/task_engine.py:1878` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:1046— src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:1046-1058 | src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:1060-1072 | src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:1074-1086 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:1046` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) src/integrations/prefect-docker/prefect_docker/worker.py:737— src/integrations/prefect-docker/prefect_docker/worker.py:737-749 | src/prefect/workers/base.py:1158-1170 | src/prefect/workers/process.py:265-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-docker/prefect_docker/worker.py:737` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2022_10_20_101423_3ced59d8806b_add_last_polled.py:22— src/prefect/server/database/_migrations/versions/postgresql/2022_10_20_101423_3ced59d8806b_add_last_polled.py:22-34 | src/prefect/server/database/_migrations/versions/postgresql/2023_10_12_224511_bfe653bbf62e_add_last_polled_to_deployment.py:22-34 | src/prefect/server/database/_migrations/versions/sqlite/2022_10_20_101423_3ced59d8806b_add_last_polled.py:22-34 — `src/prefect/server/database/_migrations/versions/postgresql/2022_10_20_101423_3ced59d8806b_add_last_polled.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_10_20_101423_3ced59d8806b_add_last_polled.py` 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 1 separate duplicated blocks between them, totalling at least 13 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 (8 lines × 3) src/integrations/prefect-azure/prefect_azure/repository.py:163— src/integrations/prefect-azure/prefect_azure/repository.py:163-170 | src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py:200-207 | src/integrations/prefect-gitlab/prefect_gitlab/repositories.py:178-185 — before extracting anything, compare `src/integrations/prefect-bitbucket/prefect_bitbucket/repository.py` and `src/integrations/prefect-gitlab/prefect_gitlab/repositories.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (8 lines × 3) src/prefect/cli/flow.py:71— src/prefect/cli/flow.py:71-78 | src/prefect/cli/flow_run.py:313-320 | src/prefect/cli/task_run.py:182-189 — before extracting anything, compare `src/prefect/cli/flow_run.py` and `src/prefect/cli/task_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/cli/flow_run.py:311` calls `exit_with_success` and `src/prefect/cli/flow.py:69` 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) src/prefect/server/schemas/filters.py:764— src/prefect/server/schemas/filters.py:764-771 | src/prefect/server/schemas/filters.py:1099-1106 | src/prefect/server/schemas/filters.py:2563-2570 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
R10 · Code Duplication· Duplicated block with local edits (100 matched lines × 2 locations) · ×3
Duplicated block with local edits (100 matched lines × 2 locations) ui-v2/src/components/deployments/data-table/index.tsx:186— ui-v2/src/components/deployments/data-table/index.tsx:186 · ui-v2/src/components/flows/data-table.tsx:80 — the two spans are one implementation copied and then locally edited — 518 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 (100 matched lines × 2 locations) ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx:35— ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx:35 · ui-v2/src/components/task-runs/task-run-state-filter.tsx:32 — the two spans are one implementation copied and then locally edited — 543 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 (100 matched lines × 2 locations) ui-v2/src/components/ui/dialog.tsx:7— ui-v2/src/components/ui/dialog.tsx:7 · ui-v2/src/components/ui/sheet.tsx:7 — the two spans are one implementation copied and then locally edited — 465 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 (~0 LoC) ui-v2/src/components/blocks/block-document-details-page/index.ts— no import path from any entry point (29 application, 20 tooling, 678 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 (~0 LoC) ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/flow-runs-filters.tsx— no import path from any entry point (29 application, 20 tooling, 678 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 (~0 LoC) ui-v2/src/components/work-pools/work-pool-card/components/constants.ts— no import path from any entry point (29 application, 20 tooling, 678 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
AC2 · Forms & labels· <Select> field component without a label · ×2
<Select> field component without a label ui-v2/src/components/deployments/deployment-form/limit-collision-strategy-select.tsx:29— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:641— 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.
Focus outline removed inline ui-v2/src/components/schemas/schema-form-input-array-item.tsx:88— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline ui-v2/src/components/ui/textarea.tsx:7— <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).
AXI1 · Runtime container hardening· Container process runs as root · ×2
Container process runs as root: proxy-test-forward_proxy-1 — 'proxy-test-forward_proxy-1' (ubuntu/squid) 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 REDACTED reader. Advisory evidence for CRA Annex I (2)(b).
Container process runs as root: proxy-test-server-1 — 'proxy-test-server-1' (proxy-test-server) 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 REDACTED reader. Advisory evidence for CRA Annex I (2)(b).
templating.apply_values (cyclomatic 26) src/prefect/utilities/templating/__init__.py:123— templating.apply_values 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. This shape REPEATS in the file: one other method here (templating.apply_values) 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.
templating.apply_values (cyclomatic 26) src/prefect/utilities/templating/__init__.py:132— templating.apply_values 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. This shape REPEATS in the file: one other method here (templating.apply_values) 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.
templating.apply_values (cognitive 55) src/prefect/utilities/templating/__init__.py:123— templating.apply_values has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 3 (7 pts), boolean chains 3 (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. This shape REPEATS in the file: one other method here (templating.apply_values) 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.
templating.apply_values (cognitive 55) src/prefect/utilities/templating/__init__.py:132— templating.apply_values has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 3 (7 pts), boolean chains 3 (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. This shape REPEATS in the file: one other method here (templating.apply_values) 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.
D4 · Code Duplication· Near-duplicate member family (4 members, 23 shared lines) · ×2
Near-duplicate member family (4 members, 23 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38-812 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:23-56 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-854 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py:23-63 — These 4 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Near-duplicate member family (4 members, 23 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:22— src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:22-54 | src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:24-87 | src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py:22-57 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:24-87 — These 4 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:690— src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:690-701 | src/prefect/client/orchestration/_deployments/client.py:562-602 | src/prefect/client/orchestration/_deployments/client.py:1276-1316 | src/prefect/client/orchestration/_flow_runs/client.py:140-184 | src/prefect/client/orchestration/_flow_runs/client.py:667-710 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) src/prefect/server/models/artifacts.py:300— src/prefect/server/models/artifacts.py:300-331 | src/prefect/server/models/artifacts.py:347-377 | src/prefect/server/models/deployments.py:587-625 | src/prefect/server/models/flow_runs.py:296-342 | src/prefect/server/models/flows.py:227-263 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (66 lines × 2) src/prefect/deployments/runner.py:1733— src/prefect/deployments/runner.py:1733-1798 | src/prefect/deployments/runner.py:1974-2039 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/runner.py:1733` it begins part-way through the construct above it, so those 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 (66 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:22— src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:22-87 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:22-87 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 256 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (61 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:366— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:366-426 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:421-481 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:366` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (61 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_06_152528_4cdc2ba709a4_migrates_block_schemas_with_new_secrets_.py:85— src/prefect/server/database/_migrations/versions/postgresql/2022_07_06_152528_4cdc2ba709a4_migrates_block_schemas_with_new_secrets_.py:85-145 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_06_142824_e2dae764a603_migrates_block_schemas_with_new_secrets_.py:84-144 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_07_06_152528_4cdc2ba709a4_migrates_block_schemas_with_new_secrets_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_07_06_142824_e2dae764a603_migrates_block_schemas_with_new_secrets_.py` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (60 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py:23— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py:23-82 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c26_migrate_artifact_data.py:25-84 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c26_migrate_artifact_data.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c26_migrate_artifact_data.py:20` calls `execute` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py:19` 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 (60 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:66— src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:66-125 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:65-124 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 202 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 (58 lines × 2) src/integrations/prefect-gcp/prefect_gcp/bigquery.py:824— src/integrations/prefect-gcp/prefect_gcp/bigquery.py:824-881 | src/integrations/prefect-gcp/prefect_gcp/bigquery.py:922-979 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: `GcpCredentials` names `prefect_gcp` in one and `prefect_gcp.credentials` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (58 lines × 2) src/prefect/deployments/runner.py:1309— src/prefect/deployments/runner.py:1309-1366 | src/prefect/deployments/runner.py:1450-1507 — both copies are in the same file, so extract the 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 (55 lines × 2) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:508— src/integrations/prefect-aws/prefect_aws/observers/ecs.py:508-562 | src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1202-1256 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `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 (55 lines × 2) src/prefect/client/orchestration/_deployments/client.py:668— src/prefect/client/orchestration/_deployments/client.py:668-722 | src/prefect/client/orchestration/_deployments/client.py:1382-1436 — both copies are in the same file, so extract the 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: `FlowRun` names `prefect.client.schemas` in one and `prefect.client.schemas.objects` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (48 lines × 2) src/prefect/_internal/states.py:233— src/prefect/_internal/states.py:233-280 | src/prefect/states.py:363-410 — before extracting anything, compare `src/prefect/_internal/states.py` and `src/prefect/states.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 210 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (48 lines × 2) src/prefect/tasks.py:935— src/prefect/tasks.py:935-982 | src/prefect/tasks.py:1040-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/tasks.py:985` calls `create_task_run` and `src/prefect/tasks.py:1089` 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 (46 lines × 2) src/prefect/client/orchestration/__init__.py:841— src/prefect/client/orchestration/__init__.py:841-886 | src/prefect/client/orchestration/__init__.py:1579-1624 — both copies are in the same file, so extract the 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 (46 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:34— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:34-79 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:43-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:34` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (41 lines × 2) src/prefect/deployments/runner.py:463— src/prefect/deployments/runner.py:463-503 | src/prefect/deployments/runner.py:569-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41 lines × 2) src/prefect/server/events/filters.py:432— src/prefect/server/events/filters.py:432-472 | src/prefect/server/events/filters.py:538-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/events/filters.py:432` it begins part-way through the construct above it, so those 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 (36 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:1440— src/integrations/prefect-aws/prefect_aws/s3.py:1440-1475 | src/integrations/prefect-aws/prefect_aws/s3.py:1496-1531 — both copies are in the same file, so extract the 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 (36 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:53— src/prefect/client/orchestration/_flow_runs/client.py:53-88 | src/prefect/client/orchestration/_flow_runs/client.py:580-615 — both copies are in the same file, so extract the 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 (35 lines × 2) src/prefect/client/base.py:395— src/prefect/client/base.py:395-429 | src/prefect/client/base.py:668-702 — both copies are in the same file, so extract the 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 (35 lines × 2) src/prefect/client/orchestration/__init__.py:331— src/prefect/client/orchestration/__init__.py:331-365 | src/prefect/client/orchestration/__init__.py:1278-1312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/client/orchestration/__init__.py:366` calls `AsyncExitStack` and `src/prefect/client/orchestration/__init__.py:1313` 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 (32 lines × 3) src/prefect/runtime/deployment.py:60— src/prefect/runtime/deployment.py:60-91 | src/prefect/runtime/flow_run.py:87-118 | src/prefect/runtime/task_run.py:51-82 — 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 (32 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:100— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:100-131 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:110-141 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:332-363 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29–30 lines × 2) src/prefect/server/database/query_components.py:626— src/prefect/server/database/query_components.py:626-655 | src/prefect/server/database/query_components.py:928-956 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:626` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29–30 lines × 2) src/prefect/transactions.py:671— src/prefect/transactions.py:671-699 | src/prefect/transactions.py:723-752 — both copies are in the same file, so extract the 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 (29 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:90— src/prefect/client/orchestration/_flow_runs/client.py:90-118 | src/prefect/client/orchestration/_flow_runs/client.py:617-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 `src/prefect/client/orchestration/_flow_runs/client.py:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) src/prefect/server/models/flow_runs.py:647— src/prefect/server/models/flow_runs.py:647-675 | src/prefect/server/models/task_runs.py:539-567 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/flow_runs.py:647` it begins part-way through the construct above it, so those 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 (27–29 lines × 2) src/prefect/server/database/query_components.py:657— src/prefect/server/database/query_components.py:657-685 | src/prefect/server/database/query_components.py:958-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:657` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–29 lines × 2) src/prefect/utilities/engine/__init__.py:581— src/prefect/utilities/engine/__init__.py:581-609 | src/prefect/utilities/engine/__init__.py:677-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (27–28 lines × 2) src/prefect/flow_engine.py:715— src/prefect/flow_engine.py:715-742 | src/prefect/flow_engine.py:1455-1481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:1455` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–28 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:37— src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:37-64 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:288-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–28 lines × 2) src/prefect/flow_runs.py:277— src/prefect/flow_runs.py:277-304 | src/prefect/flow_runs.py:588-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_runs.py:277` it begins part-way through the construct above it, so those 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 (22–28 lines × 2) src/prefect/flow_runs.py:434— src/prefect/flow_runs.py:434-461 | src/prefect/flow_runs.py:717-738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_runs.py:434` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (24–27 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/_executor.py:624— src/integrations/prefect-dbt/prefect_dbt/core/_executor.py:624-650 | src/integrations/prefect-dbt/prefect_dbt/core/_executor.py:668-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-dbt/prefect_dbt/core/_executor.py:624` it begins part-way through the construct above it, so those exact lines 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–27 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:153— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:153-176 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:154-180 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:153` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) src/integrations/prefect-redis/prefect_redis/ordering.py:249— src/integrations/prefect-redis/prefect_redis/ordering.py:249-275 | src/prefect/server/events/ordering/memory.py:213-239 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (27 lines × 2) src/prefect/deployments/runner.py:645— src/prefect/deployments/runner.py:645-671 | src/prefect/deployments/runner.py:703-729 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–26 lines × 2) src/prefect/_internal/buildx.py:111— src/prefect/_internal/buildx.py:111-135 | src/prefect/utilities/dockerutils.py:200-225 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/_internal/buildx.py:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25–26 lines × 2) REDACTED:412— REDACTED:412-437 | REDACTED:441-465 — both copies are in the same file, so extract the 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 (23–24 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:24— src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:24-46 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:24-47 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py` and `src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:24` it does not close everything it opens, so those 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 (23–24 lines × 2) src/prefect/server/events/actions.py:1552— src/prefect/server/events/actions.py:1552-1574 | src/prefect/server/events/actions.py:1670-1693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) src/prefect/flow_engine.py:1268— src/prefect/flow_engine.py:1268-1287 | src/prefect/flow_engine.py:2001-2019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) src/prefect/server/models/events.py:466— src/prefect/server/models/events.py:466-485 | src/prefect/server/models/events.py:551-569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/events.py:466` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–19 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:2244— src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:2244-2261 | src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:2273-2291 — both copies are in the same file, so extract the 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–19 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:25— src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:25-42 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:246-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:25` it does not close everything it opens, so those exact lines 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–18 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:35— src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:35-49 | src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:93-107 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:40-57 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:110-124 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:32` calls `drop_constraint`, `batch_alter_table` and `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:93` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–18 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:20— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:20-34 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:58-75 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:22-36 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py:62-79 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py: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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:20` calls `execute` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:19` 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 (16–18 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:138— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:138-153 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:159-176 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (16–18 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:37— src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:37-52 | src/prefect/server/database/_migrations/versions/postgresql/2024_12_04_165333_5d03c01be85e_sync_orm_models_and_migrations.py:69-86 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_07_21_133134_e085c9cbf8ce_remove_flow_runners.py:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/runner.py:872— src/integrations/prefect-dbt/prefect_dbt/core/runner.py:872-886 | src/integrations/prefect-dbt/prefect_dbt/core/runner.py:1131-1147 — both copies are in the same file, so extract the 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 (15–17 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:28— src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:28-42 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:27-43 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:28` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 3) src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:63— src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:63-76 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:192-205 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:263-278 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:63` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 3) src/prefect/server/events/actions.py:797— src/prefect/server/events/actions.py:797-812 | src/prefect/server/events/actions.py:1562-1575 | src/prefect/server/events/actions.py:1679-1694 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–16 lines × 2) src/prefect/deployments/runner.py:1507— src/prefect/deployments/runner.py:1507-1520 | REDACTED:1432-1447 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14–16 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:648— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:648-661 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:759-774 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:648` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–15 lines × 2) src/prefect/cli/work_queue.py:216— src/prefect/cli/work_queue.py:216-230 | src/prefect/cli/work_queue.py:796-808 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/work_queue.py:216` it begins part-way through the construct above it, so those exact lines 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–15 lines × 2) src/prefect/client/orchestration/_deployments/client.py:169— src/prefect/client/orchestration/_deployments/client.py:169-181 | src/prefect/client/orchestration/_deployments/client.py:876-890 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–14 lines × 3) src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:88— src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:88-99 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:198-210 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py:68-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–14 lines × 3) src/prefect/server/database/query_components.py:717— src/prefect/server/database/query_components.py:717-730 | src/prefect/server/database/query_components.py:748-759 | src/prefect/server/database/query_components.py:1009-1022 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:717` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/query_components.py:1023` calls `distinct` and `src/prefect/server/database/query_components.py:731` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–13 lines × 5) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:84— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:84-94 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:189-199 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:98-108 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:80-92 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:202-212 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` and `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:81` calls `Column`, `String` and `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:186` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–13 lines × 5) src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:61— src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:61-71 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:135-145 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:190-200 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:261-273 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:63-73 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) src/prefect/futures.py:646— src/prefect/futures.py:646-656 | src/prefect/futures.py:749-760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) src/prefect/locking/filesystem.py:113— src/prefect/locking/filesystem.py:113-124 | src/prefect/locking/filesystem.py:163-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 × 4) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:95— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:95-105 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:96-106 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:98-108 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:95-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:213— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:213-223 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:25-36 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:216-226 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py:24-35 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:213` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–11 lines × 2) src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1188— src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1188-1198 | src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1241-1248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1188` it begins part-way through the construct above it, so those 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–11 lines × 2) src/prefect/bundles/__init__.py:818— src/prefect/bundles/__init__.py:818-825 | src/prefect/bundles/__init__.py:883-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/bundles/__init__.py:883` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) src/prefect/server/__init__.py:13— src/prefect/server/__init__.py:13-22 | src/prefect/server/api/__init__.py:79-88 | src/prefect/server/schemas/__init__.py:37-46 — before extracting anything, compare `src/prefect/server/__init__.py` and `src/prefect/server/api/__init__.py` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `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 (10 lines × 3) src/prefect/server/events/services/actions.py:47— src/prefect/server/events/services/actions.py:47-56 | src/prefect/server/events/services/event_logger.py:67-76 | src/prefect/server/events/services/triggers.py:58-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (7 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:268— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:268-274 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:374-382 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:316-322 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:429-437 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_03_10_102713_2e7e1428ffce_index_flow_created.py:19— src/prefect/server/database/_migrations/versions/postgresql/2022_03_10_102713_2e7e1428ffce_index_flow_created.py:19-25 | src/prefect/server/database/_migrations/versions/postgresql/2022_10_14_172612_ad4b1b4d1e9d_index_deployment_created.py:19-25 | src/prefect/server/database/_migrations/versions/sqlite/2022_03_10_102500_71a57ec351d1_index_flow_created.py:19-25 | src/prefect/server/database/_migrations/versions/sqlite/2022_10_14_172612_ad4b1b4d1e9d_index_deployment_created.py:19-25 — `src/prefect/server/database/_migrations/versions/postgresql/2022_10_14_172612_ad4b1b4d1e9d_index_deployment_created.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_10_14_172612_ad4b1b4d1e9d_index_deployment_created.py` 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 1 separate duplicated blocks between them, totalling at least 7 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 (7 lines × 3) src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:497— src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:497-503 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:599-608 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:842-851 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py: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 (7 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:82— src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:82-88 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_19_181604_7f5f335cace3_add_flow_run_state_name.py:30-36 | src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:76-82 — `src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py` 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 92 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:582— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:582-586 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:42-47 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:675-679 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:49-54 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:582` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:581` calls `Column`, `Interval`, `String` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:42` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 4) src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:55— src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:55-59 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:69-74 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:91-95 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:341-346 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:55` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14 lines × 4) src/prefect/client/orchestration/_blocks_documents/client.py:86— src/prefect/client/orchestration/_blocks_documents/client.py:86-99 | src/prefect/client/orchestration/_concurrency_limits/client.py:166-187 | src/prefect/client/orchestration/_deployments/client.py:442-461 | src/prefect/client/orchestration/_work_pools/client.py:260-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (14 lines × 4) src/prefect/client/orchestration/_blocks_documents/client.py:244— src/prefect/client/orchestration/_blocks_documents/client.py:244-257 | src/prefect/client/orchestration/_concurrency_limits/client.py:627-648 | src/prefect/client/orchestration/_deployments/client.py:1156-1175 | src/prefect/client/orchestration/_work_pools/client.py:587-603 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Off the main sequence: prefect-docker — prefect-docker: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: prefect-shell — prefect-shell: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
R10 · Code Duplication· Duplicated block with local edits (56 matched lines × 2 locations) · ×2
Duplicated block with local edits (56 matched lines × 2 locations) ui-v2/src/components/work-pools/work-pool-details/work-pool-details.tsx:13— ui-v2/src/components/work-pools/work-pool-details/work-pool-details.tsx:13 · ui-v2/src/components/work-pools/work-pool-queue-details/work-pool-queue-details.tsx:9 — the two spans are one implementation copied and then locally edited — 283 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 (56 matched lines × 2 locations) ui-v2/src/graphs/factories/flowRunEvent.ts:26— ui-v2/src/graphs/factories/flowRunEvent.ts:26 · ui-v2/src/graphs/factories/nodeFlowRunEvent.ts:28 — the two spans are one implementation copied and then locally edited — 329 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.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×2
Untrusted text written into markup unescaped REDACTED:91— `Object.entries(THEMES).map(([theme,prefix])=>`
${prefix} [data-chart=${id}] {
${colorConfig.map(([key,itemConfig])=>{…` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped ui-v2/src/components/ui/mermaid-diagram.tsx:71— `svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
AC2 · Forms & labels· <fieldset> without a <legend> · ×1
<fieldset> without a <legend> ui-v2/src/components/schemas/schema-form-property.tsx:207— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
AC2 · Forms & labels· <RadioGroup> field component without a label · ×1
<RadioGroup> field component without a label ui-v2/src/components/settings/theme-switch.tsx:13— 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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×1
Animation without a prefers-reduced-motion guard ui-v2/src/graphs/objects/viewport.ts:135— `viewport.animate()` moves (`Web Animations API keyframes`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
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 failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
_core._run_single_deploy (cyclomatic 67) src/prefect/cli/deploy/_core.py:67— _core._run_single_deploy has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Task.__init__ (cyclomatic 57) src/prefect/tasks.py:394— Task.__init__ has cyclomatic complexity 57 (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.
nearestParentVertical.getVerticalNearestParentLayout (cyclomatic 56) ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts:8— nearestParentVertical.getVerticalNearestParentLayout has cyclomatic complexity 56 (threshold 15). Most of this is not in the body itself: 3 of the 56 points are its own statements and the rest belongs to 16 function items inside it that branch (argueWithCompetingUpstreamPlacement, getNearestParentPosition, placeNearUpstreamNode, …). 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.
IntervalSchedule._get_dates_generator (cyclomatic 54) src/prefect/server/schemas/schedules.py:221— IntervalSchedule._get_dates_generator 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.
prepare_release_notes.format_release_notes (cyclomatic 47) scripts/prepare_release_notes.py:104— prepare_release_notes.format_release_notes has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cloud.login (cyclomatic 46) src/prefect/cli/cloud/__init__.py:57— cloud.login 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.
Flow.__init__ (cyclomatic 45) REDACTED:212— Flow.__init__ has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
backfill_release_notes.format_release_notes (cyclomatic 44) scripts/backfill_release_notes.py:102— backfill_release_notes.format_release_notes has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deployments.update_deployment (cyclomatic 43) src/prefect/server/api/deployments.py:214— deployments.update_deployment 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.
flow-run-header.FlowRunHeader (cyclomatic 41) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:57— flow-run-header.FlowRunHeader 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, 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.
observer._replicate_pod_event (cyclomatic 40) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:406— observer._replicate_pod_event 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.
collections.visit_collection (cyclomatic 40) src/prefect/utilities/collections.py:312— collections.visit_collection 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.
ECSWorker._prepare_task_run_request (cyclomatic 35) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1384— ECSWorker._prepare_task_run_request has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PrefectDbtRunner.invoke (cyclomatic 35) src/integrations/prefect-dbt/prefect_dbt/core/runner.py:1239— PrefectDbtRunner.invoke 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.
urls.url_for (cyclomatic 35) src/prefect/utilities/urls.py:353— urls.url_for has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
action-details.ActionDetailsType (cyclomatic 35) ui-v2/src/components/automations/action-details/action-details.tsx:75— action-details.ActionDetailsType 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.
_config._apply_cli_options_to_deploy_config (cyclomatic 33) src/prefect/cli/deploy/_config.py:198— _config._apply_cli_options_to_deploy_config 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.
deployment.run (cyclomatic 33) src/prefect/cli/deployment.py:325— deployment.run 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.
runner.adeploy (cyclomatic 32) src/prefect/deployments/runner.py:1561— runner.adeploy has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (runner.deploy) 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.
runner.deploy (cyclomatic 32) src/prefect/deployments/runner.py:1802— runner.deploy has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (runner.adeploy) 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.
importtools.safe_load_namespace (cyclomatic 32) REDACTED:327— importtools.safe_load_namespace 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.
work-pool-create-wizard.WorkPoolCreateWizard (cyclomatic 32) ui-v2/src/components/work-pools/create/work-pool-create-wizard.tsx:37— work-pool-create-wizard.WorkPoolCreateWizard has cyclomatic complexity 32 (threshold 15). 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 58, handleSubmit, a function literal at line 60, …). 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.
ECSWorker._prepare_task_definition (cyclomatic 31) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1148— ECSWorker._prepare_task_definition 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.
flow_run.logs (cyclomatic 31) src/prefect/cli/flow_run.py:561— flow_run.logs 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.
index.FlowRunTooltip (cyclomatic 31) ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:417— index.FlowRunTooltip has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 13 of the 31 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 467, 524, 517, …). 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.
SPCSWorkerConfiguration.prepare_for_flow_run (cyclomatic 30) src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py:239— SPCSWorkerConfiguration.prepare_for_flow_run has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
config.view (cyclomatic 30) src/prefect/cli/config.py:162— config.view 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.
deployment._set_schedule_activation (cyclomatic 30) src/prefect/cli/deployment.py:933— deployment._set_schedule_activation 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.
task_run_recorder._record_bulk_task_run_events (cyclomatic 30) src/prefect/server/services/task_run_recorder.py:416— task_run_recorder._record_bulk_task_run_events 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.
script.loadAmplitude (cyclomatic 30) REDACTED:186— script.loadAmplitude has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 330, getScrollPercent, a function literal at line 279, …). 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.
fetcher.fetch_sdk_data (cyclomatic 28) src/prefect/_sdk/fetcher.py:292— fetcher.fetch_sdk_data 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.
api.api_request (cyclomatic 28) src/prefect/cli/api.py:130— api.api_request 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.
AsyncFlowRunEngine.initialize_run (cyclomatic 28) src/prefect/flow_engine.py:1925— AsyncFlowRunEngine.initialize_run 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.
PrefectDbtOrchestrator._execute_per_node (cyclomatic 27) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1807— PrefectDbtOrchestrator._execute_per_node 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.
observer._mark_flow_run_as_crashed (cyclomatic 27) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1029— observer._mark_flow_run_as_crashed 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.
deployment.create_schedule (cyclomatic 27) src/prefect/cli/deployment.py:711— deployment.create_schedule 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.
flow_runs.run_deployment (cyclomatic 27) src/prefect/deployments/flow_runs.py:244— flow_runs.run_deployment 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.
AsyncPostgresConfiguration.engine (cyclomatic 27) src/prefect/server/database/configurations.py:220— AsyncPostgresConfiguration.engine 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.
rich-date-range-selector.RichDateRangeSelector (cyclomatic 27) ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:225— rich-date-range-selector.RichDateRangeSelector has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 288, a function literal at line 296, a function literal at line 268, …). 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.
ecs.mark_runs_as_crashed (cyclomatic 26) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:823— ecs.mark_runs_as_crashed 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.
Block._to_block_document (cyclomatic 26) src/prefect/blocks/core.py:598— Block._to_block_document 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.
MigratableAutomation.get_dependencies (cyclomatic 25) src/prefect/cli/transfer/_migratable_resources/automations.py:77— MigratableAutomation.get_dependencies 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.
work_pool.create (cyclomatic 25) src/prefect/cli/work_pool.py:298— work_pool.create has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
flow_runs.arun_deployment (cyclomatic 25) src/prefect/deployments/flow_runs.py:51— flow_runs.arun_deployment 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.
text_search_parser.parse_text_search_query (cyclomatic 25) src/prefect/server/utilities/text_search_parser.py:26— text_search_parser.parse_text_search_query 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.
Task.with_options (cyclomatic 25) src/prefect/tasks.py:679— Task.with_options has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
flow-run-graph.FlowRunGraph (cyclomatic 25) ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph.tsx:58— flow-run-graph.FlowRunGraph has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 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.
PrefectDbtOrchestrator._execute_per_wave (cyclomatic 24) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1345— PrefectDbtOrchestrator._execute_per_wave 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.
DockerWorker._submit_adhoc_run (cyclomatic 24) src/integrations/prefect-docker/prefect_docker/worker.py:622— DockerWorker._submit_adhoc_run 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.
ValidatedFunction.validate_call_args (cyclomatic 24) src/prefect/_internal/pydantic/validated_func.py:249— ValidatedFunction.validate_call_args 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.
plugins._diagnose_plugins (cyclomatic 24) src/prefect/cli/plugins.py:25— plugins._diagnose_plugins 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.
deployments.bulk_create_flow_runs_from_deployment (cyclomatic 24) src/prefect/server/api/deployments.py:1006— deployments.bulk_create_flow_runs_from_deployment 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.
cli.invoke_and_assert (cyclomatic 24) src/prefect/testing/cli.py:231— cli.invoke_and_assert 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.
event-resource-combobox.EventResourceCombobox (cyclomatic 24) ui-v2/src/components/automations/automations-wizard/trigger-step/event-resource-combobox/event-resource-combobox.tsx:35— event-resource-combobox.EventResourceCombobox has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 65, a function literal at line 139, a function literal at line 128, …). 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.
states.return_value_to_state_sync (cyclomatic 23) src/prefect/_internal/states.py:176— states.return_value_to_state_sync 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.
ControlChannel._handle_connection (cyclomatic 23) src/prefect/runner/_control_channel.py:377— ControlChannel._handle_connection 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.
states.return_value_to_state (cyclomatic 23) src/prefect/states.py:308— states.return_value_to_state 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.
dashboard.RouteComponent (cyclomatic 23) ui-v2/src/routes/dashboard.tsx:778— dashboard.RouteComponent 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 5 function literals inside it that branch (lines 792, 956, 868, …). 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.
schema-form-property.SchemaFormProperty (cyclomatic 23) ui-v2/src/components/schemas/schema-form-property.tsx:38— schema-form-property.SchemaFormProperty has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 4 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 71, a function literal at line 124, a function literal at line 146, …). 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.
control_listener._reader_loop (cyclomatic 22) src/prefect/_internal/control_listener.py:211— control_listener._reader_loop has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
automation.create (cyclomatic 22) src/prefect/cli/automation.py:416— automation.create 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.
_commands.init (cyclomatic 22) src/prefect/cli/deploy/_commands.py:35— _commands.init 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.
flow_run.retry (cyclomatic 22) src/prefect/cli/flow_run.py:387— flow_run.retry 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.
worker.start (cyclomatic 22) src/prefect/cli/worker.py:37— worker.start 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.
SecureTaskConcurrencySlots.before_transition (cyclomatic 22) src/prefect/server/orchestration/core_policy.py:327— SecureTaskConcurrencySlots.before_transition 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.
Settings.post_hoc_settings (cyclomatic 22) src/prefect/settings/models/root.py:275— Settings.post_hoc_settings 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.
ProcessPoolTaskRunner._forward_subprocess_messages (cyclomatic 22) src/prefect/task_runners.py:977— ProcessPoolTaskRunner._forward_subprocess_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.
jobs._build_trigger_job_run_options (cyclomatic 21) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:698— jobs._build_trigger_job_run_options 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.
DbtCoreExecutor._invoke (cyclomatic 21) src/integrations/prefect-dbt/prefect_dbt/core/_executor.py:407— DbtCoreExecutor._invoke 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.
ast_utils.find_prefect_decorated_functions_in_file (cyclomatic 21) src/prefect/_internal/ast_utils.py:23— ast_utils.find_prefect_decorated_functions_in_file 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.
automation.delete (cyclomatic 21) src/prefect/cli/automation.py:306— automation.delete 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.
task_run.ls (cyclomatic 21) src/prefect/cli/task_run.py:92— task_run.ls 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.
task_run.logs (cyclomatic 21) src/prefect/cli/task_run.py:220— task_run.logs 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.
work_queue.ls (cyclomatic 21) src/prefect/cli/work_queue.py:505— work_queue.ls 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.
RunnerDeployment._create (cyclomatic 21) src/prefect/deployments/runner.py:431— RunnerDeployment._create has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (RunnerDeployment._create_sync) 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.
RunnerDeployment._create_sync (cyclomatic 21) src/prefect/deployments/runner.py:537— RunnerDeployment._create_sync has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (RunnerDeployment._create) 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.
Flow.with_options (cyclomatic 21) REDACTED:460— Flow.with_options 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.
CancellationManager.cancel (cyclomatic 21) src/prefect/runner/_cancellation_manager.py:72— CancellationManager.cancel 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.
triggers.evaluate (cyclomatic 21) src/prefect/server/events/triggers.py:89— triggers.evaluate 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.
Task.create_run (cyclomatic 21) src/prefect/tasks.py:889— Task.create_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.
Task.create_local_run (cyclomatic 21) src/prefect/tasks.py:1005— Task.create_local_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.
BaseWorker._submit_adhoc_run (cyclomatic 21) src/prefect/workers/base.py:1008— BaseWorker._submit_adhoc_run 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.
index.FlowRunsCard (cyclomatic 21) ui-v2/src/components/dashboard/flow-runs-card/index.tsx:51— index.FlowRunsCard has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
flow-run-action.FlowRunDialogBody (cyclomatic 21) ui-v2/src/components/flows/flow-run-action/flow-run-action.tsx:132— flow-run-action.FlowRunDialogBody has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
data-table.DataTable (cyclomatic 21) ui-v2/src/components/ui/data-table.tsx:61— data-table.DataTable has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 90, 147, 130, …). 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.
utils.update_work_pool_defaults (cyclomatic 20) src/integrations/prefect-aws/prefect_aws/_cli/utils.py:502— utils.update_work_pool_defaults has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
automation.inspect (cyclomatic 20) src/prefect/cli/automation.py:97— automation.inspect 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.
_config._format_validation_error (cyclomatic 20) src/prefect/cli/deploy/_config.py:21— _config._format_validation_error 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.
deployment.delete (cyclomatic 20) src/prefect/cli/deployment.py:616— deployment.delete 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.
server.start (cyclomatic 20) src/prefect/cli/server.py:48— server.start 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.
work_pool.slots (cyclomatic 20) src/prefect/cli/work_pool.py:649— work_pool.slots has cyclomatic complexity 20 (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.
PrefectClient.__init__ (cyclomatic 20) src/prefect/client/orchestration/__init__.py:321— PrefectClient.__init__ 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. This shape REPEATS in the file: one other method here (SyncPrefectClient.__init__) 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.
SyncPrefectClient.__init__ (cyclomatic 20) src/prefect/client/orchestration/__init__.py:1268— SyncPrefectClient.__init__ 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. This shape REPEATS in the file: one other method here (PrefectClient.__init__) 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.
FlowRunEngine.initialize_run (cyclomatic 20) src/prefect/flow_engine.py:1195— FlowRunEngine.initialize_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.
block_documents.update_block_document (cyclomatic 20) src/prefect/server/models/block_documents.py:539— block_documents.update_block_document 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.
workers.update_work_queue (cyclomatic 20) src/prefect/server/models/workers.py:763— workers.update_work_queue 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.
callables.parameters_to_args_kwargs (cyclomatic 20) REDACTED:275— callables.parameters_to_args_kwargs 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.
schema-form-input.SchemaFormInput (cyclomatic 20) ui-v2/src/components/schemas/schema-form-input.tsx:35— schema-form-input.SchemaFormInput 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.
task-run-details.TaskRunDetails (cyclomatic 20) ui-v2/src/components/task-runs/task-run-details/task-run-details.tsx:25— task-run-details.TaskRunDetails 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.
rich-date-range-selector.RangeView (cyclomatic 20) ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:667— rich-date-range-selector.RangeView 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 12 function items inside it that branch (a function literal at line 717, commit, a function literal at line 676, …). 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.
PrefectDbtOrchestrator._prepare_build (cyclomatic 19) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:880— PrefectDbtOrchestrator._prepare_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.
PrefectDbtOrchestrator._build_cache_options_for_node (cyclomatic 19) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1596— PrefectDbtOrchestrator._build_cache_options_for_node 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.
diagnostics._parse_scheduler_message (cyclomatic 19) src/integrations/prefect-kubernetes/prefect_kubernetes/diagnostics.py:135— diagnostics._parse_scheduler_message 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.
Consumer.run (cyclomatic 19) src/integrations/prefect-redis/prefect_redis/messaging.py:512— Consumer.run 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.
SPCSWorker._watch_service (cyclomatic 19) src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py:730— SPCSWorker._watch_service 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.
ObservationDelivery._run (cyclomatic 19) src/prefect/_internal/_observation_delivery.py:189— ObservationDelivery._run 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.
flow_runs.pause_flow_run (cyclomatic 19) src/prefect/flow_runs.py:350— flow_runs.pause_flow_run 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.
ElasticContainerServicePushProvisioner.provision (cyclomatic 19) src/prefect/infrastructure/provisioners/ecs.py:1229— ElasticContainerServicePushProvisioner.provision 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.
storage._format_token_from_credentials (cyclomatic 19) src/prefect/runner/storage.py:1222— storage._format_token_from_credentials 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.
stream.log_matches_filter (cyclomatic 19) src/prefect/server/logs/stream.py:99— stream.log_matches_filter 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.
RRuleSchedule.from_rrule (cyclomatic 19) src/prefect/server/schemas/schedules.py:766— RRuleSchedule.from_rrule 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.
cancellation_cleanup.handle_cancelling_timeout (cyclomatic 19) src/prefect/server/services/cancellation_cleanup.py:194— cancellation_cleanup.handle_cancelling_timeout 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.
states.get_state_exception (cyclomatic 19) src/prefect/states.py:535— states.get_state_exception 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.
index.buildPaginationBody (cyclomatic 19) ui-v2/src/routes/runs/index.tsx:133— index.buildPaginationBody 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.
date-time-picker.DateTimePicker (cyclomatic 19) ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx:26— date-time-picker.DateTimePicker has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 5 function items inside it that branch (handleTimeChange, a function literal at line 134, 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.
utils.organizeFlowRunsWithGaps (cyclomatic 19) ui-v2/src/components/ui/flow-run-activity-bar-graph/utils.ts:18— utils.organizeFlowRunsWithGaps has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
generate_settings_ref.generate_property_docs (cyclomatic 18) scripts/generate_settings_ref.py:55— generate_settings_ref.generate_property_docs 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.
PrefectDbtOrchestrator._precompute_all_cache_keys (cyclomatic 18) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1711— PrefectDbtOrchestrator._precompute_all_cache_keys 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.
version_checking.check_server_version (cyclomatic 18) src/prefect/_internal/version_checking.py:75— version_checking.check_server_version 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.
unions.split_union_top_level (cyclomatic 18) src/prefect/_sdk/unions.py:8— unions.split_union_top_level 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.
_commands.deploy (cyclomatic 18) src/prefect/cli/deploy/_commands.py:157— _commands.deploy 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.
MigratableAutomation.migrate (cyclomatic 18) src/prefect/cli/transfer/_migratable_resources/automations.py:204— MigratableAutomation.migrate 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.
work_pool.storage_inspect (cyclomatic 18) src/prefect/cli/work_pool.py:1242— work_pool.storage_inspect 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.
PrefectHttpxAsyncClient._send_with_retry (cyclomatic 18) src/prefect/client/base.py:273— PrefectHttpxAsyncClient._send_with_retry has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (PrefectHttpxSyncClient._send_with_retry) 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.
PrefectHttpxSyncClient._send_with_retry (cyclomatic 18) src/prefect/client/base.py:546— PrefectHttpxSyncClient._send_with_retry has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (PrefectHttpxAsyncClient._send_with_retry) 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.
related.related_resources_from_run_context (cyclomatic 18) src/prefect/events/related.py:60— related.related_resources_from_run_context 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.
flow_runs.apause_flow_run (cyclomatic 18) src/prefect/flow_runs.py:196— flow_runs.apause_flow_run 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.
FlowRunExecutor.submit (cyclomatic 18) src/prefect/runner/_flow_run_executor.py:116— FlowRunExecutor.submit 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.
deployments.create_deployment (cyclomatic 18) src/prefect/server/api/deployments.py:66— deployments.create_deployment 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.
deployments.update_deployment (cyclomatic 18) src/prefect/server/models/deployments.py:279— deployments.update_deployment 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.
use-get-automation-action-resources.getResourceSets (cyclomatic 18) ui-v2/src/api/automations/use-get-automation-action-resources/use-get-automation-action-resources.ts:140— use-get-automation-action-resources.getResourceSets 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.
resource-routes.getResourceRoute (cyclomatic 18) ui-v2/src/components/events/event-resource-display/resource-routes.ts:33— resource-routes.getResourceRoute 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.
flow-run-task-runs.FlowRunTaskRuns (cyclomatic 18) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-task-runs.tsx:28— flow-run-task-runs.FlowRunTaskRuns has cyclomatic complexity 18 (threshold 15). Of this number, 12 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.
selection.isSelected (cyclomatic 18) ui-v2/src/graphs/objects/selection.ts:60— selection.isSelected 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.
ecs._forward_cloudwatch_logs (cyclomatic 17) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:573— ecs._forward_cloudwatch_logs 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.
ecs.replicate_ecs_event (cyclomatic 17) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:718— ecs.replicate_ecs_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.
DaskTaskRunner.client (cyclomatic 17) src/integrations/prefect-dask/prefect_dask/task_runners.py:306— DaskTaskRunner.client 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.
DbtCloudJobRun._build_trigger_job_run_options (cyclomatic 17) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:1135— DbtCloudJobRun._build_trigger_job_run_options 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.
PrefectDbtOrchestrator.run_build (cyclomatic 17) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1095— PrefectDbtOrchestrator.run_build 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.
KubernetesWorker._create_job (cyclomatic 17) src/integrations/prefect-kubernetes/prefect_kubernetes/worker.py:1069— KubernetesWorker._create_job 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.
flow_run.ls (cyclomatic 17) src/prefect/cli/flow_run.py:209— flow_run.ls 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.
server.status (cyclomatic 17) src/prefect/cli/server.py:259— server.status 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.
task.serve (cyclomatic 17) src/prefect/cli/task.py:49— task.serve 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.
DeploymentClient.create_deployment (cyclomatic 17) src/prefect/client/orchestration/_deployments/client.py:49— DeploymentClient.create_deployment 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 shape REPEATS in the file: one other method here (DeploymentAsyncClient.create_deployment) 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.
DeploymentAsyncClient.create_deployment (cyclomatic 17) src/prefect/client/orchestration/_deployments/client.py:756— DeploymentAsyncClient.create_deployment 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 shape REPEATS in the file: one other method here (DeploymentClient.create_deployment) 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.
RRuleSchedule.from_rrule (cyclomatic 17) src/prefect/client/schemas/schedules.py:222— RRuleSchedule.from_rrule 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.
RunnerDeployment.from_flow (cyclomatic 17) src/prefect/deployments/runner.py:1027— RunnerDeployment.from_flow 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.
core.run_steps (cyclomatic 17) src/prefect/deployments/steps/core.py:180— core.run_steps 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.
FlowRunEngine.call_hooks (cyclomatic 17) src/prefect/flow_engine.py:1043— FlowRunEngine.call_hooks has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (AsyncFlowRunEngine.call_hooks) 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.
AsyncFlowRunEngine.call_hooks (cyclomatic 17) src/prefect/flow_engine.py:1775— AsyncFlowRunEngine.call_hooks has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (FlowRunEngine.call_hooks) 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.
flows.load_flow_from_flow_run (cyclomatic 17) REDACTED:3260— flows.load_flow_from_flow_run 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.
GitRepository.__init__ (cyclomatic 17) src/prefect/runner/storage.py:191— GitRepository.__init__ 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.
concurrency_limits.increment_concurrency_limits_v1 (cyclomatic 17) src/prefect/server/api/concurrency_limits.py:440— concurrency_limits.increment_concurrency_limits_v1 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.
work_queues.update_work_queue (cyclomatic 17) src/prefect/server/models/work_queues.py:362— work_queues.update_work_queue 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.
ValidateDeploymentConcurrencyAtRunning.before_transition (cyclomatic 17) src/prefect/server/orchestration/core_policy.py:733— ValidateDeploymentConcurrencyAtRunning.before_transition 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.
ReleaseFlowConcurrencySlots.after_transition (cyclomatic 17) src/prefect/server/orchestration/core_policy.py:884— ReleaseFlowConcurrencySlots.after_transition 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.
subscriptions.accept_prefect_socket (cyclomatic 17) src/prefect/server/utilities/subscriptions.py:20— subscriptions.accept_prefect_socket 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.
states.aget_state_exception (cyclomatic 17) src/prefect/states.py:449— states.aget_state_exception 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.
callables._generate_signature_from_source (cyclomatic 17) REDACTED:681— callables._generate_signature_from_source 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.
index.buildHistoryFilter (cyclomatic 17) ui-v2/src/routes/runs/index.tsx:271— index.buildHistoryFilter has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.AutomationDeploymentCombobox (cyclomatic 17) ui-v2/src/components/automations/automations-wizard/trigger-step/automation-deployment-combobox/index.tsx:34— index.AutomationDeploymentCombobox has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 112, renderSelectedDeployments, a function literal at line 50, …). 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.
state-filter.StateFilter (cyclomatic 17) ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx:24— state-filter.StateFilter has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (renderSelectedTags, a function literal at line 37, handleSelectFilter, …). 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.
data-table.FlowsTable (cyclomatic 17) ui-v2/src/components/flows/data-table.tsx:42— data-table.FlowsTable has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 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 176, a function literal at line 97, a function literal at line 86, …). 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.
tags-select.TagsSelect (cyclomatic 17) ui-v2/src/components/ui/tags-select/tags-select.tsx:28— tags-select.TagsSelect 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 5 function items inside it that branch (a function literal at line 91, a function literal at line 45, a function literal at line 54, …). 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.
infrastructure-type-step.InfrastructureTypeStep (cyclomatic 17) ui-v2/src/components/work-pools/create/infrastructure-type-step/infrastructure-type-step.tsx:26— infrastructure-type-step.InfrastructureTypeStep has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 38, 72, 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.
seconds.secondsToApproximateString (cyclomatic 17) ui-v2/src/utils/seconds.ts:118— seconds.secondsToApproximateString has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ECSWorker._task_definitions_equal (cyclomatic 16) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1597— ECSWorker._task_definitions_equal 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.
DbtConfigs._populate_configs_json (cyclomatic 16) src/integrations/prefect-dbt/prefect_dbt/cli/configs/base.py:41— DbtConfigs._populate_configs_json has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_artifacts.create_summary_markdown (cyclomatic 16) src/integrations/prefect-dbt/prefect_dbt/core/_artifacts.py:39— _artifacts.create_summary_markdown has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
KubernetesJobRun.await_for_completion (cyclomatic 16) src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:392— KubernetesJobRun.await_for_completion 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.
_SuspensionWatch._confirm (cyclomatic 16) src/prefect/_internal/observers.py:112— _SuspensionWatch._confirm 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.
_config._pick_deploy_configs (cyclomatic 16) src/prefect/cli/deploy/_config.py:457— _config._pick_deploy_configs 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.
events.emit (cyclomatic 16) src/prefect/cli/events.py:112— events.emit 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.
base.initialize_project (cyclomatic 16) src/prefect/deployments/base.py:154— base.initialize_project 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.
engine.handle_engine_signals (cyclomatic 16) src/prefect/engine.py:63— engine.handle_engine_signals 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.
RemoteFileSystem._resolve_path (cyclomatic 16) src/prefect/filesystems.py:409— RemoteFileSystem._resolve_path 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.
flow_runs.asuspend_flow_run (cyclomatic 16) src/prefect/flow_runs.py:508— flow_runs.asuspend_flow_run has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (flow_runs.suspend_flow_run) 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.
flow_runs.suspend_flow_run (cyclomatic 16) src/prefect/flow_runs.py:637— flow_runs.suspend_flow_run has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (flow_runs.asuspend_flow_run) 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.
flow_runs.resume_flow_run (cyclomatic 16) src/prefect/server/api/flow_runs.py:448— flow_runs.resume_flow_run 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.
workers.update_work_pool (cyclomatic 16) src/prefect/server/models/workers.py:309— workers.update_work_pool 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.
FlowRunFilter._get_filter_list (cyclomatic 16) src/prefect/server/schemas/filters.py:761— FlowRunFilter._get_filter_list 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.
WorkerChannelConnection.dispatch_one_cleanup_message (cyclomatic 16) src/prefect/server/utilities/worker_channel.py:297— WorkerChannelConnection.dispatch_one_cleanup_message 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.
task_worker.aserve (cyclomatic 16) src/prefect/task_worker.py:452— task_worker.aserve 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.
Transaction.commit (cyclomatic 16) src/prefect/transactions.py:335— Transaction.commit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AsyncTransaction.commit) 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.
AsyncTransaction.commit (cyclomatic 16) src/prefect/transactions.py:495— AsyncTransaction.commit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Transaction.commit) 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.
use-deployment-form.useDeploymentForm.onSave (cyclomatic 16) ui-v2/src/components/deployments/deployment-form/use-deployment-form.ts:125— use-deployment-form.useDeploymentForm.onSave 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, 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.
No assertions: works without onPrefetchPage callback ui-v2/src/components/task-runs/task-runs-list/task-runs-pagination.test.tsx:346— 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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.
IntervalSchedule._get_dates_generator (cognitive 111) src/prefect/server/schemas/schedules.py:221— IntervalSchedule._get_dates_generator has cognitive complexity 111 (threshold 15). Drivers by points: if/else 27 (51 pts), ternaries 8 (25 pts), boolean chains 21, loops 6 (14 pts) (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
importtools.safe_load_namespace (cognitive 104) REDACTED:327— importtools.safe_load_namespace has cognitive complexity 104 (threshold 15). Drivers by points: if/else 17 (50 pts), error handling 6 (27 pts), loops 5 (13 pts), ternaries 2 (10 pts), boolean chains 4 (nesting depth added 70). 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.
_core._run_single_deploy (cognitive 97) src/prefect/cli/deploy/_core.py:67— _core._run_single_deploy has cognitive complexity 97 (threshold 15). Drivers by points: if/else 39 (61 pts), boolean chains 25, ternaries 5 (7 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prepare_release_notes.format_release_notes (cognitive 79) scripts/prepare_release_notes.py:104— prepare_release_notes.format_release_notes has cognitive complexity 79 (threshold 15). Drivers by points: if/else 28 (63 pts), boolean chains 11, ternaries 1 (3 pts), error handling 1, loops 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nearestParentVertical.getVerticalNearestParentLayout (cognitive 76) ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts:8— nearestParentVertical.getVerticalNearestParentLayout has cognitive complexity 76 (threshold 15). Drivers by points: if/else 40 (56 pts), boolean chains 8, loops 5 (6 pts), ternaries 2 (6 pts) (nesting depth added 21). Most of this is not in the body itself: 3 of the 76 points are its own statements and the rest belongs to 16 function items inside it that branch (getNearestParentPosition, argueWithCompetingUpstreamPlacement, placeNearUpstreamNode, …). 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.
deployments.update_deployment (cognitive 73) src/prefect/server/api/deployments.py:214— deployments.update_deployment has cognitive complexity 73 (threshold 15). Drivers by points: if/else 25 (44 pts), error handling 4 (8 pts), loops 5 (8 pts), boolean chains 7, ternaries 3 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
backfill_release_notes.format_release_notes (cognitive 72) scripts/backfill_release_notes.py:102— backfill_release_notes.format_release_notes has cognitive complexity 72 (threshold 15). Drivers by points: if/else 26 (57 pts), boolean chains 10, ternaries 1 (3 pts), error handling 1, loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Task.__init__ (cognitive 71) src/prefect/tasks.py:394— Task.__init__ has cognitive complexity 71 (threshold 15). Drivers by points: if/else 28 (37 pts), boolean chains 19, ternaries 6 (7 pts), error handling 2 (4 pts), loops 2 (4 pts) (nesting depth added 14). 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.
collections.visit_collection (cognitive 71) src/prefect/utilities/collections.py:312— collections.visit_collection has cognitive complexity 71 (threshold 15). Drivers by points: if/else 25 (52 pts), loops 2 (8 pts), error handling 2 (4 pts), ternaries 2 (4 pts), boolean chains 3 (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.
observer._replicate_pod_event (cognitive 69) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:406— observer._replicate_pod_event has cognitive complexity 69 (threshold 15). Drivers by points: if/else 23 (39 pts), error handling 5 (13 pts), ternaries 5 (8 pts), boolean chains 7, loops 1 (2 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.
PrefectDbtOrchestrator._execute_per_wave (cognitive 68) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1345— PrefectDbtOrchestrator._execute_per_wave has cognitive complexity 68 (threshold 15). Drivers by points: if/else 9 (29 pts), ternaries 4 (19 pts), loops 5 (12 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Consumer.run (cognitive 63) src/integrations/prefect-redis/prefect_redis/messaging.py:512— Consumer.run has cognitive complexity 63 (threshold 15). Drivers by points: if/else 8 (30 pts), error handling 6 (23 pts), loops 4 (10 pts) (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.
cloud.login (cognitive 63) src/prefect/cli/cloud/__init__.py:57— cloud.login has cognitive complexity 63 (threshold 15). Drivers by points: if/else 27 (43 pts), boolean chains 13, loops 3 (5 pts), error handling 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.
Flow.__init__ (cognitive 62) REDACTED:212— Flow.__init__ has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 15, ternaries 6 (9 pts), error handling 4 (8 pts), loops 2 (4 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.
deployment._set_schedule_activation (cognitive 60) src/prefect/cli/deployment.py:933— deployment._set_schedule_activation has cognitive complexity 60 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 4 (11 pts), ternaries 4 (8 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_config._apply_cli_options_to_deploy_config (cognitive 59) src/prefect/cli/deploy/_config.py:198— _config._apply_cli_options_to_deploy_config has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 5 (13 pts), boolean chains 10, error handling 1 (5 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.
MigratableAutomation.get_dependencies (cognitive 56) src/prefect/cli/transfer/_migratable_resources/automations.py:77— MigratableAutomation.get_dependencies has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (35 pts), error handling 4 (16 pts), boolean chains 4, 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.
AsyncPostgresConfiguration.engine (cognitive 54) src/prefect/server/database/configurations.py:220— AsyncPostgresConfiguration.engine has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (46 pts), loops 1 (3 pts), ternaries 1 (3 pts), boolean chains 2 (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.
fetcher.fetch_sdk_data (cognitive 53) src/prefect/_sdk/fetcher.py:292— fetcher.fetch_sdk_data has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (41 pts), loops 5 (8 pts), boolean chains 3, ternaries 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecureTaskConcurrencySlots.before_transition (cognitive 53) src/prefect/server/orchestration/core_policy.py:327— SecureTaskConcurrencySlots.before_transition has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 5 (16 pts), error handling 1 (5 pts), boolean chains 3 (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.
PrefectDbtOrchestrator._precompute_all_cache_keys (cognitive 52) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1711— PrefectDbtOrchestrator._precompute_all_cache_keys has cognitive complexity 52 (threshold 15). Drivers by points: if/else 8 (29 pts), loops 7 (18 pts), error handling 1 (5 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task_run_recorder._record_bulk_task_run_events (cognitive 52) src/prefect/server/services/task_run_recorder.py:416— task_run_recorder._record_bulk_task_run_events has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 13 (20 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefectDbtOrchestrator._execute_per_node (cognitive 51) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1807— PrefectDbtOrchestrator._execute_per_node has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 6 (13 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flow_run.retry (cognitive 51) src/prefect/cli/flow_run.py:387— flow_run.retry has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 6 (16 pts), ternaries 4 (11 pts), boolean chains 3 (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.
text_search_parser.parse_text_search_query (cognitive 50) src/prefect/server/utilities/text_search_parser.py:26— text_search_parser.parse_text_search_query has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 3 (7 pts), boolean chains 6 (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.
PrefectDbtRunner.invoke (cognitive 49) src/integrations/prefect-dbt/prefect_dbt/core/runner.py:1239— PrefectDbtRunner.invoke has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 8, ternaries 5 (7 pts), loops 4, error handling 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.
ast_utils.find_prefect_decorated_functions_in_file (cognitive 49) src/prefect/_internal/ast_utils.py:23— ast_utils.find_prefect_decorated_functions_in_file has cognitive complexity 49 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 3 (9 pts), boolean chains 7, error handling 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deployment.run (cognitive 48) src/prefect/cli/deployment.py:325— deployment.run has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (27 pts), error handling 6 (11 pts), boolean chains 7, ternaries 2 (3 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.
flow_run.logs (cognitive 48) src/prefect/cli/flow_run.py:561— flow_run.logs has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 9, ternaries 3 (5 pts), error handling 2 (3 pts), 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.
ControlChannel._handle_connection (cognitive 47) src/prefect/runner/_control_channel.py:377— ControlChannel._handle_connection has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (29 pts), error handling 5 (10 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugins._diagnose_plugins (cognitive 46) src/prefect/cli/plugins.py:25— plugins._diagnose_plugins has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (9 pts), ternaries 4 (9 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ECSWorker._prepare_task_definition (cognitive 45) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1148— ECSWorker._prepare_task_definition has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 7, loops 4 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ObservationDelivery._run (cognitive 45) src/prefect/_internal/_observation_delivery.py:189— ObservationDelivery._run has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (40 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (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.
api.api_request (cognitive 43) src/prefect/cli/api.py:130— api.api_request has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (22 pts), ternaries 4 (8 pts), error handling 4 (7 pts), boolean chains 6 (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.
_commands.init (cognitive 43) src/prefect/cli/deploy/_commands.py:35— _commands.init has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 4 (11 pts), boolean chains 5, error handling 1, ternaries 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.
AsyncFlowRunEngine.initialize_run (cognitive 43) src/prefect/flow_engine.py:1925— AsyncFlowRunEngine.initialize_run has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 6, error handling 5, ternaries 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.invoke_and_assert (cognitive 43) src/prefect/testing/cli.py:231— cli.invoke_and_assert has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (30 pts), loops 3 (8 pts), ternaries 1 (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.
ValidatedFunction.validate_call_args (cognitive 42) src/prefect/_internal/pydantic/validated_func.py:249— ValidatedFunction.validate_call_args has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 4 (5 pts), ternaries 1 (5 pts), boolean chains 3, error handling 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.
work_queue.ls (cognitive 42) src/prefect/cli/work_queue.py:505— work_queue.ls has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 4 (12 pts), boolean chains 4, loops 2 (4 pts), error handling 1 (2 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.
block_documents.update_block_document (cognitive 42) src/prefect/server/models/block_documents.py:539— block_documents.update_block_document has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 4 (10 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.
ProcessPoolTaskRunner._forward_subprocess_messages (cognitive 42) src/prefect/task_runners.py:977— ProcessPoolTaskRunner._forward_subprocess_messages has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (31 pts), error handling 4 (8 pts), loops 2, 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.
config.view (cognitive 41) src/prefect/cli/config.py:162— config.view has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 7 (9 pts), boolean chains 5, ternaries 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
callables.parameters_to_args_kwargs (cognitive 41) REDACTED:275— callables.parameters_to_args_kwargs has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 5, ternaries 1 (4 pts), loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ECSWorker._prepare_task_run_request (cognitive 40) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1384— ECSWorker._prepare_task_run_request has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24 (32 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.
deployment.create_schedule (cognitive 40) src/prefect/cli/deployment.py:711— deployment.create_schedule has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (23 pts), error handling 4 (9 pts), boolean chains 5, loops 1 (2 pts), ternaries 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.
runner.adeploy (cognitive 40) src/prefect/deployments/runner.py:1561— runner.adeploy has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 10, error handling 2 (3 pts), loops 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. This shape REPEATS in the file: one other method here (runner.deploy) 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.
runner.deploy (cognitive 40) src/prefect/deployments/runner.py:1802— runner.deploy has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 10, error handling 2 (3 pts), loops 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. This shape REPEATS in the file: one other method here (runner.adeploy) 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.
flow_runs.run_deployment (cognitive 39) src/prefect/deployments/flow_runs.py:244— flow_runs.run_deployment has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, ternaries 3 (5 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validation.build_error_obj (cognitive 39) src/prefect/utilities/schema_tools/validation.py:153— validation.build_error_obj has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 4 (12 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generate_mintlify_openapi_docs.main (cognitive 38) scripts/generate_mintlify_openapi_docs.py:39— generate_mintlify_openapi_docs.main has cognitive complexity 38 (threshold 15). Drivers by points: if/else 4 (20 pts), loops 4 (16 pts), boolean chains 2 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_config._format_validation_error (cognitive 38) src/prefect/cli/deploy/_config.py:21— _config._format_validation_error has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 4 (8 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deployments.bulk_create_flow_runs_from_deployment (cognitive 38) src/prefect/server/api/deployments.py:1006— deployments.bulk_create_flow_runs_from_deployment has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 5 (11 pts), boolean chains 5, loops 2 (3 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.
DaskTaskRunner.client (cognitive 37) src/integrations/prefect-dask/prefect_dask/task_runners.py:306— DaskTaskRunner.client has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (31 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 20). 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.
observer._mark_flow_run_as_crashed (cognitive 37) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:1029— observer._mark_flow_run_as_crashed has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, error handling 3 (5 pts), ternaries 2 (4 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.
task_run.ls (cognitive 37) src/prefect/cli/task_run.py:92— task_run.ls has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 6 (13 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
core.run_steps (cognitive 37) src/prefect/deployments/steps/core.py:180— core.run_steps has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 2 (7 pts), loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workers.update_work_queue (cognitive 37) src/prefect/server/models/workers.py:763— workers.update_work_queue has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 5, 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.
urls.url_for (cognitive 37) src/prefect/utilities/urls.py:353— urls.url_for has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 7, ternaries 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.
control_listener._reader_loop (cognitive 36) src/prefect/_internal/control_listener.py:211— control_listener._reader_loop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (21 pts), error handling 8 (13 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.
flow_runs.arun_deployment (cognitive 36) src/prefect/deployments/flow_runs.py:51— flow_runs.arun_deployment has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7, ternaries 3 (5 pts), error handling 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.
RRuleSchedule.from_rrule (cognitive 36) src/prefect/server/schemas/schedules.py:766— RRuleSchedule.from_rrule has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 3 (9 pts), boolean chains 3 (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.
ecs.mark_runs_as_crashed (cognitive 35) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:823— ecs.mark_runs_as_crashed has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 7, error handling 3 (5 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.
jobs._build_trigger_job_run_options (cognitive 35) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:698— jobs._build_trigger_job_run_options has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, error handling 1 (3 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.
action-details.ActionDetailsType (cognitive 35) ui-v2/src/components/automations/action-details/action-details.tsx:75— action-details.ActionDetailsType has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (29 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.
states.return_value_to_state_sync (cognitive 34) src/prefect/_internal/states.py:176— states.return_value_to_state_sync has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), error handling 4 (11 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.
automation.delete (cognitive 34) src/prefect/cli/automation.py:306— automation.delete has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 2 (4 pts), boolean chains 2, ternaries 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.
PrefectClient.__init__ (cognitive 34) src/prefect/client/orchestration/__init__.py:321— PrefectClient.__init__ has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (27 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SyncPrefectClient.__init__) 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.
SyncPrefectClient.__init__ (cognitive 34) src/prefect/client/orchestration/__init__.py:1268— SyncPrefectClient.__init__ has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (27 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PrefectClient.__init__) 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.
_asyncio._format_http_status_error (cognitive 34) src/prefect/concurrency/_asyncio.py:47— _asyncio._format_http_status_error has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 1 (3 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RunnerDeployment.from_flow (cognitive 34) src/prefect/deployments/runner.py:1027— RunnerDeployment.from_flow has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), error handling 2 (7 pts), boolean chains 5 (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.
GitRepository._pull_code_locked (cognitive 34) src/prefect/runner/storage.py:428— GitRepository._pull_code_locked has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 2 (7 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
states.return_value_to_state (cognitive 34) src/prefect/states.py:308— states.return_value_to_state has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), error handling 4 (11 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.
script.loadAmplitude (cognitive 34) REDACTED:186— script.loadAmplitude has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (21 pts), ternaries 5 (9 pts), boolean chains 3, loops 1 (nesting depth added 6). None of this is in the body itself: all 34 points belong to 10 function items inside it that branch (a function literal at line 330, a function literal at line 279, getScrollPercent, …). 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.
flow-run-header.FlowRunHeader (cognitive 34) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:57— flow-run-header.FlowRunHeader has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 26, ternaries 6, if/else 2. Of this number, 30 points are the body's own statements and 4 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.
DockerWorker._submit_adhoc_run (cognitive 33) src/integrations/prefect-docker/prefect_docker/worker.py:622— DockerWorker._submit_adhoc_run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (21 pts), error handling 5 (7 pts), boolean chains 5 (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.
IgnoreFilter.filter (cognitive 33) src/prefect/bundles/_ignore_filter.py:178— IgnoreFilter.filter has cognitive complexity 33 (threshold 15). Drivers by points: error handling 4 (12 pts), if/else 5 (12 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.status (cognitive 33) src/prefect/cli/server.py:259— server.status has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 3, error handling 1 (3 pts), 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.
task_run.logs (cognitive 33) src/prefect/cli/task_run.py:220— task_run.logs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 3 (8 pts), boolean chains 5, loops 2 (4 pts), error handling 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.
BaseWorker._submit_adhoc_run (cognitive 33) src/prefect/workers/base.py:1008— BaseWorker._submit_adhoc_run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (24 pts), error handling 4 (5 pts), boolean chains 4 (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.
SPCSWorker._watch_service (cognitive 32) src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py:730— SPCSWorker._watch_service has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, error handling 2 (5 pts), loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
automation.create (cognitive 32) src/prefect/cli/automation.py:416— automation.create has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 3 (6 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ElasticContainerServicePushProvisioner.provision (cognitive 32) src/prefect/infrastructure/provisioners/ecs.py:1229— ElasticContainerServicePushProvisioner.provision has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 5 (11 pts), boolean chains 3, error handling 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.
ecs._forward_cloudwatch_logs (cognitive 31) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:573— ecs._forward_cloudwatch_logs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, error handling 2 (3 pts), ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefectDbtOrchestrator._augment_immediate_test_edges (cognitive 31) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:795— PrefectDbtOrchestrator._augment_immediate_test_edges has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 7 (13 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.
deployment.delete (cognitive 31) src/prefect/cli/deployment.py:616— deployment.delete has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (7 pts), boolean chains 5, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.handle_engine_signals (cognitive 31) src/prefect/engine.py:63— engine.handle_engine_signals has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (25 pts), error handling 5, 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.
PrefectEventSubscriber.__anext__ (cognitive 31) src/prefect/events/clients.py:881— PrefectEventSubscriber.__anext__ has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concurrency_limits.decrement_concurrency_limits_v1 (cognitive 31) src/prefect/server/api/concurrency_limits.py:575— concurrency_limits.decrement_concurrency_limits_v1 has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (8 pts), ternaries 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stream.log_matches_filter (cognitive 31) src/prefect/server/logs/stream.py:99— stream.log_matches_filter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ECSWorker._task_definitions_equal (cognitive 30) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1597— ECSWorker._task_definitions_equal has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_commands.deploy (cognitive 30) src/prefect/cli/deploy/_commands.py:157— _commands.deploy has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 4 (6 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
work_pool.create (cognitive 30) src/prefect/cli/work_pool.py:298— work_pool.create has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (16 pts), error handling 5 (7 pts), boolean chains 5, ternaries 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.
work_pool.storage_inspect (cognitive 30) src/prefect/cli/work_pool.py:1242— work_pool.storage_inspect has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (6 pts), boolean chains 5, ternaries 1 (3 pts), error handling 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.
CancellationManager.cancel (cognitive 30) src/prefect/runner/_cancellation_manager.py:72— CancellationManager.cancel has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 4 (5 pts), boolean chains 3, ternaries 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.
SubprocessASGIServer.start (cognitive 30) src/prefect/server/api/server.py:1171— SubprocessASGIServer.start has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 2 (5 pts), loops 1 (2 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.
work_queues.update_work_queue (cognitive 30) src/prefect/server/models/work_queues.py:362— work_queues.update_work_queue has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 4, loops 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.
Settings.post_hoc_settings (cognitive 30) src/prefect/settings/models/root.py:275— Settings.post_hoc_settings has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (21 pts), ternaries 2 (4 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
utils.organizeFlowRunsWithGaps (cognitive 30) ui-v2/src/components/ui/flow-run-activity-bar-graph/utils.ts:18— utils.organizeFlowRunsWithGaps has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 7 (10 pts), boolean chains 2, loops 1 (nesting depth added 12). Of this number, 15 points are the body's own statements and 15 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent 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_cli_docs._extract_command_params (cognitive 29) scripts/generate_cli_docs.py:111— generate_cli_docs._extract_command_params has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (2 pts), error handling 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.
generate_settings_ref.generate_property_docs (cognitive 29) scripts/generate_settings_ref.py:55— generate_settings_ref.generate_property_docs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 3 (6 pts), ternaries 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.
observer._reconcile_pod_lifecycle_states (cognitive 29) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:186— observer._reconcile_pod_lifecycle_states has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (6 pts), boolean chains 1, error handling 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.
SPCSWorkerConfiguration.prepare_for_flow_run (cognitive 29) src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py:239— SPCSWorkerConfiguration.prepare_for_flow_run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, 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.
Block._to_block_document (cognitive 29) src/prefect/blocks/core.py:598— Block._to_block_document has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 12, loops 2, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MigratableBlockSchema.get_dependencies (cognitive 29) src/prefect/cli/transfer/_migratable_resources/blocks.py:115— MigratableBlockSchema.get_dependencies has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
worker.start (cognitive 29) src/prefect/cli/worker.py:37— worker.start has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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.
PrefectHttpxAsyncClient._send_with_retry (cognitive 29) src/prefect/client/base.py:273— PrefectHttpxAsyncClient._send_with_retry has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PrefectHttpxSyncClient._send_with_retry) 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.
PrefectHttpxSyncClient._send_with_retry (cognitive 29) src/prefect/client/base.py:546— PrefectHttpxSyncClient._send_with_retry has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PrefectHttpxAsyncClient._send_with_retry) 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.
base._save_deployment_to_prefect_file (cognitive 29) src/prefect/deployments/base.py:314— base._save_deployment_to_prefect_file has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 3, loops 1 (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.
RunnerDeployment._create (cognitive 29) src/prefect/deployments/runner.py:431— RunnerDeployment._create has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, error handling 2, 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. This shape REPEATS in the file: one other method here (RunnerDeployment._create_sync) 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.
RunnerDeployment._create_sync (cognitive 29) src/prefect/deployments/runner.py:537— RunnerDeployment._create_sync has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, error handling 2, 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. This shape REPEATS in the file: one other method here (RunnerDeployment._create) 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.
FlowRunEngine.initialize_run (cognitive 29) src/prefect/flow_engine.py:1195— FlowRunEngine.initialize_run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 5, 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.
KubernetesJobRun.await_for_completion (cognitive 28) src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:392— KubernetesJobRun.await_for_completion has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
Consumer.process_pending_messages (cognitive 28) src/integrations/prefect-redis/prefect_redis/messaging.py:455— Consumer.process_pending_messages has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 1 (4 pts), error handling 1 (3 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.
triggers.evaluate (cognitive 28) src/prefect/server/events/triggers.py:89— triggers.evaluate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8, ternaries 3 (4 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.
WorkerCleanupExecutor._renew_until_finished (cognitive 28) src/prefect/workers/_cleanup.py:387— WorkerCleanupExecutor._renew_until_finished has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (27 pts), 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.
_artifacts.create_summary_markdown (cognitive 27) src/integrations/prefect-dbt/prefect_dbt/core/_artifacts.py:39— _artifacts.create_summary_markdown has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (15 pts), loops 4 (7 pts), if/else 4 (5 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.
FileCollector.collect (cognitive 27) src/prefect/bundles/_file_collector.py:140— FileCollector.collect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (9 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.
flows.load_flow_arguments_from_entrypoint (cognitive 27) REDACTED:3574— flows.load_flow_arguments_from_entrypoint has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (4 pts), loops 2 (4 pts), ternaries 1 (4 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.
workers.update_work_pool (cognitive 27) src/prefect/server/models/workers.py:309— workers.update_work_pool has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 3, 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.
task_worker.aserve (cognitive 27) src/prefect/task_worker.py:452— task_worker.aserve has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 5 (6 pts), loops 1 (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.
jobs.run_dbt_cloud_job (cognitive 26) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:1377— jobs.run_dbt_cloud_job has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (6 pts), error handling 2 (4 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.
DbtCoreExecutor._invoke (cognitive 26) src/integrations/prefect-dbt/prefect_dbt/core/_executor.py:407— DbtCoreExecutor._invoke has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 2, ternaries 2, 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.
BuildPlan.__str__ (cognitive 26) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:319— BuildPlan.__str__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (5 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.
PrefectDbtOrchestrator._prepare_build (cognitive 26) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:880— PrefectDbtOrchestrator._prepare_build has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, 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.
diagnostics._parse_scheduler_message (cognitive 26) src/integrations/prefect-kubernetes/prefect_kubernetes/diagnostics.py:135— diagnostics._parse_scheduler_message has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 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.
flow_run.ls (cognitive 26) src/prefect/cli/flow_run.py:209— flow_run.ls has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (5 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task.serve (cognitive 26) src/prefect/cli/task.py:49— task.serve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 2 (6 pts), ternaries 2 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
work_pool.slots (cognitive 26) src/prefect/cli/work_pool.py:649— work_pool.slots has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 6 (8 pts), boolean chains 6, ternaries 1 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConcurrencySlotAcquisitionWithLeaseService.acquire (cognitive 26) src/prefect/concurrency/services.py:128— ConcurrencySlotAcquisitionWithLeaseService.acquire has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), error handling 2 (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.
ReleaseTaskConcurrencySlots.after_transition (cognitive 26) src/prefect/server/orchestration/core_policy.py:505— ReleaseTaskConcurrencySlots.after_transition has cognitive complexity 26 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 4 (9 pts), error handling 1 (4 pts), boolean chains 1 (nesting depth added 16). 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.
subscriptions.accept_prefect_socket (cognitive 26) src/prefect/server/utilities/subscriptions.py:20— subscriptions.accept_prefect_socket has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (10 pts), boolean chains 4, error handling 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.
services.critical_service_loop (cognitive 26) src/prefect/utilities/services.py:21— services.critical_service_loop has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 2 (4 pts), loops 2 (4 pts), ternaries 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.
index.FlowRunTooltip (cognitive 26) ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:417— index.FlowRunTooltip has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11, boolean chains 9, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 467, 517, 524, …). 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.
EcsObserver.run (cognitive 25) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:370— EcsObserver.run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DbtConfigs._populate_configs_json (cognitive 25) src/integrations/prefect-dbt/prefect_dbt/cli/configs/base.py:41— DbtConfigs._populate_configs_json has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DbtCloudJobRun._build_trigger_job_run_options (cognitive 25) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:1135— DbtCloudJobRun._build_trigger_job_run_options has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, error handling 1 (3 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.
bundles.create_bundle_for_flow_run (cognitive 25) src/prefect/bundles/__init__.py:430— bundles.create_bundle_for_flow_run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 1 (2 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.
MigratableAutomation.migrate (cognitive 25) src/prefect/cli/transfer/_migratable_resources/automations.py:204— MigratableAutomation.migrate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
server.create_ui_app (cognitive 25) src/prefect/server/api/server.py:618— server.create_ui_app has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 1 (4 pts), loops 2 (4 pts), boolean chains 1, ternaries 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.
cancellation_cleanup.handle_cancelling_timeout (cognitive 25) src/prefect/server/services/cancellation_cleanup.py:194— cancellation_cleanup.handle_cancelling_timeout has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5, error handling 1 (2 pts), ternaries 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.
WorkerChannelConnection._receive_loop (cognitive 25) src/prefect/server/utilities/worker_channel.py:660— WorkerChannelConnection._receive_loop has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 4 (9 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkerCleanupQueue.reserve (cognitive 25) src/prefect/server/worker_communication/cleanup_queue/memory.py:164— WorkerCleanupQueue.reserve has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (4 pts), boolean chains 2, ternaries 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.
schema-form-input.SchemaFormInput (cognitive 25) ui-v2/src/components/schemas/schema-form-input.tsx:35— schema-form-input.SchemaFormInput has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (22 pts), ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ecs.replicate_ecs_event (cognitive 24) src/integrations/prefect-aws/prefect_aws/observers/ecs.py:718— ecs.replicate_ecs_event has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 3 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commands._create_unsuccessful_markdown (cognitive 24) src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:1029— commands._create_unsuccessful_markdown has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 4 (12 pts), loops 4 (8 pts), if/else 4 (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.
WorkerCleanupQueue._run_operation (cognitive 24) src/integrations/prefect-redis/prefect_redis/cleanup_queue.py:616— WorkerCleanupQueue._run_operation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 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.
_SuspensionWatch._confirm (cognitive 24) src/prefect/_internal/observers.py:112— _SuspensionWatch._confirm has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, error handling 2 (4 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.
_prompts.prompt_push_custom_docker_image (cognitive 24) src/prefect/cli/_prompts.py:529— _prompts.prompt_push_custom_docker_image has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 3 (10 pts) (nesting depth added 15). 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.
events.emit (cognitive 24) src/prefect/cli/events.py:112— events.emit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
related.related_resources_from_run_context (cognitive 24) src/prefect/events/related.py:60— related.related_resources_from_run_context has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flow_runs.pause_flow_run (cognitive 24) src/prefect/flow_runs.py:350— flow_runs.pause_flow_run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4, error handling 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.
PrefectLogsSubscriber.__anext__ (cognitive 24) src/prefect/logging/clients.py:303— PrefectLogsSubscriber.__anext__ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concurrency_limits.reset_concurrency_limit_by_tag (cognitive 24) src/prefect/server/api/concurrency_limits.py:241— concurrency_limits.reset_concurrency_limit_by_tag has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (8 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.
triggers.reactive_evaluation (cognitive 24) src/prefect/server/events/triggers.py:581— triggers.reactive_evaluation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
legacy._get_settings_fields (cognitive 24) src/prefect/settings/legacy.py:122— legacy._get_settings_fields has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 2 (6 pts), loops 2 (5 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.
Task.with_options (cognitive 24) src/prefect/tasks.py:679— Task.with_options has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14, boolean chains 10. 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.
Task.create_local_run (cognitive 24) src/prefect/tasks.py:1005— Task.create_local_run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 7, loops 1, 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.
CycloptsCliRunner.invoke (cognitive 24) src/prefect/testing/cli.py:87— CycloptsCliRunner.invoke has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
WorkerCleanupExecutor._send_operation_until_resolved (cognitive 24) src/prefect/workers/_cleanup.py:453— WorkerCleanupExecutor._send_operation_until_resolved has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, error handling 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.
rich-date-range-selector.RichDateRangeSelector (cognitive 24) ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:225— rich-date-range-selector.RichDateRangeSelector has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 9, ternaries 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 268, a function literal at line 288, a function literal at line 296, …). 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.
use-animated-reorder.useAnimatedReorder (cognitive 24) ui-v2/src/hooks/use-animated-reorder.ts:30— use-animated-reorder.useAnimatedReorder has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 11). None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 39). 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.
ManifestParser.compute_execution_waves (cognitive 23) src/integrations/prefect-dbt/prefect_dbt/core/_manifest.py:361— ManifestParser.compute_execution_waves has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 6 (10 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.
PrefectDbtOrchestrator._build_cache_options_for_node (cognitive 23) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1596— PrefectDbtOrchestrator._build_cache_options_for_node has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, ternaries 3, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
server.start (cognitive 23) src/prefect/cli/server.py:48— server.start has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (17 pts), error handling 4 (6 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
attribution.get_attribution_headers (cognitive 23) src/prefect/client/attribution.py:18— attribution.get_attribution_headers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AssetContext.from_task_and_inputs (cognitive 23) src/prefect/context.py:600— AssetContext.from_task_and_inputs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (5 pts), ternaries 3, 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.
RemoteFileSystem._resolve_path (cognitive 23) src/prefect/filesystems.py:409— RemoteFileSystem._resolve_path has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, 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.
flows.load_flow_from_flow_run (cognitive 23) REDACTED:3260— flows.load_flow_from_flow_run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, error handling 2 (3 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.
PrefectBaseSettings.to_environment_variables (cognitive 23) src/prefect/settings/base.py:124— PrefectBaseSettings.to_environment_variables has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 15). 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.
Task.create_run (cognitive 23) src/prefect/tasks.py:889— Task.create_run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5, loops 1, 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.
callables._generate_signature_from_source (cognitive 23) REDACTED:681— callables._generate_signature_from_source has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (8 pts), loops 5, 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.
schema-form-property.SchemaFormProperty (cognitive 23) ui-v2/src/components/schemas/schema-form-property.tsx:38— schema-form-property.SchemaFormProperty has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 8, ternaries 2 (nesting depth added 2). Most of this is not in the body itself: 2 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 146, a function literal at line 71, a function literal at line 124, …). 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.
data-table.DataTable (cognitive 23) ui-v2/src/components/ui/data-table.tsx:61— data-table.DataTable has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, ternaries 6 (9 pts), if/else 1 (3 pts) (nesting depth added 5). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 90, 147, 130, …). 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.
work-pool-create-wizard.WorkPoolCreateWizard (cognitive 23) ui-v2/src/components/work-pools/create/work-pool-create-wizard.tsx:37— work-pool-create-wizard.WorkPoolCreateWizard has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts), ternaries 3 (4 pts), match/switch 2 (nesting depth added 2). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 9 function items inside it that branch (handleNext, handleSubmit, a function literal at line 60, …). 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.
prepare_release_notes.update_docs_json (cognitive 22) scripts/prepare_release_notes.py:399— prepare_release_notes.update_docs_json has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_freshness.filter_stale_nodes (cognitive 22) src/integrations/prefect-dbt/prefect_dbt/core/_freshness.py:398— _freshness.filter_stale_nodes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 7 (9 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.
steps.push_docker_image (cognitive 22) src/integrations/prefect-docker/prefect_docker/deployments/steps.py:420— steps.push_docker_image has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 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.
MigratableBlockDocument.get_dependencies (cognitive 22) src/prefect/cli/transfer/_migratable_resources/blocks.py:255— MigratableBlockDocument.get_dependencies has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 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.
work_pool.ls (cognitive 22) src/prefect/cli/work_pool.py:519— work_pool.ls has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RRuleSchedule.from_rrule (cognitive 22) src/prefect/client/schemas/schedules.py:222— RRuleSchedule.from_rrule has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 3 (6 pts), 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, 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.
flow_runs.apause_flow_run (cognitive 22) src/prefect/flow_runs.py:196— flow_runs.apause_flow_run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flows._sanitize_and_load_flow (cognitive 22) REDACTED:3457— flows._sanitize_and_load_flow has cognitive complexity 22 (threshold 15). Drivers by points: error handling 5 (11 pts), if/else 6 (8 pts), loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concurrency_limits.increment_concurrency_limits_v1 (cognitive 22) src/prefect/server/api/concurrency_limits.py:440— concurrency_limits.increment_concurrency_limits_v1 has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
events.stream_workspace_events_out (cognitive 22) src/prefect/server/api/events.py:83— events.stream_workspace_events_out has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), error handling 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flow_runs.resume_flow_run (cognitive 22) src/prefect/server/api/flow_runs.py:448— flow_runs.resume_flow_run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 4 (8 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.
AutomationCore.prevent_run_deployment_loops (cognitive 22) src/prefect/server/events/schemas/automations.py:573— AutomationCore.prevent_run_deployment_loops has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkerChannelConnection.dispatch_one_cleanup_message (cognitive 22) src/prefect/server/utilities/worker_channel.py:297— WorkerChannelConnection.dispatch_one_cleanup_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (18 pts), error handling 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Transaction.commit (cognitive 22) src/prefect/transactions.py:335— Transaction.commit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, error handling 2, loops 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. This shape REPEATS in the file: one other method here (AsyncTransaction.commit) 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.
AsyncTransaction.commit (cognitive 22) src/prefect/transactions.py:495— AsyncTransaction.commit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, error handling 2, loops 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. This shape REPEATS in the file: one other method here (Transaction.commit) 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.
rich-date-range-selector.RangeView (cognitive 22) ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:667— rich-date-range-selector.RangeView has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), ternaries 4 (nesting depth added 2). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 12 function items inside it that branch (commit, a function literal at line 717, a function literal at line 676, …). 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.
KubernetesWorker._create_job (cognitive 21) src/integrations/prefect-kubernetes/prefect_kubernetes/worker.py:1069— KubernetesWorker._create_job has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
startup.run_startup_hooks (cognitive 21) src/prefect/_internal/plugins/startup.py:27— startup.run_startup_hooks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (3 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.
version_checking.check_server_version (cognitive 21) src/prefect/_internal/version_checking.py:75— version_checking.check_server_version has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), error handling 2, boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
automation.inspect (cognitive 21) src/prefect/cli/automation.py:97— automation.inspect has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, error handling 1 (2 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.
_config._pick_deploy_configs (cognitive 21) src/prefect/cli/deploy/_config.py:457— _config._pick_deploy_configs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4 (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.
flow_run.execute (cognitive 21) src/prefect/cli/flow_run.py:771— flow_run.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (7 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.
deployments.create_deployment (cognitive 21) src/prefect/server/api/deployments.py:66— deployments.create_deployment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2, ternaries 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.
WorkerCleanupConnectionRegistry.dispatch_available (cognitive 21) src/prefect/server/utilities/worker_channel_cleanup.py:173— WorkerCleanupConnectionRegistry.dispatch_available has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (6 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.
root._get_settings_accessors (cognitive 21) src/prefect/settings/models/root.py:54— root._get_settings_accessors has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (5 pts), boolean chains 2, ternaries 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.
SyncTaskRunEngine.handle_success (cognitive 21) src/prefect/task_engine.py:627— SyncTaskRunEngine.handle_success has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncTaskRunEngine.handle_success) 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.
AsyncTaskRunEngine.handle_success (cognitive 21) src/prefect/task_engine.py:1288— AsyncTaskRunEngine.handle_success has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SyncTaskRunEngine.handle_success) 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.
BaseWorker._submit_scheduled_flow_runs (cognitive 21) src/prefect/workers/base.py:1522— BaseWorker._submit_scheduled_flow_runs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 3 (7 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.
DockerWorker._build_container_settings (cognitive 20) src/integrations/prefect-docker/prefect_docker/worker.py:859— DockerWorker._build_container_settings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (4 pts), ternaries 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.
Consumer._run_without_consumer_group (cognitive 20) src/integrations/prefect-redis/prefect_redis/messaging.py:412— Consumer._run_without_consumer_group has cognitive complexity 20 (threshold 15). Drivers by points: error handling 2 (8 pts), loops 3 (6 pts), ternaries 1 (4 pts), if/else 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.
unions.split_union_top_level (cognitive 20) src/prefect/_sdk/unions.py:8— unions.split_union_top_level has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, 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.
bundles._is_local_module (cognitive 20) src/prefect/bundles/__init__.py:145— bundles._is_local_module has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
profile.check_server_connection (cognitive 20) src/prefect/cli/profile.py:412— profile.check_server_connection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 6 (9 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.
MigratableDeployment.get_dependencies (cognitive 20) src/prefect/cli/transfer/_migratable_resources/deployments.py:58— MigratableDeployment.get_dependencies 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, 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.
DeploymentClient.create_deployment (cognitive 20) src/prefect/client/orchestration/_deployments/client.py:49— DeploymentClient.create_deployment has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeploymentAsyncClient.create_deployment) 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.
DeploymentAsyncClient.create_deployment (cognitive 20) src/prefect/client/orchestration/_deployments/client.py:756— DeploymentAsyncClient.create_deployment has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeploymentClient.create_deployment) 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.
base._format_deployment_for_saving_to_prefect_file (cognitive 20) src/prefect/deployments/base.py:217— base._format_deployment_for_saving_to_prefect_file has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 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.
Flow.with_options (cognitive 20) REDACTED:460— Flow.with_options has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, boolean chains 9, if/else 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.
CoiledPushProvisioner.provision (cognitive 20) src/prefect/infrastructure/provisioners/coiled.py:135— CoiledPushProvisioner.provision has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, error handling 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.
FlowRunExecutor.submit (cognitive 20) src/prefect/runner/_flow_run_executor.py:116— FlowRunExecutor.submit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, 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.
validation._get_base_config_defaults (cognitive 20) src/prefect/server/api/validation.py:67— validation._get_base_config_defaults has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EventRelatedFilter.build_where_clauses (cognitive 20) src/prefect/server/events/filters.py:411— EventRelatedFilter.build_where_clauses has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
postgres_listener._normalize_asyncpg_dsn_query_params (cognitive 20) src/prefect/server/utilities/postgres_listener.py:21— postgres_listener._normalize_asyncpg_dsn_query_params has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 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.
postgres_listener.pg_listen (cognitive 20) src/prefect/server/utilities/postgres_listener.py:180— postgres_listener.pg_listen has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 6 (9 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.
ProfileSettingsTomlLoader.get_field_value (cognitive 20) src/prefect/settings/sources.py:182— ProfileSettingsTomlLoader.get_field_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 1 (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.
SyncTaskRunEngine.handle_retry (cognitive 20) src/prefect/task_engine.py:693— SyncTaskRunEngine.handle_retry has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AsyncTaskRunEngine.handle_retry) 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.
AsyncTaskRunEngine.handle_retry (cognitive 20) src/prefect/task_engine.py:1353— AsyncTaskRunEngine.handle_retry has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SyncTaskRunEngine.handle_retry) 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.
event-resource-combobox.EventResourceCombobox (cognitive 20) ui-v2/src/components/automations/automations-wizard/trigger-step/event-resource-combobox/event-resource-combobox.tsx:35— event-resource-combobox.EventResourceCombobox has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, loops 3, match/switch 1 (2 pts), ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 139, a function literal at line 65, a function literal at line 128, …). 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.FlowRunsCard (cognitive 20) ui-v2/src/components/dashboard/flow-runs-card/index.tsx:51— index.FlowRunsCard has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 8, ternaries 1. Of this number, 10 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
generate_settings_ref.build_ref_paths (cognitive 19) scripts/generate_settings_ref.py:13— generate_settings_ref.build_ref_paths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils.update_work_pool_defaults (cognitive 19) src/integrations/prefect-aws/prefect_aws/_cli/utils.py:502— utils.update_work_pool_defaults has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 6, error handling 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DockerWorker._create_and_start_container (cognitive 19) src/integrations/prefect-docker/prefect_docker/worker.py:926— DockerWorker._create_and_start_container has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3 (7 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.
Block.ser_model (cognitive 19) src/prefect/blocks/core.py:441— Block.ser_model has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, 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.
automation.update (cognitive 19) src/prefect/cli/automation.py:521— automation.update has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 4 (5 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_actions._generate_default_pull_action (cognitive 19) src/prefect/cli/deploy/_actions.py:211— _actions._generate_default_pull_action has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 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.
flow_runs.wait_for_flow_run (cognitive 19) src/prefect/flow_runs.py:57— flow_runs.wait_for_flow_run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 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.
flow_runs.asuspend_flow_run (cognitive 19) src/prefect/flow_runs.py:508— flow_runs.asuspend_flow_run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 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. This shape REPEATS in the file: one other method here (flow_runs.suspend_flow_run) 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.
flow_runs.suspend_flow_run (cognitive 19) src/prefect/flow_runs.py:637— flow_runs.suspend_flow_run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 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. This shape REPEATS in the file: one other method here (flow_runs.asuspend_flow_run) 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.
APILogHandler.prepare (cognitive 19) src/prefect/logging/handlers.py:232— APILogHandler.prepare has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (4 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.
GitRepository.__init__ (cognitive 19) src/prefect/runner/storage.py:191— GitRepository.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, loops 1 (2 pts), ternaries 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GitRepository._git_config (cognitive 19) src/prefect/runner/storage.py:307— GitRepository._git_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (7 pts), loops 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.
storage._format_token_from_credentials (cognitive 19) src/prefect/runner/storage.py:1222— storage._format_token_from_credentials has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4, 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.
concurrency_limits.delete_concurrency_limit (cognitive 19) src/prefect/server/api/concurrency_limits.py:316— concurrency_limits.delete_concurrency_limit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (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. This shape REPEATS in the file: one other method here (concurrency_limits.delete_concurrency_limit_by_tag) 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.
concurrency_limits.delete_concurrency_limit_by_tag (cognitive 19) src/prefect/server/api/concurrency_limits.py:374— concurrency_limits.delete_concurrency_limit_by_tag has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (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. This shape REPEATS in the file: one other method here (concurrency_limits.delete_concurrency_limit) 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.
2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.upgrade (cognitive 19) src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:19— 2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.upgrade has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (8 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.
2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.upgrade (cognitive 19) src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py:19— 2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.upgrade has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (8 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.
triggers.listen_for_automation_changes (cognitive 19) src/prefect/server/events/triggers.py:1267— triggers.listen_for_automation_changes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 3 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
block_schemas._register_nested_block_schemas (cognitive 19) src/prefect/server/models/block_schemas.py:157— block_schemas._register_nested_block_schemas has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deployments.update_deployment (cognitive 19) src/prefect/server/models/deployments.py:279— deployments.update_deployment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, 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.
flow_runs.count_flow_runs (cognitive 19) src/prefect/server/models/flow_runs.py:435— flow_runs.count_flow_runs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ValidateDeploymentConcurrencyAtRunning.before_transition (cognitive 19) src/prefect/server/orchestration/core_policy.py:733— ValidateDeploymentConcurrencyAtRunning.before_transition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
schedules._seek_calendar_interval (cognitive 19) src/prefect/server/schemas/schedules.py:100— schedules._seek_calendar_interval has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 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.
states.get_state_exception (cognitive 19) src/prefect/states.py:535— states.get_state_exception has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 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.
tasks._infer_parent_task_runs (cognitive 19) src/prefect/tasks.py:222— tasks._infer_parent_task_runs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_datetime.in_local_tz (cognitive 19) src/prefect/types/_datetime.py:355— _datetime.in_local_tz has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (6 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.
WorkerChannelProtocolHandler._receive_loop (cognitive 19) src/prefect/workers/_worker_channel/_protocol.py:306— WorkerChannelProtocolHandler._receive_loop has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 2 (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.
task-run-details.TaskRunDetails (cognitive 19) ui-v2/src/components/task-runs/task-run-details/task-run-details.tsx:25— task-run-details.TaskRunDetails has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10, boolean chains 8, if/else 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.
PrefectDbtOrchestrator.run_build (cognitive 18) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:1095— PrefectDbtOrchestrator.run_build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, 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.
steps.build_docker_image (cognitive 18) src/integrations/prefect-docker/prefect_docker/deployments/steps.py:147— steps.build_docker_image has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
observer._fetch_pod_container_logs_ordered (cognitive 18) src/integrations/prefect-kubernetes/prefect_kubernetes/observer.py:748— observer._fetch_pod_container_logs_ordered has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
messaging._trim_stream_to_lowest_delivered_id (cognitive 18) src/integrations/prefect-redis/prefect_redis/messaging.py:743— messaging._trim_stream_to_lowest_delivered_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (3 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.
buildx.buildx_build_image (cognitive 18) src/prefect/_internal/buildx.py:37— buildx.buildx_build_image has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 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.
naming.to_class_name (cognitive 18) src/prefect/_sdk/naming.py:144— naming.to_class_name has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Block._save (cognitive 18) src/prefect/blocks/core.py:1692— Block._save has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, 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.
block.register (cognitive 18) src/prefect/cli/block.py:164— block.register has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_schedules._schedule_config_to_deployment_schedule (cognitive 18) src/prefect/cli/deploy/_schedules.py:43— _schedules._schedule_config_to_deployment_schedule has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 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.
profile.inspect (cognitive 18) src/prefect/cli/profile.py:271— profile.inspect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
work_queue.preview (cognitive 18) src/prefect/cli/work_queue.py:646— work_queue.preview has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Subscription._ensure_connected (cognitive 18) src/prefect/client/subscriptions.py:72— Subscription._ensure_connected has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utility.run_shell_script (cognitive 18) REDACTED:113— utility.run_shell_script has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, error handling 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.
RemoteFileSystem.aput_directory (cognitive 18) src/prefect/filesystems.py:518— RemoteFileSystem.aput_directory has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RemoteFileSystem.put_directory) 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.
RemoteFileSystem.put_directory (cognitive 18) src/prefect/filesystems.py:574— RemoteFileSystem.put_directory has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RemoteFileSystem.aput_directory) 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.
InfrastructureBoundFlow.submit_to_work_pool (cognitive 18) REDACTED:2637— InfrastructureBoundFlow.submit_to_work_pool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2 (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.
AzureCLI.run_command (cognitive 18) src/prefect/infrastructure/provisioners/container_instance.py:62— AzureCLI.run_command has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModalPushProvisioner.provision (cognitive 18) src/prefect/infrastructure/provisioners/modal.py:144— ModalPushProvisioner.provision has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResultStore.aupdate_for_task (cognitive 18) src/prefect/results.py:556— ResultStore.aupdate_for_task has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 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. This shape REPEATS in the file: one other method here (ResultStore.update_for_task) 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.
ResultStore.update_for_task (cognitive 18) src/prefect/results.py:610— ResultStore.update_for_task has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 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. This shape REPEATS in the file: one other method here (ResultStore.aupdate_for_task) 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.
deployments.create_flow_run_from_deployment (cognitive 18) src/prefect/server/api/deployments.py:865— deployments.create_flow_run_from_deployment has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
task_runs.scheduled_task_subscription (cognitive 18) src/prefect/server/api/task_runs.py:358— task_runs.scheduled_task_subscription has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (5 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.
SecureFlowConcurrencySlots.before_transition (cognitive 18) src/prefect/server/orchestration/core_policy.py:582— SecureFlowConcurrencySlots.before_transition has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task_engine.run_generator_task_async (cognitive 18) src/prefect/task_engine.py:1854— task_engine.run_generator_task_async has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validation.validate (cognitive 18) src/prefect/utilities/schema_tools/validation.py:76— validation.validate has cognitive complexity 18 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 6 (8 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.
WorkerChannelProtocolHandler.run_session (cognitive 18) src/prefect/workers/_worker_channel/_protocol.py:220— WorkerChannelProtocolHandler.run_session has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (4 pts), boolean chains 1, error handling 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.
WorkPoolWorkerChannel._sync_rest_work_pool (cognitive 18) src/prefect/workers/_worker_channel/_sync.py:298— WorkPoolWorkerChannel._sync_rest_work_pool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (4 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.
BaseWorker._submit_run (cognitive 18) src/prefect/workers/base.py:1590— BaseWorker._submit_run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (5 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.
use-get-automation-action-resources.getResourceSets (cognitive 18) ui-v2/src/api/automations/use-get-automation-action-resources/use-get-automation-action-resources.ts:140— use-get-automation-action-resources.getResourceSets 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.
index.AutomationDeploymentCombobox (cognitive 18) ui-v2/src/components/automations/automations-wizard/trigger-step/automation-deployment-combobox/index.tsx:34— index.AutomationDeploymentCombobox has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, ternaries 3, loops 2 (nesting depth added 1). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 112, handleSelectDeployment, renderSelectedDeployments, …). 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.
interval-schedule-form.IntervalScheduleForm (cognitive 18) ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx:146— interval-schedule-form.IntervalScheduleForm has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 3). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 163, handleSave, a function literal at line 223, …). 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.
schema-form-input-object.SchemaFormInputObject (cognitive 18) ui-v2/src/components/schemas/schema-form-input-object.tsx:27— schema-form-input-object.SchemaFormInputObject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 4). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 78, 42, 52, …). 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.
uiSettings.getVisibleBasePrefix (cognitive 18) REDACTED:39— uiSettings.getVisibleBasePrefix has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (8 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.
ecs_worker.deploy_service (cognitive 17) src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:37— ecs_worker.deploy_service has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 1 (2 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.
Automation.aread (cognitive 17) src/prefect/automations.py:191— Automation.aread has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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. This shape REPEATS in the file: one other method here (Automation.read) 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.
Automation.read (cognitive 17) src/prefect/automations.py:238— Automation.read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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. This shape REPEATS in the file: one other method here (Automation.aread) 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.
FileCollector._matches_exclusion (cognitive 17) src/prefect/bundles/_file_collector.py:374— FileCollector._matches_exclusion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 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.
FileCollector._validate_file_path (cognitive 17) src/prefect/bundles/_file_collector.py:410— FileCollector._validate_file_path has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (2 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 (FileCollector._collect_single_file) 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.
FileCollector._collect_single_file (cognitive 17) src/prefect/bundles/_file_collector.py:458— FileCollector._collect_single_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (2 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 (FileCollector._validate_file_path) 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.
cloud.workspace_set (cognitive 17) src/prefect/cli/cloud/__init__.py:375— cloud.workspace_set has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), error handling 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.
futures.wait (cognitive 17) src/prefect/futures.py:694— futures.wait has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (6 pts), boolean chains 1, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loggers.get_run_logger (cognitive 17) src/prefect/logging/loggers.py:101— loggers.get_run_logger has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EngineCommandStarter.start (cognitive 17) src/prefect/runner/_starter_engine.py:68— EngineCommandStarter.start has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4, error handling 2 (3 pts), boolean chains 1 (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.
EventAnyResourceFilter.build_where_clauses (cognitive 17) src/prefect/server/events/filters.py:523— EventAnyResourceFilter.build_where_clauses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReleaseFlowConcurrencySlots.after_transition (cognitive 17) src/prefect/server/orchestration/core_policy.py:884— ReleaseFlowConcurrencySlots.after_transition has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 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.
HandleFlowTerminalStateTransitions.before_transition (cognitive 17) src/prefect/server/orchestration/core_policy.py:1652— HandleFlowTerminalStateTransitions.before_transition has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (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.
TaskOrchestrationContext._validate_proposed_state (cognitive 17) src/prefect/server/orchestration/rules.py:449— TaskOrchestrationContext._validate_proposed_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 1 (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.
CronSchedule._get_dates_whenever (cognitive 17) src/prefect/server/schemas/schedules.py:669— CronSchedule._get_dates_whenever has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1, 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.
RRuleSchedule.to_rrule (cognitive 17) src/prefect/server/schemas/schedules.py:823— RRuleSchedule.to_rrule has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (8 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.
WorkerCleanupConnectionRegistry._dispatch_loop (cognitive 17) src/prefect/server/utilities/worker_channel_cleanup.py:267— WorkerCleanupConnectionRegistry._dispatch_loop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrefectBaseSettings._ser_model (cognitive 17) src/prefect/settings/base.py:167— PrefectBaseSettings._ser_model has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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.
base._add_environment_variables (cognitive 17) src/prefect/settings/base.py:229— base._add_environment_variables has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (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.
engine.capture_sigterm (cognitive 17) src/prefect/utilities/engine/__init__.py:273— engine.capture_sigterm has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, error handling 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
engine.propose_state (cognitive 17) src/prefect/utilities/engine/__init__.py:514— engine.propose_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 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.
BaseJobConfiguration.from_template_and_values (cognitive 17) src/prefect/workers/base.py:209— BaseJobConfiguration.from_template_and_values has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 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.
activity-chart.FlowRunsBarChart (cognitive 17) ui-v2/src/components/flow-runs/activity-chart/activity-chart.tsx:17— activity-chart.FlowRunsBarChart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4, boolean chains 2, loops 1 (nesting depth added 3). None of this is in the body itself: all 17 points belong to 6 function literals inside it that branch (lines 57, 70, 82, …). 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.
flow-run-graph.FlowRunGraph (cognitive 17) ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph.tsx:58— flow-run-graph.FlowRunGraph has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, ternaries 4 (5 pts), if/else 2 (nesting depth added 1). Of this number, 13 points are the body's own statements and 4 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.
date-time-picker.DateTimePicker (cognitive 17) ui-v2/src/components/ui/date-time-picker/date-time-picker.tsx:26— date-time-picker.DateTimePicker has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (5 pts), ternaries 5 (nesting depth added 1). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (handleTimeChange, a function literal at line 134, 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.
infrastructure-type-step.InfrastructureTypeStep (cognitive 17) ui-v2/src/components/work-pools/create/infrastructure-type-step/infrastructure-type-step.tsx:26— infrastructure-type-step.InfrastructureTypeStep has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (8 pts) (nesting depth added 3). None of this is in the body itself: all 17 points belong to 5 function literals inside it that branch (lines 38, 72, 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.
uiVersion.getVisibleBasePrefix (cognitive 17) REDACTED:59— uiVersion.getVisibleBasePrefix has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 4 (7 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.
utils.deploy_stack (cognitive 16) src/integrations/prefect-aws/prefect_aws/_cli/utils.py:250— utils.deploy_stack has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 3 (4 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ECSWorker._get_or_register_task_definition (cognitive 16) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:940— ECSWorker._get_or_register_task_definition has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ECSWorker._validate_task_definition (cognitive 16) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1026— ECSWorker._validate_task_definition has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6 (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.
ecs_worker._drop_empty_keys_from_dict (cognitive 16) src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:177— ecs_worker._drop_empty_keys_from_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BigQueryTargetConfigs.get_configs (cognitive 16) src/integrations/prefect-dbt/prefect_dbt/cli/configs/bigquery.py:70— BigQueryTargetConfigs.get_configs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
client.get_async_redis_client (cognitive 16) src/integrations/prefect-redis/prefect_redis/client.py:194— client.get_async_redis_client has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 4, if/else 2 (3 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.
connection._split_members (cognitive 16) src/integrations/prefect-redis/prefect_redis/connection.py:174— connection._split_members has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (2 pts), ternaries 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.
ValidatedFunction._build_fields (cognitive 16) src/prefect/_internal/pydantic/validated_func.py:97— ValidatedFunction._build_fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 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.
Block.get_code_example (cognitive 16) src/prefect/blocks/core.py:775— Block.get_code_example has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 1 (2 pts), boolean chains 1, 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.
Block._save_sync (cognitive 16) src/prefect/blocks/core.py:1788— Block._save_sync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, 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.
bundles._process_module_dependencies (cognitive 16) src/prefect/bundles/__init__.py:282— bundles._process_module_dependencies has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (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.
_server_utils.prestart_check (cognitive 16) src/prefect/cli/_server_utils.py:105— _server_utils.prestart_check has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (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.
artifact.delete (cognitive 16) src/prefect/cli/artifact.py:192— artifact.delete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 1 (2 pts), loops 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.
config.set_ (cognitive 16) src/prefect/cli/config.py:36— config.set_ has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 3 (6 pts), error handling 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.
profile.populate_defaults (cognitive 16) src/prefect/cli/profile.py:323— profile.populate_defaults has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), 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.
orchestration.get_client (cognitive 16) src/prefect/client/orchestration/__init__.py:200— orchestration.get_client has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
AutomationClient.find_automation (cognitive 16) src/prefect/client/orchestration/_automations/client.py:65— AutomationClient.find_automation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (4 pts), 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. This shape REPEATS in the file: one other method here (AutomationAsyncClient.find_automation) 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.
AutomationAsyncClient.find_automation (cognitive 16) src/prefect/client/orchestration/_automations/client.py:240— AutomationAsyncClient.find_automation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (4 pts), 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. This shape REPEATS in the file: one other method here (AutomationClient.find_automation) 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.
context.hydrated_context (cognitive 16) src/prefect/context.py:150— context.hydrated_context has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flows.safe_load_flow_from_entrypoint (cognitive 16) REDACTED:3404— flows.safe_load_flow_from_entrypoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, 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.
futures.as_completed (cognitive 16) src/prefect/futures.py:631— futures.as_completed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (4 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
configuration.setup_logging (cognitive 16) src/prefect/logging/configuration.py:81— configuration.setup_logging has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 2 (4 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlChannel.signal (cognitive 16) src/prefect/runner/_control_channel.py:228— ControlChannel.signal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (6 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.
GitRepository._clone_repo (cognitive 16) src/prefect/runner/storage.py:598— GitRepository._clone_repo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 1 (2 pts), boolean chains 1, 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.
workers.worker_channel_connect (cognitive 16) src/prefect/server/api/workers.py:1136— workers.worker_channel_connect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 5 (6 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EventTextFilter.build_where_clauses (cognitive 16) src/prefect/server/events/filters.py:676— EventTextFilter.build_where_clauses has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (6 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.
work_queues.create_work_queue (cognitive 16) src/prefect/server/models/work_queues.py:59— work_queues.create_work_queue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogFilterTextSearch._get_filter_list (cognitive 16) src/prefect/server/schemas/filters.py:1542— LogFilterTextSearch._get_filter_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (6 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.
postgres_listener.get_pg_notify_connection (cognitive 16) src/prefect/server/utilities/postgres_listener.py:83— postgres_listener.get_pg_notify_connection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
server._find_unpaired_surrogate (cognitive 16) src/prefect/server/utilities/server.py:48— server._find_unpaired_surrogate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task_engine.run_generator_task_sync (cognitive 16) src/prefect/task_engine.py:1793— task_engine.run_generator_task_sync has cognitive complexity 16 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 3 (4 pts), loops 2 (4 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.
TaskWorker._submit_scheduled_task_run (cognitive 16) src/prefect/task_worker.py:302— TaskWorker._submit_scheduled_task_run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.propose_state_sync (cognitive 16) src/prefect/utilities/engine/__init__.py:612— engine.propose_state_sync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 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.
engine.resolve_to_final_result (cognitive 16) src/prefect/utilities/engine/__init__.py:977— engine.resolve_to_final_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6 (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.
pydantic.handle_secret_render (cognitive 16) src/prefect/utilities/pydantic.py:345— pydantic.handle_secret_render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 1 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkPoolWorkerChannel._run (cognitive 16) src/prefect/workers/_worker_channel/_sync.py:237— WorkPoolWorkerChannel._run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (6 pts), loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
dashboard.RouteComponent (cognitive 16) ui-v2/src/routes/dashboard.tsx:778— dashboard.RouteComponent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, ternaries 3, match/switch 2 (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 5 function literals inside it that branch (lines 792, 956, 868, …). 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.
trigger-step.TriggerStep (cognitive 16) ui-v2/src/components/automations/automations-wizard/trigger-step/trigger-step.tsx:22— trigger-step.TriggerStep has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 68, 45, 98, …). 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.
use-delete-block-document-confirmation-dialog.useDeleteBlockDocumentConfirmationDialog (cognitive 16) ui-v2/src/components/blocks/use-delete-block-document-confirmation-dialog.ts:9— use-delete-block-document-confirmation-dialog.useDeleteBlockDocumentConfirmationDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 4 (6 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). None of this is in the body itself: all 16 points belong to 4 function items inside it that branch (handleConfirmDelete, handleConfirmDelete::handleDeleteBlockDocuments, a function literal at line 64, …). 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.
work-pool-flow-runs-tab.WorkPoolFlowRunsTab (cognitive 16) ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:24— work-pool-flow-runs-tab.WorkPoolFlowRunsTab has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, ternaries 1 (nesting depth added 2). 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 38, 83, 157, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
work-pool-queue-runs-tab.WorkPoolQueueRunsTab (cognitive 16) ui-v2/src/components/work-pools/work-pool-queue-runs-tab/work-pool-queue-runs-tab.tsx:26— work-pool-queue-runs-tab.WorkPoolQueueRunsTab has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, ternaries 1 (nesting depth added 2). 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 41, 96, 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.
detectHorizontalCollisions.clusterHorizontalCollisions (cognitive 16) ui-v2/src/graphs/utilities/detectHorizontalCollisions.ts:27— detectHorizontalCollisions.clusterHorizontalCollisions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 2). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (checkCollisions, clusterItems, a function literal at line 109). 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.
Change-coupling hub: concurrency_limits_v2.py → filesystem.py, memory.py, concurrency_limits_v2.py src/prefect/server/api/concurrency_limits_v2.py— `src/prefect/server/api/concurrency_limits_v2.py` changes together with 3 other files — `src/prefect/server/concurrency/lease_storage/filesystem.py`, `src/prefect/server/concurrency/lease_storage/memory.py`, `src/prefect/server/models/concurrency_limits_v2.py` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication· Near-duplicate member family (11 members, 24 shared lines) · ×1
Near-duplicate member family (11 members, 24 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38-812 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:23-230 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:23-240 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:244-462 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:36-91 | src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:22-98 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-854 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23-259 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:27-277 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:281-528 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:22-106 — These 11 members are variants of one another: a block of 24 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 11 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 11 times.
D4 · Code Duplication· Near-duplicate member family (8 members, 45 shared lines) · ×1
Near-duplicate member family (8 members, 45 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:22— src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:22-101 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:23-230 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:23-240 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:244-462 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:22-115 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23-259 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:27-277 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:281-528 — These 8 members are variants of one another: a block of 45 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 58 shared lines) · ×1
Near-duplicate member family (7 members, 58 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:23-230 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:23-240 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:244-462 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23-259 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:27-277 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:281-528 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:22-157 — These 7 members are variants of one another: a block of 58 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 55 shared lines) · ×1
Near-duplicate member family (7 members, 55 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38-812 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:23-120 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:36-178 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:129-221 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:23-134 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:36-192 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:128-234 — These 7 members are variants of one another: a block of 55 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 33 shared lines) · ×1
Near-duplicate member family (7 members, 33 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:23-120 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:22-157 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:129-221 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:23-134 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:22-153 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:22-157 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:128-234 — These 7 members are variants of one another: a block of 33 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Near-duplicate member family (7 members, 27 shared lines) · ×1
Near-duplicate member family (7 members, 27 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:23-57 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:22-101 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:23-230 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:23-240 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:244-462 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:23-64 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:22-115 — These 7 members are variants of one another: a block of 27 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Near-duplicate member family (6 members, 42 shared lines) · ×1
Near-duplicate member family (6 members, 42 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38-812 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:23-120 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:36-178 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-854 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:23-134 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:36-192 — These 6 members are variants of one another: a block of 42 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (6 members, 35 shared lines) · ×1
Near-duplicate member family (6 members, 35 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:23-120 | src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:22-98 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28-276 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:22-157 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:23-134 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:22-157 — These 6 members are variants of one another: a block of 35 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 34 shared lines) · ×1
Near-duplicate member family (5 members, 34 shared lines) src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23— src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23-259 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:27-277 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:281-528 | src/prefect/server/database/_migrations/versions/sqlite/2023_04_05_134301_3d46e23593d6_add_variables.py:22-67 | src/prefect/server/database/_migrations/versions/sqlite/2023_08_02_113813_5b0bd3b41a23_create_concurrency_limit_v2_table.py:23-63 — These 5 members are variants of one another: a block of 34 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 21 shared lines) · ×1
Near-duplicate member family (5 members, 21 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38-812 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:23-57 | src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py:22-53 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-854 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:23-64 — These 5 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 67 shared lines) · ×1
Near-duplicate member family (4 members, 67 shared lines) src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38— src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-854 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:23-134 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:36-192 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:128-234 — These 4 members are variants of one another: a block of 67 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 45 shared lines) · ×1
Near-duplicate member family (4 members, 45 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:38-812 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:22-101 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-854 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:22-115 — These 4 members are variants of one another: a block of 45 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 39 shared lines) · ×1
Near-duplicate member family (4 members, 39 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28-276 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:23-157 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:27-282 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:22-153 — These 4 members are variants of one another: a block of 39 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 33 shared lines) · ×1
Near-duplicate member family (4 members, 33 shared lines) src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:24— src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:24-174 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23-259 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:27-277 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:281-528 — These 4 members are variants of one another: a block of 33 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 26 shared lines) · ×1
Near-duplicate member family (4 members, 26 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28-276 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:25-86 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:27-282 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py:24-85 — These 4 members are variants of one another: a block of 26 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 22 shared lines) · ×1
Near-duplicate member family (4 members, 22 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:28-276 | src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:24-87 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:27-282 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:24-87 — These 4 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 15 shared lines) · ×1
Near-duplicate member family (4 members, 15 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:23— src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:23-70 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_10_145956_1c9390e2f9c6_replace_version_with_checksum_and_.py:24-151 | src/prefect/server/database/_migrations/versions/postgresql/2023_03_20_185238_d20618ce678e_add_artifact_collection_table.py:21-51 | src/prefect/server/database/_migrations/versions/postgresql/2023_12_07_095320_733ca1903976_create_flow_run_input_table.py:23-55 — These 4 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Near-duplicate member pair (225 shared lines) src/prefect/deployments/runner.py:1570— src/prefect/deployments/runner.py:1570-1798 | src/prefect/deployments/runner.py:1811-2039 — These two members are variants of one another: 225 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 (123 shared lines) src/prefect/_internal/states.py:183— src/prefect/_internal/states.py:183-316 | src/prefect/states.py:315-446 — These two members are variants of one another: 123 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 (117 shared lines) src/prefect/server/database/query_components.py:608— src/prefect/server/database/query_components.py:608-764 | src/prefect/server/database/query_components.py:911-1052 — These two members are variants of one another: 117 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 (104 shared lines) src/prefect/deployments/flow_runs.py:65— src/prefect/deployments/flow_runs.py:65-240 | src/prefect/deployments/flow_runs.py:258-443 — These two members are variants of one another: 104 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 (76 shared lines) src/prefect/flow_engine.py:1093— src/prefect/flow_engine.py:1093-1192 | src/prefect/flow_engine.py:1825-1922 — These two members are variants of one another: 76 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 (39 shared lines) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:817— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:817-899 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:859-924 — These two members are variants of one another: 39 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 (37 shared lines) src/prefect/cli/work_pool.py:1133— src/prefect/cli/work_pool.py:1133-1205 | src/prefect/cli/work_queue.py:677-759 — These two members are variants of one another: 37 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 (59 corresponding lines) · ×1
Edited copy of a member (59 corresponding lines) src/integrations/prefect-dbt/prefect_dbt/core/runner.py:749— src/integrations/prefect-dbt/prefect_dbt/core/runner.py:749-978 | src/integrations/prefect-dbt/prefect_dbt/core/runner.py:986-1066 — 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 (52 corresponding lines) · ×1
Edited copy of a member (52 corresponding lines) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:120— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:120-194 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23-259 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×1
Edited copy of a member (34 corresponding lines) src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_214717_4ff2f2bf81f4_adds_block_type_slug.py:37— src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_214717_4ff2f2bf81f4_adds_block_type_slug.py:37-74 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_142515_f335f9633eec_adds_block_type_slug.py:37-80 — 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) · ×1
Edited copy of a member (30 corresponding lines) src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:23— src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:23-77 | src/prefect/server/database/_migrations/versions/sqlite/2023_03_20_184534_b9aafc3ab936_add_artifact_collection_table.py:22-64 — 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· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) REDACTED:1482— REDACTED:1482-1651 | REDACTED:1682-1803 | REDACTED:2230-2396 | REDACTED:2847-2883 | src/prefect/runner/runner.py:351-420 | src/prefect/runner/runner.py:449-499 | src/prefect/tasks.py:2029-2215 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:41— src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:41-58 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:71-77 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:23-35 | src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py:41-58 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:73-81 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py:22-37 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Duplicated block (132 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:21— src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:21-152 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py:21-152 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py:156` calls `get_bind` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:157` 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 (127 lines × 2) scripts/backfill_release_notes.py:117— scripts/backfill_release_notes.py:117-243 | scripts/prepare_release_notes.py:125-251 — before extracting anything, compare `scripts/backfill_release_notes.py` and `scripts/prepare_release_notes.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 240 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (106–109 lines × 2) src/prefect/cli/work_pool.py:1431— src/prefect/cli/work_pool.py:1431-1536 | src/prefect/cli/work_pool.py:1576-1684 — both copies are in the same file, so extract the 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 (94 lines × 2) REDACTED:1212— REDACTED:1212-1305 | REDACTED:1339-1432 — both copies are in the same file, so extract the 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 (92 lines × 2) src/prefect/client/orchestration/_deployments/client.py:76— src/prefect/client/orchestration/_deployments/client.py:76-167 | src/prefect/client/orchestration/_deployments/client.py:783-874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (83 lines × 2) src/prefect/deployments/runner.py:1649— src/prefect/deployments/runner.py:1649-1731 | src/prefect/deployments/runner.py:1890-1972 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/runner.py:1649` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (79 lines × 2) scripts/backfill_release_notes.py:246— scripts/backfill_release_notes.py:246-324 | scripts/prepare_release_notes.py:264-342 — before extracting anything, compare `scripts/backfill_release_notes.py` and `scripts/prepare_release_notes.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 240 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (76 lines × 2) src/prefect/deployments/runner.py:1570— src/prefect/deployments/runner.py:1570-1645 | src/prefect/deployments/runner.py:1811-1886 — both copies are in the same file, so extract the 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 (70–75 lines × 2) src/prefect/deployments/flow_runs.py:65— src/prefect/deployments/flow_runs.py:65-134 | src/prefect/deployments/flow_runs.py:258-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.
Duplicated block (68 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:55— src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:55-122 | src/prefect/server/database/_migrations/versions/sqlite/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:57-124 — `src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py` 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 162 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (67 lines × 2) src/prefect/flow_runs.py:514— src/prefect/flow_runs.py:514-580 | src/prefect/flow_runs.py:643-709 — both copies are in the same file, so extract the 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 (65 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:577— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:577-641 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:670-734 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:577` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (64 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:172— src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:172-235 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py:171-234 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_110543_f98ae6d8e2cc_work_queue_data_migration.py:169` calls `get_bind` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_31_105442_1678f2fb8b33_work_queue_data_migration.py:168` 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 (15–63 lines × 2) src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:114— src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:114-128 | src/integrations/prefect-dbt/prefect_dbt/cli/commands.py:167-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (63 lines × 2) src/integrations/prefect-snowflake/prefect_snowflake/database.py:975— src/integrations/prefect-snowflake/prefect_snowflake/database.py:975-1037 | src/integrations/prefect-snowflake/prefect_snowflake/database.py:1060-1122 — both copies are in the same file, so extract the 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: `SnowflakeCredentials` names `prefect_snowflake` in one and `prefect_snowflake.credentials` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (61–63 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:126— src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:126-188 | src/prefect/server/database/_migrations/versions/sqlite/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:128-188 — `src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py` 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 162 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2025_09_17_091213_9e83011d1f2a_migrate_v1_concurrency_limits_to_v2.py:126` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (59–62 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/runner.py:770— src/integrations/prefect-dbt/prefect_dbt/core/runner.py:770-831 | src/integrations/prefect-dbt/prefect_dbt/core/runner.py:1000-1058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (58–60 lines × 2) src/integrations/prefect-aws/prefect_aws/s3.py:669— src/integrations/prefect-aws/prefect_aws/s3.py:669-728 | src/integrations/prefect-aws/prefect_aws/s3.py:745-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-aws/prefect_aws/s3.py:669` it does not close everything it opens, so those 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 (59–60 lines × 2) src/prefect/server/events/actions.py:163— src/prefect/server/events/actions.py:163-222 | src/prefect/server/events/actions.py:252-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/events/actions.py:163` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (51–58 lines × 2) src/prefect/client/orchestration/__init__.py:374— src/prefect/client/orchestration/__init__.py:374-431 | src/prefect/client/orchestration/__init__.py:1317-1367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/__init__.py:374` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (51–54 lines × 2) src/integrations/prefect-aws/prefect_aws/lambda_function.py:126— src/integrations/prefect-aws/prefect_aws/lambda_function.py:126-179 | src/integrations/prefect-aws/prefect_aws/lambda_function.py:195-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (51–53 lines × 2) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:705— src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:705-755 | src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:1140-1192 — both copies are in the same file, so extract the 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 (52 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:463— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:463-514 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:668-719 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:543-594 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:786-837 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:463` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (52 lines × 2) src/integrations/prefect-aws/prefect_aws/client_waiter.py:22— src/integrations/prefect-aws/prefect_aws/client_waiter.py:22-73 | src/integrations/prefect-aws/prefect_aws/client_waiter.py:87-138 — both copies are in the same file, so extract the 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: `AwsCredentials` names `prefect_aws` in one and `prefect_aws.credentials` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (49–52 lines × 2) src/integrations/prefect-azure/prefect_azure/deployments/steps.py:80— src/integrations/prefect-azure/prefect_azure/deployments/steps.py:80-131 | src/integrations/prefect-azure/prefect_azure/deployments/steps.py:165-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.
Duplicated block (46–52 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:22— src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:22-73 | src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:22-67 — `src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py` 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 92 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. 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 (49–51 lines × 2) src/prefect/task_engine.py:562— src/prefect/task_engine.py:562-610 | src/prefect/task_engine.py:1221-1271 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `state` to `State[R]` in one and `State` 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 (49 lines × 2) src/integrations/prefect-gcp/prefect_gcp/bigquery.py:657— src/integrations/prefect-gcp/prefect_gcp/bigquery.py:657-705 | src/integrations/prefect-gcp/prefect_gcp/bigquery.py:741-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: `GcpCredentials` names `prefect_gcp` in one and `prefect_gcp.credentials` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (47–49 lines × 2) src/prefect/_internal/states.py:183— src/prefect/_internal/states.py:183-231 | src/prefect/states.py:315-361 — before extracting anything, compare `src/prefect/_internal/states.py` and `src/prefect/states.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 210 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 (46–47 lines × 2) src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1265— src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1265-1311 | src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py:1345-1390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (45 lines × 3) src/prefect/_internal/versioning.py:143— src/prefect/_internal/versioning.py:143-187 | src/prefect/_internal/versioning.py:207-251 | src/prefect/_internal/versioning.py:271-315 — 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 (43 lines × 2) src/prefect/client/orchestration/_deployments/client.py:473— src/prefect/client/orchestration/_deployments/client.py:473-515 | src/prefect/client/orchestration/_deployments/client.py:1187-1229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41–43 lines × 2) src/prefect/infrastructure/provisioners/coiled.py:92— src/prefect/infrastructure/provisioners/coiled.py:92-132 | src/prefect/infrastructure/provisioners/modal.py:99-141 — before extracting anything, compare `src/prefect/infrastructure/provisioners/coiled.py` and `src/prefect/infrastructure/provisioners/modal.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (41 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:308— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:308-348 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:541-581 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:363-403 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:634-674 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:308` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:583` calls `Column`, `String` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:350` 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 (38–41 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:209— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:209-246 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:211-251 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:209` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35–39 lines × 2) src/prefect/server/services/scheduler.py:247— src/prefect/server/services/scheduler.py:247-285 | src/prefect/server/services/scheduler.py:324-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/services/scheduler.py:247` it begins part-way through the construct above it, so those 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 (37–38 lines × 2) src/prefect/client/orchestration/_flow_runs/client.py:140— src/prefect/client/orchestration/_flow_runs/client.py:140-177 | src/prefect/client/orchestration/_flow_runs/client.py:667-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–37 lines × 2) src/integrations/prefect-dbt/prefect_dbt/cloud/_executor.py:218— src/integrations/prefect-dbt/prefect_dbt/cloud/_executor.py:218-254 | src/integrations/prefect-dbt/prefect_dbt/cloud/_executor.py:330-347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (36–37 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_05_10_145956_1c9390e2f9c6_replace_version_with_checksum_and_.py:99— src/prefect/server/database/_migrations/versions/postgresql/2022_05_10_145956_1c9390e2f9c6_replace_version_with_checksum_and_.py:99-134 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:106-142 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_10_145956_1c9390e2f9c6_replace_version_with_checksum_and_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (35 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:155— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:155-189 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:165-199 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:387-421 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:155` it begins part-way through the construct above it, so those exact lines 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–34 lines × 3) scripts/backfill_release_notes.py:257— scripts/backfill_release_notes.py:257-290 | scripts/prepare_integration_release_notes.py:281-309 | scripts/prepare_release_notes.py:275-308 — before extracting anything, compare `scripts/backfill_release_notes.py` and `scripts/prepare_release_notes.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 240 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (33–34 lines × 2) REDACTED:264— REDACTED:264-297 | src/prefect/tasks.py:437-469 — 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:264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (32–34 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:31— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:31-62 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:30-63 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:31` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–33 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_04_21_095519_14dc68cc5853_backfill_state_name.py:27— src/prefect/server/database/_migrations/versions/postgresql/2022_04_21_095519_14dc68cc5853_backfill_state_name.py:27-59 | src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:46-78 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_21_113057_db6bde582447_backfill_state_name.py:27-53 | src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py:46-72 — `src/prefect/server/database/_migrations/versions/postgresql/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_10_12_102048_22b7cb02e593_add_state_timestamp.py` 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 92 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. 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 (28–31 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:82— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:82-109 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:186-216 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:96-123 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:199-229 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` and `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:81` calls `Column`, `String`, `Boolean` and `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:186` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–31 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:194— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:194-212 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:111-141 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:111-141 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:194` it begins part-way through the construct above it, so those exact lines 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 × 3) src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:64— src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:64-94 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:86-114 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:336-366 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 247 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py: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.
Duplicated block (19–31 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:22— src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:22-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_151028_88c2112b668f_update_deployments_to_include_more_.py:35-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (30 lines × 2) src/prefect/client/orchestration/_deployments/client.py:562— src/prefect/client/orchestration/_deployments/client.py:562-591 | src/prefect/client/orchestration/_deployments/client.py:1276-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 (27–30 lines × 2) src/prefect/flow_engine.py:1163— src/prefect/flow_engine.py:1163-1192 | src/prefect/flow_engine.py:1896-1922 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:1896` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28–30 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:89— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:89-116 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:92-121 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:89` it begins part-way through the construct above it, so those 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 (29 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:36— src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:36-64 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df465_migrate_artifact_data.py:95-123 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:38-66 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c26_migrate_artifact_data.py:97-125 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 98 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 (29 lines × 3) src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:130— src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:130-158 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:150-178 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:402-430 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 247 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:130` it begins part-way through the construct above it, so those exact lines 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–29 lines × 2) REDACTED:2350— REDACTED:2350-2372 | src/prefect/tasks.py:2157-2185 — 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:2350` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:53— src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:53-80 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:108-135 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:60-87 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:122-149 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:53` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–28 lines × 3) src/prefect/server/api/concurrency_limits.py:256— src/prefect/server/api/concurrency_limits.py:256-282 | src/prefect/server/api/concurrency_limits.py:326-353 | src/prefect/server/api/concurrency_limits.py:382-408 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/api/concurrency_limits.py:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (26–28 lines × 2) src/prefect/utilities/engine/__init__.py:190— src/prefect/utilities/engine/__init__.py:190-215 | src/prefect/utilities/engine/__init__.py:242-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/utilities/engine/__init__.py:190` it begins part-way through the construct above it, so those 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 (25–27 lines × 3) src/prefect/server/models/work_queues.py:432— src/prefect/server/models/work_queues.py:432-456 | src/prefect/server/models/workers.py:384-410 | src/prefect/server/models/workers.py:835-861 — 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. 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 (23–27 lines × 2) src/integrations/prefect-azure/prefect_azure/repository.py:147— src/integrations/prefect-azure/prefect_azure/repository.py:147-169 | src/integrations/prefect-gitlab/prefect_gitlab/repositories.py:158-184 — 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 (25–27 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:28— src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:28-52 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py:27-53 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:28` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23–26 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:434— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:434-456 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:506-531 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:434` it does not close everything it opens, so those 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 (25 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:49— src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:49-73 | src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:107-131 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:66-90 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:124-148 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 3) src/prefect/deployments/runner.py:1250— src/prefect/deployments/runner.py:1250-1274 | src/prefect/deployments/runner.py:1383-1407 | src/prefect/deployments/runner.py:1522-1546 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/runner.py:1250` it begins part-way through the construct above it, so those exact lines 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–25 lines × 2) src/prefect/flow_engine.py:1243— src/prefect/flow_engine.py:1243-1267 | src/prefect/flow_engine.py:1980-1999 — both copies are in the same file, so extract the 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 (23–25 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:483— src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:483-507 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:733-755 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:483` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:481` calls `create_index`, `f` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:732` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–24 lines × 2) src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:735— src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run.py:735-753 | REDACTED:1358-1381 — 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 (23 lines × 37) src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38— src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38-60 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:76-98 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:124-146 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:170-192 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:210-232 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:262-284 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:341-363 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:525-547 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:612-634 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:768-790 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py:23-45 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:23-45 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:22-44 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:67-89 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:23-45 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:24-46 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:23-45 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:68-90 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:36-58 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:98-120 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:26-48 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:78-100 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:143-165 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:48-70 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:98-120 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:163-185 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:298-320 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:350-372 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:415-437 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:24-46 | src/prefect/server/database/_migrations/versions/sqlite/2023_03_20_184534_b9aafc3ab936_add_artifact_collection_table.py:24-46 | src/prefect/server/database/_migrations/versions/sqlite/2023_04_05_134301_3d46e23593d6_add_variables.py:24-46 | src/prefect/server/database/_migrations/versions/sqlite/2023_08_02_113813_5b0bd3b41a23_create_concurrency_limit_v2_table.py:23-45 | src/prefect/server/database/_migrations/versions/sqlite/2023_12_07_095112_a299308852a7_create_flow_run_input_table.py:23-45 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:24-46 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:128-150 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:173-195 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:38` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:23` calls `execute` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:36` 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 (23 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:35— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:35-57 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:141-163 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:42-64 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:147-169 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` and `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:35` it begins part-way through the construct above it, so those exact lines 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–23 lines × 3) src/prefect/server/models/block_schemas.py:345— src/prefect/server/models/block_schemas.py:345-365 | src/prefect/server/models/block_schemas.py:684-706 | src/prefect/server/models/block_schemas.py:796-816 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/block_schemas.py:345` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/models/block_schemas.py:710` calls `order_by`, `asc` and `src/prefect/server/models/block_schemas.py:366` 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 (22–23 lines × 2) src/prefect/cli/work_queue.py:570— src/prefect/cli/work_queue.py:570-592 | src/prefect/cli/work_queue.py:615-636 — both copies are in the same file, so extract the 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–22 lines × 6) src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:65— src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:65-86 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:120-141 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:96-113 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:72-93 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:134-155 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:96-113 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:65` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 6) src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:120— src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:120-141 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:183-204 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:140-161 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:203-224 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:392-413 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:455-476 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 247 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:120` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–22 lines × 2) src/prefect/_internal/schemas/validators.py:513— src/prefect/_internal/schemas/validators.py:513-529 | src/prefect/_internal/schemas/validators.py:569-590 — both copies are in the same file, so extract the 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 `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 (21–22 lines × 2) src/prefect/blocks/redis.py:91— src/prefect/blocks/redis.py:91-111 | src/prefect/blocks/redis.py:132-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–21 lines × 22) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:189— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:189-209 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:210-229 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:199-219 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:220-239 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:421-441 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:442-461 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:44-64 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:65-85 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:152-172 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_152801_0a1250a5aa25_expand_work_queue_table.py:173-193 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:213-233 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:234-254 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:233-253 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:254-274 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:485-505 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:506-526 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:113-133 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:135-155 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:65-85 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:86-106 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:154-172 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:173-193 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:189` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_25_114348_b9bda9f142f1_expand_work_queue_table.py:152` calls `alter_column`, `batch_alter_table` and `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:189` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–21 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:396— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:396-416 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:624-638 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:451-471 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:717-731 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:396` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–20 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:67— src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:67-86 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:111-129 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:111-129 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 256 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 3) src/prefect/server/worker_communication/cleanup_queue/memory.py:263— src/prefect/server/worker_communication/cleanup_queue/memory.py:263-282 | src/prefect/server/worker_communication/cleanup_queue/memory.py:316-335 | src/prefect/server/worker_communication/cleanup_queue/memory.py:380-399 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/worker_communication/cleanup_queue/memory.py:314` calls `ValueError` and `src/prefect/server/worker_communication/cleanup_queue/memory.py:262` 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–20 lines × 2) src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:208— src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:208-217 | src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:291-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–20 lines × 2) src/integrations/prefect-dbt/prefect_dbt/core/_manifest.py:320— src/integrations/prefect-dbt/prefect_dbt/core/_manifest.py:320-339 | src/integrations/prefect-dbt/prefect_dbt/core/_manifest.py:463-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–20 lines × 2) src/prefect/deployments/flow_runs.py:195— src/prefect/deployments/flow_runs.py:195-212 | src/prefect/deployments/flow_runs.py:392-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/deployments/flow_runs.py:195` it begins part-way through the construct above it, so those exact lines 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 × 6) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:41— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:41-59 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:51-69 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:273-291 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:51-69 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:73-91 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:323-341 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–19 lines × 3) src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:263— src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:263-281 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:27-45 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:281-296 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 247 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–19 lines × 2) src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:779— src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:779-797 | src/integrations/prefect-dbt/prefect_dbt/cloud/jobs.py:1108-1124 — both copies are in the same file, so extract the 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 (18 lines × 5) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:207— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:207-224 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:47-64 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:153-170 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:54-71 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:159-176 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 4) REDACTED:843— REDACTED:843-860 | REDACTED:866-883 | REDACTED:986-1003 | REDACTED:1011-1028 — 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 (16–18 lines × 3) src/prefect/cli/work_pool.py:1423— src/prefect/cli/work_pool.py:1423-1438 | src/prefect/cli/work_pool.py:1568-1585 | src/prefect/cli/work_pool.py:1716-1733 — 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 (17–18 lines × 2) src/prefect/client/orchestration/_blocks_types/client.py:127— src/prefect/client/orchestration/_blocks_types/client.py:127-144 | src/prefect/client/orchestration/_blocks_types/client.py:308-324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/client/orchestration/_blocks_types/client.py:308` it begins part-way through the construct above it, so those exact lines 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–18 lines × 2) src/prefect/server/services/scheduler.py:72— src/prefect/server/services/scheduler.py:72-89 | src/prefect/server/services/scheduler.py:91-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/services/scheduler.py:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 8) src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:77— src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:77-93 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:82-98 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:92-108 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:314-330 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:91-107 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:102-118 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:122-138 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:374-390 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 6) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:273— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:273-287 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:504-520 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:709-725 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:321-335 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:584-600 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:827-843 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:273` it begins part-way through the construct above it, so those exact lines 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 × 6) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:104— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:104-120 | src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:56-72 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:190-206 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:107-123 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:118-134 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:107-123 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` and `src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:104` it begins part-way through the construct above it, so those exact lines 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 × 5) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:142— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:142-158 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:214-230 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:54-70 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:84-100 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:160-176 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:140` calls `create_index`, `f` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:213` 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–17 lines × 2) src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:19— src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py:19-31 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py:24-40 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_04_23_132803_d38c5e6a9115_rename_block_to_blockbasis_and_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_04_23_114831_fd966d4ad99c_rename_block_to_blockbasis_and_.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14–16 lines × 95) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:44— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:44-57 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:75-88 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:116-129 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:155-168 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:188-201 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:227-240 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:299-312 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:458-471 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:532-545 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:663-676 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:29-42 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:29-42 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:28-41 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:66-79 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:29-42 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_10_145956_1c9390e2f9c6_replace_version_with_checksum_and_.py:30-43 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:29-42 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:67-80 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:42-55 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:97-110 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:29-42 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:71-84 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:128-141 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:39-52 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:81-94 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:138-151 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:261-274 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:303-316 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:360-373 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:28-41 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:47-60 | src/prefect/server/database/_migrations/versions/postgresql/2023_03_20_185238_d20618ce678e_add_artifact_collection_table.py:27-40 | src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py:28-41 | src/prefect/server/database/_migrations/versions/postgresql/2023_08_02_133838_5f623ddbf7fe_create_concurrency_limit_v2_table.py:28-41 | src/prefect/server/database/_migrations/versions/postgresql/2023_12_07_095320_733ca1903976_create_flow_run_input_table.py:29-42 | src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:28-41 | src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:35-48 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:59-72 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:117-130 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:173-186 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:243-256 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_09_125658_916718e8330f_automation_event_follower.py:49-62 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:38-51 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:112-125 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:84-97 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:135-148 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:173-186 | src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:48-61 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:49-64 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:87-102 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:135-150 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:181-196 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:221-236 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:273-288 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:352-367 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:536-551 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:623-638 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:779-794 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py:34-49 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:34-49 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:33-48 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:78-93 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:34-49 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:35-50 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:34-49 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:79-94 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:47-62 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:109-124 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:37-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:89-104 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:154-169 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:59-74 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:109-124 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:174-189 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:309-324 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:361-376 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:426-441 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:35-50 | src/prefect/server/database/_migrations/versions/sqlite/2023_03_20_184534_b9aafc3ab936_add_artifact_collection_table.py:35-50 | src/prefect/server/database/_migrations/versions/sqlite/2023_04_05_134301_3d46e23593d6_add_variables.py:35-50 | src/prefect/server/database/_migrations/versions/sqlite/2023_08_02_113813_5b0bd3b41a23_create_concurrency_limit_v2_table.py:34-49 | src/prefect/server/database/_migrations/versions/sqlite/2023_12_07_095112_a299308852a7_create_flow_run_input_table.py:34-49 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:35-50 | src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py:35-50 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:58-73 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:120-135 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:175-190 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:246-261 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py:48-63 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:37-52 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:111-126 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:84-97 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:139-154 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:184-199 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:48-63 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:131` calls `Column`, `Integer` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:59` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–16 lines × 7) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:212— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:212-225 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:52-65 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:82-95 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:158-171 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:59-74 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:89-104 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:164-179 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:212` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–16 lines × 6) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:96— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:96-107 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:151-166 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:106-117 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:161-176 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:328-339 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:383-398 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:96` it begins part-way through the construct above it, so those 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–16 lines × 5) src/prefect/server/models/artifacts.py:317— src/prefect/server/models/artifacts.py:317-331 | src/prefect/server/models/artifacts.py:363-377 | src/prefect/server/models/deployments.py:612-625 | src/prefect/server/models/flow_runs.py:328-342 | src/prefect/server/models/flows.py:248-263 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/models/artifacts.py: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–16 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:26— src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:26-37 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:247-259 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:39-54 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:290-304 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:37` calls `drop_index`, `drop_constraint` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:25` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–16 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:360— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:360-371 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:78-93 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:415-426 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:360` it begins part-way through the construct above it, so those 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–16 lines × 2) src/prefect/task_engine.py:884— src/prefect/task_engine.py:884-899 | src/prefect/task_engine.py:1553-1563 — both copies are in the same file, so extract the 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–15 lines × 19) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:276— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:276-285 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:508-518 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:713-723 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:100-112 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:74-88 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:129-143 | src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:52-64 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:186-198 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:256-268 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:103-115 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:205-219 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:324-333 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:588-598 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:831-841 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:114-126 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:81-95 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:143-157 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:103-115 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:218-232 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:275` calls `Column`, `UUID`, `ForeignKeyConstraint` and `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:100` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 7) REDACTED:1593— REDACTED:1593-1607 | REDACTED:1788-1802 | REDACTED:2356-2370 | REDACTED:2853-2867 | src/prefect/runner/runner.py:392-406 | src/prefect/runner/runner.py:484-498 | src/prefect/tasks.py:2169-2183 — there are 7 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1593` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 5) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:251— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:251-265 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:357-370 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:79-93 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:299-313 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:412-425 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:251` it begins part-way through the construct above it, so those exact lines 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 × 5) src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py:38— src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py:38-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:24-38 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:42-56 | src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_151028_88c2112b668f_update_deployments_to_include_more_.py:38-52 | src/prefect/server/database/_migrations/versions/sqlite/2024_09_16_162719_4ad4658cbefe_add_deployment_to_global_concurrency_.py:22-36 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_07_25_233637_add97ce1937d_update_deployments_to_include_more_.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_07_25_151028_88c2112b668f_update_deployments_to_include_more_.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2022_07_11_113314_638cbcc2a158_add_infrastructure_block_id_to_.py:22` calls `execute` and `src/prefect/server/database/_migrations/versions/sqlite/2024_09_16_162719_4ad4658cbefe_add_deployment_to_global_concurrency_.py:21` 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 (15 lines × 3) src/prefect/server/events/filters.py:369— src/prefect/server/events/filters.py:369-383 | src/prefect/server/events/filters.py:454-468 | src/prefect/server/events/filters.py:560-574 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/events/filters.py:451` calls `pop`, `in_` and `src/prefect/server/events/filters.py:367` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–15 lines × 3) src/prefect/server/services/cancellation_cleanup.py:466— src/prefect/server/services/cancellation_cleanup.py:466-480 | src/prefect/server/services/cancellation_cleanup.py:520-534 | src/prefect/server/services/pause_expirations.py:69-81 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/services/cancellation_cleanup.py:466` it begins part-way through the construct above it, so those exact lines 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–15 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:88— src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:88-99 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py:69-83 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:87` calls `PrimaryKeyConstraint`, `f` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_09_125712_cc510aec4689_automation_event_follower.py: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 (14 lines × 13) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:94— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:94-107 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:149-162 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:104-117 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:159-172 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:326-339 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:381-394 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:68-81 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:114-127 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:177-190 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:134-147 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:197-210 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:386-399 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:449-462 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:108` calls `create_index`, `f` and `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:163` 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 (10–14 lines × 6) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:64— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:64-73 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:175-186 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:54-64 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:71-82 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:203-216 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:61-73 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py: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. 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 lines × 3) src/prefect/events/clients.py:407— src/prefect/events/clients.py:407-420 | src/prefect/events/clients.py:830-843 | src/prefect/logging/clients.py:261-274 — `src/prefect/events/clients.py` and `src/prefect/logging/clients.py` 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 43 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 (12–14 lines × 2) src/prefect/deployments/runner.py:1645— src/prefect/deployments/runner.py:1645-1656 | REDACTED:1572-1585 — 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 lines × 4) src/prefect/flow_engine.py:1066— src/prefect/flow_engine.py:1066-1078 | src/prefect/flow_engine.py:1798-1810 | src/prefect/task_engine.py:497-509 | src/prefect/task_engine.py:1142-1154 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/flow_engine.py:1066` it begins part-way through the construct above it, so those exact lines 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–13 lines × 3) src/prefect/cli/artifact.py:79— src/prefect/cli/artifact.py:79-87 | src/prefect/cli/global_concurrency_limit.py:58-70 | src/prefect/cli/variable.py:71-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/global_concurrency_limit.py:58` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 3) src/prefect/filesystems.py:190— src/prefect/filesystems.py:190-202 | src/prefect/filesystems.py:212-223 | src/prefect/filesystems.py:281-293 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–13 lines × 2) src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:106— src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:106-118 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:71-81 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 6) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:108— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:108-114 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:519-530 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:59-69 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:69-79 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:291-301 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:122-130 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:108` it does not close everything it opens, so those 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 × 4) src/prefect/cli/concurrency_limit.py:161— src/prefect/cli/concurrency_limit.py:161-172 | src/prefect/cli/flow_run.py:307-317 | src/prefect/cli/task_run.py:176-186 | src/prefect/cli/work_pool.py:561-572 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/concurrency_limit.py:161` it does not close everything it opens, so those 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 (12 lines × 4) src/prefect/deployments/runner.py:1104— src/prefect/deployments/runner.py:1104-1115 | src/prefect/deployments/runner.py:1255-1266 | src/prefect/deployments/runner.py:1386-1397 | src/prefect/deployments/runner.py:1525-1536 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–12 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:135— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:135-146 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:48-55 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:156-167 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py:55-62 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 3) src/integrations/prefect-aws/prefect_aws/s3.py:1049— src/integrations/prefect-aws/prefect_aws/s3.py:1049-1060 | src/integrations/prefect-aws/prefect_aws/s3.py:1104-1115 | src/integrations/prefect-azure/prefect_azure/blob_storage.py:670-681 — 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. 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 × 3) src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:86— src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:86-97 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:67-77 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:196-207 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000042_f92143d30c24_implement_artifact_table.py:86` it begins part-way through the construct above it, so those 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) src/prefect/cli/deployment.py:598— src/prefect/cli/deployment.py:598-609 | src/prefect/cli/flow_run.py:759-765 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/deployment.py:598` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–12 lines × 2) src/prefect/server/events/actions.py:1361— src/prefect/server/events/actions.py:1361-1372 | src/prefect/server/events/actions.py:1437-1446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 63) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:50— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:50-60 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:81-89 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:122-130 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:161-171 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:194-204 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:233-243 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:305-315 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:482-491 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:538-548 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:687-696 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:35-43 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:35-45 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:34-44 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:72-82 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:35-43 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_10_145956_1c9390e2f9c6_replace_version_with_checksum_and_.py:36-44 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:73-81 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:48-58 | src/prefect/server/database/_migrations/versions/postgresql/2022_05_28_081821_2fe6fe6ca16e_adds_block_schema_references_and_block_.py:103-113 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:35-43 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:77-87 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:134-142 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:45-53 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:87-97 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:144-152 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:267-275 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:309-319 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:366-374 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:53-61 | src/prefect/server/database/_migrations/versions/postgresql/2023_03_20_185238_d20618ce678e_add_artifact_collection_table.py:33-41 | src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py:34-42 | src/prefect/server/database/_migrations/versions/postgresql/2023_12_07_095320_733ca1903976_create_flow_run_input_table.py:35-43 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:57-67 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:95-103 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:143-151 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:189-199 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:229-239 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:281-291 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:360-370 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:562-571 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:631-641 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:805-814 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py:42-50 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:42-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:41-51 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:86-96 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:42-50 | src/prefect/server/database/_migrations/versions/sqlite/2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py:43-51 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:87-95 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:55-65 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_28_081650_e73c6f1fe752_adds_block_schema_referecnes_and_block_.py:117-127 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:45-53 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:97-107 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:162-170 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:67-75 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:117-127 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:182-190 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:317-325 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:369-379 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:434-442 | src/prefect/server/database/_migrations/versions/sqlite/2023_03_20_184534_b9aafc3ab936_add_artifact_collection_table.py:43-52 | src/prefect/server/database/_migrations/versions/sqlite/2023_04_05_134301_3d46e23593d6_add_variables.py:43-51 | src/prefect/server/database/_migrations/versions/sqlite/2023_12_07_095112_a299308852a7_create_flow_run_input_table.py:42-50 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:130` calls `Column`, `String`, `Integer` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:60` 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–11 lines × 21) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:274— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:274-282 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:505-515 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:710-720 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:91-101 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:147-156 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:101-111 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:157-166 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:323-333 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:379-388 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_31_133052_2a88656f4a23_clean_up_work_queue_migration.py:66-75 | src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:50-59 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:322-330 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:585-595 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:828-838 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:111-121 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:175-184 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:131-141 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:195-204 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:383-393 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:447-456 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_22_120214_265eb1a2da4c_create_deployment_schedule_and_add_.py:59-68 — there are 21 copies across 9 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 21 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2024_01_22_120615_8cf4d4933848_create_deployment_schedule_and_add_.py:49` calls `Column`, `Boolean` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:274` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:439— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:439-448 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:643-653 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:512-521 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:755-764 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:439` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–11 lines × 2) src/integrations/prefect-gcp/prefect_gcp/models/cloud_run_v2.py:107— src/integrations/prefect-gcp/prefect_gcp/models/cloud_run_v2.py:107-117 | src/integrations/prefect-gcp/prefect_gcp/models/cloud_run_v2.py:360-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 `src/integrations/prefect-gcp/prefect_gcp/models/cloud_run_v2.py:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–11 lines × 2) src/prefect/runner/storage.py:279— src/prefect/runner/storage.py:279-289 | src/prefect/runner/storage.py:326-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 9) src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:83— src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:83-91 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:37-45 | src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py:53-62 | src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:188-196 | src/prefect/server/database/_migrations/versions/sqlite/2022_05_12_203158_888a0bb0df7b_add_flow_run_alerts.py:97-105 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:78-87 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:37-45 | src/prefect/server/database/_migrations/versions/sqlite/2025_03_19_145018_bbca16f6f218_create_new_deployment_version_table.py:53-62 | src/prefect/server/database/_migrations/versions/sqlite/2025_04_28_133722_7655f31c5157_remove_flow_run_notifications.py:201-209 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py` and `src/prefect/server/database/_migrations/versions/postgresql/2025_03_19_145033_06b7c293bc69_create_new_deployment_version_table.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_05_12_202952_dc7a3c6fd3e9_add_flow_run_alerts.py:81` calls `Column`, `String` and `src/prefect/server/database/_migrations/versions/postgresql/2025_04_29_112902_4160a4841eed_remove_flow_run_notifications.py:186` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–10 lines × 7) src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:48— src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:48-57 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:94-101 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:56-63 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:66-73 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:288-295 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:55-64 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:108-115 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:48` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 5) src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:691— src/integrations/prefect-dbt/prefect_dbt/core/_orchestrator.py:691-700 | src/prefect/client/orchestration/_deployments/client.py:577-586 | src/prefect/client/orchestration/_deployments/client.py:1291-1300 | src/prefect/client/orchestration/_flow_runs/client.py:160-169 | src/prefect/client/orchestration/_flow_runs/client.py:687-696 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9–10 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:23— src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:23-31 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:66-75 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:22-30 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py:65-74 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_10_104304_824e9edafa60_adds_events_tables.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:23` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:31` calls `Column`, `Text`, `JSON` and `src/prefect/server/database/_migrations/versions/postgresql/2024_04_10_194742_15768c2ec702_add_events_and_event_resources_tables.py:75` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–10 lines × 2) src/prefect/server/database/query_components.py:699— src/prefect/server/database/query_components.py:699-708 | src/prefect/server/database/query_components.py:995-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:699` it begins part-way through the construct above it, so those 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) src/prefect/server/database/query_components.py:730— src/prefect/server/database/query_components.py:730-739 | src/prefect/server/database/query_components.py:1024-1032 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:730` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/query_components.py:1023` calls `distinct`, `join` and `src/prefect/server/database/query_components.py:730` 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–9 lines × 6) src/prefect/cli/artifact.py:78— src/prefect/cli/artifact.py:78-84 | src/prefect/cli/block.py:288-294 | src/prefect/cli/concurrency_limit.py:167-173 | src/prefect/cli/global_concurrency_limit.py:57-65 | src/prefect/cli/variable.py:70-76 | src/prefect/cli/work_pool.py:567-573 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/artifact.py:78` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–9 lines × 5) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:849— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:849-857 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:863-869 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:864-872 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:884-890 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:891-894 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:860` calls `drop_table` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:872` 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 × 4) src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:26— src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:26-34 | src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:39-47 | src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py:26-36 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:39-49 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:237— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:237-245 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:23-31 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:244-252 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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–9 lines × 3) src/prefect/server/models/variables.py:99— src/prefect/server/models/variables.py:99-107 | src/prefect/server/models/workers.py:159-166 | src/prefect/server/models/workers.py:679-686 — 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. 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 (4–9 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:859— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:859-862 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:879-887 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:910-917 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:910` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:879` calls `drop_table` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:859` 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–9 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:44— src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:44-47 | src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py:44-52 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_04_093838_619bea85701a_block_data.py:51-54 | src/prefect/server/database/_migrations/versions/sqlite/2023_04_05_134301_3d46e23593d6_add_variables.py:53-61 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:44` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py:44` calls `Column` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_5f376def75c3_block_data.py:44` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 2) src/prefect/server/database/query_components.py:688— src/prefect/server/database/query_components.py:688-696 | src/prefect/server/database/query_components.py:986-993 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/query_components.py:688` it begins part-way through the construct above it, so those exact lines 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 × 6) src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:66— src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:66-73 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:88-95 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py:338-345 | src/prefect/server/database/_migrations/versions/sqlite/2023_04_05_134301_3d46e23593d6_add_variables.py:58-65 | src/prefect/server/database/_migrations/versions/sqlite/2023_08_02_113813_5b0bd3b41a23_create_concurrency_limit_v2_table.py:57-63 | src/prefect/server/database/_migrations/versions/sqlite/2024_03_13_111316_bacc60edce16_create_csrf_token_toble.py:50-57 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/sqlite/2023_01_08_175327_bb38729c471a_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 247 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:66` it begins part-way through the construct above it, so those exact lines 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 × 4) src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:54— src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:54-60 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:64-70 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:286-292 | src/prefect/server/database/_migrations/versions/postgresql/2023_03_20_185238_d20618ce678e_add_artifact_collection_table.py:42-49 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 250 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:223— src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:223-230 | src/prefect/server/database/_migrations/versions/postgresql/2026_10_19_000000_e7f54680bce3_add_automation_held_event.py:26-33 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:226-233 | src/prefect/server/database/_migrations/versions/sqlite/2026_10_19_000000_8f5eda7c1dd7_add_automation_held_event.py:26-33 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py` and `src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 199 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:223` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) src/prefect/client/orchestration/__init__.py:593— src/prefect/client/orchestration/__init__.py:593-600 | src/prefect/client/orchestration/__init__.py:686-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (7 lines × 6) src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:52— src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py:52-58 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:71-77 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045502_2882cd2df466_cleanup_artifact_migration.py:29-35 | src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py:52-58 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:75-81 | src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000044_f92143d30c27_cleanup_artifact_migration.py:31-37 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_08_07_134410_77eb737fc759_add_work_queue_name_to_runs.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_08_07_134138_575634b7acd4_add_work_queue_name_to_runs.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2023_01_12_000043_f92143d30c25_create_migration_index.py:73` calls `execute` and `src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045501_2882cd2df464_create_migration_index.py:70` 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 × 5) src/prefect/cli/concurrency_limit.py:165— src/prefect/cli/concurrency_limit.py:165-172 | src/prefect/cli/flow_run.py:311-317 | src/prefect/cli/global_concurrency_limit.py:55-64 | src/prefect/cli/task_run.py:180-186 | src/prefect/cli/work_pool.py:565-572 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/concurrency_limit.py:165` it does not close everything it opens, so those 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 × 8) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:63— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:63-68 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:174-181 | src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:47-54 | src/prefect/server/database/_migrations/versions/postgresql/2023_04_05_134520_310dda75f561_add_variables.py:48-53 | src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:47-54 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:70-75 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:202-209 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_15_211737_28ae48128c75_add_configurations.py:54-61 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:63` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_02_13_125213_679e695af6ba_add_configurations.py:55` calls `create_index`, `f` and `src/prefect/server/database/_migrations/versions/postgresql/2024_03_13_111215_7a653837d9ba_create_csrf_token_toble.py:57` 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 × 7) src/prefect/cli/artifact.py:76— src/prefect/cli/artifact.py:76-84 | src/prefect/cli/block.py:288-293 | src/prefect/cli/block.py:498-508 | src/prefect/cli/concurrency_limit.py:167-173 | src/prefect/cli/global_concurrency_limit.py:57-65 | src/prefect/cli/variable.py:70-76 | src/prefect/cli/work_pool.py:567-573 — there are 7 copies across 6 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/cli/artifact.py:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 5) src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:54— src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:54-59 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:56-62 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:66-72 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:288-294 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_17_151416_7c91cb86dc4e_add_agents_and_work_queues.py:61-66 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py` and `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:63` calls `create_index`, `f` and `src/prefect/server/database/_migrations/versions/postgresql/2022_02_17_140821_5bff7878e700_add_agents_and_work_queue.py:60` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:388— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:388-393 | src/prefect/server/database/_migrations/versions/postgresql/2024_04_03_112409_aeea5ee6f070_automations_models.py:80-87 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:443-448 | src/prefect/server/database/_migrations/versions/sqlite/2024_04_03_111618_07ed05dfd4ec_automations_models.py:83-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:388` it does not close everything it opens, so those exact lines 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–6 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:858— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:858-861 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:875-880 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:899-904 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:875` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:899` calls `drop_table` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:858` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:283— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:283-290 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:640-644 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:331-338 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–5 lines × 4) src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:877— src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:877-883 | src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:892-896 | src/prefect/server/database/_migrations/versions/postgresql/2023_01_26_045500_2882cd2df463_implement_artifact_table.py:170-173 | src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py:920-924 — before extracting anything, compare `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py` and `src/prefect/server/database/_migrations/versions/sqlite/2022_01_20_115236_9725c1cbee35_initial_migration.py` as WHOLE FILES: this scan already matched 31 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:875` calls `drop_table`, `drop_index` and `src/prefect/server/database/_migrations/versions/postgresql/2021_01_20_122127_25f4b90a7a42_initial_migration.py:891` 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 × 7) src/prefect/server/database/_migrations/versions/postgresql/2022_08_01_211251_97e212ea6545_add_deployment_version.py:20— src/prefect/server/database/_migrations/versions/postgresql/2022_08_01_211251_97e212ea6545_add_deployment_version.py:20-26 | src/prefect/server/database/_migrations/versions/postgresql/2022_11_18_161056_5d526270ddb4_add_flowrun_infrastructure_pid.py:20-26 | src/prefect/server/database/_migrations/versions/postgresql/2023_03_15_153039_4a1a0e4f89de_add_artifact_description_col.py:20-26 | src/prefect/server/database/_migrations/versions/sqlite/2022_08_01_211039_24bb2e4a195c_add_deployment_version.py:20-26 | src/prefect/server/database/_migrations/versions/sqlite/2022_11_18_161332_7201de756d85_add_flowrun_infrastructure_pid.py:20-26 | src/prefect/server/database/_migrations/versions/sqlite/2023_10_30_075026_cef24af2ec34_add_block_type_name_to_block_document.py:20-26 | src/prefect/server/database/_migrations/versions/sqlite/2024_01_05_101041_c63a0a6dc787_add_sender_to_flowruninput.py:20-26 — 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 (13 lines × 6) src/prefect/server/database/_migrations/versions/postgresql/2022_11_05_180555_54c1876c68ae_add_index_for_scheduled_deployments.py:19— src/prefect/server/database/_migrations/versions/postgresql/2022_11_05_180555_54c1876c68ae_add_index_for_scheduled_deployments.py:19-35 | src/prefect/server/database/_migrations/versions/postgresql/2023_03_01_154651_7d918a392297_remove_flowrun_deployment_fk.py:19-33 | src/prefect/server/database/_migrations/versions/postgresql/2023_11_20_084708_9c493c02ca6d_add_trgm_index_to_block_document_name.py:19-36 | src/prefect/server/database/_migrations/versions/postgresql/2026_02_19_200000_add_scheduler_schedule_id_index.py:19-36 | src/prefect/server/database/_migrations/versions/postgresql/2026_03_03_000000_add_task_run_state_type_start_time_index.py:19-33 | src/prefect/server/database/_migrations/versions/postgresql/2026_06_10_000000_bad1e352c597_add_event_resources_occurred_index.py:27-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20 lines × 5) src/integrations/prefect-aws/prefect_aws/decorators.py:29— src/integrations/prefect-aws/prefect_aws/decorators.py:29-48 | src/integrations/prefect-azure/prefect_azure/decorators.py:31-50 | src/integrations/prefect-docker/prefect_docker/decorators.py:25-44 | src/integrations/prefect-gcp/prefect_gcp/decorators.py:32-51 | src/integrations/prefect-kubernetes/prefect_kubernetes/decorators.py:31-50 — before extracting anything, compare `src/integrations/prefect-aws/prefect_aws/decorators.py` and `src/integrations/prefect-azure/prefect_azure/decorators.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 × 9) src/prefect/cli/transfer/_migratable_resources/automations.py:63— src/prefect/cli/transfer/_migratable_resources/automations.py:63-67 | src/prefect/cli/transfer/_migratable_resources/blocks.py:47-51 | src/prefect/cli/transfer/_migratable_resources/blocks.py:101-105 | src/prefect/cli/transfer/_migratable_resources/blocks.py:241-245 | src/prefect/cli/transfer/_migratable_resources/concurrency_limits.py:49-53 | src/prefect/cli/transfer/_migratable_resources/deployments.py:44-48 | src/prefect/cli/transfer/_migratable_resources/flows.py:38-42 | src/prefect/cli/transfer/_migratable_resources/variables.py:41-45 | src/prefect/cli/transfer/_migratable_resources/work_queues.py:42-46 — there are 9 copies across 7 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 9 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `obj` to `Automation` in one and `BlockType` 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 (34 lines × 3) src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:22— src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:22-55 | src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:39-73 | src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py:19-52 — before extracting anything, compare `src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py` and `src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (37 lines × 3) src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:151— src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:151-187 | src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:174-216 | src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py:147-183 — before extracting anything, compare `src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py` and `src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 4) src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:197— src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py:197-228 | src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:226-262 | src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:319-352 | src/integrations/prefect-kubernetes/prefect_kubernetes/pods.py:193-224 — before extracting anything, compare `src/integrations/prefect-kubernetes/prefect_kubernetes/deployments.py` and `src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (15 lines × 4) src/prefect/server/models/flow_run_states.py:65— src/prefect/server/models/flow_run_states.py:65-79 | src/prefect/server/models/saved_searches.py:132-146 | src/prefect/server/models/task_run_states.py:60-74 | src/prefect/server/models/task_runs.py:469-483 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×1
Edited copy of a member (13 corresponding lines) src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:76— src/prefect/server/database/_migrations/versions/postgresql/2022_02_20_103844_4799f657a6a1_add_block_spec_table.py:76-88 | src/prefect/server/database/_migrations/versions/sqlite/2022_02_20_103610_e1ff4973a9eb_add_block_spec_table.py:84-96 — 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.
P12 · CI test-gate honesty· Test failure does not fail the CI gate · ×1
Test failure does not fail the CI gate .github/workflows/api-compatibility-tests.yaml:21— `continue-on-error: true` lets the step or job that runs `node --test head/.github/scripts/comment-api-compatibility.test.cjs` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
Duplication concentrated across 17 sibling directories (137 clone groups) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs.tsx:1— 137 duplicated blocks under ui-v2/src/components/ have copies in at least two of the sibling directories artifacts, automations, blocks, concurrency, dashboard, deployments (+11 more sibling(s) not listed) — 91 of them are reported below, and 46 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 137 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 137 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 137 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 18 sibling directories (30 clone groups) ui-v2/src/api/flow-runs/index.ts:117— 30 duplicated blocks under ui-v2/src/api/ have copies in at least two of the sibling directories admin, artifacts, automations, block-documents, block-schemas, block-types (+12 more sibling(s) not listed) — 19 of them are reported below, and 11 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 30 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 30 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 30 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 (30 clone groups) ui-v2/src/routes/deployments/index.tsx:97— 30 duplicated blocks under ui-v2/src/routes/ have copies in at least two of the sibling directories artifacts, automations, blocks, deployments, events, flows (+3 more sibling(s) not listed) — 23 of them are reported below, and 7 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 30 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 30 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 30 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 26 sibling directories (25 clone groups) ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:1— 25 duplicated blocks under ui-v2/src/components/work-pools/ have copies in at least two of the sibling directories create, edit, poll-status, work-pool-card, work-pool-deployments-tab, work-pool-details (+20 more sibling(s) not listed) — 18 of them are reported below, and 7 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 25 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 25 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 25 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 (15 clone groups) ui-v2/src/api/flow-runs/constants.ts:27— 15 duplicated blocks under ui-v2/src/ have copies in at least two of the sibling directories api, components, hooks, routes — 10 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 15 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 15 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 15 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 2 sibling directories (7 clone groups) ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:72— 7 of the duplicated blocks reported below have copies in at least two of the sibling directories global-concurrency-limits, task-run-concurrency-limits under ui-v2/src/components/concurrency/. That concentration is one structural fact, not 7 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 7 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 3 sibling directories (6 clone groups) ui-v2/src/components/deployments/create-flow-run-form/create-flow-run-form.tsx:234— 6 duplicated blocks under ui-v2/src/components/deployments/ have copies in at least two of the sibling directories create-flow-run-form, deployment-form, deployment-schedules — 4 of them are reported below, and 2 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 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 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 6 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 (187 matched lines × 2 locations) · ×1
Duplicated block with local edits (187 matched lines × 2 locations) ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:62— ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:62 · ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx:135 — the two spans are one implementation copied and then locally edited — 796 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 (175 matched lines × 2 locations) · ×1
Duplicated block with local edits (175 matched lines × 2 locations) ui-v2/src/components/deployments/deployment-details-runs-tab.tsx:22— ui-v2/src/components/deployments/deployment-details-runs-tab.tsx:22 · ui-v2/src/components/deployments/deployment-details-upcoming-tab.tsx:17 — the two spans are one implementation copied and then locally edited — 919 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 (159 matched lines × 2 locations) · ×1
Duplicated block with local edits (159 matched lines × 2 locations) ui-v2/src/components/ui/dropdown-menu.tsx:56— ui-v2/src/components/ui/dropdown-menu.tsx:56 · ui-v2/src/components/ui/menubar.tsx:85 — the two spans are one implementation copied and then locally edited — 581 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (148 identical lines × 2 files) ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx:1— ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx:1 · ui-v2/src/components/automations/automations-wizard/actions-step/send-notification-fields.tsx:1 — these 2 files are line-for-line copies of one another — 148 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Wholesale file copy (142 identical lines × 2 files) ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:1— ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:1 · ui-v2/src/components/work-pools/work-pool-queue-runs-tab/work-pool-queue-runs-tab.tsx:1 — these 2 files are line-for-line copies of one another — 142 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (140 matched lines × 2 locations) · ×1
Duplicated block with local edits (140 matched lines × 2 locations) ui-v2/src/api/flow-runs/index.ts:117— ui-v2/src/api/flow-runs/index.ts:117 · ui-v2/src/api/task-runs/index.ts:68 — the two spans are one implementation copied and then locally edited — 781 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 (122 matched lines × 2 locations) · ×1
Duplicated block with local edits (122 matched lines × 2 locations) ui-v2/src/graphs/factories/flowRunState.ts:17— ui-v2/src/graphs/factories/flowRunState.ts:17 · ui-v2/src/graphs/factories/nodeFlowRunState.ts:27 — the two spans are one implementation copied and then locally edited — 635 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 (121 lines × 2 locations) ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/deployment-filter.tsx:19— ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/deployment-filter.tsx:19 · ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/flow-filter.tsx:16 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (107 matched lines × 2 locations) · ×1
Duplicated block with local edits (107 matched lines × 2 locations) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-subflows.tsx:26— ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-subflows.tsx:26 · ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-task-runs.tsx:24 — the two spans are one implementation copied and then locally edited — 576 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (101 identical lines × 2 files) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs.tsx:1— ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs.tsx:1 · ui-v2/src/components/task-runs/task-run-logs/index.tsx:1 — these 2 files are line-for-line copies of one another — 101 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (94 matched lines × 2 locations) · ×1
Duplicated block with local edits (94 matched lines × 2 locations) ui-v2/src/components/dashboard/task-runs-card/task-runs-trends.tsx:33— ui-v2/src/components/dashboard/task-runs-card/task-runs-trends.tsx:33 · ui-v2/src/components/flows/detail/flow-stats-summary/cumulative-task-runs-card.tsx:40 — the two spans are one implementation copied and then locally edited — 376 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 (88 lines × 2 locations) ui-v2/src/components/automations/automations-wizard/actions-step/select-automations-fields.tsx:51— ui-v2/src/components/automations/automations-wizard/actions-step/select-automations-fields.tsx:51 · ui-v2/src/components/automations/automations-wizard/actions-step/select-work-pools-fields.tsx:51 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (85 matched lines × 2 locations) · ×1
Duplicated block with local edits (85 matched lines × 2 locations) ui-v2/src/graphs/factories/runArtifacts.ts:12— ui-v2/src/graphs/factories/runArtifacts.ts:12 · ui-v2/src/graphs/factories/runEvents.ts:13 — the two spans are one implementation copied and then locally edited — 521 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (82 identical lines × 2 files) ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-pagination.tsx:9— ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-pagination.tsx:9 · ui-v2/src/components/task-runs/task-runs-list/task-runs-pagination.tsx:9 — these 2 files are line-for-line copies of one another — 82 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (71 matched lines × 2 locations) · ×1
Duplicated block with local edits (71 matched lines × 2 locations) ui-v2/src/components/flows/data-table.tsx:83— ui-v2/src/components/flows/data-table.tsx:83 · ui-v2/src/components/variables/data-table/data-table.tsx:112 — the two spans are one implementation copied and then locally edited — 407 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 (70 matched lines × 2 locations) · ×1
Duplicated block with local edits (70 matched lines × 2 locations) ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:72— ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:72 · ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-data-table/task-run-concurrency-limits-data-table.tsx:66 — the two spans are one implementation copied and then locally edited — 338 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (69 identical lines × 2 files) ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-row-count.tsx:1— ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-row-count.tsx:1 · ui-v2/src/components/task-runs/task-runs-list/task-runs-row-count.tsx:1 — these 2 files are line-for-line copies of one another — 69 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (67 matched lines × 2 locations) · ×1
Duplicated block with local edits (67 matched lines × 2 locations) ui-v2/src/api/deployments/index.ts:56— ui-v2/src/api/deployments/index.ts:56 · ui-v2/src/api/variables/index.ts:39 — the two spans are one implementation copied and then locally edited — 386 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 (66 matched lines × 2 locations) · ×1
Duplicated block with local edits (66 matched lines × 2 locations) ui-v2/src/components/automations/automations-wizard/trigger-step/work-pools-combobox.tsx:15— ui-v2/src/components/automations/automations-wizard/trigger-step/work-pools-combobox.tsx:15 · ui-v2/src/components/work-pools/work-pool-multi-select/work-pool-multi-select.tsx:17 — the two spans are one implementation copied and then locally edited — 358 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 (62 lines × 2 locations) ui-v2/src/components/work-pools/work-pool-select/work-pool-select.tsx:48— ui-v2/src/components/work-pools/work-pool-select/work-pool-select.tsx:48 · ui-v2/src/components/work-pools/work-queue-select/work-queue-select.tsx:54 — 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 (58 matched lines × 2 locations) · ×1
Duplicated block with local edits (58 matched lines × 2 locations) ui-v2/src/graphs/factories/nodeFlowRun.ts:44— ui-v2/src/graphs/factories/nodeFlowRun.ts:44 · ui-v2/src/graphs/factories/nodeTaskRun.ts:31 — the two spans are one implementation copied and then locally edited — 345 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (57 identical lines × 3 files) ui-v2/src/components/ui/json-input.tsx:3— ui-v2/src/components/ui/json-input.tsx:3 · ui-v2/src/components/ui/markdown-input.tsx:3 · ui-v2/src/components/ui/python-input.tsx:3 — these 3 files are line-for-line copies of one another — 57 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Duplicated block (56 lines × 2 locations) ui-v2/src/components/work-pools/work-pool-queue-create-dialog/work-pool-queue-create-dialog.tsx:62— ui-v2/src/components/work-pools/work-pool-queue-create-dialog/work-pool-queue-create-dialog.tsx:62 · ui-v2/src/components/work-pools/work-pool-queue-form/work-pool-queue-form.tsx:44 — the 2 copies are spread across 2 files, 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 (55 matched lines × 2 locations) · ×1
Duplicated block with local edits (55 matched lines × 2 locations) ui-v2/src/routes/deployments/index.tsx:97— ui-v2/src/routes/deployments/index.tsx:97 · ui-v2/src/routes/variables/index.tsx:120 — the two spans are one implementation copied and then locally edited — 248 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 (55 lines × 2 locations) ui-v2/src/routes/runs/index.tsx:130— ui-v2/src/routes/runs/index.tsx:130 · ui-v2/src/routes/runs/index.tsx:268 — 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 (54 lines × 2 locations) ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx:53— ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx:53 · ui-v2/src/components/automations/automations-wizard/trigger-step/custom-trigger-fields.tsx:151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Wholesale file copy (54 identical lines × 2 files) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-artifacts.tsx:1— ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-artifacts.tsx:1 · ui-v2/src/components/task-runs/task-run-artifacts/index.tsx:1 — these 2 files are line-for-line copies of one another — 54 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (53 matched lines × 2 locations) · ×1
Duplicated block with local edits (53 matched lines × 2 locations) ui-v2/src/components/artifacts/artifact/artifact-detail-tabs.tsx:10— ui-v2/src/components/artifacts/artifact/artifact-detail-tabs.tsx:10 · ui-v2/src/components/deployments/deployment-details-tabs.tsx:14 — the two spans are one implementation copied and then locally edited — 307 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 FlowRunHeader (cyclomatic 47, cognitive 40) ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:57— FlowRunHeader has cyclomatic complexity 47 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 ActionDetailsType (cyclomatic 35, cognitive 35) ui-v2/src/components/automations/action-details/action-details.tsx:75— ActionDetailsType has cyclomatic complexity 35 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 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 26, cognitive 20) ui-v2/src/routes/runs/index.tsx:135— (anonymous) has cyclomatic complexity 26 and cognitive complexity 20; 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 manualChunks (cyclomatic 26, cognitive 17) ui-v2/vite.config.ts:42— manualChunks has cyclomatic complexity 26 and cognitive complexity 17; 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 transformActionToFormValue (cyclomatic 26, cognitive 10) ui-v2/src/components/automations/automations-wizard/use-edit-automation.ts:108— transformActionToFormValue has cyclomatic complexity 26 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function FlowRunsCard (cyclomatic 25, cognitive 23) ui-v2/src/components/dashboard/flow-runs-card/index.tsx:51— FlowRunsCard has cyclomatic complexity 25 and cognitive complexity 23; 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 FlowRunGraph (cyclomatic 24, cognitive 16) ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph.tsx:58— FlowRunGraph has cyclomatic complexity 24 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 TaskRunDetails (cyclomatic 23, cognitive 22) ui-v2/src/components/task-runs/task-run-details/task-run-details.tsx:25— TaskRunDetails has cyclomatic complexity 23 and cognitive complexity 22; 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 FlowRunDialogBody (cyclomatic 22, cognitive 18) ui-v2/src/components/flows/flow-run-action/flow-run-action.tsx:132— FlowRunDialogBody has cyclomatic complexity 22 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 21, cognitive 17) ui-v2/src/routes/runs/index.tsx:273— (anonymous) has cyclomatic complexity 21 and cognitive complexity 17; 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 SchemaFormInput (cyclomatic 20, cognitive 25) ui-v2/src/components/schemas/schema-form-input.tsx:35— SchemaFormInput has cyclomatic complexity 20 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 19, cognitive 18) ui-v2/src/routes/runs/index.tsx:210— (anonymous) has cyclomatic complexity 19 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getResourceSets (cyclomatic 18, cognitive 18) ui-v2/src/api/automations/use-get-automation-action-resources/use-get-automation-action-resources.ts:140— getResourceSets has cyclomatic complexity 18 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 getResourceRoute (cyclomatic 18, cognitive 12) ui-v2/src/components/events/event-resource-display/resource-routes.ts:33— getResourceRoute has cyclomatic complexity 18 and cognitive complexity 12; 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 isSelected (cyclomatic 18, cognitive 9) ui-v2/src/graphs/objects/selection.ts:60— isSelected has cyclomatic complexity 18 and cognitive complexity 9; 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 getDateRangeFromSearch (cyclomatic 17, cognitive 13) ui-v2/src/routes/dashboard.tsx:174— getDateRangeFromSearch has cyclomatic complexity 17 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function secondsToApproximateString (cyclomatic 17, cognitive 9) ui-v2/src/utils/seconds.ts:118— secondsToApproximateString has cyclomatic complexity 17 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 16, cognitive 12) ui-v2/src/routes/dashboard.tsx:792— (anonymous) has cyclomatic complexity 16 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 15, cognitive 25) ui-v2/src/hooks/use-animated-reorder.ts:39— (anonymous) has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· ui-v2/src/mocks/create-fake-block-schema.ts · ×1
ui-v2/src/mocks/create-fake-block-schema.ts: 8921 lines of code ui-v2/src/mocks/create-fake-block-schema.ts:1— ui-v2/src/mocks/create-fake-block-schema.ts has 8921 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· ui-v2/src/routes/dashboard.tsx · ×1
ui-v2/src/routes/dashboard.tsx: 1094 lines of code ui-v2/src/routes/dashboard.tsx:1— ui-v2/src/routes/dashboard.tsx has 1094 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
ui-v2/src/routeTree.gen.ts: 911 lines of code ui-v2/src/routeTree.gen.ts:1— ui-v2/src/routeTree.gen.ts has 911 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· ui-v2/src/mocks/create-fake-block-type.ts · ×1
ui-v2/src/mocks/create-fake-block-type.ts: 908 lines of code ui-v2/src/mocks/create-fake-block-type.ts:1— ui-v2/src/mocks/create-fake-block-type.ts has 908 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· ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx · ×1
ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx: 841 lines of code ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx:1— ui-v2/src/components/ui/date-range-select/rich-date-range-selector.tsx has 841 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· ui-v2/src/routes/runs/index.tsx · ×1
ui-v2/src/routes/runs/index.tsx: 796 lines of code ui-v2/src/routes/runs/index.tsx:1— ui-v2/src/routes/runs/index.tsx has 796 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· ui-v2/src/components/ui/sidebar/sidebar.tsx · ×1
ui-v2/src/components/ui/sidebar/sidebar.tsx: 738 lines of code ui-v2/src/components/ui/sidebar/sidebar.tsx:1— ui-v2/src/components/ui/sidebar/sidebar.tsx has 738 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· ui-v2/src/components/schemas/stories/properties.stories.tsx · ×1
ui-v2/src/components/schemas/stories/properties.stories.tsx: 706 lines of code ui-v2/src/components/schemas/stories/properties.stories.tsx:1— ui-v2/src/components/schemas/stories/properties.stories.tsx has 706 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· ui-v2/src/components/dashboard/work-pools-card/work-pools-card.tsx · ×1
ui-v2/src/components/dashboard/work-pools-card/work-pools-card.tsx: 655 lines of code ui-v2/src/components/dashboard/work-pools-card/work-pools-card.tsx:1— ui-v2/src/components/dashboard/work-pools-card/work-pools-card.tsx has 655 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· ui-v2/src/routes/flows/flow.$id.tsx · ×1
ui-v2/src/routes/flows/flow.$id.tsx: 606 lines of code ui-v2/src/routes/flows/flow.$id.tsx:1— ui-v2/src/routes/flows/flow.$id.tsx has 606 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· ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx · ×1
ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx: 597 lines of code ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx:1— ui-v2/src/components/ui/flow-run-activity-bar-graph/index.tsx has 597 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· ui-v2/src/api/flow-runs/index.ts · ×1
ui-v2/src/api/flow-runs/index.ts: 571 lines of code ui-v2/src/api/flow-runs/index.ts:1— ui-v2/src/api/flow-runs/index.ts has 571 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· ui-v2/src/components/runs/runs-page.tsx · ×1
ui-v2/src/components/runs/runs-page.tsx: 476 lines of code ui-v2/src/components/runs/runs-page.tsx:1— ui-v2/src/components/runs/runs-page.tsx has 476 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· ui-v2/src/api/deployments/index.ts · ×1
ui-v2/src/api/deployments/index.ts: 464 lines of code ui-v2/src/api/deployments/index.ts:1— ui-v2/src/api/deployments/index.ts has 464 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· ui-v2/src/components/automations/trigger-details/trigger-utils.ts · ×1
ui-v2/src/components/automations/trigger-details/trigger-utils.ts: 464 lines of code ui-v2/src/components/automations/trigger-details/trigger-utils.ts:1— ui-v2/src/components/automations/trigger-details/trigger-utils.ts has 464 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· ui-v2/src/routes/work-pools/work-pool.$workPoolName.tsx · ×1
ui-v2/src/routes/work-pools/work-pool.$workPoolName.tsx: 459 lines of code ui-v2/src/routes/work-pools/work-pool.$workPoolName.tsx:1— ui-v2/src/routes/work-pools/work-pool.$workPoolName.tsx has 459 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· ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts · ×1
ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts: 432 lines of code ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts:1— ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts has 432 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· ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx · ×1
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx: 405 lines of code ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx:1— ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx has 405 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 (~451 LoC) ui-v2/src/components/ui/utils/spacing-utils.ts— no import path from any entry point (29 application, 20 tooling, 678 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 (~130 LoC) ui-v2/src/components/work-pools/priority-management/priority-editor-dialog.tsx— no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/work-pools/priority-management/index.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~75 LoC) ui-v2/src/components/flows/detail/runs-columns.tsx— no import path from any entry point (29 application, 20 tooling, 678 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 (~61 LoC) ui-v2/src/components/flow-runs/flow-run-state-dialog/use-flow-run-state-dialog.tsx— no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/flow-runs/flow-run-state-dialog/flow-run-state-dialog.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~51 LoC) ui-v2/src/components/work-pools/priority-management/use-bulk-update-priorities-mutation.ts— no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/work-pools/priority-management/priority-editor-dialog.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~39 LoC) ui-v2/src/components/flows/table-count-header.tsx— no import path from any entry point (29 application, 20 tooling, 678 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 (~37 LoC) ui-v2/src/components/flows/detail/cells.tsx— no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui-v2/src/components/flows/detail/runs-columns.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~18 LoC) ui/src/compositions/useToast.ts— no import path from any entry point (29 application, 20 tooling, 678 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (ui/src/compositions/index.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~17 LoC) ui/src/utilities/units.ts— no import path from any entry point (29 application, 20 tooling, 678 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 (~13 LoC) ui-v2/src/components/flow-runs/flow-run-state-dialog/flow-run-state-dialog.tsx— no import path from any entry point (29 application, 20 tooling, 678 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) ui/src/utilities/promises.ts— no import path from any entry point (29 application, 20 tooling, 678 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
Unused dependency 'aws-cdk' — Declared in src/integrations/prefect-aws/infra/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 '@fontsource-variable/inter' — Declared in ui-v2/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 '@radix-ui/react-avatar' — Declared in ui-v2/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.
Orphaned file src/prefect/_internal/concurrency/calls.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/blocks/abstract.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/server/database/dependencies.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/server/api/validation.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/_internal/versioning.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file REDACTED:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/client/orchestration/_blocks_types/client.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/client/orchestration/_blocks_documents/client.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/client/orchestration/_flows/client.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/client/orchestration/_artifacts/client.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/server/database/_migrations/versions/sqlite/2022_11_24_143302_fe77ad0dda06_add_worker_tables.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file ui-v2/src/api/task-run-concurrency-limits/task-run-concurrency-limits.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/_internal/concurrency/waiters.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file ui-v2/src/components/schemas/utilities/convertValueToPrefectKind.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/infrastructure/provisioners/coiled.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/server/database/_migrations/versions/postgresql/2022_11_24_143620_f7587d6c5776_add_worker_tables.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/integrations/prefect-azure/prefect_azure/repository.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file ui-v2/src/components/ui/menubar.tsx:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/_internal/concurrency/api.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/server/api/artifacts.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file ui-v2/src/components/ui/utils/spacing-utils.ts:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file benches/bench_block_schemas.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file src/prefect/_internal/compatibility/migration.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file ui-v2/src/components/deployments/deployment-form/deployment-form.tsx:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
redundant comment REDACTED:331— "Code copy button" repeats the code it sits on: 3 of its 3 words (code, copy, button) are already in `const copyBtn = e.target.closest('[data-testid="copy-code-button"]')`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/e2e/blocks/blocks.spec.ts:250— "Click on the block name link" repeats the code it sits on: 4 of its 4 words (click, block, name, link) are already in `await page.getByRole("link", { name: blockName }).click();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/e2e/dashboard/dashboard.spec.ts:154— "Create a parent flow run" repeats the code it sits on: 4 of its 4 words (create, parent, flow, run) are already in `await createFlowRun(apiClient, {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/e2e/dashboard/dashboard.spec.ts:288— "Other flow runs exist - skip this test" repeats the code it sits on: 5 of its 5 words (flow, runs, exist, skip, test) are already in `test.skip(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/api/deployments/use-list-deployments-with-flows/use-list-deployments-with-flows.ts:56— "Creates a set of unique flow ids" repeats the code it sits on: 4 of its 5 words (creates, set, flow, ids) are already in `const deploymentsFlowIds = new Set(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/api/work-pools/work-pools.ts:340— "Invalidate workers list for the work pool" repeats the code it sits on: 5 of its 5 words (invalidate, workers, list, work, pool) are already in `void queryClient.invalidateQueries({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/automations-wizard/automation-wizard.test.tsx:402— "Click on Trigger step" repeats the code it sits on: 3 of its 3 words (click, trigger, step) are already in `await user.click(triggerStepButton);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/automations-wizard/trigger-step/form-mode-toggle.test.tsx:167— "Click JSON tab" repeats the code it sits on: 3 of its 3 words (click, json, tab) are already in `await user.click(screen.getByRole("tab", { name: "JSON" }));`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/automations-wizard/trigger-step/trigger-step.tsx:43— "Validate and parse JSON string" repeats the code it sits on: 4 of its 4 words (validate, parse, json, string) are already in `const validateAndParseJson = useCallback(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/automations-wizard/trigger-step/work-pool-status-trigger-fields.tsx:45— "Get events for a status value" repeats the code it sits on: 4 of its 4 words (get, events, status, value) are already in `function getEventsForStatus(statusValue: string): string[]`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/trigger-details/trigger-utils.test.ts:42— "Helper to create a deployment-status trigger" repeats the code it sits on: 4 of its 5 words (create, deployment, status, trigger) are already in `function createDeploymentStatusTrigger(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/trigger-details/trigger-utils.test.ts:55— "Helper to create a flow-run-state trigger" repeats the code it sits on: 5 of its 6 words (create, flow, run, state, trigger) are already in `function createFlowRunStateTrigger(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/trigger-details/trigger-utils.test.ts:69— "Helper to create a work-pool-status trigger" repeats the code it sits on: 5 of its 6 words (create, work, pool, status, trigger) are already in `function createWorkPoolStatusTrigger(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/automations/trigger-details/trigger-utils.test.ts:82— "Helper to create a work-queue-status trigger" repeats the code it sits on: 5 of its 6 words (create, work, queue, status, trigger) are already in `function createWorkQueueStatusTrigger(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/dashboard/task-runs-card/index.test.tsx:239— "2 running, 1 completed = 3 total" repeats the code it sits on: 3 of its 3 words (running, completed, total) are already in `seedTaskRunsCountQueries(queryClient, {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/dashboard/task-runs-card/index.test.tsx:258— "2 completed, 1 running, 1 failed = 4 total" repeats the code it sits on: 4 of its 4 words (completed, running, failed, total) are already in `seedTaskRunsCountQueries(queryClient, {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/events/events-line-chart/interactive-events-chart.test.tsx:65— "Mock getBoundingClientRect for the container" repeats the code it sits on: 5 of its 6 words (mock, get, bounding, client, rect) are already in `vi.spyOn(wrapper, "getBoundingClientRect").mockReturnValue({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/flow-runs/activity-chart/activity-chart.tsx:55— "Organize flow runs with gaps" repeats the code it sits on: 4 of its 4 words (organize, flow, runs, gaps) are already in `const organizeFlowRunsWithGaps = useCallback(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/runs/runs-page.test.tsx:367— "Click "Clear filters"" repeats the code it sits on: 3 of its 3 words (click, clear, filters) are already in `await user.click(screen.getByRole("button", { name: "Clear filters" }));`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/runs/use-saved-filters.test.ts:248— "User-saved filters come after system filters" repeats the code it sits on: 4 of its 5 words (user, saved, filters, system) are already in `const userFilter = result.current.savedFilters[SYSTEM_FILTERS.length];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/runs/use-saved-filters.test.ts:296— "User-saved filters come after system filters" repeats the code it sits on: 4 of its 5 words (user, saved, filters, system) are already in `const userFilter = result.current.savedFilters[SYSTEM_FILTERS.length];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/work-pools/create/infrastructure-type-step/infrastructure-type-step.test.tsx:31— "Mock the API query" repeats the code it sits on: 3 of its 3 words (mock, api, query) are already in `vi.mock("@/api/collections/collections", () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/work-pools/create/work-pool-create-wizard.test.tsx:6— "Mock data for work pool types" repeats the code it sits on: 4 of its 5 words (mock, work, pool, types) are already in `const mockWorkPoolTypes = {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/work-pools/create/work-pool-create-wizard.test.tsx:45— "Mock the collections API" repeats the code it sits on: 3 of its 3 words (mock, collections, api) are already in `vi.mock("@/api/collections/collections", () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment ui-v2/src/components/work-pools/poll-status/poll-status.test.tsx:8— "Mock the FormattedDate component" repeats the code it sits on: 4 of its 4 words (mock, formatted, date, component) are already in `vi.mock("@/components/ui/formatted-date", () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
Interpolated log message defeats structured logging src/prefect/artifacts.py:323— `warning` at line 323 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/artifacts.py:327— `warning` at line 327 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/engine.py:146— `error` at line 146 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:586— `info` at line 586 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:820— `info` at line 820 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:864— `info` at line 864 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:894— `info` at line 894 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:907— `error` at line 907 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1075— `info` at line 1075 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1084— `error` at line 1084 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1089— `info` at line 1089 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1168— `debug` at line 1168 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1183— `info` at line 1183 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1188— `info` at line 1188 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1305— `log` at line 1305 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.log(logging.INFO, "order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1344— `debug` at line 1344 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1556— `info` at line 1556 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1597— `info` at line 1597 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1627— `info` at line 1627 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1644— `error` at line 1644 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1807— `info` at line 1807 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1816— `error` at line 1816 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1821— `info` at line 1821 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1899— `debug` at line 1899 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging src/prefect/flow_engine.py:1913— `info` at line 1913 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Duplicated predicate ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx:211— `!debouncedValue || debouncedValue.trim() === ""` appears character-identically in 2 files — ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx, ui-v2/src/components/automations/automations-wizard/actions-step/send-notification-fields.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 ui-v2/src/components/automations/automations-wizard/trigger-step/automation-deployment-combobox/index.tsx:182— `!deferredSearch || deployment.name.toLowerCase().includes(deferredSearch.toLowerCase())` appears character-identically in 2 files — ui-v2/src/components/automations/automations-wizard/trigger-step/automation-deployment-combobox/index.tsx, ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/deployment-filter.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 ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/flow-filter.tsx:101— `!deferredSearch || flow.name.toLowerCase().includes(deferredSearch.toLowerCase())` appears character-identically in 2 files — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/flow-filter.tsx, ui-v2/src/components/flows/flow-multi-select/flow-multi-select.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 ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/work-pool-filter.tsx:80— `!deferredSearch || workPool.name.toLowerCase().includes(deferredSearch.toLowerCase())` appears character-identically in 2 files — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/work-pool-filter.tsx, ui-v2/src/components/work-pools/work-pool-multi-select/work-pool-multi-select.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 ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx:172— `!isAllButScheduled && selectedFilters.has(filterKey)` appears character-identically in 2 files — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-filters/state-filter.tsx, ui-v2/src/components/task-runs/task-run-state-filter.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 ui-v2/src/components/automations/automations-wizard/trigger-step/automation-deployment-combobox/index.tsx:114— `!measureEl || containerWidth === 0 || names.length === 0` appears character-identically in 2 files — ui-v2/src/components/automations/automations-wizard/trigger-step/automation-deployment-combobox/index.tsx, ui-v2/src/components/automations/automations-wizard/trigger-step/event-resource-combobox/event-resource-combobox.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 ui-v2/src/components/work-pools/work-pool-deployments-tab/work-pool-deployments-tab.tsx:130— `!paginatedData || totalCount === undefined` appears character-identically in 4 files — ui-v2/src/components/work-pools/work-pool-deployments-tab/work-pool-deployments-tab.tsx, ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx, ui-v2/src/components/work-pools/work-pool-queue-runs-tab/work-pool-queue-runs-tab.tsx, ui-v2/src/components/work-pools/work-pool-queue-upcoming-runs-tab/work-pool-queue-upcoming-runs-tab.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 ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-row-count.tsx:28— `"results" in props && "setSelectedRows" in props && "selectedRows" in props` appears character-identically in 2 files — ui-v2/src/components/flow-runs/flow-runs-list/flow-runs-row-count.tsx, ui-v2/src/components/task-runs/task-runs-list/task-runs-row-count.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 ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:255— `createPending || updatePending || form.formState.isSubmitting` appears character-identically in 2 files — ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx, ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.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 ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx:106— `data.length > 0 && filteredData.length === 0` appears character-identically in 2 files — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.tsx, ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-data-table/task-run-concurrency-limits-data-table.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 ui-v2/src/components/deployments/deployment-description.tsx:17— `deployment.entrypoint === "" || deployment.entrypoint === null` appears character-identically in 2 files — ui-v2/src/components/deployments/deployment-description.tsx, ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-toggle.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 ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx:102— `error.message || "Failed to change state"` appears character-identically in 2 files — ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-header.tsx, ui-v2/src/components/task-runs/task-run-details-page/index.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 ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:153— `error.message || "Unknown error while creating deployment schedule."` appears character-identically in 2 files — ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx, ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.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 ui-v2/src/components/deployments/create-flow-run-form/use-create-flow-run-form.tsx:218— `error.message || "Unknown error while creating flow run."` appears character-identically in 3 files — ui-v2/src/components/deployments/create-flow-run-form/use-create-flow-run-form.tsx, ui-v2/src/components/deployments/quick-run-parameters-dialog/quick-run-parameters-dialog.tsx, ui-v2/src/components/deployments/use-quick-run.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 ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-create-or-edit-dialog/use-create-or-edit-global-concurrency-limit-form.ts:121— `error.message || "Unknown error while creating variable."` appears character-identically in 2 files — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-create-or-edit-dialog/use-create-or-edit-global-concurrency-limit-form.ts, ui-v2/src/components/variables/variable-dialog/variable-dialog.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 ui-v2/src/components/automations/automations-delete-dialog/automations-delete-dialog.tsx:34— `error.message || "Unknown error while deleting automation."` appears character-identically in 2 files — ui-v2/src/components/automations/automations-delete-dialog/automations-delete-dialog.tsx, ui-v2/src/components/automations/use-delete-automation-confirmation-dialog.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 ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-delete-dialog/global-concurrency-limits-delete-dialog.tsx:39— `error.message || "Unknown error while deleting concurrency limit."` appears character-identically in 2 files — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-delete-dialog/global-concurrency-limits-delete-dialog.tsx, ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-delete-dialog/task-run-concurrency-limits-delete-dialog.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 ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-reset-dialog/global-concurrency-limits-reset-dialog.tsx:39— `error.message || "Unknown error while resetting concurrency limit."` appears character-identically in 2 files — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-reset-dialog/global-concurrency-limits-reset-dialog.tsx, ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-reset-dialog/task-run-concurrency-limits-reset-dialog.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 ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx:133— `error.message || "Unknown error while updating deployment schedule."` appears character-identically in 3 files — ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/cron-schedule-form.tsx, ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/interval-schedule-form.tsx, ui-v2/src/components/deployments/deployment-schedules/schedule-toggle-switch.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 ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-create-or-edit-dialog/use-create-or-edit-global-concurrency-limit-form.ts:108— `error.message || "Unknown error while updating limit."` appears character-identically in 2 files — ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-create-or-edit-dialog/use-create-or-edit-global-concurrency-limit-form.ts, ui-v2/src/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-create-dialog/task-run-concurrency-limits-create-dialog.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 ui-v2/src/components/events/events-timeline/events-timeline.tsx:54— `event.resource["prefect.resource.id"] || ""` appears character-identically in 2 files — ui-v2/src/components/events/events-timeline/events-timeline.tsx, ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph-event-popover.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 ui-v2/src/components/events/event-resource-display/event-resource-display.tsx:98— `extractedId && resourceType !== "unknown"` appears character-identically in 2 files — ui-v2/src/components/events/event-resource-display/event-resource-display.tsx, ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph-event-popover.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 ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph-center-button.tsx:24— `isEventTargetInput(event.target) || event.metaKey || event.ctrlKey` appears character-identically in 2 files — ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph-center-button.tsx, ui-v2/src/components/flow-runs/flow-run-graph/flow-run-graph-fullscreen-button.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 ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx:68— `isLoadingBlockTypes || isLoadingBlockDocuments` appears character-identically in 2 files — ui-v2/src/components/automations/automations-wizard/actions-step/call-webhook-fields.tsx, ui-v2/src/components/automations/automations-wizard/actions-step/send-notification-fields.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 ui-v2/src/graphs/factories/node.ts:157— `layout.isTemporal() && !settings.disableArtifacts` appears character-identically in 2 files — ui-v2/src/graphs/factories/node.ts, ui-v2/src/graphs/objects/flowRunArtifacts.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.
Mock-dominated test: should allow a variable to be deleted ui-v2/tests/variables/variables.test.tsx:525— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does nothing when --breakpoint-lg is not defined on the document ui-v2/src/routes/work-pools/-use-redirect-details-tab-on-desktop.test.tsx:133— This test sets up 3 test doubles (for example `vi.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: is a no-op when the breakpoint CSS variable is missing ui-v2/src/components/work-pools/work-pool-queue-tabs-sync/use-redirect-details-tab-on-desktop.test.ts:128— This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: shows success toast and calls callbacks on successful delete ui-v2/src/components/work-pools/work-pool-queue-menu/components/delete-work-pool-queue-dialog.test.tsx:138— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: submits structured feedback ui-v2/src/components/ui-version-switch/ui-version-switch-dialog.test.tsx:30— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: supports skipping feedback ui-v2/src/components/ui-version-switch/ui-version-switch-dialog.test.tsx:62— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: triggers download on click ui-v2/src/components/flow-runs/flow-run-details-page/flow-run-logs-download-button.test.tsx:61— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: calls onDelete upon clicking delete action menu item ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.test.tsx:42— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: calls onEdit upon clicking edit action menu item ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.test.tsx:66— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: calls onReset upon clicking reset action menu item ui-v2/src/components/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/global-concurrency-limits-data-table.test.tsx:90— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
X7 · Silent fallback defaults· Pending state with no failure state · ×7
Pending state with no failure state ui-v2/src/components/work-pools/work-pool-queue-upcoming-runs-tab/work-pool-queue-upcoming-runs-tab.tsx:129— The view draws `Loading upcoming runs...` under `! paginatedData || totalCount === undefined`, but `paginatedData` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state ui-v2/src/components/work-pools/work-pool-queue-runs-tab/work-pool-queue-runs-tab.tsx:223— The view draws `Loading flow runs...` under `! paginatedData || totalCount === undefined`, but `paginatedData` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state ui-v2/src/components/work-pools/work-pool-flow-runs-tab/work-pool-flow-runs-tab.tsx:206— The view draws `Loading flow runs...` under `! paginatedData || totalCount === undefined`, but `paginatedData` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state ui-v2/src/components/work-pools/work-pool-details/work-pool-details.tsx:124— The view draws `Loading work pool details...` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state ui-v2/src/components/work-pools/work-pool-deployments-tab/work-pool-deployments-tab.tsx:132— The view draws `Loading deployments...` under `! paginatedData || totalCount === undefined`, but `paginatedData` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state ui/src/pages/Events.vue:2— The view draws `Loading events No events` under `startDate && endDate`, but `startDate` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state ui/src/pages/Events.vue:29— The view draws `Loading events` under `loading && empty`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×6
Diagnostic log message is built whether or not it is wanted src/prefect/server/events/triggers.py:423— `debug` at line 423 is called with an argument built by `sorted(str(f) for f in firing_ids)` (line 432), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted src/prefect/bundles/__init__.py:362— `debug` at line 362 is called with an argument built by `"…".join(local_modules)` (line 364), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py:664— `debug` at line 664 is called with an argument built by `json.dumps(configuration.job_manifest, indent = 2, default = str)` (line 665), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:838— `debug` at line 838 is called with an argument built by `json.dumps(task_definition, indent = 2, default = str)` (line 839), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:850— `debug` at line 850 is called with an argument built by `json.dumps(mask_api_key(task_run_request), indent = 2, default = str)` (line 852), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py:1101— `debug` at line 1101 is called with an argument built by `json.dumps(task_definition, indent = 2, default = str)` (line 1103), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Silent fallback default in catch scripts/all_links_should_be_ok.py:38— `extract_links` swallows every exception into `return set()` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch src/prefect/utilities/filesystem/__init__.py:240— `get_open_file_limit` swallows every exception into `return 200` — 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 ui-v2/src/utils/date.ts:72— `getLocalTimezone` swallows every exception into `return "UTC"` — 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 5 significant file(s) lose their only recent owner: src/prefect/client/schemas/worker_channel.py, src/prefect/workers/_worker_channel/_protocol.py, src/prefect/_sdk/naming.py, src/integrations/prefect-dbt/prefect_dbt/core/_cache.py, src/prefect/workers/_worker_channel/_state.py. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 5 significant file(s) lose their only recent owner: scripts/prepare_release_notes.py, src/integrations/prefect-gitlab/prefect_gitlab/repositories.py, src/prefect/runtime/deployment.py, src/prefect/server/models/storage_defaults.py, src/prefect/cli/task.py. Pair on, review, or document these before any departure.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung ui-v2/package.json:106— Accessibility checks run in tests (Verified) but aren't gated in CI — run the suite that holds those checks in your pipeline so an accessibility regression blocks the merge (Prevented). What was searched, so you can tell an absence from a miss: the 599 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 5 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 (47 single-owned of 824 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; 824 of the 2114 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)), anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (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: REDACTED, benches/bench_block_schemas.py, src/prefect/_internal/engine.py, src/integrations/prefect-gcp/prefect_gcp/settings.py, src/prefect/client/schemas/sorting.py, src/prefect/server/api/middleware.py.
D20 · ADR Quality· ADR has no Context and Decision and Consequences section · ×1
ADR has no Context and Decision and Consequences section plans/2026-01-06-custom-deployment-sdks.md:1— plans/2026-01-06-custom-deployment-sdks.md has no Context and Decision and Consequences section (a heading such as `## Context`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 3 of 23 project(s) overshoot their size bounds, lowering Project Cohesion to 7.4/10. The most over is `(repository root)` (180092 LoC, 2215 module-visible types across 99 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 92 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: src/prefect/_internal/concurrency/calls.py, src/prefect/blocks/abstract.py, src/prefect/server/database/_migrations/versions/postgresql/2023_01_08_180142_d481d5058a19_rename_worker_pools_to_work_pools.py, src/prefect/server/database/dependencies.py, src/prefect/_internal/versioning.py, REDACTED, src/prefect/client/orchestration/_blocks_types/client.py, src/prefect/client/orchestration/_blocks_documents/client.py (and 84 more) (97 orphaned of 824 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; 824 of the 2114 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `plans/2026-01-06-custom-deployment-sdks.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 16/18 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `client`, `src/integrations/prefect-kubernetes/integration_tests`.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety — Deployment automation exists but no readiness/liveness probes, rolling-update strategy, lifecycle hooks or migration job were evidenced — a bad release is harder to detect and reverse.
R7 · Dead Code· Unused export 'HistoryResponseState' · ×1
Unused export 'HistoryResponseState' ui-v2/src/api/task-runs/index.ts:368— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'TriggerPosture' · ×1
Unused export 'TriggerPosture' ui-v2/src/components/automations/automations-wizard/automation-schema.ts:127— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'ActionsSchema' · ×1
Unused export 'ActionsSchema' ui-v2/src/components/automations/automations-wizard/automation-schema.ts:242— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'isPrefectKindValueJinja' · ×1
Unused export 'isPrefectKindValueJinja' ui-v2/src/components/schemas/types/prefect-kind-value.ts:64— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'isPrefectKindValueWorkspaceVariable' · ×1
Unused export 'isPrefectKindValueWorkspaceVariable' ui-v2/src/components/schemas/types/prefect-kind-value.ts:77— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'workPoolQueuesTableColumns' · ×1
Unused export 'workPoolQueuesTableColumns' ui-v2/src/components/work-pools/work-pool-queues-table/components/work-pool-queues-table-columns.tsx:117— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'DEFAULT_HORIZONTAL_SCALE' · ×1
Unused export 'DEFAULT_HORIZONTAL_SCALE' ui-v2/src/graphs/consts.ts:16— Nothing ultimately consumes this binding: its only referrer is the re-export in ui-v2/src/graphs/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in ui-v2/src/graphs/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'isArtifactClusterFactory' · ×1
Unused export 'isArtifactClusterFactory' ui-v2/src/graphs/factories/artifactCluster.ts:84— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'FlowRunArtifactFactory' · ×1
Unused export 'FlowRunArtifactFactory' ui-v2/src/graphs/factories/flowRunArtifact.ts:25— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'FlowRunEventFactory' · ×1
Unused export 'FlowRunEventFactory' ui-v2/src/graphs/factories/flowRunEvent.ts:20— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'NodeFlowRunArtifactFactory' · ×1
Unused export 'NodeFlowRunArtifactFactory' ui-v2/src/graphs/factories/nodeFlowRunArtifact.ts:24— Nothing imports this binding — it is safe to review for removal.
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 0/4 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types· Strict null checking is not enabled everywhere the repository type-checks · ×1
Strict null checking is not enabled everywhere the repository type-checks — 1/3 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
Null assertions (`!`) reduce the strict null checking score — ~0.2 `!` null assertions per 1k TypeScript source lines — 22 assertion(s) across the 88645 source line(s) of the 976 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: ui-v2/src/graphs/factories/runEvents.ts (5), ui-v2/src/graphs/workers/layouts/nearestParentVertical.ts (5), ui-v2/src/graphs/factories/runArtifacts.ts (4). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Silent fallback default on parse failure src/prefect/server/concurrency/lease_storage/filesystem.py:94— `_load_expiration_index` returns `{}` when `(json.JSONDecodeError, KeyError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Skipped (documented): able to configure run a deployment action type ui-v2/src/components/automations/automations-wizard/actions-step/actions-step.test.tsx:330— Skipped with a documented reason — a deferral, not lazy debt: declared with it.todo — a placeholder that registers a name and runs nothing
Skipped (documented): able to select a notification block ui-v2/src/components/automations/automations-wizard/actions-step/actions-step.test.tsx:573— Skipped with a documented reason — a deferral, not lazy debt: declared with it.todo — a placeholder that registers a name and runs nothing
doc comments repeat the names ui-v2/src/api/work-pool-queues/work-pool-queues.ts:89— 2 of 155 documented parameters and 5 of 438 summaries in `prefect-ui` only repeat the member or parameter name (e.g. "Name of the work pool" for `workPoolName`). 11 documentation tag(s) are empty. 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 197 file(s) — `ui-v2/.storybook/preview.ts`, `ui-v2/src/api/admin/admin.ts`, `ui-v2/src/api/flow-runs/constants.ts`, `ui-v2/src/api/flow-runs/index.ts`, `ui-v2/src/api/flow-runs/use-paginate-flow-runs-with-flows/use-paginate-flow-runs-with-flows.ts`, … (+192 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 01a1a899-6042-7da1-aed3-db891fa21ac8 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 67 · Warnings: 1826 · Recommendations: 261 · Info: 3 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 04-11-2026 @ 22:06 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.