Public report of invoke-ai/InvokeAI, published 16 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 16 November 2026, 19:10 UTC · Survey ID cd_3b3ef0ca6da64c32b04f99064a1d88c9
invoke-ai/InvokeAI
Measured 16 November 2026, 19:04 UTC, at code version 672c724
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
Up 1.4 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A very large codebase: 782,404 lines of product code in 7 projects, tests not counted · Estimated rebuild effort: about 9.7 person-years · Weakest lens: Production Readiness, 37.2
Findings by how serious they are
70 critical4832 serious998 minor
14 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
16 November 2026, 19:04 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
84of 84 dimensions measured by tools.
5883of 5900 findings point to an exact file and line, so you can open each one in the code. The other 17 concern the repository as a whole, such as missing documentation.
84dimensions across 7 lenses, read from 782,404 lines of product code in 7 projects.
invoke-ai/InvokeAI falls short of our standard for production, in part because we found no automated security scanning of the code, its secrets or its dependencies. It scores 43.6 out of 100 and is rated Weak, and 41 of its 70 critical findings are security problems.
Production Readiness, at 37.2, is the weakest lens and counts most in the score. The best first step is making the two tests that check nothing check their results, worth about 4.6 points. Adding automated security scanning would lift Production Readiness itself, worth about 3.7 points. Raising Production Readiness to 70 would lift the score to about 49.0.
Thirty pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Five known security holes in the packages the code depends on can be used by attackers, and twenty-three parts of the code are no longer understood by anyone working on it. Pinning each tool to an exact version, updating the vulnerable packages and having someone learn the forgotten files would close these risks. Fixing the weaknesses the scanner points to would fix the two security weaknesses in the code, and the three places where the code runs text as code or as a command need a direct call instead. The two loops of files that import each other need breaking.
The product code is 782,404 lines, about €1,400,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 37.2 to 70, the lowest score rated Strong, the score would rise from 43.6 to about 49.0.
Code composition: what the lines of code are
Product code 53%Tests 47%
New since the last survey: 797 findings
These 797 critical or serious findings weren't in the previous survey, on 4 November 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 5445 findings
These 5445 critical or serious findings were in the previous survey, on 4 November 2026, and are gone from this one. The first 100 are listed here.
God Classes · FunctionTooLong: engine.createCanvasEngine invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts
God Classes · FunctionTooLong: GalleryPickerView.GalleryPickerView invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx
God Classes · FunctionTooLong: FloatingWidgetWindow.FloatingWidgetWindow invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx
God Classes · FunctionTooLong: ScrubberField.ScrubberField invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx
God Classes · FunctionTooLong: WorkflowLibraryDialog.WorkflowLibraryDialog invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx
God Classes · FunctionTooLong: RegionalGuidanceSettings.RegionalGuidanceSettings invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx
God Classes · FunctionTooLong: GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewOpenAsMenu.tsx
God Classes · FunctionTooLong: ProjectWorkflowsView.ProjectWorkflowDetailPanel invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx
God Classes · FunctionTooLong: GalleryThumbnail.GalleryThumbnail invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx
God Classes · FunctionTooLong: ReferenceImageCard.ReferenceImageCardBase invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx
God Classes · FunctionTooLong: WorkflowWidgetChrome.WorkflowDialogHost invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx
God Classes · FunctionTooLong: run-accessibility-journeys.runTopbarMenuJourney REDACTED
God Classes · FunctionTooLong: InvocationFlowNode.InputFieldRow invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
God Classes · FunctionTooLong: useGalleryUploadAction.useGalleryUploadAction invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts
God Classes · FunctionTooLong: ReferenceImageControls.IPAdapterControls invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx
God Classes · FunctionTooLong: videoPolicies.getVideoValidationReasons invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
God Classes · FunctionTooLong: run-accessibility-journeys.runFloatingWindowJourney REDACTED
God Classes · FunctionTooLong: InvocationFlowNode.ExpandedInvocationNode invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx
God Classes · FunctionTooLong: SettingControl.SettingControl invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx
God Classes · FunctionTooLong: WorkflowLibraryCard.WorkflowLibraryCard invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx
God Classes · FunctionTooLong: QueueCluster.QueueCluster invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx
God Classes · FileTooLong: working_memory/build_shipped.py scripts/working_memory/build_shipped.py
God Classes · FunctionTooLong: ProjectWorkflowsView.ProjectWorkflowsView invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx
God Classes · ClassTooLong: GalleryPickerView invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx
God Classes · FunctionTooLong: GalleryBoardMenu.BoardDeleteDialog invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx
God Classes · FileTooLong: scripts/calibrate_flux3_denoise_working_memory.py scripts/calibrate_flux3_denoise_working_memory.py
God Classes · FunctionTooLong: ShapeOptions.ShapeSettings invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/ShapeOptions.tsx
God Classes · FileTooLong: tool-options/SamOptions.tsx invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/SamOptions.tsx
God Classes · ClassTooLong: CanvasWidgetView invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx
God Classes · FileTooLong: wan/wan_denoise.py invokeai/app/invocations/wan/wan_denoise.py
God Classes · FileTooLong: canvas/CanvasWidgetView.tsx invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx
Code Duplication · Near-duplicate member pair (114 shared lines) invokeai/app/invocations/wan/wan_denoise.py
Code Duplication · Near-duplicate member pair (80 shared lines) invokeai/backend/pid/_src/networks/pid_net.py
Code Duplication · Near-duplicate member pair (30 shared lines) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py
Code Duplication · Edited copy of a member (18 corresponding lines) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py
Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) invokeai/backend/model_manager/configs/base.py
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) invokeai/backend/model_manager/load/model_loaders/flux.py
Rebuild cost: about €1,400,000 · Estimate
Cost to rebuild
€470,000 to €2,400,000, for 7,831 to 24,842 hours of work, about 9.7 person-years for 5 to 19 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 44. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Very large: 782,404 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 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx.
Raises the score by about 4.6 points · Low effort · Test Quality
2
Resolve the 3 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with package.json (2), REDACTED.
Raises the score by about 2.1 points · Low effort · Project Cohesion
3
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €1,400,000 to build again, about 9.7 person-years of work. Its weakest lens is Production Readiness, at 37.2 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 No assertions (empty test) finding(s) in Test Quality. Of all the actions in this report, it raises the score most for the work it takes: about 4.6 points for low effort, because it clears the 2 Test Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 1,398,847 lines over the last 90 days, which is about 5,673,102 lines a year. At that pace, the extra work comes to an estimated 762.3 to 4573.5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: 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.
2524 modules, with 4339 dependencies between them. 5 loops run through 25 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 2484 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.
app.api.routers uses app.services.config.config_default, so a change to app.services.config.config_default can break app.api.routers, while a change to app.api.routers can't break app.services.config.config_default.
Position
Below the diagonal: app.api.routers uses a module listed above it, which is the healthy direction.
app.api.routers uses backend.model_manager.taxonomy, so a change to backend.model_manager.taxonomy can break app.api.routers, while a change to app.api.routers can't break backend.model_manager.taxonomy.
Position
Below the diagonal: app.api.routers uses a module listed above it, which is the healthy direction.
app.services.shared.invocation_context uses app.services.config.config_default, so a change to app.services.config.config_default can break app.services.shared.invocation_context, while a change to app.services.shared.invocation_context can't break app.services.config.config_default.
Position
Below the diagonal: app.services.shared.invocation_context uses a module listed above it, which is the healthy direction.
app.services.shared.invocation_context uses backend.model_manager.taxonomy, so a change to backend.model_manager.taxonomy can break app.services.shared.invocation_context, while a change to app.services.shared.invocation_context can't break backend.model_manager.taxonomy.
Position
Below the diagonal: app.services.shared.invocation_context uses a module listed above it, which is the healthy direction.
backend.model_manager.configs.base uses backend.model_manager.model_on_disk, so a change to backend.model_manager.model_on_disk can break backend.model_manager.configs.base, while a change to backend.model_manager.configs.base can't break backend.model_manager.model_on_disk.
Position
Below the diagonal: backend.model_manager.configs.base uses a module listed above it, which is the healthy direction.
backend.model_manager.configs.base uses backend.model_manager.taxonomy, so a change to backend.model_manager.taxonomy can break backend.model_manager.configs.base, while a change to backend.model_manager.configs.base can't break backend.model_manager.taxonomy.
Position
Below the diagonal: backend.model_manager.configs.base uses a module listed above it, which is the healthy direction.
backend.model_manager.load.load_default uses app.services.config.config_default, so a change to app.services.config.config_default can break backend.model_manager.load.load_default, while a change to backend.model_manager.load.load_default can't break app.services.config.config_default.
Position
Below the diagonal: backend.model_manager.load.load_default uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase uses a type in frontend.webv2.src.platform.logging.contracts.
frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase uses frontend.webv2.src.platform.logging.contracts, so a change to frontend.webv2.src.platform.logging.contracts can break frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase, while a change to frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase can't break frontend.webv2.src.platform.logging.contracts.
Position
Below the diagonal: frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase uses a module listed above it, which is the healthy direction.
21→27 frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase uses frontend.webv1.src.features.controlLayers.konva.CanvasManagerpart of a loop✕
Connections
1 pair of types, where a type in frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase uses a type in frontend.webv1.src.features.controlLayers.konva.CanvasManager.
frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase uses frontend.webv1.src.features.controlLayers.konva.CanvasManager, so a change to frontend.webv1.src.features.controlLayers.konva.CanvasManager can break frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase, while a change to frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase can't break frontend.webv1.src.features.controlLayers.konva.CanvasManager.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
2 pairs of types, where a type in frontend.webv2.src.features.generation.core.canvas.types uses a type in frontend.webv2.src.features.generation.core.types.
frontend.webv2.src.features.generation.core.canvas.types uses frontend.webv2.src.features.generation.core.types, so a change to frontend.webv2.src.features.generation.core.types can break frontend.webv2.src.features.generation.core.canvas.types, while a change to frontend.webv2.src.features.generation.core.canvas.types can't break frontend.webv2.src.features.generation.core.types.
Position
Below the diagonal: frontend.webv2.src.features.generation.core.canvas.types uses a module listed above it, which is the healthy direction.
frontend.webv2.src.features.generation.ui uses frontend.webv2.src.features.generation.core.types, so a change to frontend.webv2.src.features.generation.core.types can break frontend.webv2.src.features.generation.ui, while a change to frontend.webv2.src.features.generation.ui can't break frontend.webv2.src.features.generation.core.types.
Position
Below the diagonal: frontend.webv2.src.features.generation.ui uses a module listed above it, which is the healthy direction.
frontend.webv2.src.features.generation.ui uses frontend.webv2.src.features.models.core.types, so a change to frontend.webv2.src.features.models.core.types can break frontend.webv2.src.features.generation.ui, while a change to frontend.webv2.src.features.generation.ui can't break frontend.webv2.src.features.models.core.types.
Position
Below the diagonal: frontend.webv2.src.features.generation.ui uses a module listed above it, which is the healthy direction.
frontend.webv2.src.features.generation.ui uses frontend.webv2.src.platform.state.accountLifecycle, so a change to frontend.webv2.src.platform.state.accountLifecycle can break frontend.webv2.src.features.generation.ui, while a change to frontend.webv2.src.features.generation.ui can't break frontend.webv2.src.platform.state.accountLifecycle.
Position
Below the diagonal: frontend.webv2.src.features.generation.ui uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in frontend.webv2.src.features.workflow.ui.library uses a type in frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage.
frontend.webv2.src.features.workflow.ui.library uses frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage, so a change to frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage can break frontend.webv2.src.features.workflow.ui.library, while a change to frontend.webv2.src.features.workflow.ui.library can't break frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage.
Position
Below the diagonal: frontend.webv2.src.features.workflow.ui.library uses a module listed above it, which is the healthy direction.
frontend.webv2.src.features.workflow.ui.library uses frontend.webv2.src.features.workflow.core.types, so a change to frontend.webv2.src.features.workflow.core.types can break frontend.webv2.src.features.workflow.ui.library, while a change to frontend.webv2.src.features.workflow.ui.library can't break frontend.webv2.src.features.workflow.core.types.
Position
Below the diagonal: frontend.webv2.src.features.workflow.ui.library uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.projectContracts uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.projectContracts, while a change to frontend.webv2.src.workbench.projectContracts can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.projectContracts uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.projectContracts uses frontend.webv2.src.workbench.widgetContracts, so a change to frontend.webv2.src.workbench.widgetContracts can break frontend.webv2.src.workbench.projectContracts, while a change to frontend.webv2.src.workbench.projectContracts can't break frontend.webv2.src.workbench.widgetContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.projectContracts uses a module listed above it, which is the healthy direction.
app.invocations.baseinvocation uses app.services.shared.invocation_context, so a change to app.services.shared.invocation_context can break app.invocations.baseinvocation, while a change to app.invocations.baseinvocation can't break app.services.shared.invocation_context.
Position
Below the diagonal: app.invocations.baseinvocation uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in frontend.webv1.src.features.controlLayers.konva.CanvasManager uses a type in frontend.webv2.src.platform.logging.contracts.
frontend.webv1.src.features.controlLayers.konva.CanvasManager uses frontend.webv2.src.platform.logging.contracts, so a change to frontend.webv2.src.platform.logging.contracts can break frontend.webv1.src.features.controlLayers.konva.CanvasManager, while a change to frontend.webv1.src.features.controlLayers.konva.CanvasManager can't break frontend.webv2.src.platform.logging.contracts.
Position
Below the diagonal: frontend.webv1.src.features.controlLayers.konva.CanvasManager uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in frontend.webv1.src.features.controlLayers.konva.CanvasManager uses a type in frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase.
frontend.webv1.src.features.controlLayers.konva.CanvasManager uses frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase, so a change to frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase can break frontend.webv1.src.features.controlLayers.konva.CanvasManager, while a change to frontend.webv1.src.features.controlLayers.konva.CanvasManager can't break frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase.
Position
Below the diagonal: frontend.webv1.src.features.controlLayers.konva.CanvasManager uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.features.models.core.types, so a change to frontend.webv2.src.features.models.core.types can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.features.models.core.types.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.features.workflow.core.types, so a change to frontend.webv2.src.features.workflow.core.types can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.features.workflow.core.types.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.platform.logging.contracts, so a change to frontend.webv2.src.platform.logging.contracts can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.platform.logging.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.platform.state.accountLifecycle, so a change to frontend.webv2.src.platform.state.accountLifecycle can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.platform.state.accountLifecycle.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.workbench.widgetContracts, so a change to frontend.webv2.src.workbench.widgetContracts can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.workbench.widgetContracts.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench uses frontend.webv2.src.workbench.projectContracts, so a change to frontend.webv2.src.workbench.projectContracts can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.workbench.projectContracts.
Position
Below the diagonal: frontend.webv2.src.workbench uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in frontend.webv2.src.workbench.canvas-engine.types uses a type in frontend.webv2.src.workbench.canvas-engine.render.raster.
frontend.webv2.src.workbench.canvas-engine.types uses frontend.webv2.src.workbench.canvas-engine.render.raster, so a change to frontend.webv2.src.workbench.canvas-engine.render.raster can break frontend.webv2.src.workbench.canvas-engine.types, while a change to frontend.webv2.src.workbench.canvas-engine.types can't break frontend.webv2.src.workbench.canvas-engine.render.raster.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.types uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.types uses a type in frontend.webv2.src.features.generation.core.canvas.types.
frontend.webv2.src.workbench.canvas-engine.types uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.canvas-engine.types, while a change to frontend.webv2.src.workbench.canvas-engine.types can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.types uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.image-actions uses frontend.webv2.src.features.generation.core.types, so a change to frontend.webv2.src.features.generation.core.types can break frontend.webv2.src.workbench.image-actions, while a change to frontend.webv2.src.workbench.image-actions can't break frontend.webv2.src.features.generation.core.types.
Position
Below the diagonal: frontend.webv2.src.workbench.image-actions uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.image-actions uses frontend.webv2.src.platform.state.accountLifecycle, so a change to frontend.webv2.src.platform.state.accountLifecycle can break frontend.webv2.src.workbench.image-actions, while a change to frontend.webv2.src.workbench.image-actions can't break frontend.webv2.src.platform.state.accountLifecycle.
Position
Below the diagonal: frontend.webv2.src.workbench.image-actions uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.image-actions uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.image-actions, while a change to frontend.webv2.src.workbench.image-actions can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.image-actions uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.image-actions uses frontend.webv2.src.workbench.widgetContracts, so a change to frontend.webv2.src.workbench.widgetContracts can break frontend.webv2.src.workbench.image-actions, while a change to frontend.webv2.src.workbench.image-actions can't break frontend.webv2.src.workbench.widgetContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.image-actions uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.image-actions uses frontend.webv2.src.workbench.projectContracts, so a change to frontend.webv2.src.workbench.projectContracts can break frontend.webv2.src.workbench.image-actions, while a change to frontend.webv2.src.workbench.image-actions can't break frontend.webv2.src.workbench.projectContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.image-actions uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.projects uses frontend.webv2.src.platform.state.accountLifecycle, so a change to frontend.webv2.src.platform.state.accountLifecycle can break frontend.webv2.src.workbench.projects, while a change to frontend.webv2.src.workbench.projects can't break frontend.webv2.src.platform.state.accountLifecycle.
Position
Below the diagonal: frontend.webv2.src.workbench.projects uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.projects uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.projects, while a change to frontend.webv2.src.workbench.projects can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.projects uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.projects uses frontend.webv2.src.workbench.projectContracts, so a change to frontend.webv2.src.workbench.projectContracts can break frontend.webv2.src.workbench.projects, while a change to frontend.webv2.src.workbench.projects can't break frontend.webv2.src.workbench.projectContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.projects uses a module listed above it, which is the healthy direction.
app.invocations.model uses app.invocations.fields, so a change to app.invocations.fields can break app.invocations.model, while a change to app.invocations.model can't break app.invocations.fields.
Position
Below the diagonal: app.invocations.model uses a module listed above it, which is the healthy direction.
app.invocations.model uses backend.model_manager.taxonomy, so a change to backend.model_manager.taxonomy can break app.invocations.model, while a change to app.invocations.model can't break backend.model_manager.taxonomy.
Position
Below the diagonal: app.invocations.model uses a module listed above it, which is the healthy direction.
app.invocations.model uses app.services.shared.invocation_context, so a change to app.services.shared.invocation_context can break app.invocations.model, while a change to app.invocations.model can't break app.services.shared.invocation_context.
Position
Below the diagonal: app.invocations.model uses a module listed above it, which is the healthy direction.
app.invocations.model uses app.invocations.baseinvocation, so a change to app.invocations.baseinvocation can break app.invocations.model, while a change to app.invocations.model can't break app.invocations.baseinvocation.
Position
Below the diagonal: app.invocations.model uses a module listed above it, which is the healthy direction.
29 pairs of types, where a type in app.invocations.primitives uses a type in app.invocations.fields. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
app.invocations.primitives uses app.invocations.fields, so a change to app.invocations.fields can break app.invocations.primitives, while a change to app.invocations.primitives can't break app.invocations.fields.
Position
Below the diagonal: app.invocations.primitives uses a module listed above it, which is the healthy direction.
app.invocations.primitives uses app.services.shared.invocation_context, so a change to app.services.shared.invocation_context can break app.invocations.primitives, while a change to app.invocations.primitives can't break app.services.shared.invocation_context.
Position
Below the diagonal: app.invocations.primitives uses a module listed above it, which is the healthy direction.
55 pairs of types, where a type in app.invocations.primitives uses a type in app.invocations.baseinvocation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
app.invocations.primitives uses app.invocations.baseinvocation, so a change to app.invocations.baseinvocation can break app.invocations.primitives, while a change to app.invocations.primitives can't break app.invocations.baseinvocation.
Position
Below the diagonal: app.invocations.primitives uses a module listed above it, which is the healthy direction.
12 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.capabilities uses a type in frontend.webv2.src.workbench.canvas-engine.contracts.
frontend.webv2.src.workbench.canvas-engine.capabilities uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.canvas-engine.capabilities, while a change to frontend.webv2.src.workbench.canvas-engine.capabilities can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.capabilities uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.capabilities uses a type in frontend.webv2.src.features.generation.core.canvas.types.
frontend.webv2.src.workbench.canvas-engine.capabilities uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.canvas-engine.capabilities, while a change to frontend.webv2.src.workbench.canvas-engine.capabilities can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.capabilities uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.capabilities uses a type in frontend.webv2.src.workbench.canvas-engine.types.
frontend.webv2.src.workbench.canvas-engine.capabilities uses frontend.webv2.src.workbench.canvas-engine.types, so a change to frontend.webv2.src.workbench.canvas-engine.types can break frontend.webv2.src.workbench.canvas-engine.capabilities, while a change to frontend.webv2.src.workbench.canvas-engine.capabilities can't break frontend.webv2.src.workbench.canvas-engine.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.capabilities uses a module listed above it, which is the healthy direction.
21 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.render uses a type in frontend.webv2.src.workbench.canvas-engine.contracts.
frontend.webv2.src.workbench.canvas-engine.render uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.canvas-engine.render, while a change to frontend.webv2.src.workbench.canvas-engine.render can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.render uses a module listed above it, which is the healthy direction.
24 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.render uses a type in frontend.webv2.src.workbench.canvas-engine.render.raster.
frontend.webv2.src.workbench.canvas-engine.render uses frontend.webv2.src.workbench.canvas-engine.render.raster, so a change to frontend.webv2.src.workbench.canvas-engine.render.raster can break frontend.webv2.src.workbench.canvas-engine.render, while a change to frontend.webv2.src.workbench.canvas-engine.render can't break frontend.webv2.src.workbench.canvas-engine.render.raster.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.render uses a module listed above it, which is the healthy direction.
9 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.render uses a type in frontend.webv2.src.features.generation.core.canvas.types.
frontend.webv2.src.workbench.canvas-engine.render uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.canvas-engine.render, while a change to frontend.webv2.src.workbench.canvas-engine.render can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.render uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine.render uses frontend.webv2.src.workbench.canvas-engine.types, so a change to frontend.webv2.src.workbench.canvas-engine.types can break frontend.webv2.src.workbench.canvas-engine.render, while a change to frontend.webv2.src.workbench.canvas-engine.render can't break frontend.webv2.src.workbench.canvas-engine.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.render uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in frontend.webv2.src.workbench.canvas-engine.tools.tool uses a type in frontend.webv2.src.workbench.canvas-engine.render.raster.
frontend.webv2.src.workbench.canvas-engine.tools.tool uses frontend.webv2.src.workbench.canvas-engine.render.raster, so a change to frontend.webv2.src.workbench.canvas-engine.render.raster can break frontend.webv2.src.workbench.canvas-engine.tools.tool, while a change to frontend.webv2.src.workbench.canvas-engine.tools.tool can't break frontend.webv2.src.workbench.canvas-engine.render.raster.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.tools.tool uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.tools.tool uses a type in frontend.webv2.src.features.generation.core.canvas.types.
frontend.webv2.src.workbench.canvas-engine.tools.tool uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.canvas-engine.tools.tool, while a change to frontend.webv2.src.workbench.canvas-engine.tools.tool can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.tools.tool uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.tools.tool uses a type in frontend.webv2.src.workbench.canvas-engine.types.
frontend.webv2.src.workbench.canvas-engine.tools.tool uses frontend.webv2.src.workbench.canvas-engine.types, so a change to frontend.webv2.src.workbench.canvas-engine.types can break frontend.webv2.src.workbench.canvas-engine.tools.tool, while a change to frontend.webv2.src.workbench.canvas-engine.tools.tool can't break frontend.webv2.src.workbench.canvas-engine.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.tools.tool uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.tools.tool uses a type in frontend.webv2.src.workbench.canvas-engine.capabilities.
frontend.webv2.src.workbench.canvas-engine.tools.tool uses frontend.webv2.src.workbench.canvas-engine.capabilities, so a change to frontend.webv2.src.workbench.canvas-engine.capabilities can break frontend.webv2.src.workbench.canvas-engine.tools.tool, while a change to frontend.webv2.src.workbench.canvas-engine.tools.tool can't break frontend.webv2.src.workbench.canvas-engine.capabilities.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.tools.tool uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.platform.state.accountLifecycle, so a change to frontend.webv2.src.platform.state.accountLifecycle can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.platform.state.accountLifecycle.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in frontend.webv2.src.workbench.canvas-operations uses a type in frontend.webv2.src.workbench.canvas-engine.render.raster.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.workbench.canvas-engine.render.raster, so a change to frontend.webv2.src.workbench.canvas-engine.render.raster can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.workbench.canvas-engine.render.raster.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in frontend.webv2.src.workbench.canvas-operations uses a type in frontend.webv2.src.features.generation.core.canvas.types.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.workbench.projectContracts, so a change to frontend.webv2.src.workbench.projectContracts can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.workbench.projectContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.workbench.canvas-engine.types, so a change to frontend.webv2.src.workbench.canvas-engine.types can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.workbench.canvas-engine.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
6 pairs of types, where a type in frontend.webv2.src.workbench.canvas-operations uses a type in frontend.webv2.src.workbench.canvas-engine.capabilities.
frontend.webv2.src.workbench.canvas-operations uses frontend.webv2.src.workbench.canvas-engine.capabilities, so a change to frontend.webv2.src.workbench.canvas-engine.capabilities can break frontend.webv2.src.workbench.canvas-operations, while a change to frontend.webv2.src.workbench.canvas-operations can't break frontend.webv2.src.workbench.canvas-engine.capabilities.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-operations uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.canvas uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.canvas uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.canvas uses frontend.webv2.src.workbench.widgetContracts, so a change to frontend.webv2.src.workbench.widgetContracts can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.workbench.widgetContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.canvas uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.canvas uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.canvas uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.canvas uses frontend.webv2.src.workbench.projectContracts, so a change to frontend.webv2.src.workbench.projectContracts can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.workbench.projectContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.canvas uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.canvas uses frontend.webv2.src.workbench.canvas-engine.types, so a change to frontend.webv2.src.workbench.canvas-engine.types can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.workbench.canvas-engine.types.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.canvas uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.canvas uses frontend.webv2.src.workbench.canvas-engine.capabilities, so a change to frontend.webv2.src.workbench.canvas-engine.capabilities can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.workbench.canvas-engine.capabilities.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.canvas uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.layers uses frontend.webv2.src.features.workflow.core.types, so a change to frontend.webv2.src.features.workflow.core.types can break frontend.webv2.src.workbench.widgets.layers, while a change to frontend.webv2.src.workbench.widgets.layers can't break frontend.webv2.src.features.workflow.core.types.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.layers uses a module listed above it, which is the healthy direction.
27 pairs of types, where a type in frontend.webv2.src.workbench.widgets.layers uses a type in frontend.webv2.src.workbench.canvas-engine.contracts. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
frontend.webv2.src.workbench.widgets.layers uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.widgets.layers, while a change to frontend.webv2.src.workbench.widgets.layers can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.layers uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.layers uses frontend.webv2.src.workbench.widgetContracts, so a change to frontend.webv2.src.workbench.widgetContracts can break frontend.webv2.src.workbench.widgets.layers, while a change to frontend.webv2.src.workbench.widgets.layers can't break frontend.webv2.src.workbench.widgetContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.layers uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.layers uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.widgets.layers, while a change to frontend.webv2.src.workbench.widgets.layers can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.layers uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.layers uses frontend.webv2.src.workbench.projectContracts, so a change to frontend.webv2.src.workbench.projectContracts can break frontend.webv2.src.workbench.widgets.layers, while a change to frontend.webv2.src.workbench.widgets.layers can't break frontend.webv2.src.workbench.projectContracts.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.layers uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.widgets.layers uses frontend.webv2.src.workbench.canvas-engine.capabilities, so a change to frontend.webv2.src.workbench.canvas-engine.capabilities can break frontend.webv2.src.workbench.widgets.layers, while a change to frontend.webv2.src.workbench.widgets.layers can't break frontend.webv2.src.workbench.canvas-engine.capabilities.
Position
Below the diagonal: frontend.webv2.src.workbench.widgets.layers uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.workbench.canvas-engine.contracts, so a change to frontend.webv2.src.workbench.canvas-engine.contracts can break frontend.webv2.src.workbench.canvas-engine, while a change to frontend.webv2.src.workbench.canvas-engine can't break frontend.webv2.src.workbench.canvas-engine.contracts.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.workbench.canvas-engine.render.raster, so a change to frontend.webv2.src.workbench.canvas-engine.render.raster can break frontend.webv2.src.workbench.canvas-engine, while a change to frontend.webv2.src.workbench.canvas-engine can't break frontend.webv2.src.workbench.canvas-engine.render.raster.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.features.generation.core.canvas.types, so a change to frontend.webv2.src.features.generation.core.canvas.types can break frontend.webv2.src.workbench.canvas-engine, while a change to frontend.webv2.src.workbench.canvas-engine can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.workbench.canvas-engine.types, so a change to frontend.webv2.src.workbench.canvas-engine.types can break frontend.webv2.src.workbench.canvas-engine, while a change to frontend.webv2.src.workbench.canvas-engine can't break frontend.webv2.src.workbench.canvas-engine.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.workbench.canvas-engine.capabilities, so a change to frontend.webv2.src.workbench.canvas-engine.capabilities can break frontend.webv2.src.workbench.canvas-engine, while a change to frontend.webv2.src.workbench.canvas-engine can't break frontend.webv2.src.workbench.canvas-engine.capabilities.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine uses a module listed above it, which is the healthy direction.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.workbench.canvas-engine.tools.tool, so a change to frontend.webv2.src.workbench.canvas-engine.tools.tool can break frontend.webv2.src.workbench.canvas-engine, while a change to frontend.webv2.src.workbench.canvas-engine can't break frontend.webv2.src.workbench.canvas-engine.tools.tool.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 56.4 · Adequate · gated by D1, D2 ·
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
49
High / Critical
A03:2025 — Software Supply Chain Failures
18
High / Critical
A02:2025 — Security Misconfiguration
4
Medium
Roadmap
Top priorities: Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx; Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx.
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Replace SQLAlchemy create_all() with Alembic (`alembic revision --autogenerate` + `alembic upgrade head`) so the production schema can evolve safely and reproducibly.
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 — 70
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 — 4832
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 — 998
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 14
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 84 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 — 84 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, 5883 of 5900 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: this repository's production source spans .ts, .tsx, .py, and our analyzer cannot run the .py test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 95.3% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 18,229 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,161 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 never executed — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `pnpm install --frozen-lockfile --ignore-scripts` in docs/ (299 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in invokeai/frontend/api/ (2 tests); vitest via `pnpm install --frozen-lockfile --ignore-scripts` in invokeai/frontend/webv1/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in invokeai/frontend/webv2/ (14425 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.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in invokeai/frontend/webv1/ was NOT MEASURED: the dependency install for invokeai/frontend/webv1/ could not reach codeload.github.com, which the analyzer sandbox's egress allowlist does not carry (ERR_PNPM_FETCH_403 GET https://codeload.github.com/invoke-ai/ui-library/tar.gz/78ddd0a1670af523cfcac186849deb23bd07d419: Forbidden - 403), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
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 — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D28 Secrets (history) — 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 newest 17000 of 29167 commits were scanned for secrets, back to commit 5924dc6ff627; older commits were not. `gitleaks` TIMED OUT after 312.1s against a 311.9s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. The working tree WAS scanned in full, and every row of the scanned ranges is reported. Nothing about the unscanned commits is asserted by the absence of a result; the budget is ours to raise.
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. `docs/src/config/head.ts`, `invokeai/frontend/webv1/src/app/hooks/useSyncFaviconQueueStatus.ts`, `invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx`, `invokeai/frontend/webv1/src/common/hooks/useAsyncState.ts`, `invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx`, … (+142 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 159 further occurrence(s) are not listed individually; the score already reflects all 199.
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 invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx, 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.
AX7 Slice cohesion — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2027 further occurrence(s) are not listed individually; the score already reflects all 2067.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker/docker-compose.yml). compose up failed (exit 14 — a file the compose project references is missing) — time="2026-11-16T19:09:04Z" level=warning msg="The \"RENDER_GROUP_ID\" variable is not set. Defaulting to a blank string." env file docker/.env not found: stat docker/.env: no such file or directory; runtime evidence skipped.
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.
C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1657 further occurrence(s) are not listed individually; the score already reflects all 1697.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1037 further occurrence(s) are not listed individually; the score already reflects all 1077.
R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 232 further occurrence(s) are not listed individually; the score already reflects all 272.
R4 Test Coverage — 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. 931 further occurrence(s) are not listed individually; the score already reflects all 971.
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. 36 further occurrence(s) are not listed individually; the score already reflects all 76.
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.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 376 further occurrence(s) are not listed individually; the score already reflects all 416.
X16 Unfloored truncation loop — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X18 Disposal-pattern correctness — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X27 Collection changed while being enumerated — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X29 Per-element action decided by a fixed element — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
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. 249 further occurrence(s) are not listed individually; the score already reflects all 289.
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. 264 further occurrence(s) are not listed individually; the score already reflects all 304.
X7 Silent fallback defaults — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 1 further occurrence(s) are not listed individually; the score already reflects all 41.
Repo exclusion declarations: 22 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.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned REDACTED, 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.
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.
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.
890 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was mock-backend.startMockBackend.server at 668. A further 23 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 videoComparators.areVideoValuesEqual at 46 — they are counted neither in the figure above nor in this dimension's score. 5 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: invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts (videoComparators.areVideoValuesEqual at 46), invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts (useEnqueueCanvas.enqueueCanvas at 22), invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueGenerate.ts (useEnqueueGenerate.enqueueGenerate at 22), invokeai/frontend/webv1/src/features/parameters/util/optimalDimension.ts (optimalDimension.getGridSize at 17), invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatialDisplay.ts (spatialDisplay.createSpatialDisplay.install 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.
+ 877 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with mock-backend.startMockBackend.server (cyclomatic 668), workbenchState.reduceWorkbenchAction (cyclomatic 425), GalleryImageGrid.GalleryImageGrid (cyclomatic 322). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cyclomatic Complexity from 2.4 to about 3.9/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 1160 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 25 bodies over 120 down to 120 or less in Cognitive Complexity — start with mock-backend.startMockBackend.server (cognitive 1147), modelSelected.addModelSelectedListener (cognitive 565), workbenchState.reduceWorkbenchAction (cognitive 502). — 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 25 together lifts Cognitive Complexity from 2.0 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes6.9 / 10Adequate✓ 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 375 FunctionTooLong finding(s) in God Classes — start with graph.ts (7), baseGenerationPolicies.ts (4), workbenchState.ts (3). — One of this dimension's main actionable groups (375 warning-level).
Resolve the 197 FileTooLong finding(s) in God Classes — start with graph.ts (3), settings.ts (3), types.ts (2). — One of this dimension's main actionable groups (197 warning-level).
Resolve the 21 TooManyMethods finding(s) in God Classes — start with model_install_default.py, session_queue_default.py, graph_materializer.py. — One of this dimension's main actionable groups (21 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
454 duplicated block group(s) detected. 2.5 % of the production lines (19,272 of 782,404) are in a reported copy. A further 341 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 39 of the 795 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: .ts, .tsx (66% 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.
+ 250 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 30 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with graph.py (3), user_management.py (2), custom_block_processor.py (2). — One of this dimension's main actionable groups (30 warning-level).
Resolve the 26 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with pixeldit_official.py (3), calibrate_flux2_denoise_working_memory.py (2), videos.py. — One of this dimension's main actionable groups (26 warning-level).
Resolve the 23 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with graph.py (2), mbv2_mlsd_large.py (2), system_prompts.py. — One of this dimension's main actionable groups (23 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
4 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence, with abstractness counted on 3 of the 4 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with pixeldit_model.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality9.8 / 10Adequategated by 2 critical 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.
4 skipped (4 with a documented reason), 181 zero-assertion, 2 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 18229 tests. Measured on the JavaScript/TypeScript suite only — at least 1,161 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.
No assertions (empty test): drops a destination answered for the project that was open before a switch · ×2invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:590
No assertions: keeps a meaningful settings route when all global bindings are unassigned · ×179invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:247
Fixed-sleep synchronisation: extracts through a live unflushed mask whose contract bitmap is still null · ×2invokeai/frontend/webv2/src/workbench/canvas-engine/engine.mask.test.ts:565
Mock-dominated test: reads the board listing alongside generator resolution and dispatches only once both have answered · ×206invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:226
Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 179 No assertions finding(s) in Test Quality — start with PreferencesPage.browser.test.tsx (10), CanvasHeaderActions.browser.test.tsx (9), CanvasWidgetView.browser.test.tsx (9). — One of this dimension's main actionable groups (179 warning-level).
Resolve the 2 Fixed-sleep synchronisation finding(s) in Test Quality — start with engine.mask.test.ts, webLocks.browser.test.ts. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
1 outdated, 0 yanked pinned Python distributions. 1 of 6 shipped distributions were graded against pypi.org (0 not published there, 5 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, REDACTED, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.
Outdated: diffusers
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 68 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 6 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (62 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. 8 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, 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.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: invokeai/frontend/webv2/src/workbench/workbenchState.ts (91×425=38675); invokeai/frontend/webv2/scripts/mock-backend.mjs (42×668=28056); invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts (57×323=18411) Repeated repair below the complexity floor: invokeai/backend/util/vae_working_memory.py (16 of 29 changes were fixes); invokeai/app/services/shared/execution_state_migration.py (9 of 14 changes were fixes); invokeai/app/api/routers/images.py (8 of 14 changes were fixes)
Resolve the 359 Hotspot finding(s) in Churn × Complexity Hotspots — start with settings.ts (4), denoise.py (3), lora.py (2). — One of this dimension's main actionable groups (359 warning-level).
Resolve the 57 Repeated repair finding(s) in Churn × Complexity Hotspots — start with rocm_causal_conv3d.py (2), vae_working_memory.py, execution_state_migration.py. — One of this dimension's main actionable groups (57 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 Factor6.8 / 10Adequate✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
867 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is invokeai/app/services/shared/graph.py. Counted over 2715 of the 4892 production source files in this repository: 2144 are under the ~2,400-byte size floor this dimension measures over, and the remaining 33 have no attributable history left to measure.
Off-boarding risk: anonymized user #1 · ×6
Further sole-owners (lower concentration)
What to do
Resolve the 6 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (6 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
306 deducted task-comment markers across 766638 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 267 TodoComment finding(s) in Explicit Debt — start with new_architecture.py (9), diffusers_pipeline.py (8), ip_adapter.py (7). — One of this dimension's main actionable groups (267 warning-level).
Resolve the 29 HackComment finding(s) in Explicit Debt — start with flux.py (3), ip_adapter.py (2), torch_module_autocast.py (2). — One of this dimension's main actionable groups (29 warning-level).
Resolve the 10 FixmeComment finding(s) in Explicit Debt — start with onnx_runtime.py (4), denoise_latents.py (3), generate_vae_linear_approximation.py. — One of this dimension's main actionable groups (10 warning-level).
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.
2 of 2 documentation facets pass in full. 156 document(s) read across 5 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
13 naming inconsistencies among 2165 declarations measured against a convention their peers follow.
`selectAspectRatioID` spells `ID` where 1981 names in the project spell it `Id` · ×2invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1542
`addGetOpenAPISchemaListener` spells `API` where 34 names in the project spell it `Api`invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts:13
`getSAMPoints` spells `SAM` where 39 names in the project spell it `Sam`invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:137
`getSAMPointColor` spells `SAM` where 39 names in the project spell it `Sam`invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1531
`isAspectRatioID` spells `ID` where 1981 names in the project spell it `Id`invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:774
+ 7 more group(s) — more in Appendix A; the complete list is findings.md.
✓ On the Gold path — maintain.
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
3 of 7 build units (Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion · ×3invokeai/frontend/webv2/package.json:1
What to do
Resolve the 3 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with package.json (2), REDACTED. — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
gitleaks scanned the current working tree and the part of the history named below, and found no secrets. History coverage: The newest 17000 of 29167 commits were scanned for secrets, back to commit 5924dc6ff627; older commits were not. `gitleaks` TIMED OUT after 312.1s against a 311.9s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows.
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).
51 finding(s): 0 critical, 37 high, 13 medium, 1 low. 28 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 249 file(s) — `REDACTED` (line 105, line 106), `docs/invoke-config.json`, `docs/src/config/head.ts` (line 74, line 76), `docs/src/lib/components/setup-picker.test.mjs` (line 4), `docs/src/lib/i18n-keys.test.mjs` (line 10), … (+244 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 3 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
+ 9 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 REDACTED finding(s) charged to Static Analysis (SAST) — the other 28 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (30 issue-level, 2 of them charged here).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 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 10 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6), REDACTED (3), REDACTED. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 5 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (5 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 4 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
518 of 2748 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/gen_efficientnet.py. Counted over 2748 of the 4892 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 23 Orphaned knowledge finding(s) in Knowledge Freshness — start with gen_efficientnet.py, images.ts, CanvasSegmentAnythingModule.ts. — One of this dimension's main actionable groups (23 issue-level).
Resolve the 495 Orphaned file finding(s) in Knowledge Freshness — start with __init__.py (4), utils.py (3), selectors.ts (2). — One of this dimension's main actionable groups (495 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 53 Change coupling finding(s) in Change Coupling — start with generate-tab-auto-layout.tsx (2), types.ts (2), RefImageImage.tsx (2). — One of this dimension's main actionable groups (53 warning-level).
Resolve the 8 Change-coupling hub finding(s) in Change Coupling — start with canvas-tab-auto-layout.tsx, engine.ts, flux_denoise.py. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with flux_vae_decode.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.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 6 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 alternatives4.6 / 10Weak✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×9) — invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:222, invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:343, …
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. — invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels2.0 / 10Critical✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×16) — invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:797, invokeai/frontend/webv1/src/features/controlLayers/components/ControlLayer/ControlLayerControlAdapterControlMode.tsx:49, invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:84, …
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. (×22) — invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:826, invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:134, invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:155, …
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) — invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectModel.tsx:25, invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectPointType.tsx:26
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 <canvas> binds pointerdown, pointerup, pointermove 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. — invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421
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.
<video> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator. — invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:393
`:is(.sl-link-card, .docs-link-card) a:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — docs/src/styles/custom.css:763
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether 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.
`GalleryCommandsPort` declares 19 required operations: `clearSelection`, `reconcileDeletedBoardOutcome`, `selectBoard`, `selectItem`, `selectImage`, `setCompareItem`, `setCompareImage`, `setItemMultiSelection`, `setPage`, `setPageInfo`, `setSearchTerm`, `setStarredOnly`, `setSemanticSearchMode`, `setSemanticSearchText`, `commitSemanticSearch`, `clearSearch`, `setView`, `toggleItemSelection`, `updateSettings`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx:76
`GalleryActions` declares 28 required operations: `archiveBoard`, `clearSelection`, `createBoard`, `deleteBoard`, `downloadBoard`, `getBoardMediaUsage`, `exportProject`, `loadMore`, `moveBoard`, `refresh`, `renameBoard`, `setBoardGeneralAccess`, `selectBoard`, `selectItem`, `selectItemRange`, `setCompareItem`, `setSearchTerm`, `setSearchScope`, `setStarredOnly`, `clearSearch`, `commitSemanticSearch`, `setSemanticImageQuery`, `setSemanticSearchMode`, `setSemanticSearchText`, `setView`, `toggleItemInSelection`, `updateSettings`, `uploadFiles`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:23
`QueueBackendPort` declares 20 required operations: `claimItemDelivery`, `cancelQueueItems`, `cancelQueueItemsByBatchIds`, `enqueueGenerate`, `enqueueWorkflow`, `getItem`, `getResultImages`, `getResultVideoNames`, `getResultVideos`, `listItems`, `readCurrent`, `readItemIds`, `readItemsById`, `readNext`, `readStatus`, `readItemDetail`, `retryItems`, `emit`, `on`, `onConnectionChange`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/queue/core/types.ts:339
`QueueHistoryCommands` declares 16 required operations: `markBackendCancelled`, `markBackendSubmitted`, `noteFirstProgressFrame`, `recordSubmissionRetry`, `setCancellationPending`, `setLocalRecoveryState`, `recordError`, `refreshBackendData`, `refreshBoardDestinations`, `reopenForRetry`, `restoreFromJournal`, `routePartialResults`, `routeResults`, `setConnectionStatus`, `stageRetriedCanvasResults`, `setStatus`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/queue/runtime.ts:96
`ProjectDraftStore` declares 24 required operations: `adopt`, `acknowledgeRetarget`, `claimWriter`, `close`, `delete`, `deleteCorrupt`, `discardUnloadJournal`, `get`, `journalBeforeUnload`, `list`, `listForProject`, `listRetargets`, `peekUnloadJournalProjectIds`, `reconcileUnloadJournal`, `reserveCopyIdentity`, `resumeDraft`, `rebaseDraft`, `retargetAcknowledgedCopy`, `settleAcknowledgement`, `settleConflict`, `settleSchemaRefusal`, `settleUnloadJournal`, `stage`, `startFreshWriter`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:270
`DurableSyncedWorkbenchPersistence` declares 30 required operations: `acknowledgeProjectResolution`, `abortProjectResolution`, `adoptProjectRecord`, `clearWorkbench`, `close`, `deleteRecoverableDraft`, `deleteProjectOnServer`, `ensureProjectOnServer`, `flushProjectToServer`, `getProjectDraftDocument`, `getRecoverableDraftDocument`, `hasClosedSession`, `journalBeforeUnload`, `hasChangesUnloadWouldLose`, `hasPendingChanges`, `hydrateProjectFromServer`, `loadWorkbench`, `listRecoverableDrafts`, `markProjectDeleted`, `persistEmptySession`, `releaseMutationLocks`, `reopenSession`, `subscribeSessionReopened`, `resolveConflictDiscard`, `resolveConflictSaveAsNew`, `resolveConflictUseServer`, `releaseProjectSync`, `retain`, `saveWorkbench`, `unmarkProjectDeleted`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:510
`PersistenceAggregatePort` declares 17 required operations: `assignProjectBoard`, `getPersistedRevision`, `getState`, `hydrate`, `notifyProjectNotFound`, `reportLoadAvailable`, `reportLoadError`, `reportLoadUnavailable`, `reportRefusedProjects`, `saveFailed`, `saveNeedsAttention`, `savePending`, `saveScheduled`, `saveStarted`, `saveSucceeded`, `setHasHydrated`, `subscribe`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:11
`LayerRowCommands` declares 22 required operations: `select`, `focus`, `toggleExpanded`, `setEnabled`, `setHidden`, `setLocked`, `startRename`, `rename`, `endRename`, `openMenu`, `openStackMenu`, `toggleCollapse`, `toggleChildren`, `selectChild`, `setChildEnabled`, `removeChild`, `renameChild`, `moveChild`, `moveChildToLayer`, `duplicateChild`, `openChildMenu`, `keyDown`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts:19
`LayerContextActionEffects` declares 33 required operations: `reorder`, `duplicate`, `mergeSelected`, `mergeMasks`, `group`, `removeFromGroup`, `openRename`, `openRunWorkflow`, `startSelectObject`, `startFilter`, `transform`, `fitToBbox`, `openProperties`, `saveToBoard`, `copyToClipboard`, `cropToBbox`, `extractMaskedArea`, `booleanMerge`, `copyTo`, `rasterize`, `convertTo`, `patchConfig`, `addReferenceImage`, `addMaskModifier`, `addAdjustment`, `addLayerRegion`, `setColorLabel`, `mergeDown`, `toggleVisibility`, `toggleHidden`, `toggleLock`, `toggleQuickSwitchBookmark`, `delete`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:161
`LayerCacheStore` declares 21 required operations: `peek`, `layerIds`, `get`, `getOrCreate`, `getOrCreateRect`, `growToRect`, `shrinkToRect`, `prepareReplacement`, `installReplacement`, `publishRasterized`, `captureState`, `restoreState`, `publishPixels`, `damageSince`, `invalidate`, `delete`, `version`, `revision`, `byteSize`, `evict`, `dispose`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerCache.ts:82
`CanvasEngineLayerCapability` declares 29 required operations: `applyTransform`, `beginTransform`, `booleanMergeRasterLayers`, `cancelTextEdit`, `cancelTransform`, `clearMask`, `commitLayerConversion`, `commitLayerCopy`, `commitMaskImageResult`, `commitOpenTextSession`, `commitRasterFilterResult`, `commitTextEdit`, `convertLayerToControl`, `copyLayerToControl`, `copyLayerToRaster`, `cropAllLayersToBbox`, `cropLayerToBbox`, `duplicateLayers`, `mergeInpaintMasks`, `mergeLayerDown`, `mergeSelectedRasterLayers`, `mergeVisibleRasterLayers`, `nudgeSelectedLayer`, `openTextCreate`, `openTextEdit`, `rasterizeLayer`, `setTextEditContentReader`, `updateTextEditStyle`, `updateTransformSession`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts:786
`CanvasApplicationHost` declares 27 required operations: `captureGuard`, `clearFilterPreview`, `clearSamPreview`, `commitFilter`, `commitGenerated`, `commitMask`, `decodeSelectObjectPreview`, `encodeSurface`, `exportBakedLayerBlob`, `flushLayerUploads`, `exportLayerPixels`, `getCompositeExecutorDeps`, `getDocument`, `isGuardCurrent`, `isSamToolActive`, `prepareSelectObjectStart`, `publishFilterPreview`, `publishSamPreview`, `replaceSelection`, `replaceTemporaryRestoreTool`, `selectLayer`, `setSamInputHandler`, `setEscapeHandler`, `setSamInteraction`, `setSamTool`, `setViewTool`, `subscribeToolChanges`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:42
`PixelEditControllerOptions` declares 17 required operations: `canEdit`, `deleteDerived`, `getActiveProjectId`, `getAdjustedSurface`, `peekAdjustedSurface`, `getAdjustmentStatus`, `getDocument`, `getTransformSession`, `installPrepared`, `invalidate`, `isCacheReady`, `isOperationIdle`, `notifyPainted`, `preparePixels`, `publishStroke`, `reportRefusal`, `setTransformOverride`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:43
`PointerPipeline` declares 16 required operations: `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel`, `onPointerEnter`, `onPointerLeave`, `onKeyDown`, `onKeyUp`, `onFocusIn`, `isGestureActive`, `hoverPoint`, `cancelActiveGesture`, `endForToolSwitch`, `replaceTemporaryRestoreTool`, `heldRestoreToolId`, `reset`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:71
`CanvasOperationCapability` declares 26 required operations: `composeForGeneration`, `uploadIntermediate`, `getOperationState`, `subscribeOperation`, `getFilterSessionState`, `subscribeFilterSession`, `getSamSessionState`, `subscribeSamSession`, `startSelectObject`, `startFilterOperation`, `updateFilterOperation`, `setFilterOperationAutoProcess`, `processFilterOperation`, `resetFilterOperation`, `commitFilterOperation`, `cancelFilterOperation`, `updateSelectObjectSession`, `processSelectObjectSession`, `applySelectObjectSession`, `saveSelectObjectSession`, `resetSelectObjectSession`, `cancelSelectObjectSession`, `applyControlLayerIntent`, `retryControlDetection`, `getControlDetectionStatus`, `subscribeControlDetectionStatus`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:65
`CanvasSelectObjectCoordinatorDeps` declares 19 required operations: `prepareStart`, `selectLayer`, `clearOtherOperation`, `setSamTool`, `setViewTool`, `replaceTemporaryRestoreTool`, `isSamToolActive`, `captureGuard`, `isGuardCurrent`, `exportSource`, `uploadIntermediate`, `runGraph`, `decodePreview`, `publishPreview`, `clearPreview`, `invalidateOverlay`, `commitGenerated`, `commitMask`, `replaceSelection`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:204
`ImageActions` declares 22 required operations: `copyImage`, `createCanvasFromImages`, `deleteImages`, `deriveImageRecallCapabilities`, `downloadImage`, `downloadImages`, `generatePbrMaps`, `loadImageWorkflow`, `loadVideoWorkflow`, `moveImagesToBoard`, `openImageInPreview`, `recallImageData`, `recallVideoData`, `sendToInitialVideo`, `savePromptAsTemplate`, `selectForCompare`, `sendToCanvas`, `sendImageAsControl`, `setImagesStarred`, `useAsReferenceImage`, `useAsReferenceVideo`, `useAsConditioningClip`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:115
`ImageFileStorageBase` declares 21 abstract methods: `get`, `get_path`, `iter_image_paths`, `iter_thumbnail_paths`, `image_root`, `thumbnail_root`, `evict_cache_paths`, `validate_path`, `save`, `generate_thumbnail_if_missing`, `copy`, `get_file_size_bytes`, `delete`, `stage_delete`, `begin_delete`, `commit_delete`, `abandon_delete`, `rollback_delete`, `get_workflow`, `get_graph`, `get_resolved_inputs`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/app/services/image_files/image_files_base.py:9
`ImageRecordStorageBase` declares 17 abstract methods: `get`, `exists`, `get_metadata`, `update`, `get_many`, `delete`, `delete_many`, `get_subfolders`, `iter_all_image_locations`, `delete_intermediates_by_names`, `save`, `set_file_size_bytes`, `set_file_sizes_bytes`, `get_user_id`, `get_most_recent_image_for_board`, `get_image_names`, `get_image_names_by_date`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/app/services/image_records/image_records_base.py:18
`ImageServiceABC` declares 19 abstract methods: `create`, `copy`, `update`, `get_pil_image`, `get_record`, `get_dto`, `get_metadata`, `get_workflow`, `get_graph`, `get_resolved_inputs`, `get_path`, `validate_path`, `get_url`, `get_many`, `delete`, `delete_intermediates_by_names`, `delete_images_by_names`, `delete_images_on_board`, `get_image_names`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/app/services/images/images_base.py:19
`ModelInstallServiceBase` declares 25 abstract methods: `start`, `stop`, `app_config`, `record_store`, `event_bus`, `register_path`, `unregister`, `delete`, `unconditionally_delete`, `install_path`, `heuristic_import`, `import_model`, `get_job_by_source`, `get_job_by_id`, `list_jobs`, `prune_jobs`, `cancel_job`, `pause_job`, `resume_job`, `restart_failed`, `restart_file`, `wait_for_job`, `resume_and_wait_for_job`, `wait_for_installs`, `download_and_cache_model`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/app/services/model_install/model_install_base.py:19
`SessionQueueBase` declares 49 abstract methods: `dequeue`, `enqueue_batch`, `acknowledge_enqueue`, `get_enqueue_receipt`, `replay_enqueue`, `get_current`, `get_current_for_api`, `get_next`, `get_next_for_api`, `clear`, `prune`, `is_empty`, `is_full`, `get_queue_status`, `has_active_queue_work`, `get_counts_by_destination`, `get_batch_status`, `complete_queue_item`, `suspend_queue_item`, `resume_queue_item`, `cancel_queue_item`, `delete_queue_item`, `delete_queue_items_by_id`, `fail_queue_item`, `cancel_by_batch_ids`, `cancel_by_destination`, `delete_by_destination`, `cancel_by_queue_id`, `cancel_all_except_current`, `delete_all_except_current`, `list_queue_items`, `list_all_queue_items`, `get_queue_item_ids`, `get_queue_item_lineage`, `get_unfinished_origins`, `get_queue_item_summaries_by_ids`, `get_queue_item`, `get_queue_item_owner`, `claim_queue_item_delivery`, `confirm_queue_item_delivery`, and 9 more. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/app/services/session_queue/session_queue_base.py:43
`VideoServiceABC` declares 16 abstract methods: `create`, `copy`, `update`, `get_record`, `get_dto`, `get_metadata`, `get_workflow`, `get_graph`, `get_path`, `get_url`, `get_many`, `delete`, `delete_intermediates_by_names`, `delete_videos_by_names`, `delete_videos_on_board`, `get_video_names`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/app/services/videos/videos_base.py:19
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Other · Architecture — Whether feature slices stay independent (no direct cross-slice references) — the discipline that makes vertical-slice architecture pay off.
Method: Roslyn scan (vertical-slice gated): feature slices resolved from namespaces (.Features.*, .Slices.*) or project names; cross-slice type references detected. Deterministic, traceable.
`UserMenu` (slice 'auth') depends on `toast` from slice 'toast'. — invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:32
`ChangeBoardModal` (slice 'changeBoardModal') depends on `selectSelectedBoardId` from slice 'gallery'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:44
`ChangeBoardModal` (slice 'changeBoardModal') depends on `selectCurrentUser` from slice 'auth'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:45
`ChangeBoardModal` (slice 'changeBoardModal') depends on `captureAuthContext` from slice 'auth'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:92
`ChangeBoardModal` (slice 'changeBoardModal') depends on `isSameAuthContext` from slice 'auth'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:135
`ChangeBoardModal` (slice 'changeBoardModal') depends on `toast` from slice 'toast'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:148
`CanvasAlertsInvocationProgress` (slice 'controlLayers') depends on `selectSystemShouldShowInvocationProgressDetail` from slice 'system'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:45
`addRasterLayerFromImageDndTargetData` (slice 'controlLayers') depends on `newCanvasEntityFromImageDndTarget` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:9
`CanvasDropArea` (slice 'controlLayers') depends on `DndDropTarget` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:43
`CanvasEntityContainer` (slice 'controlLayers') depends on `DndListDropIndicator` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:54
`CanvasEntityGroupList` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:40
`CanvasEntityGroupList` (slice 'controlLayers') depends on `triggerPostMoveFlash` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:114
`useCanvasEntityListDnd` (slice 'controlLayers') depends on `DndListTargetState` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15
`useCanvasEntityListDnd` (slice 'controlLayers') depends on `idle` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15
`useCanvasEntityListDnd` (slice 'controlLayers') depends on `dndInputFix` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:24
`useCanvasEntityListDnd` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:28
`CanvasPasteModal` (slice 'controlLayers') depends on `selectAutoAddBoardId` from slice 'gallery'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:35
`CanvasPasteModal` (slice 'controlLayers') depends on `createNewCanvasEntityFromImage` from slice 'imageActions'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:68
`CanvasPasteModal` (slice 'controlLayers') depends on `toast` from slice 'toast'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:77
`WorkflowFieldRendererProps` (slice 'controlLayers') depends on `NodeFieldElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:47
`WorkflowFieldRenderer` (slice 'controlLayers') depends on `$templates` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:56
`WorkflowFieldRenderer` (slice 'controlLayers') depends on `isParameterScheduler` from slice 'parameters'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:162
`WorkflowFieldRenderer` (slice 'controlLayers') depends on `SCHEDULER_OPTIONS` from slice 'parameters'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:170
`WorkflowFieldRenderer` (slice 'controlLayers') depends on `ModelFieldCombobox` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:411
`ImageFieldComponent` (slice 'controlLayers') depends on `DndImage` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:518
`WorkflowFormPreview` (slice 'controlLayers') depends on `$templates` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:87
`WorkflowFormPreview` (slice 'controlLayers') depends on `FormElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:93
`WorkflowFormPreview` (slice 'controlLayers') depends on `isNodeFieldElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:124
`WorkflowFormPreview` (slice 'controlLayers') depends on `isContainerElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:193
`WorkflowFormPreview` (slice 'controlLayers') depends on `DepthContextProvider` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:201
`WorkflowFormPreview` (slice 'controlLayers') depends on `ContainerContextProvider` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:202
`WorkflowFormPreview` (slice 'controlLayers') depends on `ROOT_CONTAINER_CLASS_NAME` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:203
`FormElementComponentPreview` (slice 'controlLayers') depends on `isDividerElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:228
`FormElementComponentPreview` (slice 'controlLayers') depends on `DividerElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:229
`FormElementComponentPreview` (slice 'controlLayers') depends on `isHeadingElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:232
`FormElementComponentPreview` (slice 'controlLayers') depends on `HeadingElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:233
`FormElementComponentPreview` (slice 'controlLayers') depends on `isTextElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:236
`FormElementComponentPreview` (slice 'controlLayers') depends on `TextElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:237
`ContainerElementPreview` (slice 'controlLayers') depends on `useDepthContext` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:253
`ContainerElementPreview` (slice 'controlLayers') depends on `useContainerContext` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:254
What to do
Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices.
Other · Code Health — Unreviewed-generation residue in this repository's JavaScript/TypeScript: functions whose whole body still throws a "not implemented" error, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings and JSX of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's JavaScript/TypeScript: functions that only throw a "not implemented" error, functions that take inputs and return a constant or do nothing, async functions that never await, dead `if (false)` branches, and skeleton classes most of whose methods are holes.
Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.
Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. (×2) — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:839, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:840
The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:346
`ignoreContextMenu` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryList.tsx:516
`ignoreRefusal` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/platform/ui/video-player/mediaElementStore.ts:108
`focusAdjacentRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:413
`focusFloating` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:414
`focusRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:415
What to do
Clear the softer debt: re-enable or delete skipped tests, decide whether each empty function is a deliberate no-op (and say so in a comment), and replace blanket `eslint-disable` / `@ts-nocheck` with targeted, justified suppressions.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
`invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 154 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/services/events/useSocketIO.ts:154
`invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 169 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/services/events/useSocketIO.ts:169
`invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 311 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:311
`invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 313 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:313
`invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 397 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:397
`invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 399 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:399
`invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 444 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:444
`invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 446 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:446
`invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts` reports through `console.*` at line 328 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:328
`invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 19 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:19
`invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 23 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:23
`invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 26 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:26
`invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` reports through `console.*` at line 2781 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2781
What to do
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
Add a health-check endpoint (a /health route) so orchestrators and load balancers can probe liveness/readiness.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 18 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:29
`docs/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — docs/package.json:20
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Deployment is orchestrated by compose, and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no compose service declares a `healthcheck:` that uses them and nothing pins a previous image to fall back to — so a release that starts but does not serve looks healthy, and reversing it is a manual step. — REDACTED:255
What to do
Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
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.
Do you agree with this assessment?
P8 · Schema migrations3.0 / 10Weak✓ Tool-verified
Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.
Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.
SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment. (×2) — invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_impl.py:565, invokeai/app/services/shared/database/copy.py:213
What to do
Replace SQLAlchemy create_all() with Alembic (`alembic revision --autogenerate` + `alembic upgrade head`) so the production schema can evolve safely and reproducibly.
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.
`unzipSync` in `readArchiveEntries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:173
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety9.9 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
220 duplicated blocks under invokeai/frontend/webv1/src/features/ have copies in at least two of the sibling directories auth, changeBoardModal, controlLayers, cropper, customNodes, deleteImageModal (+18 more sibling(s) not listed) — 107 of them are reported below, and 113 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 220 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 220 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 220 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. — invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx:12
187 duplicated blocks under invokeai/frontend/webv2/src/ have copies in at least two of the sibling directories app, features, platform, workbench — 58 of them are reported below, and 129 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 187 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 187 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 187 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. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:224
101 duplicated blocks under invokeai/frontend/webv2/src/features/ have copies in at least two of the sibling directories fonts, gallery, generation, identity, intermediates, models (+5 more sibling(s) not listed) — 51 of them are reported below, and 50 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 101 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 101 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 101 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. — invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts:107
77 duplicated blocks under invokeai/frontend/webv2/src/workbench/ have copies in at least two of the sibling directories canvas-engine, canvas-operations, diagnostics, hotkeys, image-actions, launchpad (+7 more sibling(s) not listed) — 34 of them are reported below, and 43 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 77 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 77 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 77 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. — invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:165
59 duplicated blocks under invokeai/frontend/ have copies in at least two of the sibling directories webv1, webv2 — 31 of them are reported below, and 28 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 59 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 59 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 59 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. — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170
59 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/components/ have copies in at least two of the sibling directories CanvasContextMenu, CanvasEntityList, ControlLayer, Filters, InpaintMask, RasterLayer (+8 more sibling(s) not listed) — 40 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 59 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 59 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 59 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. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:11
22 duplicated blocks under invokeai/frontend/webv1/src/features/parameters/components/ have copies in at least two of the sibling directories Advanced, Bbox, Canvas, Core, Dimensions, Krea2Enhancers (+7 more sibling(s) not listed) — 18 of them are reported below, and 4 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 22 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 22 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 22 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. — invokeai/frontend/webv1/src/features/parameters/components/Bbox/BboxPreview.tsx:1
18 duplicated blocks under invokeai/frontend/webv2/src/workbench/widgets/ have copies in at least two of the sibling directories autosave-status, canvas, diagnostics, gallery, image-map, layers (+6 more sibling(s) not listed) — 8 of them are reported below, and 10 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 18 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 18 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 18 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. — invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx:72
14 duplicated blocks under invokeai/frontend/webv1/src/ have copies in at least two of the sibling directories app, common, features, services — 9 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 14 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 14 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 14 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. — invokeai/frontend/webv1/src/common/hooks/useCopyImageToClipboard.ts:14
11 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/konva/ have copies in at least two of the sibling directories CanvasEntity, CanvasObject, CanvasTool — 6 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 11 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 11 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 11 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. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1186
10 duplicated blocks under invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ have copies in at least two of the sibling directories ControlAdapterModelDefaultSettings, CpuOnlyModelSettings, EncoderModelSettings, LoRAModelDefaultSettings, MainModelDefaultSettings, VAEModelSettings — 8 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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. — invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/ControlAdapterModelDefaultSettings.tsx:31
10 duplicated blocks under invokeai/frontend/webv2/src/features/models/ui/ have copies in at least two of the sibling directories add-models, credentials, detail, install-queue, launchpad, library (+1 more sibling(s) not listed) — 5 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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. — invokeai/frontend/webv2/src/features/models/ui/detail/UpdatePathDialog.tsx:60
10 duplicated blocks under invokeai/frontend/webv2/src/features/workflow/ui/ have copies in at least two of the sibling directories editor, fields, graph-preview, library, linear — 7 of them are reported below, and 3 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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. — invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewMoreMenu.tsx:404
10 duplicated blocks under invokeai/frontend/webv2/src/workbench/canvas-engine/ have copies in at least two of the sibling directories controllers, document, document-model, editing, export, math (+3 more sibling(s) not listed) — 7 of them are reported below, and 3 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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. — invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:456
7 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/components/ have copies in at least two of the sibling directories flow, sidePanel — 3 of them are reported below, and 4 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 7 and which does not depend on how exactly each block's copies still match. 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. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/StringFieldCollectionInputComponent.tsx:117
7 duplicated blocks under invokeai/frontend/webv2/ have copies in at least two of the sibling directories scripts, src — 5 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 7 and which does not depend on how exactly each block's copies still match. 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. — invokeai/frontend/webv2/scripts/mock-backend.mjs:661
6 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/ have copies in at least two of the sibling directories components, hooks, store, util — 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. — invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts:667
5 duplicated blocks under invokeai/frontend/webv1/src/features/gallery/components/ have copies in at least two of the sibling directories Boards, ContextMenu, GallerySettingsPopover, ImageGrid, ImageViewer — 4 of them are reported below, and 1 is 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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. — invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsSettingsPopover.tsx:23
5 of the duplicated blocks reported below have copies in at least two of the sibling directories FloatField, IntegerField under invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/. That concentration is one structural fact, not 5 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 5 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. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/FloatField/useFloatField.ts:45
invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170 · invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts:174 — the two spans are one implementation copied and then locally edited — 1760 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. — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170
invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:24 — the two spans are one implementation copied and then locally edited — 1330 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. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22
invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:128 — the two spans are one implementation copied and then locally edited — 1036 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. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117
invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 172 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. — invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1
invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:152 · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:138 — the two spans are one implementation copied and then locally edited — 878 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. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:152
invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 169 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. — invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1
invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 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. — invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1
invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 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. — invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1
invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:221 · invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:570 — the two spans are one implementation copied and then locally edited — 996 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:221
invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:251 — 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. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250
invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IntegerFieldCollectionInputComponent.tsx:1 — these 2 files are line-for-line copies of one another — 143 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. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1
invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:42 — the two spans are one implementation copied and then locally edited — 973 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. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47
invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112 · invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:93 — the two spans are one implementation copied and then locally edited — 739 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. — invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112
invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:60 · invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasPressure.ts:49 — 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. — invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:60
invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:63 · invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:66 — the two spans are one implementation copied and then locally edited — 793 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. — invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:63
invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1 · invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueGenerate.ts:1 — these 2 files are line-for-line copies of one another — 108 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. — invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1
invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:692 · invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:937 — the two spans are one implementation copied and then locally edited — 569 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:692
invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 · invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25 — the two spans are one implementation copied and then locally edited — 689 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. — invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26
invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339 · invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:640 — the two spans are one implementation copied and then locally edited — 669 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. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339
invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/OutputFieldHandle.tsx:1 — these 2 files are line-for-line copies of one another — 100 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. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1
invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:492 — the two spans are one implementation copied and then locally edited — 717 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306
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.
(anonymous) has cyclomatic complexity 722 and cognitive complexity 1199; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/scripts/mock-backend.mjs:1332
(anonymous) has cyclomatic complexity 266 and cognitive complexity 206; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:4742
effect has cyclomatic complexity 209 and cognitive complexity 574; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:100
getReasonsWhyCannotEnqueueCanvasTab has cyclomatic complexity 145 and cognitive complexity 294; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773
(anonymous) has cyclomatic complexity 101 and cognitive complexity 131; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:690
(anonymous) has cyclomatic complexity 100 and cognitive complexity 123; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2424
(anonymous) has cyclomatic complexity 98 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:56
(anonymous) has cyclomatic complexity 96 and cognitive complexity 163; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:201
(anonymous) has cyclomatic complexity 96 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:321
GalleryImageGrid has cyclomatic complexity 95 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:445
getReasonsWhyCannotEnqueueGenerateTab has cyclomatic complexity 89 and cognitive complexity 148; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357
(anonymous) has cyclomatic complexity 86 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:796
(anonymous) has cyclomatic complexity 82 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:4248
(anonymous) has cyclomatic complexity 78 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:352
VideoWidgetView has cyclomatic complexity 78 and cognitive complexity 70; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:147
(anonymous) has cyclomatic complexity 74 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:179
GenerateAdvancedFields has cyclomatic complexity 74 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:93
(anonymous) has cyclomatic complexity 73 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — invokeai/frontend/webv2/src/features/workflow/core/document.ts:915
(anonymous) has cyclomatic complexity 72 and cognitive complexity 122; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55
(anonymous) has cyclomatic complexity 71 and cognitive complexity 134; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:205
(anonymous) has cyclomatic complexity 70 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1974
(anonymous) has cyclomatic complexity 69 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140
(anonymous) has cyclomatic complexity 69 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/core/graph.ts:654
(anonymous) has cyclomatic complexity 68 and cognitive complexity 164; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:490
(anonymous) has cyclomatic complexity 68 and cognitive complexity 98; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1526
(anonymous) has cyclomatic complexity 67 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/core/settings.ts:470
(anonymous) has cyclomatic complexity 66 and cognitive complexity 144; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addRegions.ts:97
WorkflowLibraryDetailPanel has cyclomatic complexity 65 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:110
(anonymous) has cyclomatic complexity 64 and cognitive complexity 101; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx:93
IntermediatesManager has cyclomatic complexity 64 and cognitive complexity 58; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.tsx:63
GalleryPickerView has cyclomatic complexity 62 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67
ProjectWorkflowDetailPanel has cyclomatic complexity 62 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:432
(anonymous) has cyclomatic complexity 59 and cognitive complexity 134; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/nodes/store/util/validateConnection.ts:209
(anonymous) has cyclomatic complexity 59 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:330
(anonymous) has cyclomatic complexity 58 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/generation/core/settings.ts:959
(anonymous) has cyclomatic complexity 58 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv1/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx:62
extract has cyclomatic complexity 55 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122
LayerRowComponent has cyclomatic complexity 55 and cognitive complexity 54; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:77
(anonymous) has cyclomatic complexity 54 and cognitive complexity 69; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1029
(anonymous) has cyclomatic complexity 53 and cognitive complexity 104; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — invokeai/frontend/webv2/src/features/workflow/core/batch.ts:686
Do you agree with this assessment?
R3 · Large Files6.8 / 10Adequate✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
invokeai/frontend/webv2/src/workbench/workbenchState.ts has 6229 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:1
invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts has 3955 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1
invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts has 3089 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:1
invokeai/frontend/webv1/src/features/metadata/parsing.tsx has 2950 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/metadata/parsing.tsx:1
invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts has 2860 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1
invokeai/frontend/webv2/src/features/queue/runtime.ts has 2825 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/queue/runtime.ts:1
invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts has 2479 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1
invokeai/frontend/webv2/src/features/generation/core/graph.ts has 2108 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/core/graph.ts:1
invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx has 2013 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1
invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts has 2001 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts:1
invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx has 1975 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1
invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts has 1841 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts:1
invokeai/frontend/webv1/src/features/nodes/types/field.ts has 1629 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/nodes/types/field.ts:1
invokeai/frontend/webv2/src/workbench/projects/draftStore.ts has 1583 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1
invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts has 1550 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1
invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts has 1543 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:1
invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts has 1542 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1
invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts has 1531 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts:1
invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts has 1471 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1
REDACTED has 1448 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
invokeai/frontend/webv1/src/features/queue/store/readiness.ts has 1446 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1
invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx has 1446 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1
invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts has 1444 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1
invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts has 1424 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:1
invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx has 1409 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:1
invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx has 1403 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:1
invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts has 1383 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1
invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx has 1370 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:1
invokeai/frontend/webv1/src/features/cropper/lib/editor.ts has 1336 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1
invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx has 1294 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1
invokeai/frontend/webv2/src/features/upscale/core/settings.ts has 1229 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1
invokeai/frontend/webv1/src/features/controlLayers/store/types.ts has 1203 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:1
invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts has 1200 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:1
invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx has 1169 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:1
invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts has 1166 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:1
invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts has 1160 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1
invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts has 1142 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:1
invokeai/frontend/webv2/src/features/upscale/core/graph.ts has 1128 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/upscale/core/graph.ts:1
invokeai/frontend/webv2/src/features/gallery/data/queries.ts has 1123 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/gallery/data/queries.ts:1
invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx has 1117 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.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 Coverage7.0 / 10Adequate✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:1, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
The package in `invokeai/frontend/webv1` declares the lint script `lint:eslint` (`eslint --max-warnings=0 .`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint:eslint` in `invokeai/frontend/webv1` (or the workspace's task runner). — invokeai/frontend/webv1/package.json:28
Do you agree with this assessment?
R7 · Dead Code8.0 / 10Strong✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 529 application, 18 tooling and 1428 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 (529 application, 18 tooling, 1428 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 (×8) — invokeai/frontend/webv1/src/features/nodes/types/common.test-d.ts, invokeai/frontend/webv1/knip.ts, invokeai/frontend/webv2/src/workbench/workbenchAggregateInterface.type-test.ts, …
Nothing imports this binding — it is safe to review for removal. (×31) — invokeai/frontend/webv1/src/app/store/nanostores/util.ts:16, invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:181, invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:207, …
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.
Every import is type-only — move it to devDependencies. — invokeai/frontend/webv1/src/common/hooks/useGroupedModelCombobox.ts:4
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.
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 reader2.7 / 10Weak✓ Tool-verified
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
`header_len` is read from the bytes being parsed at line 242 (`struct.unpack("<Q")`), then passed as the size of `read` at line 243 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — invokeai/backend/quantization/int8_convrot.py:243
`definition_len` is read from the bytes being parsed at line 24 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 25 — and nowhere in its function is `definition_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `definition_len` against the bytes actually remaining and a maximum the format allows before reading. — invokeai/backend/model_manager/util/model_util.py:25
What to do
Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
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.5 / 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.
`stripInstallationState` is exported, takes a document from its caller (line 292) and hands it to `mapDocument`, which calls itself at line 251 (`mapDocument`) with a piece of `node` (and at line 272) — and nowhere in `mapDocument` 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 `mapDocument` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:251
`collectFontDependencies` is exported, takes a document from its caller (line 49) and hands it to `walkTextSources`, which calls itself at line 36 (`walkTextSources`) with a piece of `value` (and at line 44) — and nowhere in `walkTextSources` 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 `walkTextSources` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:36
`sameValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 44 (`sameValue`) with a piece of `left` (and at line 51) — and nowhere in `sameValue` 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 `sameValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/postconditions.ts:44
`collectSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 46 (`collectSubtree`) with a piece of `node` — and nowhere in `collectSubtree` 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 `collectSubtree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:46
`collectSubtreeLeaves` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 59 (`collectSubtreeLeaves`) with a piece of `node` — and nowhere in `collectSubtreeLeaves` 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 `collectSubtreeLeaves` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:59
`subtreeDepth` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 69 (`subtreeDepth`) with a piece of `node` — and nowhere in `subtreeDepth` 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 `subtreeDepth` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:69
`cloneSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 80 (`cloneSubtree`) with a piece of `node` — and nowhere in `cloneSubtree` 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 `cloneSubtree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:80
`renameFonts` is exported and takes `value: unknown` from its caller, and it calls itself at line 115 (`renameFonts`) with a piece of `value` (and at line 121) — and nowhere in `renameFonts` 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 `renameFonts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/platform/ui/theme/rebase.ts:115
`areJsonValuesStructurallyEqual` is exported and takes `left: unknown` from its caller, and it calls itself at line 21 (`areJsonValuesStructurallyEqual`) with a piece of `left` (and at line 34) — and nowhere in `areJsonValuesStructurallyEqual` 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 `areJsonValuesStructurallyEqual` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/platform/core/json.ts:21
`isWorkflowContentEquivalent` is exported, takes a document from its caller (line 120) and hands it to `canonicalize`, which calls itself at line 105 (`canonicalize`) with a piece of `value` (and at line 112) — and nowhere in `canonicalize` 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 `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/workflow/data/publication.ts:105
`parseFieldType` is exported and takes `schema: unknown` from its caller, and it calls itself at line 100 (`parseFieldType`) with a piece of `schema` — and nowhere in `parseFieldType` 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 `parseFieldType` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/workflow/data/templates.ts:100
`collectSubmissionInputMediaNames` is exported, takes a document from its caller (line 19) and hands it to `visit`, which calls itself at line 26 (`visit`) with a piece of `value` (and at line 44) — and nowhere in `visit` 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 `visit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:26
`wildcardsFromNestedRecord` is exported, takes a document from its caller (line 39) and hands it to `walk`, which calls itself at line 54 (`walk`) with a piece of `node` — and nowhere in `walk` 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 `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/generation/core/wildcardTransfer.ts:54
`dump_dataclass` is public and takes `obj: Any` from its caller, and it calls itself at line 35 (`dump_dataclass`) with a piece of `obj` (and at line 37) — and nowhere in `dump_dataclass` 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 `dump_dataclass` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/backend/pid/_ext/imaginaire/lazy_config/instantiate.py:35
`normalize_path_defaults` is public and takes `node: Any` from its caller, and it calls itself at line 55 (`normalize_path_defaults`) with a piece of `node` (and at line 58) — and nowhere in `normalize_path_defaults` 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 `normalize_path_defaults` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/util/custom_openapi.py:55
`remove_unreferenced_internal_execution_schemas` is public, takes a document from its caller (line 61) and hands it to `collect_refs`, which calls itself at line 80 (`collect_refs`) with a piece of `value` (and at line 83) — and nowhere in `collect_refs` 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 `collect_refs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/util/custom_openapi.py:80
`load_execution_state` is public, takes a document from its caller (line 203) and hands it to `_normalize_persisted_ledgers`, which calls itself at line 199 (`_normalize_persisted_ledgers`) with a piece of `payload` — and nowhere in `_normalize_persisted_ledgers` 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 `_normalize_persisted_ledgers` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/services/shared/execution_state_migration.py:199
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.
`store` is never created by `PersistenceController` — it is the constructor parameter `store` (line 17), and its declared type `BitmapStore` is an interface — yet this class disposes it here (line 49). The instance came from whoever resolved it, and that owner decides when it ends. Disposing it from here reaches outside this object's lifetime: a dependency shared with the rest of the program is torn down when THIS instance goes away, and the real owner's later `dispose()` runs a second time on an object already disposed. Drop the call — a class disposes what it constructed, and only that. If this dependency genuinely is exclusive to this instance, construct it here (or take an owned factory) so the ownership is stated in the code rather than assumed. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/persistenceController.ts:49
What to do
Each finding names the value and the span that decides who owns it — the `new` that created it, or the constructor parameter that handed it over. Confirm ownership from that span, then make the disposal match it: release what this type created, leave what it was injected with to whoever created THAT, and drop a finalizer whose type holds nothing unmanaged to release.
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 19/40 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.
`findArrowJointSeams` 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 })`. — invokeai/frontend/webv2/src/platform/ui/arrowJoint.testing.ts:34
`fetchImageAsDataUrl` 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 })`. (×2) — invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:167, invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:79
`fetchFollowingCancellation` 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 })`. — invokeai/frontend/webv2/src/features/gallery/data/queries.ts:303
`startAssetFaultProxy` awaits `http.request(…)` 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: `http.request(url, { signal })`. — invokeai/frontend/webv2/scripts/asset-fault-proxy.mjs:4
`waitForPreview` 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 })`. (×3) — invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:109, REDACTED:23, REDACTED:57
`runSample` 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 })`. — invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:317
`openRepresentativePage` 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 })`. — REDACTED:73
`ready` 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 })`. — REDACTED:252
`runNativeWidgetRecoveryJourney` 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 })`. — REDACTED:1669
`runNativeUsersRecoveryJourney` 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 })`. — REDACTED:1828
`runRoundTrip` 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 })`. (×2) — invokeai/frontend/webv2/scripts/run-browser-smoke.mjs:39, REDACTED:301
`assertAssetRoute` 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 })`. — REDACTED:109
`getResultImageDTOs` 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 })`. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:321
`imageDTOToFile` 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 })`. — invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1130
`getItem` 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 })`. — invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:101
`setItem` 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 })`. — invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:154
`clearStorage` 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 })`. — invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:197
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 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 120 is called with an argument built by `children?.map((l) => ({ name : l.name, bounds : { left : l.left, top : l.top, right : l.right, bottom : l.bottom }, }))` (line 125), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — invokeai/frontend/webv1/src/features/controlLayers/hooks/useExportCanvasToPSD.ts:120
`debug` at line 98 is called with an argument built by `Object.keys(els)` (line 98), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:98
What to do
Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped5.3 / 10Adequate✓ 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.
`label` is text this program did not author, and it is written into the text of an element through `document.write` 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. — invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:465
`url` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468
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.
`RasterController` accepts `options.getDocument` from the caller and keeps it in `this.getDocument` on line 111, where only it can read the value — but nothing ever reads `this.getDocument`. Setting `options.getDocument` therefore changes nothing: every caller gets the same behaviour whatever they pass, and nothing reports that the option was ignored. Read `this.getDocument` where the behaviour it configures is decided — or, if the behaviour genuinely is fixed, remove `options.getDocument` from the accepted options so callers stop setting a knob that does nothing. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterController.ts:111
What to do
Each finding names the spans that disagree — the knob the caller supplies and the site that ignores it, whether by re-spelling its default, by falling back under the wrong key, by parsing with no format provider at all, or by printing under whatever culture the host supplies. Confirm from those spans, then decide which of the two the type meant: read the knob at the named site, or drop the knob so the signature stops advertising something the type cannot feel. Leaving both is the one option that cannot be right.
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 element7.9 / 10Strong✓ Tool-verified
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.
This loop runs once per element of `groups`, and the statement it guards acts on the element it is on — `group`. The test deciding whether that statement runs does not: `showHeadings` reads `groups[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 145, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out. — invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.ts:148
What to do
Each finding names the test and the statement it guards, which index the same collection at two different subscripts — one fixed, one the loop variable. Confirm from the two, then decide which subscript the test meant. If it was meant to be per-element, give it the loop variable so each element is judged on itself. If it really is one answer for the whole collection, hoist the test OUT of the loop, where a reader can see it is asked once and where it is not re-evaluated on every pass — leaving it inside, reading a fixed element, is the one arrangement that cannot be right under either reading.
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.
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. (×26) — invokeai/frontend/webv2/src/workbench/bootWidgetPreload.ts:41, invokeai/frontend/webv2/src/workbench/performanceMarks.ts:33, invokeai/frontend/webv2/src/workbench/widgets/preview/loupeGestures.ts:32, …
`.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. (×7) — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:673, invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewSwipeNeighbor.tsx:116, invokeai/frontend/webv2/src/workbench/widgets/image-map/useSelectMapImage.ts:47, …
`catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included. (×7) — invokeai/frontend/webv2/src/workbench/settings/clearWorkspaceData.ts:8, invokeai/frontend/webv2/src/workbench/projects/covers.ts:90, invokeai/frontend/webv2/src/workbench/projects/covers.ts:125, …
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.
`trace` at line 127 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:127
`trace` at line 534 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:534
`error` at line 562 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:562
`warn` at line 633 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:633
`debug` at line 659 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:659
`trace` at line 663 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:663
`trace` at line 761 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:761
`debug` at line 48 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onQueueItemStatusChanged.tsx:48
`debug` at line 98 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:98
`trace` at line 226 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:226
`debug` at line 230 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:230
`trace` at line 236 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:236
`trace` at line 240 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:240
`trace` at line 262 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:262
`error` at line 266 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:266
`debug` at line 638 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:638
`warn` at line 640 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:640
`error` at line 644 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:644
`info` at line 650 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:650
`debug` at line 655 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:655
`debug` at line 680 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:680
`warn` at line 682 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:682
`error` at line 686 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:686
`info` at line 690 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:690
`debug` at line 695 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:695
`debug` at line 744 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:744
`debug` at line 748 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:748
`warn` at line 753 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:753
`debug` at line 781 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:781
`info` at line 785 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:785
`error` at line 789 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:789
`info` at line 794 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:794
`debug` at line 831 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:831
`warn` at line 847 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:847
`debug` at line 903 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:903
`debug` at line 905 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:905
`debug` at line 910 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:910
`error` at line 917 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:917
`debug` at line 931 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:931
`warn` at line 942 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:942
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.
3/5 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.
~1.6 `!` null assertions per 1k TypeScript source lines — 889 assertion(s) across the 553393 source line(s) of the 3366 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: invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts (61), invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts (54), docs/src/lib/components/tour/workflow-demo-client.ts (32). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
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 — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Repo shows no audit-logging mechanism (an audit-log table or model — a class or table named for it — django-simple-history, django-auditlog, django-reversion, django-pghistory or SQLAlchemy-Continuum recording each change, or an event-sourced store beside one) for sensitive changes — absence of evidence is not evidence of a working control. Record an audit trail in code (or document where it lives) so this dimension can be scored.
C4 Data Retention — C4 reached only 34% of this repository's production lines — typescript (501,011 lines), javascript (15,766 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
C5 Data-Subject Rights — Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary — absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 37 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 vertical-slice architecture (the inward-dependency rule is for layered/clean styles)
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — compose up failed (exit 14 — a file the compose project references is missing) — time="2026-11-16T19:09:04Z" level=warning msg="The \"RENDER_GROUP_ID\" variable is not set. Defaulting to a blank string." env file docker/.env not found: stat docker/.env: no such file or directory; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — 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.
C2 Access Controls — C2 reached only 34% of this repository's production lines — typescript (501,011 lines), javascript (15,766 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — no ADRs to check
D27 Navigability — D27 reads resolved call sites in the languages it reads only — this repository's production source is .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 147 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (312 value object(s))
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
P9 Domain vs controller coverage — coverage data present for 32 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
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.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — X27 reached only 34% of this repository's production lines — typescript (501,011 lines), javascript (15,766 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
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 invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/gen_efficientnet.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 invokeai/frontend/webv1/src/services/api/endpoints/images.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.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 invokeai/frontend/webv1/src/features/cropper/lib/editor.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.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 invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx: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 invokeai/backend/rectified_flow/er_sde_scheduler.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 invokeai/frontend/webv1/src/features/dnd/dnd.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 invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.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 invokeai/app/invocations/facetools.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 invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/efficientnet_builder.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 invokeai/backend/image_util/mlsd/utils.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 invokeai/frontend/webv1/src/features/controlLayers/konva/util.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStageModule.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 invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.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 invokeai/backend/image_util/pidi/model.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 invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.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 invokeai/app/invocations/text_encoder/compel.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.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 invokeai/backend/tiles/tiles.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 invokeai/frontend/webv1/src/services/api/run-graph.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.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 invokeai/frontend/webv1/src/features/nodes/types/v1/workflowV1.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.
D10 · Test Quality· No assertions (empty test) · ×2
No assertions (empty test): drops a destination answered for the project that was open before a switch invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:590— Test method has an empty body — it asserts nothing and exercises no code.
No assertions (empty test): says every saved project goes while the count is unknown, and says so plainly when there are none invokeai/frontend/webv2/src/workbench/settings/ClearSavedDataSettings.browser.test.tsx:148— Test method has an empty body — it asserts nothing and exercises no code.
AC1 · Text alternatives· <img> without a text alternative · ×1
<img> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <canvas> · ×1
Double-click handler on a non-interactive <canvas> invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421— This <canvas> binds pointerdown, pointerup, pointermove 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.
FunctionTooLong: mock-backend.galleryMediaUsage invokeai/frontend/webv2/scripts/mock-backend.mjs:712— FunctionTooLong — galleryMediaUsage runs 2054 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1954 over it, 20.54× 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: workbenchState.enqueueCompiledSnapshot invokeai/frontend/webv2/src/workbench/workbenchState.ts:4227— FunctionTooLong — enqueueCompiledSnapshot runs 1814 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1714 over it, 18.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: GalleryImageGrid.GalleryImageGrid invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:445— FunctionTooLong — GalleryImageGrid runs 1273 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1173 over it, 12.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: indexedDbDraftStore.createIndexedDbProjectDraftStore invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:90— FunctionTooLong — createIndexedDbProjectDraftStore runs 1074 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 974 over it, 10.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: unloadJournal.scenarios.testUnloadJournalScenarios invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:189— FunctionTooLong — testUnloadJournalScenarios runs 1037 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 937 over it, 10.37× 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: LayersTree.LayersTree invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:174— FunctionTooLong — LayersTree runs 919 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 819 over it, 9.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: useImageActions.useImageActions invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:263— FunctionTooLong — useImageActions runs 892 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 792 over it, 8.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: documentModel.createDocumentModel invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:479— FunctionTooLong — createDocumentModel runs 812 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 712 over it, 8.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: LayerContextMenu.LayerMenu invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:224— FunctionTooLong — LayerMenu runs 700 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 600 over it, 7.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: coordinator.createQueueCoordinator invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:262— FunctionTooLong — createQueueCoordinator runs 667 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 567 over it, 6.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: VideoWidgetView.VideoWidgetView invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:147— FunctionTooLong — VideoWidgetView runs 635 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 535 over it, 6.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: buildFLUXGraph.buildFLUXGraph invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55— FunctionTooLong — buildFLUXGraph runs 598 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 498 over it, 5.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: draftStore.contract.testProjectDraftStoreContract invokeai/frontend/webv2/src/workbench/projects/draftStore.contract.ts:67— FunctionTooLong — testProjectDraftStoreContract runs 596 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 496 over it, 5.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: draftStore.createMemoryProjectDraftStore invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:907— FunctionTooLong — createMemoryProjectDraftStore runs 563 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 463 over it, 5.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: modelSelected.addModelSelectedListener invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97— FunctionTooLong — addModelSelectedListener runs 539 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 439 over it, 5.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: CanvasTextOverlay.TextEditor invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:95— FunctionTooLong — TextEditor runs 522 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 422 over it, 5.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ReferenceImageRow.ReferenceImageRowBase invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageRow.tsx:207— FunctionTooLong — ReferenceImageRowBase runs 501 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 401 over it, 5.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useGalleryData.useGalleryData invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:280— FunctionTooLong — useGalleryData runs 493 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 393 over it, 4.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: WorkflowLibraryGrid.WorkflowLibraryGrid invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:152— FunctionTooLong — WorkflowLibraryGrid runs 469 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 369 over it, 4.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: readiness.getReasonsWhyCannotEnqueueCanvasTab invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773— FunctionTooLong — getReasonsWhyCannotEnqueueCanvasTab runs 465 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 365 over it, 4.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: persistenceRuntime.createWorkbenchPersistenceRuntime invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:141— FunctionTooLong — createWorkbenchPersistenceRuntime runs 465 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 365 over it, 4.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: PreviewWidgetView.PreviewWidgetView invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:186— FunctionTooLong — PreviewWidgetView runs 459 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 359 over it, 4.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: bitmapStore.createBitmapStore invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:172— FunctionTooLong — createBitmapStore runs 441 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 341 over it, 4.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: LayerRow.LayerRowComponent invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:77— FunctionTooLong — LayerRowComponent runs 389 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 289 over it, 3.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: FontsPage.FontLibrary invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:297— FunctionTooLong — FontLibrary runs 387 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 287 over it, 3.87× 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: invokeai/frontend/webv2/src/workbench/workbenchState.ts invokeai/frontend/webv2/src/workbench/workbenchState.ts:4738— invokeai/frontend/webv2/src/workbench/workbenchState.ts changed 91 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 425 in workbenchState.reduceWorkbenchAction at line 4738. 36 of those changes were fix/bug commits, and the other 55 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/workbenchState.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/scripts/mock-backend.mjs invokeai/frontend/webv2/scripts/mock-backend.mjs:1332— invokeai/frontend/webv2/scripts/mock-backend.mjs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 668 in mock-backend.startMockBackend.server at line 1332. 7 of those changes were fix/bug commits, and the other 35 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/scripts/mock-backend.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:354— invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 323 in engine.createCanvasEngine at line 354. 23 of those changes were fix/bug commits, and the other 34 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/app/services/shared/graph.py invokeai/app/services/shared/graph.py:2565— invokeai/app/services/shared/graph.py changed 106 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 155 in GraphExecutionState._validate_effects at line 2565. 26 of those changes were fix/bug commits, and the other 80 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/shared/graph.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: invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:569— invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 656 in durableSyncedPersistence.createDurableSyncedWorkbenchPersistence at line 569. 9 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:445— invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 322 in GalleryImageGrid.GalleryImageGrid at line 445. 9 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.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: invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:174— invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 231 in LayersTree.LayersTree at line 174. 5 of those changes were fix/bug commits, and the other 25 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.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: invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:224— invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx changed 47 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 136 in LayerContextMenu.LayerMenu at line 224. 11 of those changes were fix/bug commits, and the other 36 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.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: invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2424— invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in videoPolicies.getVideoValidationIssues at line 2424. 19 of those changes were fix/bug commits, and the other 30 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:147— invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in VideoWidgetView.VideoWidgetView at line 147. 24 of those changes were fix/bug commits, and the other 27 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.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: invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:326— invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 163 in WorkflowEditorView.WorkflowFlow at line 326. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.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: invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:263— invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 155 in useImageActions.useImageActions at line 263. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/video/core/settings.ts invokeai/frontend/webv2/src/features/video/core/settings.ts:470— invokeai/frontend/webv2/src/features/video/core/settings.ts changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in settings.isVideoSettings at line 470. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/core/settings.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2175— invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts changed 59 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in baseGenerationPolicies.getSettingsWithCompatibleModelSelections at line 2175. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:667— invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in videoRecall.buildVideoRecallSettings at line 667. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:186— invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 86 in PreviewWidgetView.PreviewWidgetView at line 186. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.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: invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:796— invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in canvasProjectMutations.applyCanvasProjectMutation at line 796. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/workflow/core/document.ts invokeai/frontend/webv2/src/features/workflow/core/document.ts:915— invokeai/frontend/webv2/src/features/workflow/core/document.ts changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in document.applyProjectGraphAction at line 915. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/core/document.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:110— invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel at line 110. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.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: invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1505— invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in imageRecall.buildImageRecallSettings at line 1505. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:483— invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in UpscaleWidgetView.UpscaleWidgetView at line 483. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.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: invokeai/frontend/webv2/src/features/generation/core/settings.ts invokeai/frontend/webv2/src/features/generation/core/settings.ts:959— invokeai/frontend/webv2/src/features/generation/core/settings.ts changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in settings.normalizeGenerateSettings at line 959. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/core/settings.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/backend/model_manager/configs/lora.py invokeai/backend/model_manager/configs/lora.py:410— invokeai/backend/model_manager/configs/lora.py changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in lora._is_flux2_lora_state_dict at line 410. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/model_manager/configs/lora.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: invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:479— invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 198 in documentModel.createDocumentModel at line 479. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:179— invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in canvasHotkeyCommands.executeCanvasHotkeyCommand at line 179. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
TodoComment tests/test_graph_execution_state.py:3852— # TODO: test completion with iterators/subgraphs — 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_invocation_cache_memory.py:24— # TODO: when cache size is zero, should we consider it a miss? — 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_node_graph.py:2276— # TODO: test that derived types mixed with base types are compatible — 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_node_graph.py:2522— # TODO: TEST INVALID ITERATOR SCENARIOS — 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_node_graph.py:2739— # TODO: Graph serializes and deserializes — 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/backend/stable_diffusion/schedulers/test_schedulers.py:8— # TODO(ryand): This feels like it should be a type check, but I couldn't find a clean way to do this and didn't want — 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/backend/model_manager/test_libc_util.py:11— # TODO: Set the expected result preemptively based on the system properties. — 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/backend/flux/controlnet/test_state_dict_utils.py:56— # TODO(ryand): Figure out why some tests in this file are failing on the MacOS CI runners. It seems to be related to — 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/app/test_extract_metadata.py:49— # TODO(psyche): The extract_metadata_from_image does not validate the graph correctly. See note in `extract_metadata.py`. — 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 scripts/new_architecture.py:76— # TODO: every value below is a placeholder. The registry refuses to boot without these facets, but — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment scripts/new_architecture.py:79— # TODO: the latent -> RGB projection for this VAE, one row per latent channel. If the architecture — 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 scripts/new_architecture.py:88— # TODO: latent channels; must equal len(...LATENT_RGB_FACTORS) — 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 scripts/new_architecture.py:89— # TODO: how much smaller a latent is than the image, per side — 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 scripts/new_architecture.py:96— # TODO: the class its text encoder produces. Reuse an existing one where the shape matches. — 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 scripts/new_architecture.py:98— # TODO: what the generation sliders should say. Cite the model card in a comment. — 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 scripts/new_architecture.py:100— # TODO: which of txt2img / img2img / inpaint / outpaint / t2v / i2v it can do, and the prefix — 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 scripts/new_architecture.py:103— # TODO: dimension_grid must equal the `multiple_of` on this architecture's denoise node. — 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 scripts/new_architecture.py:131— # TODO: declare the starter models, then add them to STARTER_MODELS in this package's __init__.py. — 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 invokeai/frontend/webv1/knip.ts:12— // TODO(psyche): maybe we can clean up these utils after canvas v2 release — 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 invokeai/frontend/webv1/src/i18n.ts:6— // TODO: Disabled for IDE performance issues with our translation JSON — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment invokeai/frontend/webv1/.storybook/preview.tsx:8— // TODO: Disabled for IDE performance issues with our translation JSON — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment invokeai/frontend/webv1/src/features/system/components/SettingsModal/useClearIntermediates.ts:38— // TODO(psyche): Do we need to reset things w/ canvas v2? — 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 invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.test.ts:76— //TODO(psyche): Test workflow validation for form builder fields — 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 invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts:270— // TODO(psyche): figure out how to satisfy TS here without casting - this is _not_ an unsafe cast — 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 invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts:328— // TODO(psyche): Add more validation checks - cycles, valid invocation types, etc. — 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: workbench/workbenchState.ts invokeai/frontend/webv2/src/workbench/workbenchState.ts— FileTooLong — 4695 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4195 over it, 9.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: shared/graph.py invokeai/app/services/shared/graph.py— FileTooLong — 3724 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3224 over it, 7.45× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: projects/durableSyncedPersistence.ts invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts— FileTooLong — 3090 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: createDurableSyncedWorkbenchPersistence (569-4060). The bar is 500 significant lines; this is 2590 over it, 6.18× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: configs/main.py invokeai/backend/model_manager/configs/main.py— FileTooLong — 2611 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2111 over it, 5.22× 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: scripts/mock-backend.mjs invokeai/frontend/webv2/scripts/mock-backend.mjs— FileTooLong — 2482 significant lines (blank, comment-only and punctuation-only lines excluded), about 66% of them inside a single declaration: startMockBackend (1327-3721). The bar is 500 significant lines; this is 1982 over it, 4.96× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: canvas-engine/engine.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts— FileTooLong — 2345 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: createCanvasEngine (354-3239). The bar is 500 significant lines; this is 1845 over it, 4.69× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: core/baseGenerationPolicies.ts invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts— FileTooLong — 2141 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1641 over it, 4.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: shared/graph_materializer.py invokeai/app/services/shared/graph_materializer.py— FileTooLong — 2090 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1590 over it, 4.18× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: queue/runtime.ts invokeai/frontend/webv2/src/features/queue/runtime.ts— FileTooLong — 2083 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: createQueueRuntime (537-3004). The bar is 500 significant lines; this is 1583 over it, 4.17× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: model_install/model_install_default.py invokeai/app/services/model_install/model_install_default.py— FileTooLong — 2059 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1559 over it, 4.12× 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: metadata/parsing.tsx invokeai/frontend/webv1/src/features/metadata/parsing.tsx— FileTooLong — 2034 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1534 over it, 4.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/graph.ts invokeai/frontend/webv2/src/features/generation/core/graph.ts— FileTooLong — 1766 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1266 over it, 3.53× 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/videoPolicies.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts— FileTooLong — 1688 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1188 over it, 3.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: fields/WorkflowFieldInput.tsx invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx— FileTooLong — 1681 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1181 over it, 3.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ui/GalleryImageGrid.tsx invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx— FileTooLong — 1636 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: GalleryImageGrid (445-2172). The bar is 500 significant lines; this is 1136 over it, 3.27× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: store/canvasSlice.ts invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts— FileTooLong — 1548 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: slice (113-1899). The bar is 500 significant lines; this is 1048 over it, 3.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: model_loaders/flux.py invokeai/backend/model_manager/load/model_loaders/flux.py— FileTooLong — 1509 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1009 over it, 3.02× 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: shared/graph_validation.py invokeai/app/services/shared/graph_validation.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: REDACTED REDACTED— FileTooLong — 1447 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 947 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: model_cache/model_cache.py invokeai/backend/model_manager/load/model_cache/model_cache.py— FileTooLong — 1427 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 927 over it, 2.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: working_memory_calibration/working_memory_calibration_default.py invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py— FileTooLong — 1413 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 913 over it, 2.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: configs/lora.py invokeai/backend/model_manager/configs/lora.py— FileTooLong — 1329 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 829 over it, 2.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: projects/draftStore.ts invokeai/frontend/webv2/src/workbench/projects/draftStore.ts— FileTooLong — 1252 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 752 over it, 2.50× 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: editor/InvocationFlowNode.tsx invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx— FileTooLong — 1238 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 738 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: image-actions/imageRecall.ts invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts— FileTooLong — 1207 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 707 over it, 2.41× 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.
No assertions: keeps a meaningful settings route when all global bindings are unassigned invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:247— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: labels properties guidance, keeps it through editable focus, hides beneath modals and forgets a switched project invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:395— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: describes the center canvas before the user presses or focuses anything invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:420— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: reports the selection position in the whole board while only the pages around it are loaded invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:2493— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: reports no position for a selection its stamped page does not hold until a step locates it invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:2514— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: keeps the position of a selection that moved onto an adjacent loaded page invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:2536— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: hands the item's frame rate to the player, which steps one of its frames invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:3847— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: says why None has no settings invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.browser.test.tsx:488— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: describes the Model choice with its caption invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.browser.test.tsx:529— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: says on hover that FLUX ControlNets have no priority setting invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.browser.test.tsx:805— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: disables every control without an editable selection invokeai/frontend/webv2/src/workbench/widgets/layers/LayerBlendRow.browser.test.tsx:469— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: disables the field and the slider trigger while canvas editing is locked invokeai/frontend/webv2/src/workbench/widgets/layers/LayerBlendRow.browser.test.tsx:478— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: enables Filter as soon as the layer %s, without reselecting it invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterOperationButton.browser.test.tsx:56— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: starts each Run workflow open from a fresh form invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.browser.test.tsx:249— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: says why an overlay child row has no effect in the overlay’s words, and a raster one in its own invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.browser.test.tsx:1170— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: keeps the CFG Scale hint for a region without a negative prompt, describing its add button invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.browser.test.tsx:214— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: shows the pair on the wheel and switches the editing target invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx:1290— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: holds a canvas restore while results wait for review, but re-stages a Discard all point invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx:1505— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: explains a %s refusal with no offer invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:90— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: words a %s out of generation for the control that brings it back invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:123— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: explains a %s refusal once however often it is pressed invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:133— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: words a %s refusal that could offer a new layer in its own terms invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:148— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: replaces a repeated refusal without an offer, one toast per layer and reason invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:184— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: brings the cleared canvas back from its Undo, even after a selection or bbox change invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:338— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: pads the masks by the project's mask blur plus 8 before snapping outward to the grid invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:477— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
Repeated repair: invokeai/backend/util/vae_working_memory.py invokeai/backend/util/vae_working_memory.py:561— invokeai/backend/util/vae_working_memory.py changed 29 times in last 90 days and 16 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is vae_working_memory.estimate_vae_working_memory_sd15_sdxl at line 561), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(working-memory): reserve measured working memory for tiled VAE decodes and encodes (#9946)”; “fix(working-memory): reserve VAE working memory per dtype and allocator (#9898)”; “fix(wan): calibrate the VAE under the app's ROCm runtime”; “fix(wan): budget the video VAE decode against reserved memory”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/util/vae_working_memory.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.
Repeated repair: invokeai/app/services/shared/execution_state_migration.py invokeai/app/services/shared/execution_state_migration.py:42— invokeai/app/services/shared/execution_state_migration.py changed 14 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is execution_state_migration._compact_effects at line 42), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(workflows): drop unused child policies and read legacy child rows (#10242)”; “fix(execution): harden queue and workflow state recovery”; “fix(execution): preserve loop state across rehydration”; “fix(execution): hide runtime ledgers from API schemas”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/shared/execution_state_migration.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.
Repeated repair: invokeai/app/api/routers/images.py invokeai/app/api/routers/images.py:99— invokeai/app/api/routers/images.py changed 14 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is images.upload_image at line 99), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(images): document upload resize_to as a width/height JSON object (#10143)”; “fix(api): allow downloading the Uncategorized board (#10148)”; “fix(images): display resolved inputs and preserve source graphs (#10035)”; “fix(intermediates): protect every saved reference and isolate force clears”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/api/routers/images.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.
Repeated repair: invokeai/backend/architectures/capabilities.py invokeai/backend/architectures/capabilities.py:169— invokeai/backend/architectures/capabilities.py changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is capabilities.architecture_capabilities at line 169), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: floor guidance and CFG at 1 everywhere”; “fix(architectures): backend owns VAE and scheduler policy; clear capability outage states”; “fix(architectures): serve only what webv2 reads, and per-variant Wan VAEs”; “fix(architectures): pin the latent space per base, and bound guidance from the node”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/architectures/capabilities.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.
Repeated repair: invokeai/app/services/model_load/model_load_default.py invokeai/app/services/model_load/model_load_default.py:164— invokeai/app/services/model_load/model_load_default.py changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ModelLoadService.load_model at line 164), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(model-manager): refuse model loaders that bypass the stale-config check”; “fix(model-manager): retire per-model edit tracking once no edit or load needs it”; “fix(model-manager): keep the stale-load check off the database under MODEL_LOAD_LOCK”; “fix(model-manager): read the model record outside MODEL_LOAD_LOCK”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/model_load/model_load_default.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.
Repeated repair: invokeai/app/services/intermediates/intermediates_default.py invokeai/app/services/intermediates/intermediates_default.py:334— invokeai/app/services/intermediates/intermediates_default.py changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is IntermediatesService._resolve_scope at line 334), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(intermediates): close review findings across queue privacy, deletion safety and UI”; “fix(intermediates): protect every saved reference and isolate force clears”; “fix(intermediates): protect child media and serialize video deletion”; “fix(intermediates): protect active and undo media during cleanup”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/intermediates/intermediates_default.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.
Repeated repair: invokeai/app/util/video_audio.py invokeai/app/util/video_audio.py:50— invokeai/app/util/video_audio.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is video_audio.run_ffmpeg_process at line 50), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(audio): classify silent inputs without stderr matching (#9828)”; “fix(video): bound splice reads and walks, cancel audio decodes”; “fix(video): stop re-encoding the soundtrack kept by a trim”; “fix(video): stop re-encoding earlier segments when extending videos”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/util/video_audio.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.
Repeated repair: invokeai/backend/util/wddm.py invokeai/backend/util/wddm.py:221— invokeai/backend/util/wddm.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is wddm._resolve_adapter at line 221), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(vae): bound the pre-tiling ceiling by residency, not by usage Windows has paged out”; “fix(vae): tile on the budget and our own residency, not on an adapter counter”; “fix(vae): decide tiling on what other processes hold, not on the budget”; “fix(vae): price up-front tiling from the measured peak and a stable ceiling”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/util/wddm.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.
Repeated repair: invokeai/app/services/model_install/model_install_common.py invokeai/app/services/model_install/model_install_common.py:135— invokeai/app/services/model_install/model_install_common.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is HFModelSource.__str__ at line 135), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(model-install): preserve install tmpdir when a single multi-file part fails (#9591)”; “fix(model-manager): preserve recovery state (#9915)”; “fix(model-manager): harden install lifecycle retries”; “fix(model-manager): harden recovery and cache invalidation”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/model_install/model_install_common.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.
Repeated repair: invokeai/backend/minimax_h3/rocm_causal_conv3d.py invokeai/backend/minimax_h3/rocm_causal_conv3d.py:72— invokeai/backend/minimax_h3/rocm_causal_conv3d.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is rocm_causal_conv3d._decomposed_forward at line 72), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(minimax-h3): hand MIOpen contiguous tensors in the conv3d decomposition”; “fix(wan): keep the ROCm conv3d decomposition on HIP 7.2 and hand MIOpen contiguous tensors”; “fix(rocm): keep the MiniMax H3 encoder conv3d decomposition on HIP >= 7.2”; “fix: retire the ROCm conv3d decompositions on HIP >= 7.2”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/minimax_h3/rocm_causal_conv3d.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.
Repeated repair: invokeai/backend/model_manager/load/model_loaders/vae.py invokeai/backend/model_manager/load/model_loaders/vae.py:243— invokeai/backend/model_manager/load/model_loaders/vae.py changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is VAELoader._load_model at line 243), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(model-manager): identify standalone 16-channel VAEs as FLUX.1 or SD3”; “fix(loaders): refuse a quantized checkpoint where no loader handles its scales”; “fix(model loaders): ignore unexpected checkpoint keys, report them at debug only (#9581)”; “fix(architectures): serve only what webv2 reads, and per-variant Wan VAEs”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/model_manager/load/model_loaders/vae.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.
Repeated repair: invokeai/backend/model_manager/load/model_loaders/comfyui_state_dict_utils.py invokeai/backend/model_manager/load/model_loaders/comfyui_state_dict_utils.py:86— invokeai/backend/model_manager/load/model_loaders/comfyui_state_dict_utils.py changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is comfyui_state_dict_utils._strip_quantization_metadata at line 86), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(wan): keep ComfyUI fp8_scaled checkpoints packed instead of folding them to bf16 (#10262)”; “fix(wan): keep system RAM within the model cache budget (#10192)”; “fix(loaders): refuse quantization payloads a plain scale fold cannot decode”; “fix(loaders): refuse a rotated int8 layer where only the scale would be folded”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/model_manager/load/model_loaders/comfyui_state_dict_utils.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.
Repeated repair: invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts:170— invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is workflowImageExport.getWorkflowContentBounds at line 170), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(workflow): cancel PNG export when editor closes”; “fix(workflow): retain snapshot previews and current workflow names”; “fix(workflow): preserve snapshot layout and full resolution”; “fix(workflow): export pristine workflow snapshots”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:276— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is anima_lora_conversion_utils.lora_model_from_anima_state_dict at line 276), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(lora): apply DoRA magnitudes on Z-Image, Qwen-Image and Anima and on quantized transformers (#10245)”; “fix(lora): honor saved alpha for PEFT A/B adapters (#10156)”; “fix(lora): handle DoRA magnitudes on LoKr and LoHa layers (#10075)”; “fix(lora): identify and map Diffusers Anima LoRAs (#10076)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.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.
Repeated repair: invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:179— invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is qwen_image_lora_conversion_utils._convert_kohya_format at line 179), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(lora): apply DoRA magnitudes on Z-Image, Qwen-Image and Anima and on quantized transformers (#10245)”; “fix(qwen-image): identify LyCORIS LoRA layouts and group dotted LoKr and LoHa keys (#10189)”; “fix(qwen-image): apply LoRA text-encoder layers to the Qwen2.5-VL encoder (#10184)”; “fix(lora): honor saved alpha for PEFT A/B adapters (#10156)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.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.
Repeated repair: invokeai/backend/wan/rocm_causal_conv3d.py invokeai/backend/wan/rocm_causal_conv3d.py:96— invokeai/backend/wan/rocm_causal_conv3d.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is rocm_causal_conv3d._verified_forward at line 96), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rocm): make the offload, the budget lookup and the ROCm checks hold up”; “fix(wan): keep the ROCm conv3d decomposition on HIP 7.2 and hand MIOpen contiguous tensors”; “fix: retire the ROCm conv3d decompositions on HIP >= 7.2”; “fix: make ALL strided surfaces of the conv3d decompositions contiguous”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/wan/rocm_causal_conv3d.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.
Repeated repair: invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:116— invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is krea2_lora_conversion_utils._maybe_convert_kohya_krea2_state_dict at line 116), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(lora): handle DoRA magnitudes on LoKr and LoHa layers (#10075)”; “fix(krea2-lora): require complete LoKr modules, pin the factor mapping in tests”; “fix(krea2-lora): validate kohya keys by un-flattening, not by prefix (#9518)”; “fix(lora): support ai-toolkit DoRA magnitudes for Krea-2 LoRAs (#9517)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.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.
Repeated repair: invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts:54— invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is savedWorkflowQueries.getSavedWorkflowDetailQueryStatus at line 54), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(webv2): refresh saved workflow picker after library changes”; “fix(webv2): repair saved workflow regressions”; “fix(webv2): harden saved workflow synchronization”; “fix(webv2): repair saved workflow integration”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: invokeai/app/invocations/ideal_size.py invokeai/app/invocations/ideal_size.py:51— invokeai/app/invocations/ideal_size.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is IdealSizeInvocation.invoke at line 51), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(architectures): pin the latent space per base, and bound guidance from the node”; “fix(invocations): size Ideal Size from the declared canvas, not a squared width”; “fix(architectures): close the review findings on the facet registry”; “fix(architectures): resolve review findings in the architecture registry”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/invocations/ideal_size.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.
Repeated repair: invokeai/app/services/image_index/image_index_base.py invokeai/app/services/image_index/image_index_base.py:37— invokeai/app/services/image_index/image_index_base.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is ImageIndexServiceBase.model_id at line 37), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(image-map): cool down automatic projection refits (#10129)”; “fix(nodes): resume image indexing on its own after an encoder replacement”; “fix(ui): preserve concept edits and recover missing encoders”; “fix(image-map): correct the indexing-unavailable messages and pick up a late model install”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/image_index/image_index_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.
Repeated repair: invokeai/frontend/webv2/src/app/WorkbenchApp.tsx invokeai/frontend/webv2/src/app/WorkbenchApp.tsx:30— invokeai/frontend/webv2/src/app/WorkbenchApp.tsx changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is WorkbenchApp.WorkbenchApp at line 30), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(webv2): release intermediate holds and require undo media refs”; “fix(intermediates): protect active and undo media during cleanup”; “fix(gallery): refresh the gallery when media is uploaded elsewhere”; “fix(webv2): apply recall API updates to the Generate panel”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/app/WorkbenchApp.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts:170— invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is engineRegistry.createEngineRegistry.getOrCreateEngine at line 170), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(canvas): scope the paint barrier to document writes and never wait on open edits”; “fix(canvas): close raster-ownership review gaps”; “fix(intermediates): close review findings across queue privacy, deletion safety and UI”; “fix(intermediates): protect active and undo media during cleanup”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: invokeai/backend/pid/decode.py invokeai/backend/pid/decode.py:331— invokeai/backend/pid/decode.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is decode.load_pid_decoder at line 331), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(pid): hand PiD the normalized latent it was trained on (#9888)”; “fix(pid): make PiD 1.5 usable for FLUX.1 and FLUX.2”; “fix(loaders): refuse quantization payloads a plain scale fold cannot decode”; “fix(model loaders): ignore unexpected checkpoint keys, report them at debug only (#9581)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/backend/pid/decode.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.
Repeated repair: invokeai/app/services/image_records/image_records_base.py invokeai/app/services/image_records/image_records_base.py:24— invokeai/app/services/image_records/image_records_base.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is ImageRecordStorageBase.get at line 24), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(intermediates): protect every saved reference and isolate force clears”; “fix(images): make single-image and intermediate deletion transactional (#9361)”; “fix: remove duplicate image record methods”; “fix(api): report partial failures and bound batch bodies on image routes (#9394)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/app/services/image_records/image_records_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.
Repeated repair: invokeai/frontend/webv2/src/features/intermediates/core/selection.ts invokeai/frontend/webv2/src/features/intermediates/core/selection.ts:115— invokeai/frontend/webv2/src/features/intermediates/core/selection.ts changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is selection.resolveScope at line 115), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(intermediates): close review findings across queue privacy, deletion safety and UI”; “fix(intermediates): protect active and undo media during cleanup”; “fix(intermediates): preserve selection across pages and refreshes”; “fix(intermediates): make cleanup durable and scope-safe”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 16:59:20 +00:00' --until='2026-11-16 16:59:20 +00:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/intermediates/core/selection.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Change coupling: CanvasAddEntityButtons.tsx ↔ EntityListGlobalActionBarAddLayerMenu.tsx invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAddEntityButtons.tsx:1— `invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx` change together 100% of the time (10 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `2b2f64b2` refactor(ui): simplify useIsEntityTypeEnabled (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx`); `8837932b` create hook for managing entity type enabledness for given base model… (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx`); `c259899b` feat(ui): support for FLUX Redux in canvas (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx`) — run `git show` on any of them.
Change coupling: generate-tab-auto-layout.tsx ↔ upscaling-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1— `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` change together 96% of the time (23 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency 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 23 shared commits counted here, the most recent 3 are `8fec6add` fix(ui): keep main panel reachable on small screens (#9144) (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`); `4f3a5dcc` tidy(ui): remove unused progress related logic and components (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`); `96ee394f` refactor(ui): use dockview's own ser/de for persistence (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`) — run `git show` on any of them.
Change coupling: upscaling-tab-auto-layout.tsx ↔ workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1— `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` change together 96% of the time (23 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency 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 23 shared commits counted here, the most recent 3 are `8fec6add` fix(ui): keep main panel reachable on small screens (#9144) (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `4f3a5dcc` tidy(ui): remove unused progress related logic and components (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `96ee394f` refactor(ui): use dockview's own ser/de for persistence (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`) — run `git show` on any of them.
Change coupling: generate-tab-auto-layout.tsx ↔ workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1— `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` change together 92% of the time (23 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency 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 23 shared commits counted here, the most recent 3 are `8fec6add` fix(ui): keep main panel reachable on small screens (#9144) (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `4f3a5dcc` tidy(ui): remove unused progress related logic and components (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `96ee394f` refactor(ui): use dockview's own ser/de for persistence (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`) — run `git show` on any of them.
Change coupling: CanvasSettingsPopover.tsx ↔ canvasSettingsSlice.ts invokeai/frontend/webv1/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx:1— `invokeai/frontend/webv1/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/store/canvasSettingsSlice.ts` change together 91% of the time (10 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `340566c2` Feat(canvas): add pressure dependent opacity for brush (#9232) (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts`); `daa4fd75` ToolWidthPicker refactored (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts`); `3fd265c3` slider for brush and eraser tool (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts`) — run `git show` on any of them.
Change coupling: NegativePromptField.tsx ↔ PositivePromptField.tsx invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx:1— `invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx` and `invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx` change together 87% of the time (13 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 13 shared commits counted here, the most recent 3 are `0730324f` feat(webv2): show feature hints on generate and upscale fields; `d684fc28` fix: normalize prompt template view state; `c265016b` fix: preserve prompt behavior during template flattening — run `git show` on any of them.
Change coupling: RefImageSettings.tsx ↔ RegionalGuidanceIPAdapterSettings.tsx invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx:1— `invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx` change together 75% of the time (9 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 9 shared commits counted here, the most recent 3 are `e0d7a401` feat(ui): make ref images croppable (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/RefImage/RefImageSettings.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx`); `56cd839d` feat(ui): support for ref images for chatgpt on canvas (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterSettings.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx`); `5956f96e` feat(ui): add flux redux image influence to canvas (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterSettings.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx`) — run `git show` on any of them.
Change coupling: boardIdSelected.ts ↔ onInvocationComplete.tsx invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:1— `invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx` change together 75% of the time (9 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 9 shared commits counted here, the most recent 3 are `97844ed6` refactor(ui): item-owned reveal state machine with explicit selection… (at that commit the files were still `invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `e431d249` fix(ui): don't strand the viewer under the progress overlay, for imag… (at that commit the files were still `invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `c09dc8e1` tidy: removing unused code paths 3 (at that commit the files were still `invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`) — run `git show` on any of them.
Change coupling: UpscalingLaunchpadPanel.tsx ↔ WorkflowsLaunchpadPanel.tsx invokeai/frontend/webv1/src/features/ui/layouts/UpscalingLaunchpadPanel.tsx:1— `invokeai/frontend/webv1/src/features/ui/layouts/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/WorkflowsLaunchpadPanel.tsx` change together 70% of the time (7 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `193de6a8` feat(ui): add launchpad container component (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/WorkflowsLaunchpadPanel.tsx`); `8b8e29d2` Fixes & Styling updates (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/WorkflowsLaunchpadPanel.tsx`); `46a56191` Update all text to translations (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/WorkflowsLaunchpadPanel.tsx`) — run `git show` on any of them.
Change coupling: z_image_denoise.py ↔ buildZImageGraph.ts invokeai/app/invocations/z_image_denoise.py:1— `invokeai/app/invocations/z_image_denoise.py` and `invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `a3507121` feat: add configurable shift parameter for Z-Image (#9004) (at that commit the file was still `invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts`); `689953e3` Feature/zimage scheduler support (#8705) (at that commit the file was still `invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts`); `132a4849` feat(z-image): add scheduler support with metadata recall (at that commit the file was still `invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts`) — run `git show` on any of them.
Change coupling: WorkflowLibrarySideNav.tsx ↔ WorkflowList.tsx invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx:1— `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `2be701cf` Feature: Add Tag System for user made Workflows (#8673) (at that commit the files were still `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx`); `97593f95` feat(ui): on first load, if the selected library view has no workflow… (at that commit the files were still `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx`); `afd894fd` update recent workflows UI (at that commit the files were still `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx`) — run `git show` on any of them.
Change coupling: denoise_latents.py ↔ tiled_multi_diffusion_denoise_latents.py invokeai/app/invocations/denoise_latents.py:1— `invokeai/app/invocations/denoise_latents.py` and `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `58e859dc` fix(fp8): resolve compute dtype instead of reading model.dtype (#9412); `8d3743c6` tidy(nodes): rename `controlnet_image_processors.py` -> `controlnet.py`; `830880a6` chore(nodes): update titles of all model-specific nodes to reference … — run `git show` on any of them.
Change coupling: compel.py ↔ sd3_text_encoder.py invokeai/app/invocations/compel.py:1— `invokeai/app/invocations/compel.py` and `invokeai/app/invocations/sd3_text_encoder.py` change together 65% of the time (11 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `68b90174` Fix: compute device partial load (#9375); `ee600973` Broaden text encoder partial-load recovery (#9034); `76b08380` Feature(backend): Add user toggle to run encoder models on CPU (#8777) — run `git show` on any of them.
Change coupling: CanvasLaunchpadPanel.tsx ↔ GenerateLaunchpadPanel.tsx invokeai/frontend/webv1/src/features/ui/layouts/CanvasLaunchpadPanel.tsx:1— `invokeai/frontend/webv1/src/features/ui/layouts/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/GenerateLaunchpadPanel.tsx` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 7 shared commits counted here, the most recent 3 are `193de6a8` feat(ui): add launchpad container component (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/GenerateLaunchpadPanel.tsx`); `e73150c3` feat(ui): improved automatic tab/panel switching on user actions (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/GenerateLaunchpadPanel.tsx`); `3f1b2c39` Model Guide link update (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/GenerateLaunchpadPanel.tsx`) — run `git show` on any of them.
Change coupling: GeneratePromptFields.tsx ↔ PositivePromptActions.tsx invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx:1— `invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx` and `invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx` change together 62% of the time (8 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `dd48b768` feat(webv2): default and remember the prompt tool models; `3d65cd11` feat(generate): rework prompt fields; `c265016b` fix: preserve prompt behavior during template flattening — run `git show` on any of them.
Change coupling: ModelBaseBadge.tsx ↔ REDACTED invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx:1— `invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/webv1/src/features/parameters/types/constants.ts` change together 60% of the time (12 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — 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 12 shared commits counted here, the most recent 3 are `30619c04` add runway back as a model and allow runway and veo3 to live together… (at that commit the files were still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/web/src/features/parameters/types/constants.ts`); `6370412e` tsc (at that commit the files were still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/web/src/features/parameters/types/constants.ts`); `406e0be3` Revert "tsc" (at that commit the files were still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/web/src/features/parameters/types/constants.ts`) — run `git show` on any of them.
Change coupling: Filter.tsx ↔ Transform.tsx invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:1— `invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/Transform/Transform.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `b7510ce7` feat(ui): filter, select object and transform UI buttons (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/Transform/Transform.tsx`); `7f2c83b9` feat(ui): consolidate isolated preview settings (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/Transform/Transform.tsx`); `6efa1597` feat(ui): focus canvas on filter/transform (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/Transform/Transform.tsx`) — run `git show` on any of them.
Change coupling: types.ts ↔ onInvocationComplete.tsx invokeai/frontend/webv1/src/features/gallery/store/types.ts:1— `invokeai/frontend/webv1/src/features/gallery/store/types.ts` and `invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `e77c0d12` feat: Add virtual boards that dynamically group images by date (#8971) (at that commit the files were still `invokeai/frontend/web/src/features/gallery/store/types.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `c09dc8e1` tidy: removing unused code paths 3 (at that commit the files were still `invokeai/frontend/web/src/features/gallery/store/types.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `895eac6b` integrating video into gallery - thinking maybe a new category of ima… (at that commit the files were still `invokeai/frontend/web/src/features/gallery/store/types.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`) — run `git show` on any of them.
Change coupling: RefImageImage.tsx ↔ ImageFieldInputComponent.tsx invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:1— `invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx` and `invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ImageFieldInputComponent.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `faeb5f0c` refactor(ui): canvas flow (wip) (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterImagePreview.tsx` and `invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ImageFieldInputComponent.tsx`); `2d974f67` feat(ui): restore missing upload buttons (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterImagePreview.tsx` and `invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ImageFieldInputComponent.tsx`); `1afc2cba` feat(ui): support different labels for external drop targets (e.g. up… (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterImagePreview.tsx` and `invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ImageFieldInputComponent.tsx`) — run `git show` on any of them.
Change coupling: images_base.py ↔ GalleryImageGrid.tsx invokeai/app/services/images/images_base.py:1— `invokeai/app/services/images/images_base.py` and `invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ab5cb2c2` refactor: optimistic gallery updates (at that commit the file was still `invokeai/frontend/web/src/features/gallery/components/NewGallery.tsx`); `b2b42be5` refactor: remove unused methods/routes, fix some gallery invalidation… (at that commit the file was still `invokeai/frontend/web/src/features/gallery/components/NewGallery.tsx`); `f68d8ed3` refactor: gallery scroll (improved impl) (at that commit the file was still `invokeai/frontend/web/src/features/gallery/components/NewGallery.tsx`) — run `git show` on any of them.
Change coupling: PreviewHeaderActions.tsx ↔ PreviewWidgetView.tsx invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.tsx:1— `invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.tsx` and `invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 `a7358004` feat(preview): add video frame copy and details; `7f84519d` feat(preview): add mixed media video viewer; `df502df8` feat(preview): open full image context menu from header dropdown like… — run `git show` on any of them.
Change coupling: load_default.py ↔ MainModelDefaultSettings.tsx invokeai/backend/model_manager/load/load_default.py:1— `invokeai/backend/model_manager/load/load_default.py` and `invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6706a708` feat(models): enable FP8 storage for FP8 checkpoints at install (at that commit the file was still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx`); `57c85344` fix(fp8): never apply FP8 storage to already-quantized weights (#9416) (at that commit the file was still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx`); `b06e57e6` feat(fp8): enable FP8 storage for Z-Image (#9414) (at that commit the file was still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx`) — run `git show` on any of them.
Change coupling: assetTransport.ts ↔ projectFile.ts invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:1— `invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts` and `invokeai/frontend/webv2/src/workbench/projects/projectFile.ts` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6a0b0a62` fix(projects): clear references to deleted boards when a project loads; `ea2210ce` refactor(projects): share the duplicated transport, walker and quaran…; `b79742cd` fix(projects): harden media restoration — run `git show` on any of them.
Change coupling: common.ts ↔ DimensionsAspectRatioSelect.tsx invokeai/frontend/webv1/src/features/nodes/types/common.ts:1— `invokeai/frontend/webv1/src/features/nodes/types/common.ts` and `invokeai/frontend/webv1/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx` change together 59% of the time (10 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `299a4db3` chore(ui): lint (at that commit the files were still `invokeai/frontend/web/src/features/nodes/types/common.ts` and `invokeai/frontend/web/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx`); `30619c04` add runway back as a model and allow runway and veo3 to live together… (at that commit the files were still `invokeai/frontend/web/src/features/nodes/types/common.ts` and `invokeai/frontend/web/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx`); `e046417c` replace runway with veo, build out veo3 model support (at that commit the files were still `invokeai/frontend/web/src/features/nodes/types/common.ts` and `invokeai/frontend/web/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx`) — run `git show` on any of them.
Change coupling: videoPolicies.ts ↔ videoRecall.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1— `invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts` and `invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts` change together 59% of the time (10 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `97c0adaa` feat(video): let LTX-2 soundtrack conditioning keep first and last fr…; `9c8b2338` fix: floor guidance and CFG at 1 everywhere; `b37b0091` fix(webv2): restore LTX-2 dev's negative prompt when the panel carrie… — run `git show` on any of them.
Cross-slice coupling: auth → toast invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:32— `UserMenu` (slice 'auth') depends on `toast` from slice 'toast'.
Cross-slice coupling: changeBoardModal → gallery invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:44— `ChangeBoardModal` (slice 'changeBoardModal') depends on `selectSelectedBoardId` from slice 'gallery'.
Cross-slice coupling: changeBoardModal → auth invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:45— `ChangeBoardModal` (slice 'changeBoardModal') depends on `selectCurrentUser` from slice 'auth'.
Cross-slice coupling: changeBoardModal → auth invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:92— `ChangeBoardModal` (slice 'changeBoardModal') depends on `captureAuthContext` from slice 'auth'.
Cross-slice coupling: changeBoardModal → auth invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:135— `ChangeBoardModal` (slice 'changeBoardModal') depends on `isSameAuthContext` from slice 'auth'.
Cross-slice coupling: changeBoardModal → toast invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:148— `ChangeBoardModal` (slice 'changeBoardModal') depends on `toast` from slice 'toast'.
Cross-slice coupling: controlLayers → system invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:45— `CanvasAlertsInvocationProgress` (slice 'controlLayers') depends on `selectSystemShouldShowInvocationProgressDetail` from slice 'system'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:9— `addRasterLayerFromImageDndTargetData` (slice 'controlLayers') depends on `newCanvasEntityFromImageDndTarget` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:43— `CanvasDropArea` (slice 'controlLayers') depends on `DndDropTarget` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:54— `CanvasEntityContainer` (slice 'controlLayers') depends on `DndListDropIndicator` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:40— `CanvasEntityGroupList` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:114— `CanvasEntityGroupList` (slice 'controlLayers') depends on `triggerPostMoveFlash` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15— `useCanvasEntityListDnd` (slice 'controlLayers') depends on `DndListTargetState` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15— `useCanvasEntityListDnd` (slice 'controlLayers') depends on `idle` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:24— `useCanvasEntityListDnd` (slice 'controlLayers') depends on `dndInputFix` from slice 'dnd'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:28— `useCanvasEntityListDnd` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'.
Cross-slice coupling: controlLayers → gallery invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:35— `CanvasPasteModal` (slice 'controlLayers') depends on `selectAutoAddBoardId` from slice 'gallery'.
Cross-slice coupling: controlLayers → imageActions invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:68— `CanvasPasteModal` (slice 'controlLayers') depends on `createNewCanvasEntityFromImage` from slice 'imageActions'.
Cross-slice coupling: controlLayers → toast invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:77— `CanvasPasteModal` (slice 'controlLayers') depends on `toast` from slice 'toast'.
Cross-slice coupling: controlLayers → nodes invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:47— `WorkflowFieldRendererProps` (slice 'controlLayers') depends on `NodeFieldElement` from slice 'nodes'.
Cross-slice coupling: controlLayers → nodes invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:56— `WorkflowFieldRenderer` (slice 'controlLayers') depends on `$templates` from slice 'nodes'.
Cross-slice coupling: controlLayers → parameters invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:162— `WorkflowFieldRenderer` (slice 'controlLayers') depends on `isParameterScheduler` from slice 'parameters'.
Cross-slice coupling: controlLayers → parameters invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:170— `WorkflowFieldRenderer` (slice 'controlLayers') depends on `SCHEDULER_OPTIONS` from slice 'parameters'.
Cross-slice coupling: controlLayers → nodes invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:411— `WorkflowFieldRenderer` (slice 'controlLayers') depends on `ModelFieldCombobox` from slice 'nodes'.
Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:518— `ImageFieldComponent` (slice 'controlLayers') depends on `DndImage` from slice 'dnd'.
+ 15 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×40
No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.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 invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.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 invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStageModule.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityObjectRenderer.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 invokeai/frontend/webv1/src/features/controlLayers/store/filters.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 invokeai/frontend/webv1/src/features/nodes/components/flow/Flow.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterBase.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 invokeai/frontend/webv1/src/features/auth/components/UserManagement.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.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 invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.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 invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.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 invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.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 invokeai/frontend/webv1/src/features/system/components/HotkeysModal/HotkeyListItem.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 invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.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 invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.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 invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.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 invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.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.
Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/bootWidgetPreload.ts:41— 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) invokeai/frontend/webv2/src/workbench/performanceMarks.ts:33— 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) invokeai/frontend/webv2/src/workbench/widgets/preview/loupeGestures.ts:32— 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) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:673— `.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) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:1022— 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) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewSwipeNeighbor.tsx:116— `.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) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:190— 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) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerSelectionCommands.ts:64— 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) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:401— 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) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:193— 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) invokeai/frontend/webv2/src/workbench/widgets/image-map/useSelectMapImage.ts:47— `.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) invokeai/frontend/webv2/src/workbench/widgets/image-map/useSelectMapImage.ts:96— `.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) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:64— `.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) invokeai/frontend/webv2/src/workbench/widgets/canvas/toolFamilyStore.ts:33— 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) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:106— 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) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts:34— 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) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts:47— 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) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:159— 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) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:186— `.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) invokeai/frontend/webv2/src/workbench/settings/store.ts:917— 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) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:119— 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) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunPersistence.ts:120— 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) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunPersistence.ts:140— 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) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunPersistence.ts:156— `.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) invokeai/frontend/webv2/src/workbench/projects/api.ts:559— 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 (6 lines × 2) invokeai/app/invocations/baseinvocation.py:793— invokeai/app/invocations/baseinvocation.py:793-798 | invokeai/app/invocations/baseinvocation.py:921-926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `cls` to `Type[TBaseInvocation]` in one and `Type[TBaseInvocationOutput]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 2) invokeai/app/invocations/flux/flux_denoise.py:586— invokeai/app/invocations/flux/flux_denoise.py:586-592 | invokeai/app/invocations/flux2/flux2_denoise.py:698-703 — 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, `invokeai/app/invocations/flux/flux_denoise.py:583` calls `isinstance` and `invokeai/app/invocations/flux2/flux2_denoise.py:695` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) invokeai/app/invocations/krea2/krea2_model_loader.py:99— invokeai/app/invocations/krea2/krea2_model_loader.py:99-108 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py:87-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) invokeai/app/invocations/sd/create_denoise_mask.py:61— invokeai/app/invocations/sd/create_denoise_mask.py:61-66 | invokeai/app/invocations/sd/create_gradient_mask.py:193-198 — 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) invokeai/app/services/session_queue/session_queue_default.py:931— invokeai/app/services/session_queue/session_queue_default.py:931-936 | invokeai/app/services/session_queue/session_queue_default.py:976-981 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/execution_engine/scheduler.py:369— invokeai/app/services/shared/execution_engine/scheduler.py:369-374 | invokeai/app/services/shared/execution_engine/scheduler.py:414-419 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/graph.py:418— invokeai/app/services/shared/graph.py:418-423 | invokeai/app/services/shared/graph.py:430-435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) invokeai/app/services/shared/graph.py:2292— invokeai/app/services/shared/graph.py:2292-2297 | invokeai/app/services/shared/graph.py:3722-3728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:2292` it does not close everything it opens, so those exact lines 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) invokeai/app/services/shared/graph.py:2294— invokeai/app/services/shared/graph.py:2294-2299 | invokeai/app/services/shared/graph.py:3999-4004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:2294` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/services/shared/graph_iterator_ancestry.py:82— invokeai/app/services/shared/graph_iterator_ancestry.py:82-87 | invokeai/app/services/shared/graph_iterator_ancestry.py:141-146 — both copies are in the same file, so extract the block into 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) invokeai/app/util/user_management.py:82— invokeai/app/util/user_management.py:82-87 | invokeai/app/util/user_management.py:144-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) invokeai/app/util/user_management.py:450— invokeai/app/util/user_management.py:450-455 | invokeai/app/util/user_management.py:551-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.
Duplicated block (6 lines × 2) invokeai/backend/flux/custom_block_processor.py:35— invokeai/backend/flux/custom_block_processor.py:35-40 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:49-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) invokeai/backend/flux/custom_block_processor.py:35— invokeai/backend/flux/custom_block_processor.py:35-40 | invokeai/backend/flux/modules/layers.py:164-169 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) invokeai/backend/flux/extensions/kontext_extension.py:177— invokeai/backend/flux/extensions/kontext_extension.py:177-183 | invokeai/backend/flux2/ref_image_extension.py:295-300 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) invokeai/backend/image_util/dw_openpose/utils.py:140— invokeai/backend/image_util/dw_openpose/utils.py:140-145 | invokeai/backend/image_util/dw_openpose/utils.py:153-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/model_manager/configs/lora.py:710— invokeai/backend/model_manager/configs/lora.py:710-716 | invokeai/backend/model_manager/configs/lora.py:744-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 (6 lines × 2) REDACTED:1288— REDACTED:1288-1293 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:385-390 — 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) invokeai/backend/model_manager/load/model_loaders/vae.py:396— invokeai/backend/model_manager/load/model_loaders/vae.py:396-401 | invokeai/backend/model_manager/load/model_loaders/vae.py:520-525 — both copies are in the same file, so extract the 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, `invokeai/backend/model_manager/load/model_loaders/vae.py:519` calls `_wan_family_dtype` and `invokeai/backend/model_manager/load/model_loaders/vae.py:394` 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) invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:176— invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:176-181 | invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:208-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. 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, `invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:183` calls `fullmatch` and `invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:215` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) invokeai/backend/quantization/gguf/utils.py:156— invokeai/backend/quantization/gguf/utils.py:156-161 | invokeai/backend/quantization/gguf/utils.py:183-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.
Duplicated block (6 lines × 2) invokeai/backend/rectified_flow/er_sde_scheduler.py:425— invokeai/backend/rectified_flow/er_sde_scheduler.py:425-430 | invokeai/backend/rectified_flow/er_sde_scheduler.py:477-482 — both copies are in the same file, so extract the 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, `invokeai/backend/rectified_flow/er_sde_scheduler.py:476` calls `_sigma_to_alpha_sigma_t` and `invokeai/backend/rectified_flow/er_sde_scheduler.py:423` 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) invokeai/backend/stable_diffusion/diffusion/custom_atttention.py:125— invokeai/backend/stable_diffusion/diffusion/custom_atttention.py:125-130 | invokeai/backend/stable_diffusion/extensions/ip_adapter.py:276-283 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/stable_diffusion/diffusion/custom_atttention.py:125` it does not close everything it opens, so those exact lines 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) invokeai/backend/image_util/color_conversion.py:690— invokeai/backend/image_util/color_conversion.py:690-695 | invokeai/backend/image_util/color_conversion.py:946-951 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/database/queries/images.py:495— invokeai/app/services/shared/database/queries/images.py:495-500 | invokeai/app/services/shared/database/queries/videos.py:442-447 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 5 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.
HackComment REDACTED:74— # HACK: The CLIPTokenizer API does not include a way to remove tokens after calling add_tokens(...). As a — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/spandrel_image_to_image_model.py:136— # HACK(ryand): Fix this issue with circular imports. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/ip_adapter/ip_adapter.py:137— # HACK(ryand): Fix this issue with circular imports. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/textual_inversion.py:124— # HACK: If TI token expansion causes us to exceed the max text encoder input length, we silently discard — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/stable_diffusion/denoise_context.py:58— # HACK(ryand): seed is only used in a particular case when `noise` is None, but we need to re-generate the — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/stable_diffusion/diffusers_pipeline.py:510— # Hack: force compatibility with irregular resolutions by padding the feature map with zeros — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/stable_diffusion/extensions/ip_adapter.py:121— # HACK: unload image projection model, as it no longer needed — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_util.py:72— # HACK(ryand): len(model) just returns the vocabulary size, so this is blatantly wrong. It should be small — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:1068— # HACK(ryand): We shouldn't be hard-coding the compute_dtype here. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:1071— # HACK(ryand): There are some broken GGUF models in circulation that have the wrong shape for img_in.weight. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:2001— # HACK(ryand): Is it safe to assume dev here? — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_loaders/lora.py:179— # HACK(ryand): We set alpha=None for diffusers PEFT format models. These models are typically — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/torch_module_autocast.py:96— # HACK(ryand): We use custom initialization logic so that we can initialize a new custom layer instance from an — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/torch_module_autocast.py:110— # HACK(ryand): We use custom initialization logic so that we can initialize a new custom layer instance from an — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:62— # HACK(ryand): Casting self.weight to the device also casts the self.weight.quant_state in-place (i.e. it — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.py:53— # HACK(ryand): If the original parameters are in a quantized format whose weights can't be accessed, we replace — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:52— # HACK(ryand): We use this dictionary any time we are doing byte tracking calculations. We do this for — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:190— # HACK(ryand): Typically, non-persistent buffers are moved when calling module.to(device). We don't move entire — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:26— # HACK: The SAM2 pipeline may not work on MPS devices. We only allow it to be moved to CPU or CUDA. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:32— # HACK: Fix the circular import issue. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:20— # HACK(ryand): The SAM pipeline does not work on MPS devices. We only allow it to be moved to CPU or CUDA. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:26— # HACK(ryand): Fix the circular import issue. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/image_util/grounding_dino/grounding_dino_pipeline.py:34— # HACK(ryand): Fix the circular import issue. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/image_util/grounding_dino/grounding_dino_pipeline.py:26— # HACK(ryand): The GroundingDinoPipeline does not work on MPS devices. We only allow it to be moved to CPU or — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment invokeai/backend/hidiffusion/hidiffusion.py:2066— # Hack, avoid non-square problem. See unet_2d_condition.py in diffusers — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
Duplicated block (7 lines × 2) invokeai/app/api/routers/videos.py:1126— invokeai/app/api/routers/videos.py:1126-1132 | invokeai/app/api/routers/videos.py:1154-1160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/videos.py:1126` it does not close everything it opens, so those exact lines 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) invokeai/app/api/routers/workflows.py:487— invokeai/app/api/routers/workflows.py:487-493 | invokeai/app/api/routers/workflows.py:508-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 (7 lines × 2) invokeai/app/invocations/flux/flux_denoise.py:597— invokeai/app/invocations/flux/flux_denoise.py:597-603 | invokeai/app/invocations/flux/flux_denoise.py:635-641 — both copies are in the same file, so extract the block into 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) invokeai/app/invocations/flux2/flux2_denoise.py:666— invokeai/app/invocations/flux2/flux2_denoise.py:666-672 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:791-797 — 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 `invokeai/app/invocations/flux2/flux2_denoise.py:666` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) invokeai/app/invocations/image.py:1228— invokeai/app/invocations/image.py:1228-1234 | invokeai/app/invocations/image.py:1304-1310 — both copies are in the same file, so extract the 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 after the matched lines, `invokeai/app/invocations/image.py:1313` calls `_prepare_mask`, `get_pil` and `invokeai/app/invocations/image.py:1237` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) invokeai/app/invocations/model.py:556— invokeai/app/invocations/model.py:556-562 | invokeai/app/invocations/model.py:720-726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:1005— invokeai/app/invocations/sd/denoise_latents.py:1005-1011 | invokeai/app/invocations/sd/denoise_latents.py:1257-1263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/sd/denoise_latents.py:1005` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/invocations/vae/flux2_vae_decode.py:149— invokeai/app/invocations/vae/flux2_vae_decode.py:149-155 | invokeai/app/invocations/vae/flux_vae_decode.py:154-160 — 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) invokeai/app/services/shared/execution_engine/scheduler.py:383— invokeai/app/services/shared/execution_engine/scheduler.py:383-389 | invokeai/app/services/shared/execution_engine/scheduler.py:427-433 — both copies are in the same file, so extract the 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, `invokeai/app/services/shared/execution_engine/scheduler.py:382` calls `add` and `invokeai/app/services/shared/execution_engine/scheduler.py:426` 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 × 2) invokeai/backend/anima/anima_transformer.py:273— invokeai/backend/anima/anima_transformer.py:273-279 | invokeai/backend/anima/anima_transformer_patch.py:38-44 — 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) invokeai/backend/ernie_image/denoise.py:125— invokeai/backend/ernie_image/denoise.py:125-131 | invokeai/backend/ernie_image/denoise.py:171-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) invokeai/backend/flux/custom_block_processor.py:27— invokeai/backend/flux/custom_block_processor.py:27-33 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:41-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) invokeai/backend/image_util/hed.py:138— invokeai/backend/image_util/hed.py:138-144 | invokeai/backend/image_util/hed.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/image_util/hed.py:133` calls `normalize_image_channel_count`, `resize_image_to_resolution` and `invokeai/backend/image_util/hed.py:205` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:2294— invokeai/backend/model_manager/load/model_loaders/flux.py:2294-2300 | invokeai/backend/model_manager/load/model_loaders/flux.py:2320-2339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:2294` it begins part-way through the construct above it, so those exact lines 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) invokeai/backend/model_manager/load/model_loaders/krea2.py:1233— invokeai/backend/model_manager/load/model_loaders/krea2.py:1233-1243 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:383-389 — 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, `invokeai/backend/model_manager/load/model_loaders/qwen_image.py:382` calls `info` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:1232` 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 × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:344— invokeai/backend/pid/_src/networks/pixeldit_official.py:344-350 | invokeai/backend/pid/_src/networks/pixeldit_official.py:355-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) invokeai/backend/stable_diffusion/diffusers_pipeline.py:598— invokeai/backend/stable_diffusion/diffusers_pipeline.py:598-604 | invokeai/backend/stable_diffusion/extensions/rescale_cfg.py:21-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:966— invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:966-972 | invokeai/app/services/video_files/video_files_disk.py:241-247 — 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) invokeai/app/services/model_records/model_records_base.py:93— invokeai/app/services/model_records/model_records_base.py:93-99 | invokeai/backend/model_manager/configs/base.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) invokeai/backend/util/devices.py:435— invokeai/backend/util/devices.py:435-441 | invokeai/backend/working_memory/counters.py:242-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_10_board_roles.py:47— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_10_board_roles.py:47-53 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_10_project_workspaces.py:27-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_10_board_roles.py:47` it does not close everything it opens, so those exact lines 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) invokeai/backend/pid/_src/networks/pixeldit_official.py:144— invokeai/backend/pid/_src/networks/pixeldit_official.py:144-150 | invokeai/backend/pid/_src/networks/pixeldit_official.py:186-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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, `invokeai/backend/pid/_src/networks/pixeldit_official.py:183` calls `arange` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:142` 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 × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:880— invokeai/backend/pid/_src/networks/pixeldit_official.py:880-886 | invokeai/backend/pid/_src/networks/pixeldit_official.py:999-1005 — both copies are in the same file, so extract the block into 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) scripts/calibrate_vae_tiling_working_memory.py:302— scripts/calibrate_vae_tiling_working_memory.py:302-308 | scripts/calibrate_z_image_working_memory.py:283-290 — 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) scripts/calibrate_flux2_denoise_working_memory.py:455— scripts/calibrate_flux2_denoise_working_memory.py:455-461 | scripts/calibrate_flux3_denoise_working_memory.py:641-647 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) invokeai/app/api/routers/system_prompts.py:83— invokeai/app/api/routers/system_prompts.py:83-93 | invokeai/app/api/routers/system_prompts.py:107-117 — both copies are in the same file, so extract the 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 `system_prompt_id` to `str = Path(description="The id of the system prompt to update")` in one and `str = Path(description="The id of the system prompt to delete")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) invokeai/app/api/routers/workflows.py:102— invokeai/app/api/routers/workflows.py:102-112 | invokeai/app/api/routers/workflows.py:154-164 — both copies are in the same file, so extract the 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 `workflow_id` to `str = Path(description="The workflow to get")` in one and `str = Path(description="The workflow to delete")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:970— invokeai/app/invocations/anima/anima_denoise.py:970-980 | invokeai/app/invocations/anima/anima_denoise.py:1031-1041 — both copies are in the same file, so extract the block into 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) invokeai/app/invocations/flux3/flux3_model_loader.py:108— invokeai/app/invocations/flux3/flux3_model_loader.py:108-118 | invokeai/app/invocations/krea2/krea2_model_loader.py:122-132 — 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 `invokeai/app/invocations/flux3/flux3_model_loader.py:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) invokeai/app/invocations/krea2/krea2_style_reference.py:224— invokeai/app/invocations/krea2/krea2_style_reference.py:224-234 | invokeai/backend/krea2/style_reference_extension.py:106-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/krea2/krea2_style_reference.py:224` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/invocations/vae/flux2_vae_encode.py:95— invokeai/app/invocations/vae/flux2_vae_encode.py:95-105 | invokeai/backend/flux2/ref_image_extension.py:127-137 — 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) invokeai/app/services/external_generation/providers/alibabacloud.py:244— invokeai/app/services/external_generation/providers/alibabacloud.py:244-254 | invokeai/app/services/external_generation/providers/alibabacloud.py:279-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/services/model_install/model_install_default.py:2295— invokeai/app/services/model_install/model_install_default.py:2295-2305 | invokeai/app/services/model_install/model_install_default.py:2314-2324 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/graph.py:1197— invokeai/app/services/shared/graph.py:1197-1207 | invokeai/app/services/shared/graph.py:1294-1304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:1197` it does not close everything it opens, so those 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) invokeai/app/services/shared/graph.py:2131— invokeai/app/services/shared/graph.py:2131-2141 | invokeai/app/services/shared/graph.py:2144-2154 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/graph_if_dependencies.py:55— invokeai/app/services/shared/graph_if_dependencies.py:55-65 | invokeai/app/services/shared/graph_if_dependencies.py:130-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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, `invokeai/app/services/shared/graph_if_dependencies.py:127` calls `_get_input_edges` and `invokeai/app/services/shared/graph_if_dependencies.py:53` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) invokeai/app/services/shared/graph_materializer.py:622— invokeai/app/services/shared/graph_materializer.py:622-632 | invokeai/app/services/shared/graph_materializer.py:950-960 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) invokeai/app/util/user_management.py:348— invokeai/app/util/user_management.py:348-358 | invokeai/app/util/user_management.py:386-396 — both copies are in the same file, so extract the block into 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) invokeai/backend/image_util/lineart.py:152— invokeai/backend/image_util/lineart.py:152-162 | invokeai/backend/image_util/lineart_anime.py:196-206 — 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) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:32— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:32-42 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:31-41 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:202— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:202-212 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:201-211 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:214` calls `_load_pretrained_model` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:216` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) invokeai/backend/model_manager/load/model_cache/model_cache.py:2906— invokeai/backend/model_manager/load/model_cache/model_cache.py:2906-2916 | invokeai/backend/model_manager/load/model_cache/model_cache.py:2993-3003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_cache/model_cache.py:3005` calls `release` and `invokeai/backend/model_manager/load/model_cache/model_cache.py:2918` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:301— invokeai/backend/model_manager/load/model_loaders/z_image.py:301-311 | invokeai/backend/model_manager/load/model_loaders/z_image.py:421-431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1059— invokeai/backend/pid/_src/networks/pixeldit_official.py:1059-1069 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1133-1143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/invocations/flux2/flux2_control.py:109— invokeai/app/invocations/flux2/flux2_control.py:109-119 | invokeai/app/invocations/qwen_image/qwen_image_control.py:115-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/flux2/flux2_control.py:109` it begins part-way through the construct above it, so those exact lines 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) invokeai/backend/model_manager/configs/main.py:129— invokeai/backend/model_manager/configs/main.py:129-139 | invokeai/backend/quantization/sdnq/loaders.py:383-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 `state_dict` to `dict[str | int, Any]` in one and `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 (11 lines × 2) invokeai/app/api/routers/board_images.py:93— invokeai/app/api/routers/board_images.py:93-103 | invokeai/app/api/routers/videos.py:155-165 — 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 (11 lines × 2) invokeai/app/invocations/flux/flux_controlnet.py:90— invokeai/app/invocations/flux/flux_controlnet.py:90-100 | invokeai/app/invocations/sd/controlnet.py:102-112 — 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.
AC2 · Forms & labels· <Input> field component without a label · ×22
<Input> field component without a label invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:826— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:134— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:155— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:174— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:206— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:214— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:234— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:253— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:201— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:246— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:309— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Toolbar/CanvasToolbarSnapshotMenuButton.tsx:191— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsList/BoardsSearch.tsx:45— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GallerySearch.tsx:37— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/ImageMetadataViewer/DataViewer.tsx:139— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/ImageMetadataViewer/ImageMetadataViewer.tsx:117— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HFToken.tsx:79— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HFToken.tsx:121— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HuggingFaceResults.tsx:62— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ScanFolder/ScanFolderResults.tsx:96— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/StarterModels/StarterModelsResults.tsx:81— 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.
<Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelListNavigation.tsx:32— 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 (5 lines × 2) invokeai/app/api/routers/utilities.py:532— invokeai/app/api/routers/utilities.py:532-536 | invokeai/app/api/routers/utilities.py:649-653 — both copies are in the same file, so extract the 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 `body` to `ExpandPromptRequest` in one and `ImageToPromptRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:690— invokeai/app/invocations/anima/anima_denoise.py:690-694 | invokeai/app/invocations/z_image/z_image_denoise.py:330-335 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) invokeai/app/invocations/metadata_linked.py:529— invokeai/app/invocations/metadata_linked.py:529-533 | invokeai/app/invocations/metadata_linked.py:585-589 — both copies are in the same file, so extract the block into 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) invokeai/app/invocations/vae/latents_to_image.py:101— invokeai/app/invocations/vae/latents_to_image.py:101-110 | scripts/calibrate_vae_tiling_working_memory.py:451-455 — 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 `invokeai/app/invocations/vae/latents_to_image.py:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) invokeai/app/invocations/wan/wan_lora_loader.py:193— invokeai/app/invocations/wan/wan_lora_loader.py:193-197 | invokeai/app/invocations/wan/wan_lora_loader.py:274-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) invokeai/app/services/image_records/image_records_common.py:176— invokeai/app/services/image_records/image_records_common.py:176-184 | invokeai/app/services/video_records/video_records_common.py:107-111 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) invokeai/app/util/database_copy.py:174— invokeai/app/util/database_copy.py:174-178 | invokeai/app/util/database_copy.py:257-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:145— invokeai/backend/flux/controlnet/state_dict_utils.py:145-149 | invokeai/backend/model_manager/load/model_loaders/flux.py:2310-2314 — 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 `invokeai/backend/flux/controlnet/state_dict_utils.py:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) invokeai/backend/image_util/color_conversion.py:625— invokeai/backend/image_util/color_conversion.py:625-629 | invokeai/backend/image_util/color_conversion.py:695-699 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/color_conversion.py:625` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) invokeai/backend/image_util/color_conversion.py:684— invokeai/backend/image_util/color_conversion.py:684-688 | invokeai/backend/image_util/color_conversion.py:940-944 — both copies are in the same file, so extract the block into 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) invokeai/backend/image_util/lineart_anime.py:152— invokeai/backend/image_util/lineart_anime.py:152-156 | invokeai/backend/image_util/lineart_anime.py:225-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 (5 lines × 2) invokeai/backend/image_util/mlsd/utils.py:68— invokeai/backend/image_util/mlsd/utils.py:68-72 | invokeai/backend/image_util/mlsd/utils.py:125-129 — both copies are in the same file, so extract the block into 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) invokeai/backend/pid/_src/networks/pixeldit_official.py:138— invokeai/backend/pid/_src/networks/pixeldit_official.py:138-142 | invokeai/backend/pid/_src/networks/pixeldit_official.py:177-181 — both copies are in the same file, so extract the 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, `invokeai/backend/pid/_src/networks/pixeldit_official.py:184` calls `arange` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:144` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:776— invokeai/app/invocations/wan/wan_denoise.py:776-780 | invokeai/app/invocations/wan/wan_video_denoise.py:416-420 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:320— invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:320-324 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:177-181 — 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 (5 lines × 2) invokeai/app/services/shared/execution_engine/child.py:24— invokeai/app/services/shared/execution_engine/child.py:24-28 | invokeai/app/services/shared/execution_engine/primitives.py:33-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) invokeai/app/invocations/metadata_linked.py:778— invokeai/app/invocations/metadata_linked.py:778-782 | invokeai/app/invocations/metadata_linked.py:850-854 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) invokeai/app/services/external_generation/providers/atlascloud.py:350— invokeai/app/services/external_generation/providers/atlascloud.py:350-354 | invokeai/app/services/external_generation/providers/gemini.py:208-212 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) invokeai/app/services/shared/database/queries/images.py:318— invokeai/app/services/shared/database/queries/images.py:318-322 | invokeai/app/services/shared/database/queries/videos.py:282-286 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 5 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. 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) invokeai/app/util/aac_splice.py:192— invokeai/app/util/aac_splice.py:192-196 | invokeai/app/util/h264_splice.py:240-244 — 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 (5 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:480— invokeai/backend/pid/_src/networks/pid_net.py:480-484 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1526-1530 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:435— scripts/calibrate_flux2_denoise_working_memory.py:435-439 | scripts/calibrate_flux3_denoise_working_memory.py:614-618 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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.
TooManyMethods: ModelInstallService invokeai/app/services/model_install/model_install_default.py:235— TooManyMethods — 103 methods. The bar is 30 methods; this is 73 over it, 3.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SessionQueue invokeai/app/services/session_queue/session_queue_default.py:142— TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: _ExecutionNodeBuilder invokeai/app/services/shared/graph_materializer.py:39— TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ModelCache invokeai/backend/model_manager/load/model_cache/model_cache.py:506— TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WorkingMemoryCalibrationService invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:514— TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× 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: ImageIndexService invokeai/app/services/image_index/image_index_default.py:241— TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SessionQueueBase invokeai/app/services/session_queue/session_queue_base.py:43— TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SessionQueueQueries invokeai/app/services/shared/database/queries/session_queue.py:763— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ImageMoveService invokeai/app/services/image_moves/image_moves_default.py:87— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CanvasShapeToolModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:68— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Editor invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:173— TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× 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: EventServiceBase invokeai/app/services/events/events_base.py:74— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CanvasStageModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStageModule.ts:53— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DownloadQueueService invokeai/app/services/download/download_default.py:54— TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× 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: GalleryMaintenanceService invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:93— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CanvasStateApiModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:68— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DiskImageFileStorage invokeai/app/services/image_files/image_files_disk.py:94— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CanvasEntityTransformer invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:100— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CanvasToolModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:73— 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: NavigationApi invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:62— 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: Graph invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts:35— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (9 lines × 2) invokeai/app/invocations/anima/anima_lora_loader.py:153— invokeai/app/invocations/anima/anima_lora_loader.py:153-161 | invokeai/app/invocations/flux/flux_lora_loader.py:170-178 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:150— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:150-158 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:143-151 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.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 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (9 lines × 2) invokeai/app/services/images/images_default.py:623— invokeai/app/services/images/images_default.py:623-631 | invokeai/app/services/videos/videos_default.py:416-424 — 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 `invokeai/app/services/images/images_default.py:623` it does not close everything it opens, so those exact lines 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) invokeai/app/services/project_records/project_records_default.py:256— invokeai/app/services/project_records/project_records_default.py:256-264 | invokeai/app/services/project_records/project_records_default.py:394-402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/project_records/project_records_default.py:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) invokeai/app/services/shared/database/queries/board_images.py:94— invokeai/app/services/shared/database/queries/board_images.py:94-102 | invokeai/app/services/shared/database/queries/board_videos.py:88-96 — 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 (9 lines × 2) invokeai/app/services/shared/database/queries/images.py:415— invokeai/app/services/shared/database/queries/images.py:415-423 | invokeai/app/services/shared/database/queries/videos.py:361-369 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 5 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 `invokeai/app/services/shared/database/queries/images.py:415` it begins part-way through the construct above it, so those 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 (9 lines × 2) invokeai/app/services/shared/graph_scheduler.py:328— invokeai/app/services/shared/graph_scheduler.py:328-336 | invokeai/app/services/shared/graph_scheduler.py:654-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/util/user_management.py:184— invokeai/app/util/user_management.py:184-192 | invokeai/app/util/user_management.py:603-611 — both copies are in the same file, so extract the block into 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) invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:109— invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:109-117 | invokeai/backend/flux/model.py:112-120 — before extracting anything, compare `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` and `invokeai/backend/flux/model.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) invokeai/backend/hidiffusion/hidiffusion.py:1136— invokeai/backend/hidiffusion/hidiffusion.py:1136-1144 | invokeai/backend/util/hotfixes.py:651-659 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:2130— invokeai/backend/hidiffusion/hidiffusion.py:2130-2138 | invokeai/backend/hidiffusion/hidiffusion.py:2163-2171 — both copies are in the same file, so extract the block into 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) invokeai/backend/image_util/pidi/model.py:456— invokeai/backend/image_util/pidi/model.py:456-464 | invokeai/backend/image_util/pidi/model.py:486-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:116— invokeai/backend/model_manager/load/model_loaders/qwen_image.py:116-124 | invokeai/backend/model_manager/load/model_loaders/wan.py:315-323 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:250— invokeai/backend/pid/_src/networks/pixeldit_official.py:250-258 | invokeai/backend/pid/_src/networks/pixeldit_official.py:674-682 — both copies are in the same file, so extract the block into 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) invokeai/backend/pid/_src/networks/pixeldit_official.py:817— invokeai/backend/pid/_src/networks/pixeldit_official.py:817-825 | invokeai/backend/pid/_src/networks/pixeldit_official.py:854-862 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/pid/_src/networks/pixeldit_official.py:817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) invokeai/app/invocations/composition-nodes.py:1443— invokeai/app/invocations/composition-nodes.py:1443-1451 | invokeai/app/invocations/composition-nodes.py:1531-1539 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/database/queries/images.py:479— invokeai/app/services/shared/database/queries/images.py:479-487 | invokeai/app/services/shared/database/queries/videos.py:426-434 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 5 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `changes` to `ImageRecordChanges` in one and `VideoRecordChanges` 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) invokeai/app/api/routers/utilities.py:211— invokeai/app/api/routers/utilities.py:211-219 | invokeai/app/services/fonts/fonts_parsing.py:117-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) invokeai/backend/image_util/hed.py:124— invokeai/backend/image_util/hed.py:124-132 | invokeai/backend/image_util/hed.py:197-205 — both copies are in the same file, so extract the 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, `invokeai/backend/image_util/hed.py:133` calls `normalize_image_channel_count`, `resize_image_to_resolution` and `invokeai/backend/image_util/hed.py:207` 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) invokeai/app/invocations/sd/denoise_latents.py:260— invokeai/app/invocations/sd/denoise_latents.py:260-268 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:134-142 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `v` to `Union[List[float], float]` in one and `list[float] | float` 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) scripts/calibrate_krea2_working_memory.py:498— scripts/calibrate_krea2_working_memory.py:498-506 | scripts/calibrate_vae_tiling_working_memory.py:499-507 — 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.
X2 · Cancellation propagation· Async function without AbortSignal · ×21
Async function without AbortSignal: findArrowJointSeams invokeai/frontend/webv2/src/platform/ui/arrowJoint.testing.ts:34— `findArrowJointSeams` 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: fetchImageAsDataUrl invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:167— `fetchImageAsDataUrl` 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: fetchFollowingCancellation invokeai/frontend/webv2/src/features/gallery/data/queries.ts:303— `fetchFollowingCancellation` 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: startAssetFaultProxy invokeai/frontend/webv2/scripts/asset-fault-proxy.mjs:4— `startAssetFaultProxy` awaits `http.request(…)` 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: `http.request(url, { signal })`.
Async function without AbortSignal: waitForPreview invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:109— `waitForPreview` 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: runSample invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:317— `runSample` 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: waitForPreview REDACTED:23— `waitForPreview` 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: openRepresentativePage REDACTED:73— `openRepresentativePage` 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: ready REDACTED:252— `ready` 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: runNativeWidgetRecoveryJourney REDACTED:1669— `runNativeWidgetRecoveryJourney` 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: runNativeUsersRecoveryJourney REDACTED:1828— `runNativeUsersRecoveryJourney` 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: runRoundTrip invokeai/frontend/webv2/scripts/run-browser-smoke.mjs:39— `runRoundTrip` 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: waitForPreview REDACTED:57— `waitForPreview` 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: assertAssetRoute REDACTED:109— `assertAssetRoute` 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: runRoundTrip REDACTED:301— `runRoundTrip` 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: getResultImageDTOs invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:321— `getResultImageDTOs` 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: imageDTOToFile invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1130— `imageDTOToFile` 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: fetchImageAsDataUrl invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:79— `fetchImageAsDataUrl` 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: getItem invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:101— `getItem` 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: setItem invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:154— `setItem` 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: clearStorage invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:197— `clearStorage` 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 (8 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:1112— invokeai/app/invocations/anima/anima_denoise.py:1112-1123 | invokeai/app/invocations/z_image/z_image_denoise.py:774-781 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:162— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:162-169 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:155-162 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.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 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/ltx2/ltx2_lora_loader.py:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) invokeai/app/invocations/model.py:545— invokeai/app/invocations/model.py:545-552 | invokeai/app/invocations/model.py:709-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/invocations/pid/flux2_pid_decode.py:122— invokeai/app/invocations/pid/flux2_pid_decode.py:122-129 | invokeai/app/invocations/pid/sdxl_pid_decode.py:105-112 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/sdxl_pid_decode.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/pid/flux2_pid_decode.py:122` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/invocations/pid/sd3_pid_decode.py:86— invokeai/app/invocations/pid/sd3_pid_decode.py:86-93 | invokeai/app/invocations/pid/z_image_pid_decode.py:100-108 — before extracting anything, compare `invokeai/app/invocations/pid/sd3_pid_decode.py` and `invokeai/app/invocations/pid/z_image_pid_decode.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/pid/sd3_pid_decode.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.
Duplicated block (8 lines × 2) invokeai/app/invocations/sd/sdxl.py:39— invokeai/app/invocations/sd/sdxl.py:39-46 | invokeai/app/invocations/sd/sdxl.py:79-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) invokeai/app/invocations/text_encoder/ernie_image_text_encoder.py:68— invokeai/app/invocations/text_encoder/ernie_image_text_encoder.py:68-75 | invokeai/app/invocations/text_encoder/ideogram4_text_encoder.py:52-59 — 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) invokeai/app/services/shared/graph.py:1218— invokeai/app/services/shared/graph.py:1218-1225 | invokeai/app/services/shared/graph.py:1323-1330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:1218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/services/shared/graph.py:1226` calls `_get_output_edges` and `invokeai/app/services/shared/graph.py:1331` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) invokeai/app/services/shared/graph_loop_topology.py:226— invokeai/app/services/shared/graph_loop_topology.py:226-233 | invokeai/app/services/shared/graph_loop_topology.py:570-577 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/fun_controlnet/qwen_image.py:114— invokeai/backend/fun_controlnet/qwen_image.py:114-121 | invokeai/backend/model_manager/load/model_loaders/qwen_image_controlnet.py:72-79 — 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 `invokeai/backend/fun_controlnet/qwen_image.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. 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) invokeai/backend/model_manager/configs/lora.py:701— invokeai/backend/model_manager/configs/lora.py:701-708 | invokeai/backend/model_manager/configs/lora.py:709-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/model_manager/configs/qwen3_encoder.py:708— invokeai/backend/model_manager/configs/qwen3_encoder.py:708-715 | invokeai/backend/model_manager/configs/qwen3_encoder.py:759-766 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/pid/_src/modules/conditioner.py:414— invokeai/backend/pid/_src/modules/conditioner.py:414-421 | invokeai/backend/pid/_src/modules/conditioner.py:533-540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/services/image_files/image_files_disk.py:418— invokeai/app/services/image_files/image_files_disk.py:418-425 | invokeai/app/services/video_files/video_files_disk.py:161-168 — 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, `invokeai/app/services/image_files/image_files_disk.py:428` calls `__persist_journal_directory` and `invokeai/app/services/video_files/video_files_disk.py:169` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) invokeai/app/api/routers/utilities.py:542— invokeai/app/api/routers/utilities.py:542-549 | invokeai/app/api/routers/utilities.py:658-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) invokeai/app/services/session_processor/workflow_call_batch.py:93— invokeai/app/services/session_processor/workflow_call_batch.py:93-100 | invokeai/app/services/shared/workflow_graph_builder.py:245-252 — 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) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:112— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:112-119 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:111-118 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (8 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:235— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:235-242 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:235-242 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:235` it does not close everything it opens, so those exact lines 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) invokeai/app/services/style_preset_images/style_preset_images_disk.py:37— invokeai/app/services/style_preset_images/style_preset_images_disk.py:37-44 | invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py:36-43 — 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) invokeai/app/api/routers/images.py:565— invokeai/app/api/routers/images.py:565-576 | invokeai/app/api/routers/images.py:1004-1015 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/images.py:565` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/invocations/cogview4/cogview4_denoise.py:142— invokeai/app/invocations/cogview4/cogview4_denoise.py:142-153 | invokeai/app/invocations/sd3/sd3_denoise.py:241-252 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.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 7 separate duplicated blocks between them, totalling at least 126 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 (12 lines × 2) invokeai/app/invocations/image.py:1014— invokeai/app/invocations/image.py:1014-1025 | invokeai/app/invocations/image.py:1079-1090 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:200— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:200-211 | invokeai/app/invocations/z_image/z_image_denoise.py:237-248 — 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) invokeai/app/invocations/text_encoder/anima_text_encoder.py:128— invokeai/app/invocations/text_encoder/anima_text_encoder.py:128-145 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:71-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/text_encoder/anima_text_encoder.py:128` it does not close everything it opens, so those exact lines 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) invokeai/app/services/shared/graph_materializer.py:502— invokeai/app/services/shared/graph_materializer.py:502-513 | invokeai/app/services/shared/graph_materializer.py:614-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:502` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/util/user_management.py:234— invokeai/app/util/user_management.py:234-245 | invokeai/app/util/user_management.py:467-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:9— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:9-20 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:9-20 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:51— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:51-62 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:50-61 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) invokeai/backend/model_manager/configs/ip_adapter.py:93— invokeai/backend/model_manager/configs/ip_adapter.py:93-104 | invokeai/backend/model_manager/configs/ip_adapter.py:166-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:209— invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:209-220 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:134-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) invokeai/backend/pid/_src/networks/pixeldit_official.py:1025— invokeai/backend/pid/_src/networks/pixeldit_official.py:1025-1036 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1099-1110 — both copies are in the same file, so extract the block into 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) invokeai/backend/stable_diffusion/diffusers_pipeline.py:385— invokeai/backend/stable_diffusion/diffusers_pipeline.py:385-396 | invokeai/backend/stable_diffusion/multi_diffusion_pipeline.py:82-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) invokeai/app/services/shared/execution_engine/child.py:58— invokeai/app/services/shared/execution_engine/child.py:58-69 | invokeai/app/services/shared/execution_engine/primitives.py:61-72 — 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 (12 lines × 2) invokeai/app/api/routers/utilities.py:121— invokeai/app/api/routers/utilities.py:121-133 | REDACTED:660-671 — 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) invokeai/app/services/style_preset_images/style_preset_images_disk.py:69— invokeai/app/services/style_preset_images/style_preset_images_disk.py:69-80 | invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py:72-83 — 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) scripts/calibrate_flux2_denoise_working_memory.py:217— scripts/calibrate_flux2_denoise_working_memory.py:217-228 | scripts/calibrate_flux3_denoise_working_memory.py:333-344 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (12 lines × 2) scripts/calibrate_vae_tiling_working_memory.py:524— scripts/calibrate_vae_tiling_working_memory.py:524-536 | scripts/calibrate_z_image_working_memory.py:345-356 — 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.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×17
Edited copy of a member (10 corresponding lines) invokeai/backend/tiny_autoencoder/taesd.py:121— invokeai/backend/tiny_autoencoder/taesd.py:121-130 | invokeai/backend/tiny_autoencoder/taesd.py:134-143 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/flux/dype/rope.py:70— invokeai/backend/flux/dype/rope.py:70-86 | invokeai/backend/flux/math.py:18-27 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/image_util/pidi/model.py:444— invokeai/backend/image_util/pidi/model.py:444-453 | invokeai/backend/image_util/pidi/model.py:472-483 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/invocations/anima/anima_model_loader.py:97— invokeai/app/invocations/anima/anima_model_loader.py:97-111 | invokeai/app/invocations/cogview4/cogview4_model_loader.py:47-56 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/quantization/gguf/utils.py:84— invokeai/backend/quantization/gguf/utils.py:84-95 | invokeai/backend/quantization/gguf/utils.py:101-110 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/image_util/lineart_anime.py:149— invokeai/backend/image_util/lineart_anime.py:149-158 | invokeai/backend/image_util/lineart_anime.py:222-232 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/services/image_files/image_files_disk.py:531— invokeai/app/services/image_files/image_files_disk.py:531-548 | invokeai/app/services/video_files/video_files_disk.py:256-265 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/api/routers/session_queue.py:747— invokeai/app/api/routers/session_queue.py:747-756 | invokeai/app/api/routers/session_queue.py:799-808 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/invocations/image.py:579— invokeai/app/invocations/image.py:579-588 | invokeai/app/invocations/image.py:606-615 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1096— invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1096-1105 | invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1108-1118 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/invocations/flux3/flux3_denoise.py:316— invokeai/app/invocations/flux3/flux3_denoise.py:316-326 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:310-319 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:219— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:219-228 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:219-228 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/fun_controlnet/flux2.py:77— invokeai/backend/fun_controlnet/flux2.py:77-87 | invokeai/backend/fun_controlnet/qwen_image.py:55-64 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:144— invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:144-155 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_31.py:20-29 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/services/shared/graph_iterate_planner.py:291— invokeai/app/services/shared/graph_iterate_planner.py:291-300 | invokeai/app/services/shared/graph_materializer.py:1198-1207 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/app/services/style_preset_images/style_preset_images_disk.py:57— invokeai/app/services/style_preset_images/style_preset_images_disk.py:57-66 | invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py:59-69 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) invokeai/backend/model_manager/configs/controlnet.py:467— invokeai/backend/model_manager/configs/controlnet.py:467-476 | invokeai/backend/model_manager/configs/spandrel.py:38-47 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×17
Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:251— `stripInstallationState` is exported, takes a document from its caller (line 292) and hands it to `mapDocument`, which calls itself at line 251 (`mapDocument`) with a piece of `node` (and at line 272) — and nowhere in `mapDocument` 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 `mapDocument` 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 invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:36— `collectFontDependencies` is exported, takes a document from its caller (line 49) and hands it to `walkTextSources`, which calls itself at line 36 (`walkTextSources`) with a piece of `value` (and at line 44) — and nowhere in `walkTextSources` 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 `walkTextSources` 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 invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/postconditions.ts:44— `sameValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 44 (`sameValue`) with a piece of `left` (and at line 51) — and nowhere in `sameValue` 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 `sameValue` 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 invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:46— `collectSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 46 (`collectSubtree`) with a piece of `node` — and nowhere in `collectSubtree` 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 `collectSubtree` 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 invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:59— `collectSubtreeLeaves` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 59 (`collectSubtreeLeaves`) with a piece of `node` — and nowhere in `collectSubtreeLeaves` 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 `collectSubtreeLeaves` 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 invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:69— `subtreeDepth` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 69 (`subtreeDepth`) with a piece of `node` — and nowhere in `subtreeDepth` 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 `subtreeDepth` 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 invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:80— `cloneSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 80 (`cloneSubtree`) with a piece of `node` — and nowhere in `cloneSubtree` 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 `cloneSubtree` 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 invokeai/frontend/webv2/src/platform/ui/theme/rebase.ts:115— `renameFonts` is exported and takes `value: unknown` from its caller, and it calls itself at line 115 (`renameFonts`) with a piece of `value` (and at line 121) — and nowhere in `renameFonts` 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 `renameFonts` 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 invokeai/frontend/webv2/src/platform/core/json.ts:21— `areJsonValuesStructurallyEqual` is exported and takes `left: unknown` from its caller, and it calls itself at line 21 (`areJsonValuesStructurallyEqual`) with a piece of `left` (and at line 34) — and nowhere in `areJsonValuesStructurallyEqual` 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 `areJsonValuesStructurallyEqual` 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 invokeai/frontend/webv2/src/features/workflow/data/publication.ts:105— `isWorkflowContentEquivalent` is exported, takes a document from its caller (line 120) and hands it to `canonicalize`, which calls itself at line 105 (`canonicalize`) with a piece of `value` (and at line 112) — and nowhere in `canonicalize` 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 `canonicalize` 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 invokeai/frontend/webv2/src/features/workflow/data/templates.ts:100— `parseFieldType` is exported and takes `schema: unknown` from its caller, and it calls itself at line 100 (`parseFieldType`) with a piece of `schema` — and nowhere in `parseFieldType` 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 `parseFieldType` 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 invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:26— `collectSubmissionInputMediaNames` is exported, takes a document from its caller (line 19) and hands it to `visit`, which calls itself at line 26 (`visit`) with a piece of `value` (and at line 44) — and nowhere in `visit` 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 `visit` 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 invokeai/frontend/webv2/src/features/generation/core/wildcardTransfer.ts:54— `wildcardsFromNestedRecord` is exported, takes a document from its caller (line 39) and hands it to `walk`, which calls itself at line 54 (`walk`) with a piece of `node` — and nowhere in `walk` 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 `walk` 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 invokeai/backend/pid/_ext/imaginaire/lazy_config/instantiate.py:35— `dump_dataclass` is public and takes `obj: Any` from its caller, and it calls itself at line 35 (`dump_dataclass`) with a piece of `obj` (and at line 37) — and nowhere in `dump_dataclass` 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 `dump_dataclass` 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 invokeai/app/util/custom_openapi.py:55— `normalize_path_defaults` is public and takes `node: Any` from its caller, and it calls itself at line 55 (`normalize_path_defaults`) with a piece of `node` (and at line 58) — and nowhere in `normalize_path_defaults` 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 `normalize_path_defaults` 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 invokeai/app/util/custom_openapi.py:80— `remove_unreferenced_internal_execution_schemas` is public, takes a document from its caller (line 61) and hands it to `collect_refs`, which calls itself at line 80 (`collect_refs`) with a piece of `value` (and at line 83) — and nowhere in `collect_refs` 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 `collect_refs` 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 invokeai/app/services/shared/execution_state_migration.py:199— `load_execution_state` is public, takes a document from its caller (line 203) and hands it to `_normalize_persisted_ledgers`, which calls itself at line 199 (`_normalize_persisted_ledgers`) with a piece of `payload` — and nowhere in `_normalize_persisted_ledgers` 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 `_normalize_persisted_ledgers` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×16
Edited copy of a member (14 corresponding lines) invokeai/app/services/shared/database/queries/board_images.py:51— invokeai/app/services/shared/database/queries/board_images.py:51-64 | invokeai/app/services/shared/database/queries/board_videos.py:44-58 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/app/api/routers/system_prompts.py:83— invokeai/app/api/routers/system_prompts.py:83-96 | invokeai/app/api/routers/system_prompts.py:107-120 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/app/services/image_files/image_files_disk.py:450— invokeai/app/services/image_files/image_files_disk.py:450-475 | invokeai/app/services/video_files/video_files_disk.py:185-198 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/fun_controlnet/flux2.py:171— invokeai/backend/fun_controlnet/flux2.py:171-194 | invokeai/backend/fun_controlnet/qwen_image.py:140-153 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/model_manager/load/model_loaders/flux.py:1714— invokeai/backend/model_manager/load/model_loaders/flux.py:1714-1727 | invokeai/backend/model_manager/load/model_loaders/z_image.py:854-872 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/app/services/session_processor/workflow_call_batch.py:429— invokeai/app/services/session_processor/workflow_call_batch.py:429-450 | invokeai/app/services/session_processor/workflow_call_batch.py:459-472 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/app/services/images/images_default.py:373— invokeai/app/services/images/images_default.py:373-389 | invokeai/app/services/videos/videos_default.py:261-274 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/patches/layers/dora_layer.py:151— invokeai/backend/patches/layers/dora_layer.py:151-170 | invokeai/backend/patches/layers/lora_layer_base.py:62-75 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/app/services/shared/graph_scheduler.py:123— invokeai/app/services/shared/graph_scheduler.py:123-140 | invokeai/app/services/shared/graph_scheduler.py:393-406 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/ltx2/component_configs.py:98— invokeai/backend/ltx2/component_configs.py:98-111 | invokeai/backend/model_manager/load/model_loaders/minimax_h3_state_dict_utils.py:148-175 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/app/services/shared/graph_validation.py:1321— invokeai/app/services/shared/graph_validation.py:1321-1335 | invokeai/app/services/shared/graph_validation.py:1340-1353 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) REDACTED:1134— REDACTED:1134-1147 | REDACTED:1349-1362 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/working_memory/probe.py:736— invokeai/backend/working_memory/probe.py:736-751 | invokeai/backend/working_memory/probe.py:768-781 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/flux/extensions/instantx_controlnet_extension.py:30— invokeai/backend/flux/extensions/instantx_controlnet_extension.py:30-47 | invokeai/backend/flux/extensions/xlabs_controlnet_extension.py:22-35 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) invokeai/backend/model_manager/configs/t2i_adapter.py:36— invokeai/backend/model_manager/configs/t2i_adapter.py:36-49 | invokeai/backend/model_manager/configs/vae.py:502-516 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) scripts/family_e2e/gpu_memory.py:448— scripts/family_e2e/gpu_memory.py:448-465 | scripts/family_e2e/nvml_memory.py:245-258 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
ClassTooLong: GalleryImageGrid invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1— ClassTooLong — 1273 significant lines (blank, comment-only and punctuation-only lines excluded), 11 methods. The bar is 400 significant lines; this is 873 over it, 3.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: LayersTree invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1— ClassTooLong — 919 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 519 over it, 2.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: useImageActions invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1— ClassTooLong — 892 significant lines (blank, comment-only and punctuation-only lines excluded), 9 methods. The bar is 400 significant lines; this is 492 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Editor invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:173— ClassTooLong — 758 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 358 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: VideoWidgetView invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:1— ClassTooLong — 635 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 235 over it, 1.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: setEventListeners invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:1— ClassTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 222 over it, 1.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CanvasEntityTransformer invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:100— ClassTooLong — 618 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 218 over it, 1.55× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: buildFLUXGraph invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:1— ClassTooLong — 598 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 198 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CanvasToolModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:73— ClassTooLong — 592 significant lines (blank, comment-only and punctuation-only lines excluded), 37 methods. The bar is 400 significant lines; this is 192 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: usePreviewNavigation invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:1— ClassTooLong — 589 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 400 significant lines; this is 189 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UpscaleWidgetView invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:1— ClassTooLong — 534 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 134 over it, 1.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: useGalleryData invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:1— ClassTooLong — 493 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 93 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MergeLayerController invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:174— ClassTooLong — 489 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 89 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WorkflowLibraryGrid invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:1— ClassTooLong — 469 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 69 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PreviewWidgetView invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:1— ClassTooLong — 459 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 59 over it, 1.15× 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.
MethodTooLong: MergeLayerController.mergeDown invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186— MethodTooLong — mergeDown 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.
MethodTooLong: MergeLayerController.mergeSelectedInto invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:628— MethodTooLong — mergeSelectedInto runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExtractMaskedAreaController.extract invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122— MethodTooLong — extract runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MergeLayerController.mergeVisible invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394— MethodTooLong — mergeVisible runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GeneratedResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:56— MethodTooLong — commit runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: LayerMutationController.commitDuplicate invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:206— MethodTooLong — commitDuplicate runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PsdExportController.export invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:130— MethodTooLong — export runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: FilterResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:66— MethodTooLong — commit runs 124 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: StagedResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:78— MethodTooLong — commit runs 121 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 21 over it, 1.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CanvasSegmentAnythingModule.constructor invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:327— MethodTooLong — constructor runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CanvasColorPickerToolModule.constructor invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.ts:154— MethodTooLong — constructor runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: BooleanMergeController.merge invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75— MethodTooLong — merge runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Editor.getNextCropBoxByHandleWithAspectRatio invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:746— MethodTooLong — getNextCropBoxByHandleWithAspectRatio runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ControlDerivationController.commitControlMap invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:198— MethodTooLong — commitControlMap runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CanvasTextToolModule.commitSession invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:361— MethodTooLong — commitSession runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (10 lines × 2) invokeai/app/invocations/composition-nodes.py:190— invokeai/app/invocations/composition-nodes.py:190-199 | invokeai/app/invocations/composition-nodes.py:239-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) invokeai/app/services/external_generation/providers/gemini.py:111— invokeai/app/services/external_generation/providers/gemini.py:111-120 | invokeai/app/services/external_generation/providers/openai.py:117-126 — 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 `invokeai/app/services/external_generation/providers/gemini.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 (10 lines × 2) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:275— invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:275-284 | invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:409-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 (10 lines × 2) invokeai/app/services/session_processor/workflow_call_batch.py:439— invokeai/app/services/session_processor/workflow_call_batch.py:439-448 | invokeai/app/services/session_processor/workflow_call_batch.py:461-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/services/session_queue/session_queue_default.py:1152— invokeai/app/services/session_queue/session_queue_default.py:1152-1161 | invokeai/app/services/session_queue/session_queue_default.py:1168-1177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/session_queue/session_queue_default.py:1152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) invokeai/app/services/shared/database/queries/images.py:371— invokeai/app/services/shared/database/queries/images.py:371-380 | invokeai/app/services/shared/database/queries/videos.py:323-332 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 5 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 `invokeai/app/services/shared/database/queries/images.py:371` it begins part-way through the construct above it, so those 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) invokeai/app/services/shared/graph.py:573— invokeai/app/services/shared/graph.py:573-582 | invokeai/app/services/shared/graph.py:3595-3604 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/graph_iterate_planner.py:337— invokeai/app/services/shared/graph_iterate_planner.py:337-346 | invokeai/app/services/shared/graph_iterate_planner.py:392-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 `fan_in` to `_DirectIterateCollectFanIn` in one and `_BodyIterateCollectFanIn` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:260— invokeai/backend/minimax_h3/transformer_minimax_h3.py:260-269 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:331-340 — both copies are in the same file, so extract the block into 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) invokeai/backend/model_manager/load/model_loaders/z_image.py:1581— invokeai/backend/model_manager/load/model_loaders/z_image.py:1581-1590 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1757-1766 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:1581` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) invokeai/backend/quantization/int8_convrot.py:379— invokeai/backend/quantization/int8_convrot.py:379-388 | invokeai/backend/quantization/int8_convrot.py:494-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) invokeai/backend/quantization/sdnq/utils.py:122— invokeai/backend/quantization/sdnq/utils.py:122-131 | invokeai/backend/quantization/sdnq/utils.py:165-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/quantization/sdnq/utils.py:164` calls `to` and `invokeai/backend/quantization/sdnq/utils.py:118` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) invokeai/app/invocations/model.py:453— invokeai/app/invocations/model.py:453-462 | invokeai/app/invocations/model.py:613-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) invokeai/backend/flux/extensions/base_controlnet_extension.py:22— invokeai/backend/flux/extensions/base_controlnet_extension.py:22-31 | invokeai/backend/flux/extensions/xlabs_ip_adapter_extension.py:32-41 — 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 (10 lines × 2) invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:117— invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:117-133 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:158-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.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×14
Edited copy of a member (4 corresponding lines) invokeai/backend/ernie_image/sampling_utils.py:83— invokeai/backend/ernie_image/sampling_utils.py:83-91 | invokeai/backend/ernie_image/sampling_utils.py:95-98 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/patches/layers/dora_layer.py:142— invokeai/backend/patches/layers/dora_layer.py:142-145 | invokeai/backend/patches/layers/lora_layer.py:103-107 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/ltx2/packing.py:114— invokeai/backend/ltx2/packing.py:114-117 | invokeai/backend/ltx2/packing.py:121-124 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/app/invocations/flux3/flux3_denoise.py:310— invokeai/app/invocations/flux3/flux3_denoise.py:310-313 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:275-278 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/pid/_src/networks/pixeldit_official.py:126— invokeai/backend/pid/_src/networks/pixeldit_official.py:126-130 | invokeai/backend/ideogram4/modeling_ideogram4.py:159-162 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/app/api/routers/utilities.py:164— invokeai/app/api/routers/utilities.py:164-167 | invokeai/app/services/fonts/fonts_parsing.py:28-31 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/image_util/depth_anything/depth_anything_pipeline.py:25— invokeai/backend/image_util/depth_anything/depth_anything_pipeline.py:25-28 | invokeai/backend/image_util/grounding_dino/grounding_dino_pipeline.py:28-31 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:23— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:23-27 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:23-26 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/stable_diffusion/extensions/inpaint.py:117— invokeai/backend/stable_diffusion/extensions/inpaint.py:117-120 | invokeai/backend/stable_diffusion/extensions/inpaint_model.py:85-88 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/fun_controlnet/flux2.py:51— invokeai/backend/fun_controlnet/flux2.py:51-56 | invokeai/backend/fun_controlnet/qwen_image.py:33-36 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/backend/anima/anima_transformer.py:800— invokeai/backend/anima/anima_transformer.py:800-803 | invokeai/backend/ideogram4/modeling_ideogram4.py:45-48 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/app/invocations/krea2/krea2_denoise.py:209— invokeai/app/invocations/krea2/krea2_denoise.py:209-212 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:250-253 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) invokeai/app/services/shared/database/queries/board_images.py:70— invokeai/app/services/shared/database/queries/board_images.py:70-73 | invokeai/app/services/shared/database/queries/board_videos.py:64-67 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) scripts/family_e2e/gpu_memory.py:601— scripts/family_e2e/gpu_memory.py:601-604 | scripts/family_e2e/nvml_memory.py:337-340 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×13
Edited copy of a member (12 corresponding lines) invokeai/backend/flux/custom_block_processor.py:109— invokeai/backend/flux/custom_block_processor.py:109-121 | invokeai/backend/flux/modules/layers.py:225-236 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/app/invocations/mask.py:68— invokeai/app/invocations/mask.py:68-79 | invokeai/app/invocations/mask.py:129-141 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/app/services/session_queue/session_queue_default.py:1148— invokeai/app/services/session_queue/session_queue_default.py:1148-1161 | invokeai/app/services/session_queue/session_queue_default.py:1166-1177 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/app/api/routers/model_manager.py:193— invokeai/app/api/routers/model_manager.py:193-212 | invokeai/app/services/external_generation/external_generation_default.py:408-419 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/backend/pid/_src/modules/conditioner.py:410— invokeai/backend/pid/_src/modules/conditioner.py:410-421 | invokeai/backend/pid/_src/modules/conditioner.py:527-540 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/backend/flux/sampling_utils.py:21— invokeai/backend/flux/sampling_utils.py:21-32 | invokeai/backend/flux2/sampling_utils.py:23-57 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/backend/ltx2/component_configs.py:233— invokeai/backend/ltx2/component_configs.py:233-244 | invokeai/backend/ltx2/component_configs.py:288-305 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/app/util/h264_splice.py:482— invokeai/app/util/h264_splice.py:482-493 | invokeai/app/util/video_audio.py:268-279 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/backend/model_manager/load/model_loaders/flux.py:641— invokeai/backend/model_manager/load/model_loaders/flux.py:641-652 | invokeai/backend/model_manager/load/model_loaders/flux.py:769-782 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/app/invocations/image.py:515— invokeai/app/invocations/image.py:515-526 | invokeai/app/invocations/image.py:548-561 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/app/services/image_files/image_files_disk.py:665— invokeai/app/services/image_files/image_files_disk.py:665-677 | invokeai/app/services/video_files/video_files_disk.py:366-377 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) invokeai/backend/model_manager/configs/lora.py:1719— invokeai/backend/model_manager/configs/lora.py:1719-1735 | invokeai/backend/model_manager/configs/lora.py:1882-1893 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) REDACTED:428— REDACTED:428-442 | invokeai/backend/model_manager/load/model_loaders/wan.py:225-236 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×13
Edited copy of a member (9 corresponding lines) invokeai/backend/flux/modules/layers.py:31— invokeai/backend/flux/modules/layers.py:31-49 | invokeai/backend/pid/_src/networks/pixeldit_official.py:91-99 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/services/shared/database/queries/intermediates.py:302— invokeai/app/services/shared/database/queries/intermediates.py:302-310 | invokeai/app/services/shared/database/queries/intermediates.py:315-324 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/backend/anima/control_net_lllite.py:81— invokeai/backend/anima/control_net_lllite.py:81-89 | invokeai/backend/anima/control_net_lllite.py:93-108 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:235— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:235-243 | invokeai/backend/krea2/sampling_utils.py:60-71 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:349— invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:349-357 | invokeai/backend/patches/lora_conversions/moss_image_lora_constants.py:306-316 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/services/shared/graph_iterator_ancestry.py:101— invokeai/app/services/shared/graph_iterator_ancestry.py:101-111 | invokeai/app/services/shared/graph_iterator_ancestry.py:161-169 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/api/routers/files.py:80— invokeai/app/api/routers/files.py:80-88 | invokeai/app/api/routers/files.py:100-108 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/services/videos/videos_default.py:287— invokeai/app/services/videos/videos_default.py:287-295 | invokeai/app/services/videos/videos_default.py:298-306 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/services/video_files/video_files_disk.py:268— invokeai/app/services/video_files/video_files_disk.py:268-280 | invokeai/app/services/image_files/image_files_disk.py:628-636 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/app/services/shared/database/queries/images.py:254— invokeai/app/services/shared/database/queries/images.py:254-262 | invokeai/app/services/shared/database/queries/videos.py:215-223 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) invokeai/backend/quantization/fp8_scaled.py:927— invokeai/backend/quantization/fp8_scaled.py:927-935 | invokeai/backend/quantization/int8_matmul.py:90-98 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) scripts/calibrate_vae_tiling_working_memory.py:401— scripts/calibrate_vae_tiling_working_memory.py:401-409 | scripts/calibrate_vae_tiling_working_memory.py:413-422 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) scripts/family_e2e/gpu_memory.py:482— scripts/family_e2e/gpu_memory.py:482-494 | scripts/family_e2e/nvml_memory.py:275-283 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×13
Edited copy of a member (6 corresponding lines) invokeai/backend/image_util/pbr_maps/architecture/block.py:278— invokeai/backend/image_util/basicsr/rrdbnet_arch.py:32-38 | invokeai/backend/image_util/pbr_maps/architecture/block.py:278-283 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/backend/minimax_h3/pruned_adaln_lora.py:78— invokeai/backend/minimax_h3/pruned_adaln_lora.py:78-85 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:164-169 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:376— invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:376-383 | invokeai/backend/patches/lora_conversions/moss_image_lora_constants.py:358-363 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/services/shared/database/queries/intermediates.py:622— invokeai/app/services/shared/database/queries/intermediates.py:622-627 | invokeai/app/services/shared/database/queries/intermediates.py:643-651 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/backend/patches/lora_conversions/ideogram4_lora_constants.py:147— invokeai/backend/patches/lora_conversions/ideogram4_lora_constants.py:147-152 | invokeai/backend/patches/lora_conversions/sd3_lora_constants.py:164-169 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/backend/minimax_h3/transformer_minimax_h3.py:147— invokeai/backend/minimax_h3/transformer_minimax_h3.py:147-152 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:66-73 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/services/images/images_default.py:157— invokeai/app/services/images/images_default.py:157-166 | invokeai/app/services/videos/videos_default.py:178-183 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/invocations/canny.py:29— invokeai/app/invocations/canny.py:29-34 | invokeai/app/invocations/sd/controlnet.py:131-136 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/invocations/cogview4/cogview4_denoise.py:123— invokeai/app/invocations/cogview4/cogview4_denoise.py:123-129 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:183-188 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/invocations/blend_latents.py:78— invokeai/app/invocations/blend_latents.py:78-83 | invokeai/app/invocations/sd/create_denoise_mask.py:34-41 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/services/shared/database/queries/boards.py:234— invokeai/app/services/shared/database/queries/boards.py:234-246 | invokeai/app/services/shared/database/queries/projects.py:302-307 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/app/services/shared/database/queries/boards.py:300— invokeai/app/services/shared/database/queries/boards.py:300-306 | invokeai/app/services/shared/database/queries/projects.py:293-298 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) invokeai/backend/flux/extensions/regional_prompting_extension.py:45— invokeai/backend/flux/extensions/regional_prompting_extension.py:45-58 | invokeai/backend/flux2/extensions/regional_prompting_extension.py:52-57 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×12
Edited copy of a member (17 corresponding lines) invokeai/backend/quantization/gguf/utils.py:180— invokeai/backend/quantization/gguf/utils.py:180-196 | invokeai/backend/quantization/gguf/utils.py:237-253 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:129— invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:129-145 | invokeai/app/invocations/ideogram4/ideogram4_lora_loader.py:129-145 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/invocations/flux2/flux2_control.py:103— invokeai/app/invocations/flux2/flux2_control.py:103-119 | invokeai/app/invocations/qwen_image/qwen_image_control.py:109-125 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/backend/quantization/int8_convrot.py:372— invokeai/backend/quantization/int8_convrot.py:372-388 | invokeai/backend/quantization/int8_convrot.py:485-503 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/invocations/resize_latents.py:48— invokeai/app/invocations/resize_latents.py:48-64 | invokeai/app/invocations/resize_latents.py:86-103 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/services/shared/graph.py:4132— invokeai/app/services/shared/graph.py:4132-4148 | invokeai/app/services/shared/graph.py:4151-4168 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:14— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:14-30 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:28-46 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/backend/model_manager/load/model_loaders/anima.py:349— invokeai/backend/model_manager/load/model_loaders/anima.py:349-371 | invokeai/backend/model_manager/load/model_loaders/anima.py:383-399 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/services/gallery/gallery_default.py:184— invokeai/app/services/gallery/gallery_default.py:184-200 | invokeai/app/services/gallery/gallery_default.py:219-236 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/api/routers/images.py:443— invokeai/app/api/routers/images.py:443-460 | invokeai/app/api/routers/images.py:479-495 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) invokeai/app/api/routers/model_manager.py:604— invokeai/app/api/routers/model_manager.py:604-624 | invokeai/app/api/routers/model_manager.py:766-782 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:259— scripts/calibrate_flux2_denoise_working_memory.py:259-277 | scripts/calibrate_flux3_denoise_working_memory.py:437-453 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×12
Edited copy of a member (8 corresponding lines) invokeai/backend/pid/_src/models/pid_distill_model.py:57— invokeai/backend/pid/_src/models/pid_distill_model.py:57-64 | invokeai/backend/pid/_src/models/pid_distill_model.py:73-80 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/invocations/image.py:123— invokeai/app/invocations/image.py:123-130 | invokeai/app/invocations/image.py:162-174 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/backend/util/vae_working_memory.py:701— invokeai/backend/util/vae_working_memory.py:701-708 | invokeai/backend/util/vae_working_memory.py:801-809 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/services/shared/graph.py:416— invokeai/app/services/shared/graph.py:416-426 | invokeai/app/services/shared/graph.py:429-436 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/util/h264_splice.py:169— invokeai/app/util/h264_splice.py:169-176 | invokeai/app/util/h264_splice.py:180-187 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/api/routers/model_manager.py:358— invokeai/app/api/routers/model_manager.py:358-376 | invokeai/app/services/model_install/model_install_default.py:1952-1959 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/invocations/image.py:1237— invokeai/app/invocations/image.py:1237-1244 | invokeai/app/invocations/image.py:1582-1590 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/services/image_records/image_records_default.py:122— invokeai/app/services/image_records/image_records_default.py:122-138 | invokeai/app/services/video_records/video_records_default.py:42-49 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/services/shared/workflow_call_compatibility.py:26— invokeai/app/services/shared/workflow_call_compatibility.py:26-33 | invokeai/app/services/workflow_records/workflow_records_common.py:117-129 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/services/style_preset_images/style_preset_images_disk.py:47— invokeai/app/services/style_preset_images/style_preset_images_disk.py:47-54 | invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py:46-54 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) invokeai/app/invocations/flux/flux_denoise.py:1041— invokeai/app/invocations/flux/flux_denoise.py:1041-1048 | invokeai/app/invocations/flux2/flux2_denoise.py:733-740 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:465— scripts/calibrate_flux2_denoise_working_memory.py:465-472 | scripts/calibrate_flux3_denoise_working_memory.py:651-658 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (15 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:156— invokeai/app/invocations/cogview4/cogview4_denoise.py:156-170 | invokeai/app/invocations/sd3/sd3_denoise.py:255-269 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.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 7 separate duplicated blocks between them, totalling at least 126 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 (15 lines × 2) invokeai/app/invocations/composition-nodes.py:1427— invokeai/app/invocations/composition-nodes.py:1427-1441 | invokeai/app/invocations/composition-nodes.py:1511-1525 — both copies are in the same file, so extract the block into 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) invokeai/app/invocations/vae/anima_image_to_latents.py:127— invokeai/app/invocations/vae/anima_image_to_latents.py:127-141 | invokeai/app/invocations/vae/z_image_image_to_latents.py:113-127 — before extracting anything, compare `invokeai/app/invocations/vae/anima_image_to_latents.py` and `invokeai/app/invocations/vae/z_image_image_to_latents.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.
Duplicated block (15 lines × 2) invokeai/app/services/gallery/gallery_default.py:184— invokeai/app/services/gallery/gallery_default.py:184-198 | invokeai/app/services/gallery/gallery_default.py:219-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) invokeai/app/services/image_records/image_records_default.py:159— invokeai/app/services/image_records/image_records_default.py:159-173 | invokeai/app/services/video_records/video_records_default.py:134-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. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/image_records/image_records_default.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.
Duplicated block (15 lines × 2) invokeai/app/services/model_install/model_install_default.py:1085— invokeai/app/services/model_install/model_install_default.py:1085-1099 | invokeai/app/services/model_install/model_install_default.py:1101-1115 — both copies are in the same file, so extract the block into 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) invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:136— invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:136-150 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:158-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) invokeai/backend/hidiffusion/hidiffusion.py:620— invokeai/backend/hidiffusion/hidiffusion.py:620-634 | invokeai/backend/hidiffusion/hidiffusion.py:656-670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) invokeai/backend/minimax_h3/packing.py:539— invokeai/backend/minimax_h3/packing.py:539-553 | invokeai/backend/minimax_h3/packing.py:695-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. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/packing.py:539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_only_full_load.py:128— invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_only_full_load.py:128-142 | invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:236-250 — 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) invokeai/backend/model_manager/load/model_loaders/flux.py:1919— invokeai/backend/model_manager/load/model_loaders/flux.py:1919-1933 | invokeai/backend/model_manager/load/model_loaders/flux.py:1934-1948 — both copies are in the same file, so extract the block into 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) invokeai/backend/pid/_src/networks/pid_net.py:377— invokeai/backend/pid/_src/networks/pid_net.py:377-391 | invokeai/backend/pid/_src/networks/pid_net.py:413-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/pid/_src/networks/pid_net.py:377` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/api/routers/workflows.py:394— invokeai/app/api/routers/workflows.py:394-407 | invokeai/app/api/routers/workflows.py:458-478 | invokeai/app/api/routers/workflows.py:549-560 | invokeai/app/api/routers/workflows.py:572-583 — 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) invokeai/app/invocations/metadata_linked.py:631— invokeai/app/invocations/metadata_linked.py:631-690 | invokeai/app/invocations/metadata_linked.py:704-744 | invokeai/app/invocations/metadata_linked.py:758-796 | invokeai/app/invocations/metadata_linked.py:828-872 — 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) invokeai/app/services/events/events_common.py:143— invokeai/app/services/events/events_common.py:143-156 | invokeai/app/services/events/events_common.py:199-230 | invokeai/app/services/events/events_common.py:245-259 | invokeai/app/services/events/events_common.py:281-297 — 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) invokeai/app/services/shared/database/queries/images.py:356— invokeai/app/services/shared/database/queries/images.py:356-380 | invokeai/app/services/shared/database/queries/images.py:399-423 | invokeai/app/services/shared/database/queries/videos.py:312-332 | invokeai/app/services/shared/database/queries/videos.py:349-369 — 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) invokeai/app/services/shared/graph_materializer.py:461— invokeai/app/services/shared/graph_materializer.py:461-527 | invokeai/app/services/shared/graph_materializer.py:544-663 | invokeai/app/services/shared/graph_materializer.py:902-1015 | invokeai/app/services/shared/graph_materializer.py:1025-1195 — 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) invokeai/backend/model_manager/configs/main.py:1295— invokeai/backend/model_manager/configs/main.py:1295-1337 | invokeai/backend/model_manager/configs/main.py:4183-4241 | invokeai/backend/model_manager/configs/main.py:4337-4391 | invokeai/backend/model_manager/configs/main.py:4502-4547 — 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) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16-25 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:19-28 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:21-30 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py:88-97 — 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) invokeai/backend/model_manager/load/model_loaders/cogview4.py:28— invokeai/backend/model_manager/load/model_loaders/cogview4.py:28-59 | invokeai/backend/model_manager/load/model_loaders/flux.py:1133-1163 | invokeai/backend/model_manager/load/model_loaders/flux.py:1175-1240 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:171-209 — 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) invokeai/backend/model_manager/load/model_loaders/z_image.py:298— invokeai/backend/model_manager/load/model_loaders/z_image.py:298-415 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1116-1383 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1423-1594 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1628-1769 — 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) invokeai/backend/model_manager/load/model_loaders/z_image.py:418— invokeai/backend/model_manager/load/model_loaders/z_image.py:418-459 | invokeai/backend/model_manager/load/model_loaders/z_image.py:486-734 | invokeai/backend/model_manager/load/model_loaders/z_image.py:761-805 | invokeai/backend/model_manager/load/model_loaders/z_image.py:888-927 — 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) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:218— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:218-252 | invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:289-306 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:290-343 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:223-269 — 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.
FixmeComment scripts/generate_vae_linear_approximation.py:44— # FIXME: uses torch.randn. make reproducible! — 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.
FixmeComment invokeai/app/invocations/vae/image_to_latents.py:174— # FIXME: uses torch.randn. make reproducible! — 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.
FixmeComment invokeai/backend/onnx/onnx_runtime.py:45— # fixme — 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.
FixmeComment invokeai/backend/onnx/onnx_runtime.py:52— # fixme — 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.
FixmeComment invokeai/backend/onnx/onnx_runtime.py:88— # fixme — 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.
FixmeComment invokeai/backend/onnx/onnx_runtime.py:205— # fixme — 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.
FixmeComment invokeai/app/util/controlnet_utils.py:82— # FIXME: not using yet, if used in the future will most likely require modification of preprocessors — 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.
FixmeComment invokeai/app/invocations/sd/denoise_latents.py:120— # FIXME — 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.
FixmeComment invokeai/app/invocations/sd/denoise_latents.py:1169— # FIXME — 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.
FixmeComment invokeai/app/invocations/sd/denoise_latents.py:529— # FIXME: still need to test with different widths, heights, devices, dtypes — 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.
D30 · Dependency Vulnerabilities· Medium CVE · ×10
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×10
Edited copy of a member (13 corresponding lines) invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:88— invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:88-100 | invokeai/app/invocations/ideogram4/ideogram4_lora_loader.py:88-100 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/backend/quantization/block_scale_tiles.py:41— invokeai/backend/quantization/block_scale_tiles.py:41-54 | invokeai/backend/quantization/block_scale_tiles.py:58-70 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/app/invocations/sd/denoise_latents.py:316— invokeai/app/invocations/sd/denoise_latents.py:316-336 | invokeai/backend/stable_diffusion/extensions/ip_adapter.py:141-153 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/backend/model_manager/configs/lora.py:1376— invokeai/backend/model_manager/configs/lora.py:1376-1388 | invokeai/backend/model_manager/configs/lora.py:1392-1406 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:122— invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:122-138 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:142-154 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/backend/pid/_src/modules/conditioner.py:364— invokeai/backend/pid/_src/modules/conditioner.py:364-389 | invokeai/backend/pid/_src/modules/conditioner.py:551-563 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:198— invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:198-210 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:49-75 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/backend/model_manager/configs/controlnet.py:112— invokeai/backend/model_manager/configs/controlnet.py:112-129 | invokeai/backend/model_manager/configs/main.py:1179-1191 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/app/services/invocation_stats/invocation_stats_default.py:31— invokeai/app/services/invocation_stats/invocation_stats_default.py:31-43 | invokeai/backend/util/device_pool.py:227-241 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) invokeai/app/invocations/anima/anima_denoise.py:163— invokeai/app/invocations/anima/anima_denoise.py:163-179 | invokeai/backend/rectified_flow/rectified_flow_inpaint_extension.py:46-58 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×10
Edited copy of a member (3 corresponding lines) invokeai/backend/ltx2/packing.py:140— invokeai/backend/ltx2/packing.py:140-143 | invokeai/backend/ltx2/packing.py:149-151 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_07_add_image_index_vocabulary_lock.py:21— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_07_add_image_index_vocabulary_lock.py:21-23 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_07_add_session_queue_admission_lock.py:22-24 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/app/services/shared/database/queries/images.py:308— invokeai/app/services/shared/database/queries/images.py:308-310 | invokeai/app/services/shared/database/queries/videos.py:272-274 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/backend/model_manager/configs/qwen3_encoder.py:64— invokeai/backend/model_manager/configs/qwen3_encoder.py:64-66 | invokeai/backend/quantization/sdnq/detection.py:48-54 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:27— invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:27-29 | invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:21-23 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/app/invocations/canvas.py:25— invokeai/app/invocations/canvas.py:25-27 | invokeai/app/invocations/image.py:1107-1111 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:33— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:33-35 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_group_norm.py:11-13 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:34— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:34-36 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:38-40 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) invokeai/backend/patches/lora_conversions/ltx2_lora_conversion_utils.py:53— invokeai/backend/patches/lora_conversions/ltx2_lora_conversion_utils.py:53-55 | invokeai/backend/patches/lora_conversions/minimax_h3_lora_conversion_utils.py:77-83 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) scripts/family_e2e/gpu_memory.py:578— scripts/family_e2e/gpu_memory.py:578-580 | scripts/family_e2e/nvml_memory.py:319-321 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (13 lines × 2) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:197— invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:197-209 | invokeai/app/invocations/z_image/z_image_lora_loader.py:166-178 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 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) invokeai/app/invocations/metadata_linked.py:536— invokeai/app/invocations/metadata_linked.py:536-548 | invokeai/app/invocations/metadata_linked.py:592-604 — both copies are in the same file, so extract the block into 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) invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:121— invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:121-133 | invokeai/app/invocations/wan/wan_model_loader.py:281-293 — 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 `invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:121` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/invocations/sd/denoise_latents.py:324— invokeai/app/invocations/sd/denoise_latents.py:324-336 | invokeai/backend/stable_diffusion/extensions/ip_adapter.py:141-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) invokeai/app/services/shared/graph_materializer.py:649— invokeai/app/services/shared/graph_materializer.py:649-661 | invokeai/app/services/shared/graph_materializer.py:755-767 — both copies are in the same file, so extract the 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, `invokeai/app/services/shared/graph_materializer.py:647` calls `RuntimeError` and `invokeai/app/services/shared/graph_materializer.py:754` 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) invokeai/backend/flux/denoise.py:155— invokeai/backend/flux/denoise.py:155-167 | invokeai/backend/flux/denoise.py:193-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/denoise.py:155` it does not close everything it opens, so those exact lines 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) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:49— invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:49-61 | invokeai/backend/quantization/scripts/quantize_t5_xxl_bnb_llm_int8.py:55-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 (13 lines × 2) invokeai/app/api/routers/model_manager.py:842— invokeai/app/api/routers/model_manager.py:842-854 | invokeai/app/api/routers/model_manager.py:887-899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) invokeai/app/invocations/krea2/krea2_model_loader.py:149— invokeai/app/invocations/krea2/krea2_model_loader.py:149-161 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py:132-144 — 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) scripts/calibrate_flux2_denoise_working_memory.py:340— scripts/calibrate_flux2_denoise_working_memory.py:340-352 | scripts/calibrate_flux3_denoise_working_memory.py:499-511 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC1 · Text alternatives· <canvas> without a text alternative · ×9
<canvas> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:222— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:343— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:386— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv2/src/platform/browser/knownBrowserIssues.ts:62— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:129— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:130— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasClipboard.ts:47— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/layers/LayerThumbnail.tsx:94— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×9
Edited copy of a member (5 corresponding lines) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:227— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:227-231 | invokeai/backend/krea2/sampling_utils.py:48-56 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py:169— invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py:169-173 | invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py:192-197 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/app/services/shared/graph_materializer.py:694— invokeai/app/services/shared/graph_materializer.py:694-698 | invokeai/app/services/shared/graph_nested_iterate_planner.py:83-87 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/app/invocations/anima/anima_denoise.py:486— invokeai/app/invocations/anima/anima_denoise.py:486-491 | invokeai/app/invocations/ltx2/ltx2_denoise.py:319-323 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/app/services/images/images_default.py:468— invokeai/app/services/images/images_default.py:468-472 | invokeai/app/services/videos/videos_default.py:321-325 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/backend/image_util/hed.py:165— invokeai/backend/image_util/hed.py:165-169 | invokeai/backend/image_util/lineart.py:182-186 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/app/invocations/anima/anima_denoise.py:154— invokeai/app/invocations/anima/anima_denoise.py:154-158 | invokeai/backend/rectified_flow/rectified_flow_inpaint_extension.py:15-28 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) invokeai/app/services/download/download_default.py:692— invokeai/app/services/download/download_default.py:692-697 | invokeai/app/services/model_install/model_install_default.py:527-531 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:537— scripts/calibrate_flux2_denoise_working_memory.py:537-541 | scripts/calibrate_vae_tiling_working_memory.py:652-656 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 2) invokeai/app/invocations/vae/cogview4_image_to_latents.py:63— invokeai/app/invocations/vae/cogview4_image_to_latents.py:63-76 | invokeai/app/invocations/vae/sd3_image_to_latents.py:59-72 — 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 (14 lines × 2) invokeai/app/services/shared/graph_nested_iterate_planner.py:177— invokeai/app/services/shared/graph_nested_iterate_planner.py:177-190 | invokeai/app/services/shared/graph_nested_iterate_planner.py:348-361 — both copies are in the same file, so extract the 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, `invokeai/app/services/shared/graph_nested_iterate_planner.py:176` calls `_get_input_edges` and `invokeai/app/services/shared/graph_nested_iterate_planner.py:347` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) invokeai/backend/fun_controlnet/flux2.py:137— invokeai/backend/fun_controlnet/flux2.py:137-150 | invokeai/backend/fun_controlnet/qwen_image.py:100-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/fun_controlnet/flux2.py:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) invokeai/backend/fun_controlnet/flux2.py:181— invokeai/backend/fun_controlnet/flux2.py:181-194 | invokeai/backend/fun_controlnet/qwen_image.py:140-153 — 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 (14 lines × 2) invokeai/backend/minimax_h3/contiguous_attention.py:89— invokeai/backend/minimax_h3/contiguous_attention.py:89-102 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:192-205 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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, `invokeai/backend/minimax_h3/contiguous_attention.py:80` calls `_head_major_contiguous` and `invokeai/backend/minimax_h3/transformer_minimax_h3.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 (14 lines × 2) invokeai/backend/model_manager/configs/main.py:4185— invokeai/backend/model_manager/configs/main.py:4185-4198 | invokeai/backend/model_manager/configs/main.py:4339-4352 — both copies are in the same file, so extract the 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) invokeai/app/invocations/vae/ltx2_latents_to_video.py:308— invokeai/app/invocations/vae/ltx2_latents_to_video.py:308-321 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:257-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) invokeai/app/services/shared/sqlite_migrator/migrations/migration_12.py:24— invokeai/app/services/shared/sqlite_migrator/migrations/migration_12.py:24-37 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_8.py:78-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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: `InvokeAIAppConfig` names `invokeai.app.services.config` in one and `invokeai.app.services.config.config_default` 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 (14 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:382— scripts/calibrate_flux2_denoise_working_memory.py:382-395 | scripts/calibrate_flux3_denoise_working_memory.py:546-559 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC2 · Forms & labels· <Combobox> field component without a label · ×8
<Combobox> field component without a label invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:224— 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 invokeai/frontend/webv1/src/features/controlLayers/components/ControlLayer/ControlLayerControlAdapterControlMode.tsx:49— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Filters/FilterTypeSelect.tsx:40— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/IPAdapterMethod.tsx:65— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:312— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/common/IPAdapterCLIPVisionModel.tsx:51— 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 invokeai/frontend/webv1/src/features/dynamicPrompts/components/ParamDynamicPromptsSeedBehaviour.tsx:50— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Combobox> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/DefaultPreprocessor.tsx:63— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
Change-coupling hub: canvas-tab-auto-layout.tsx → generate-tab-auto-layout.tsx, upscaling-tab-auto-layout.tsx, workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx— `invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx` changes together with 3 other files — `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: engine.ts → utilityGraph.ts, paintTool.ts, operationController.ts, engineStoreHooks.ts, ControlLayerSettings.tsx, layerContextActions.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts— `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` changes together with 6 other files — `invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts`, `invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts`, `invokeai/frontend/webv2/src/workbench/canvas-operations/operationController.ts`, `invokeai/frontend/webv2/src/workbench/widgets/canvas/engineStoreHooks.ts`, `invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx`, `invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts` — none of which declares a dependency on it: one file is the hub of 6 separate couplings, not 6 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 6.
Change-coupling hub: flux_denoise.py → flux_controlnet.py, tiled_multi_diffusion_denoise_latents.py, instantx_controlnet_flux.py, denoise.py, instantx_controlnet_extension.py, xlabs_controlnet_extension.py, model.py invokeai/app/invocations/flux_denoise.py— `invokeai/app/invocations/flux_denoise.py` changes together with 7 other files — `invokeai/app/invocations/flux_controlnet.py`, `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py`, `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py`, `invokeai/backend/flux/denoise.py`, `invokeai/backend/flux/extensions/instantx_controlnet_extension.py`, `invokeai/backend/flux/extensions/xlabs_controlnet_extension.py`, `invokeai/backend/flux/model.py` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 7.
Change-coupling hub: InputFieldRenderer.tsx → nodesSlice.ts, buildFieldInputInstance.ts, buildFieldInputTemplate.ts invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx— `invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx` changes together with 3 other files — `invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts`, `invokeai/frontend/webv1/src/features/nodes/util/schema/buildFieldInputInstance.ts`, `invokeai/frontend/webv1/src/features/nodes/util/schema/buildFieldInputTemplate.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: DividerElementComponent.tsx → ContainerElement.tsx, WorkflowBuilder.tsx, workflow.ts invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/DividerElementComponent.tsx— `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/DividerElementComponent.tsx` changes together with 3 other files — `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/ContainerElement.tsx`, `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/WorkflowBuilder.tsx`, `invokeai/frontend/webv1/src/features/nodes/types/workflow.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: use-collapsible-gridview-panel.ts → GalleryPanel.tsx, canvas-tab-auto-layout.tsx, generate-tab-auto-layout.tsx, upscaling-tab-auto-layout.tsx, workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts— `invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts` changes together with 5 other files — `invokeai/frontend/webv1/src/features/gallery/components/GalleryPanel.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 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 5.
Change-coupling hub: types.ts → ModelBaseBadge.tsx, buildFieldInputInstance.ts, DimensionsAspectRatioSelect.tsx invokeai/frontend/webv1/src/services/api/types.ts— `invokeai/frontend/webv1/src/services/api/types.ts` changes together with 3 other files — `invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx`, `invokeai/frontend/webv1/src/features/nodes/util/schema/buildFieldInputInstance.ts`, `invokeai/frontend/webv1/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: flux_text_encoder.py → compel.py, sd3_text_encoder.py, tiled_multi_diffusion_denoise_latents.py invokeai/app/invocations/flux_text_encoder.py— `invokeai/app/invocations/flux_text_encoder.py` changes together with 3 other files — `invokeai/app/invocations/compel.py`, `invokeai/app/invocations/sd3_text_encoder.py`, `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.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.
Duplicated block (7 lines × 3) invokeai/app/invocations/metadata_linked.py:738— invokeai/app/invocations/metadata_linked.py:738-744 | invokeai/app/invocations/metadata_linked.py:789-796 | invokeai/app/invocations/metadata_linked.py:866-872 — 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 `invokeai/app/invocations/metadata_linked.py:789` it begins part-way through the construct above it, so those 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 (7 lines × 3) invokeai/app/invocations/pid/flux2_pid_decode.py:123— invokeai/app/invocations/pid/flux2_pid_decode.py:123-129 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:123-129 | invokeai/app/invocations/pid/sdxl_pid_decode.py:106-112 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/qwen_image_pid_decode.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/pid/flux2_pid_decode.py:123` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/services/session_queue/session_queue_default.py:1136— invokeai/app/services/session_queue/session_queue_default.py:1136-1142 | invokeai/app/services/session_queue/session_queue_default.py:1154-1160 | invokeai/app/services/session_queue/session_queue_default.py:1170-1176 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:127— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:127-133 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:108-114 | invokeai/backend/flux/model.py:111-117 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:125` calls `controlnet_x_embedder` and `invokeai/backend/flux/model.py:110` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) invokeai/backend/image_util/hed.py:132— invokeai/backend/image_util/hed.py:132-138 | invokeai/backend/image_util/lineart.py:152-159 | invokeai/backend/image_util/lineart_anime.py:196-203 — 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 × 3) invokeai/backend/model_manager/configs/main.py:4100— invokeai/backend/model_manager/configs/main.py:4100-4106 | invokeai/backend/model_manager/configs/main.py:4269-4276 | invokeai/backend/model_manager/configs/main.py:4428-4435 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) invokeai/backend/pid/_src/networks/pid_net.py:370— invokeai/backend/pid/_src/networks/pid_net.py:370-376 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1464-1470 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1489-1495 — 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 `invokeai/backend/pid/_src/networks/pid_net.py:370` it does not close everything it opens, so those exact lines 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) invokeai/backend/patches/lora_conversions/ernie_image_lora_conversion_utils.py:195— invokeai/backend/patches/lora_conversions/ernie_image_lora_conversion_utils.py:195-201 | invokeai/backend/patches/lora_conversions/ideogram4_lora_conversion_utils.py:84-90 | invokeai/backend/patches/lora_conversions/sd3_lora_conversion_utils.py:92-98 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cognitive 82) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1412— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject has cognitive complexity 82 (threshold 15). Drivers by points: if/else 20 (55 pts), ternaries 3 (11 pts), boolean chains 10, error handling 2 (5 pts), loops 1 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile (cognitive 39) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1753— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 21, ternaries 9 (11 pts), if/else 7 (nesting depth added 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. This shape REPEATS in the file: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft (cognitive 38) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:2361— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 6, ternaries 3 (6 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. This shape REPEATS in the file: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves (cognitive 32) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1540— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 3 (6 pts), boolean chains 5 (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: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject (cognitive 29) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1131— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 5 (9 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::useServerWorkspace (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:2208— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::useServerWorkspace has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 1 (3 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. This shape REPEATS in the file: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft (cognitive 17) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:887— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 6 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 7 times rather than 7 independent problems. Splitting this body alone leaves the other 6 exactly as they are. Where these are variations on one operation, the change that clears all 7 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· Edited copy of a member (18 corresponding lines) · ×7
Edited copy of a member (18 corresponding lines) invokeai/backend/image_util/lineart_anime.py:165— invokeai/backend/image_util/lineart_anime.py:165-206 | invokeai/backend/image_util/lineart_anime.py:242-274 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) invokeai/backend/pid/_src/networks/pixeldit_official.py:937— invokeai/backend/pid/_src/networks/pixeldit_official.py:937-954 | invokeai/backend/pid/_src/networks/pixeldit_official.py:974-991 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) invokeai/app/invocations/vae/cogview4_image_to_latents.py:42— invokeai/app/invocations/vae/cogview4_image_to_latents.py:42-59 | invokeai/app/invocations/vae/sd3_image_to_latents.py:38-55 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) invokeai/app/services/image_files/image_files_disk.py:639— invokeai/app/services/image_files/image_files_disk.py:639-661 | invokeai/app/services/video_files/video_files_disk.py:283-300 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) invokeai/app/invocations/sd/denoise_latents.py:474— invokeai/app/invocations/sd/denoise_latents.py:474-491 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:150-167 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:256— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:256-273 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:199-219 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) REDACTED:402— REDACTED:402-419 | invokeai/backend/quantization/fp8_scaled.py:182-203 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×7
Edited copy of a member (19 corresponding lines) invokeai/backend/stable_diffusion/diffusers_pipeline.py:44— invokeai/backend/stable_diffusion/diffusers_pipeline.py:44-62 | invokeai/backend/stable_diffusion/extensions/inpaint.py:55-73 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) invokeai/app/invocations/vae/anima_image_to_latents.py:124— invokeai/app/invocations/vae/anima_image_to_latents.py:124-142 | invokeai/app/invocations/vae/z_image_image_to_latents.py:110-128 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) invokeai/app/invocations/call_saved_workflow.py:56— invokeai/app/invocations/call_saved_workflow.py:56-74 | invokeai/app/invocations/text_llm.py:146-177 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) invokeai/app/services/images/images_default.py:616— invokeai/app/services/images/images_default.py:616-638 | invokeai/app/services/videos/videos_default.py:410-428 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) invokeai/app/api/sockets.py:1208— invokeai/app/api/sockets.py:1208-1229 | invokeai/app/api/sockets.py:1243-1261 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_28_add_moss_image_enhancer_system_prompt.py:70— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_28_add_moss_image_enhancer_system_prompt.py:70-88 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_11_09_add_flux3_prompt_upsampler_system_prompt.py:49-67 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744-762 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:583-602 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×7
Edited copy of a member (15 corresponding lines) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:42— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:42-59 | invokeai/backend/quantization/bnb_llm_int8.py:109-123 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) invokeai/backend/model_manager/configs/main.py:393— invokeai/backend/model_manager/configs/main.py:393-413 | invokeai/backend/model_manager/configs/main.py:1210-1224 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) invokeai/app/api/routers/fonts.py:288— invokeai/app/api/routers/fonts.py:288-302 | invokeai/app/api/routers/fonts.py:322-341 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) invokeai/app/services/images/images_default.py:654— invokeai/app/services/images/images_default.py:654-670 | invokeai/app/services/videos/videos_default.py:471-485 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) invokeai/backend/image_util/imwatermark/vendor.py:82— invokeai/backend/image_util/imwatermark/vendor.py:82-96 | invokeai/backend/image_util/imwatermark/vendor.py:158-174 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) invokeai/backend/flux3/denoise_working_memory.py:279— invokeai/backend/flux3/denoise_working_memory.py:279-297 | invokeai/backend/moss_image/working_memory.py:128-142 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_09_add_system_prompt_max_tokens.py:34— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_09_add_system_prompt_max_tokens.py:34-49 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_23_track_queue_session_revision.py:9-23 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×7
Edited copy of a member (11 corresponding lines) invokeai/backend/anima/anima_transformer.py:245— invokeai/backend/anima/anima_transformer.py:245-263 | invokeai/backend/anima/anima_transformer.py:855-865 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) invokeai/app/services/external_generation/providers/atlascloud.py:342— invokeai/app/services/external_generation/providers/atlascloud.py:342-354 | invokeai/app/services/external_generation/providers/gemini.py:202-212 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) invokeai/app/util/t5_model_identifier.py:6— invokeai/app/util/t5_model_identifier.py:6-16 | invokeai/app/util/t5_model_identifier.py:20-30 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) invokeai/backend/pid/_src/networks/pixeldit_official.py:456— invokeai/backend/pid/_src/networks/pixeldit_official.py:456-467 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1373-1383 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) invokeai/app/invocations/lineart.py:24— invokeai/app/invocations/lineart.py:24-34 | invokeai/app/invocations/lineart_anime.py:21-31 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) invokeai/app/services/images/images_default.py:336— invokeai/app/services/images/images_default.py:336-346 | invokeai/app/services/videos/videos_default.py:238-248 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) invokeai/backend/model_manager/configs/main.py:484— invokeai/backend/model_manager/configs/main.py:484-494 | invokeai/backend/model_manager/configs/qwen3_encoder.py:128-138 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/settings/clearWorkspaceData.ts:8— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/covers.ts:90— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/covers.ts:125— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:590— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:3969— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:3993— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/editorSession.ts:80— `catch` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (5 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_lora_loader.py:60— invokeai/app/invocations/anima/anima_lora_loader.py:60-89 | invokeai/app/invocations/flux/flux_lora_loader.py:65-106 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:82-128 | invokeai/app/invocations/qwen_image/qwen_image_lora_loader.py:76-108 | invokeai/app/invocations/z_image/z_image_lora_loader.py:58-101 — 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) invokeai/app/invocations/anima/anima_lora_loader.py:125— invokeai/app/invocations/anima/anima_lora_loader.py:125-166 | invokeai/app/invocations/flux/flux_lora_loader.py:147-186 | invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:146-184 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:164-212 | invokeai/app/invocations/z_image/z_image_lora_loader.py:136-181 — 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) invokeai/app/invocations/ernie_image/ernie_image_denoise.py:232— invokeai/app/invocations/ernie_image/ernie_image_denoise.py:232-241 | invokeai/app/invocations/ideogram4/ideogram4_denoise.py:429-442 | invokeai/app/invocations/ltx2/ltx2_denoise.py:222-231 | invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:651-660 | invokeai/app/invocations/sd3/sd3_denoise.py:448-457 — 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) invokeai/backend/model_manager/configs/base.py:244— invokeai/backend/model_manager/configs/base.py:244-255 | invokeai/backend/model_manager/configs/main.py:4168-4179 | invokeai/backend/model_manager/configs/main.py:4322-4333 | invokeai/backend/model_manager/configs/main.py:4486-4498 | invokeai/backend/model_manager/model_on_disk.py:196-210 — 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) invokeai/backend/model_manager/load/model_loaders/flux.py:894— invokeai/backend/model_manager/load/model_loaders/flux.py:894-1035 | invokeai/backend/model_manager/load/model_loaders/flux.py:1287-1571 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:362-516 | invokeai/backend/model_manager/load/model_loaders/krea2.py:543-780 | invokeai/backend/model_manager/load/model_loaders/z_image.py:486-734 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) scripts/calibrate_flux2_denoise_working_memory.py:569— scripts/calibrate_flux2_denoise_working_memory.py:569-640 | scripts/calibrate_flux3_denoise_working_memory.py:806-896 | scripts/calibrate_krea2_working_memory.py:689-783 | scripts/calibrate_vae_tiling_working_memory.py:676-715 | scripts/calibrate_z_image_working_memory.py:506-569 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×6
Edited copy of a member (24 corresponding lines) invokeai/backend/anima/anima_transformer.py:271— invokeai/backend/anima/anima_transformer.py:271-294 | invokeai/backend/anima/anima_transformer_patch.py:22-63 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) invokeai/app/invocations/metadata_linked.py:529— invokeai/app/invocations/metadata_linked.py:529-552 | invokeai/app/invocations/metadata_linked.py:585-614 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) invokeai/app/api/routers/utilities.py:137— invokeai/app/api/routers/utilities.py:137-160 | invokeai/app/services/fonts/fonts_parsing.py:64-88 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) invokeai/app/services/image_records/image_records_default.py:157— invokeai/app/services/image_records/image_records_default.py:157-180 | invokeai/app/services/video_records/video_records_default.py:130-155 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) invokeai/backend/flux/extensions/instantx_controlnet_extension.py:99— invokeai/backend/flux/extensions/instantx_controlnet_extension.py:99-127 | invokeai/backend/flux/extensions/xlabs_controlnet_extension.py:80-103 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) invokeai/app/services/auth/password_utils.py:61— invokeai/app/services/auth/password_utils.py:61-85 | invokeai/app/services/auth/password_utils.py:89-112 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×6
Edited copy of a member (7 corresponding lines) invokeai/backend/model_manager/load/model_loaders/ltx2.py:171— invokeai/backend/model_manager/load/model_loaders/ltx2.py:171-177 | invokeai/backend/model_manager/load/model_loaders/ltx2.py:570-576 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) invokeai/app/services/shared/graph_validation.py:1947— invokeai/app/services/shared/graph_validation.py:1947-1953 | invokeai/app/services/shared/graph_validation.py:1956-1964 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) invokeai/app/api/routers/images.py:326— invokeai/app/api/routers/images.py:326-336 | invokeai/app/api/routers/videos.py:728-734 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) invokeai/backend/model_manager/load/model_loaders/minimax_h3_state_dict_utils.py:67— invokeai/backend/model_manager/load/model_loaders/minimax_h3_state_dict_utils.py:67-73 | invokeai/backend/patches/lora_conversions/minimax_h3_lora_conversion_utils.py:159-167 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) scripts/family_e2e/graphs.py:237— scripts/family_e2e/graphs.py:237-243 | scripts/working_memory/build_shipped.py:676-683 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:552— scripts/calibrate_flux2_denoise_working_memory.py:552-558 | scripts/calibrate_flux3_denoise_working_memory.py:782-788 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (2 corresponding lines) · ×6
Edited copy of a member (2 corresponding lines) invokeai/app/services/shared/database/queries/image_moves.py:193— invokeai/app/services/shared/database/queries/image_moves.py:193-194 | invokeai/app/services/shared/database/queries/session_queue.py:1140-1142 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) invokeai/app/services/shared/database/queries/gallery.py:481— invokeai/app/services/shared/database/queries/gallery.py:481-482 | invokeai/app/services/shared/database/queries/intermediates.py:599-600 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) invokeai/backend/patches/layers/full_layer.py:30— invokeai/backend/patches/layers/full_layer.py:30-31 | invokeai/backend/patches/layers/norm_layer.py:30-31 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) invokeai/backend/quantization/int8_convrot.py:822— invokeai/backend/quantization/int8_convrot.py:822-835 | invokeai/backend/tiny_autoencoder/checkpoint.py:188-189 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) invokeai/backend/flux2/latent_norm.py:38— invokeai/backend/flux2/latent_norm.py:38-39 | invokeai/backend/ltx2/packing.py:157-162 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) invokeai/backend/model_manager/load/model_loaders/flux.py:1730— invokeai/backend/model_manager/load/model_loaders/flux.py:1730-1733 | invokeai/backend/model_manager/load/model_loaders/z_image.py:875-876 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (19 lines × 2) invokeai/app/services/shared/graph.py:1703— invokeai/app/services/shared/graph.py:1703-1721 | invokeai/app/services/shared/graph.py:3044-3062 — both copies are in the same file, so extract the 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `effects` to `Iterable[Any]` in one and `Iterable[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 (19 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:151— invokeai/backend/flux/controlnet/state_dict_utils.py:151-169 | invokeai/backend/model_manager/load/model_loaders/flux.py:2316-2334 — 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 `invokeai/backend/flux/controlnet/state_dict_utils.py:151` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) invokeai/backend/image_util/color_conversion.py:650— invokeai/backend/image_util/color_conversion.py:650-668 | invokeai/backend/image_util/color_conversion.py:707-725 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:124— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:124-142 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:123-141 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (19 lines × 2) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:142— invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:142-160 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:98-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) invokeai/app/api/routers/utilities.py:171— invokeai/app/api/routers/utilities.py:171-191 | invokeai/app/services/fonts/fonts_parsing.py:35-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:165— invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:165-181 | invokeai/app/invocations/z_image/z_image_lora_loader.py:137-153 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 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) invokeai/app/invocations/wan/wan_denoise.py:641— invokeai/app/invocations/wan/wan_denoise.py:641-657 | invokeai/app/invocations/wan/wan_video_denoise.py:311-327 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/wan/wan_denoise.py:641` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 lines × 2) invokeai/app/services/events/events_common.py:655— invokeai/app/services/events/events_common.py:655-671 | invokeai/app/services/events/events_common.py:691-707 — both copies are in the same file, so extract the 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 (17 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:636— invokeai/backend/hidiffusion/hidiffusion.py:636-652 | invokeai/backend/hidiffusion/hidiffusion.py:672-688 — both copies are in the same file, so extract the block into 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) invokeai/backend/minimax_h3/contiguous_attention.py:59— invokeai/backend/minimax_h3/contiguous_attention.py:59-75 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:170-186 — 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, `invokeai/backend/minimax_h3/contiguous_attention.py:80` calls `_head_major_contiguous` and `invokeai/backend/minimax_h3/transformer_minimax_h3.py:192` 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) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:71— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:71-87 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:70-86 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:71` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:338— invokeai/app/invocations/cogview4/cogview4_denoise.py:338-353 | invokeai/app/invocations/sd3/sd3_denoise.py:430-445 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.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 7 separate duplicated blocks between them, totalling at least 126 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 (16 lines × 2) invokeai/app/invocations/flux/flux_denoise.py:228— invokeai/app/invocations/flux/flux_denoise.py:228-243 | invokeai/app/invocations/flux2/flux2_denoise.py:240-255 — 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, `invokeai/app/invocations/flux2/flux2_denoise.py:236` calls `_get_bn_stats` and `invokeai/app/invocations/flux/flux_denoise.py:225` 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) invokeai/app/invocations/vae/cogview4_image_to_latents.py:44— invokeai/app/invocations/vae/cogview4_image_to_latents.py:44-59 | invokeai/app/invocations/vae/sd3_image_to_latents.py:40-55 — 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 `invokeai/app/invocations/vae/cogview4_image_to_latents.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. 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) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:92— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:92-107 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:91-106 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (16 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1038— invokeai/backend/pid/_src/networks/pixeldit_official.py:1038-1053 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1112-1127 — both copies are in the same file, so extract the block into 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) invokeai/backend/patches/lora_conversions/ltx2_lora_conversion_utils.py:119— invokeai/backend/patches/lora_conversions/ltx2_lora_conversion_utils.py:119-134 | invokeai/backend/patches/lora_conversions/minimax_h3_lora_conversion_utils.py:171-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 3) invokeai/app/invocations/text_encoder/anima_text_encoder.py:286— invokeai/app/invocations/text_encoder/anima_text_encoder.py:286-293 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:213-220 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:213-220 — 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 (8 lines × 3) invokeai/app/services/external_generation/providers/gemini.py:111— invokeai/app/services/external_generation/providers/gemini.py:111-120 | invokeai/app/services/external_generation/providers/openai.py:117-126 | invokeai/app/services/external_generation/providers/seedream.py:101-108 — 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 `invokeai/app/services/external_generation/providers/gemini.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 (8 lines × 3) invokeai/app/services/shared/graph.py:1646— invokeai/app/services/shared/graph.py:1646-1653 | invokeai/app/services/shared/graph.py:1688-1695 | invokeai/app/services/shared/graph.py:1751-1758 — 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 `invokeai/app/services/shared/graph.py:1646` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) invokeai/backend/pid/_src/networks/pixeldit_official.py:460— invokeai/backend/pid/_src/networks/pixeldit_official.py:460-467 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1063-1070 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1137-1144 — 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 `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 × 3) invokeai/backend/image_util/color_conversion.py:420— invokeai/backend/image_util/color_conversion.py:420-427 | invokeai/backend/image_util/color_conversion.py:429-436 | invokeai/backend/image_util/color_conversion.py:437-444 — 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 `invokeai/backend/image_util/color_conversion.py:420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `invokeai/backend/image_util/color_conversion.py:420` calls `where` and `invokeai/backend/image_util/color_conversion.py:437` 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 × 3) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:55— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:55-62 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:35-42 | invokeai/backend/flux/model.py:53-60 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC2 · Forms & labels· <CompositeNumberInput> field component without a label · ×5
<CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/ParamDenoisingStrength.tsx:91— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:200— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/common/Weight.tsx:43— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/dynamicPrompts/components/ParamDynamicPromptsMaxPrompts.tsx:48— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/lora/components/LoRACard.tsx:106— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile (cyclomatic 46) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1753— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile has cyclomatic complexity 46 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cyclomatic 40) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1412— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft (cyclomatic 28) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:2361— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves (cyclomatic 25) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1540— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject (cyclomatic 20) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1131— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject 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: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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· Edited copy of a member (31 corresponding lines) · ×5
Edited copy of a member (31 corresponding lines) invokeai/app/services/shared/execution_engine/scheduler.py:359— invokeai/app/services/shared/execution_engine/scheduler.py:359-389 | invokeai/app/services/shared/execution_engine/scheduler.py:402-433 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) invokeai/app/api/routers/model_manager.py:823— invokeai/app/api/routers/model_manager.py:823-855 | invokeai/app/api/routers/model_manager.py:870-900 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) invokeai/app/api/routers/workflows.py:98— invokeai/app/api/routers/workflows.py:98-142 | invokeai/app/api/routers/workflows.py:153-183 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) invokeai/app/services/external_generation/providers/alibabacloud.py:292— invokeai/app/services/external_generation/providers/alibabacloud.py:292-328 | invokeai/app/services/external_generation/providers/atlascloud.py:272-302 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) invokeai/backend/pid/_src/utils/context_parallel.py:59— invokeai/backend/pid/_src/utils/context_parallel.py:59-89 | invokeai/backend/pid/_src/utils/context_parallel.py:93-128 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×5
Edited copy of a member (20 corresponding lines) invokeai/backend/flux2/denoise_working_memory.py:137— invokeai/backend/flux2/denoise_working_memory.py:137-156 | invokeai/backend/flux3/denoise_working_memory.py:158-180 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) invokeai/backend/flux2/sampling_utils.py:214— invokeai/backend/flux2/sampling_utils.py:214-257 | invokeai/backend/flux3/sampling.py:44-63 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) invokeai/backend/model_manager/load/model_loaders/flux.py:1692— invokeai/backend/model_manager/load/model_loaders/flux.py:1692-1711 | invokeai/backend/model_manager/load/model_loaders/z_image.py:933-962 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) invokeai/backend/model_manager/load/model_loaders/ideogram4.py:88— invokeai/backend/model_manager/load/model_loaders/ideogram4.py:88-107 | invokeai/backend/util/state_dict_loading.py:63-96 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:848— invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:848-869 | invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:873-892 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×5
Edited copy of a member (16 corresponding lines) invokeai/backend/quantization/gguf/utils.py:42— invokeai/backend/quantization/gguf/utils.py:42-57 | invokeai/backend/quantization/gguf/utils.py:63-78 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) invokeai/app/services/shared/graph_validation.py:124— invokeai/app/services/shared/graph_validation.py:124-139 | invokeai/app/services/shared/graph_validation.py:143-160 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) invokeai/backend/model_manager/configs/ip_adapter.py:89— invokeai/backend/model_manager/configs/ip_adapter.py:89-104 | invokeai/backend/model_manager/configs/ip_adapter.py:159-177 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) invokeai/app/api/routers/model_relationships.py:117— invokeai/app/api/routers/model_relationships.py:117-134 | invokeai/app/api/routers/model_relationships.py:154-169 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:172— invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:172-199 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:289-304 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (20 lines × 2) invokeai/app/api/routers/utilities.py:141— invokeai/app/api/routers/utilities.py:141-160 | invokeai/app/services/fonts/fonts_parsing.py:69-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. 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 `record` to `object` in one and `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 (20 lines × 2) invokeai/app/invocations/video_concat.py:346— invokeai/app/invocations/video_concat.py:346-365 | invokeai/app/invocations/video_frame_extract_range.py:309-328 — 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) invokeai/backend/image_util/clarity.py:23— invokeai/backend/image_util/clarity.py:23-42 | invokeai/backend/image_util/texture.py:24-43 — 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 `size` to `float = 40` in one and `float = 8` 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 (20 lines × 2) invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:100— invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:100-119 | invokeai/backend/patches/lora_conversions/flux_onetrainer_lora_conversion_utils.py:104-123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:122` calls `_convert_flux_transformer_kohya_state_dict_to_invoke_format` and `invokeai/backend/patches/lora_conversions/flux_onetrainer_lora_conversion_utils.py:126` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20 lines × 2) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:901— invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:901-920 | invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py:659-678 — 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.
promptAST.parseTokens::tryParseUnquotedPromptFunction (cognitive 48) invokeai/frontend/webv1/src/common/util/promptAST.ts:535— promptAST.parseTokens::tryParseUnquotedPromptFunction has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 5 (11 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::isUnquotedPromptFunctionAhead, promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
promptAST.parseTokens::parseGroup (cognitive 45) invokeai/frontend/webv1/src/common/util/promptAST.ts:651— promptAST.parseTokens::parseGroup has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 2 (4 pts), boolean chains 3, match/switch 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. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::isUnquotedPromptFunctionAhead, promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::tryParseUnquotedPromptFunction) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
promptAST.parseTokens::tryParsePromptFunction (cognitive 38) invokeai/frontend/webv1/src/common/util/promptAST.ts:407— promptAST.parseTokens::tryParsePromptFunction has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::isUnquotedPromptFunctionAhead, promptAST.parseTokens::tryParseUnquotedPromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
promptAST.parseTokens::isUnquotedPromptFunctionAhead (cognitive 18) invokeai/frontend/webv1/src/common/util/promptAST.ts:311— promptAST.parseTokens::isUnquotedPromptFunctionAhead has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::tryParseUnquotedPromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documentModel.createDocumentModel::prepareReorder (cognitive 26) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:750— documentModel.createDocumentModel::prepareReorder has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (24 pts), 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. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareInsert, documentModel.createDocumentModel::checkReparent, documentModel.createDocumentModel::preparePatchConfigBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documentModel.createDocumentModel::checkReparent (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:848— documentModel.createDocumentModel::checkReparent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 5, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareInsert, documentModel.createDocumentModel::prepareReorder, documentModel.createDocumentModel::preparePatchConfigBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documentModel.createDocumentModel::prepareInsert (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:546— documentModel.createDocumentModel::prepareInsert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareReorder, documentModel.createDocumentModel::checkReparent, documentModel.createDocumentModel::preparePatchConfigBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documentModel.createDocumentModel::preparePatchConfigBatch (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:1282— documentModel.createDocumentModel::preparePatchConfigBatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 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. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareInsert, documentModel.createDocumentModel::prepareReorder, documentModel.createDocumentModel::checkReparent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×4
Edited copy of a member (23 corresponding lines) invokeai/backend/wan/extensions/wan_ref_image_extension.py:49— invokeai/backend/wan/extensions/wan_ref_image_extension.py:49-75 | invokeai/backend/wan/extensions/wan_ref_image_extension.py:86-118 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) invokeai/backend/quantization/gguf/utils.py:122— invokeai/backend/quantization/gguf/utils.py:122-146 | invokeai/backend/quantization/gguf/utils.py:152-174 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) invokeai/app/api/routers/images.py:242— invokeai/app/api/routers/images.py:242-275 | invokeai/app/api/routers/videos.py:621-643 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:504— scripts/calibrate_flux2_denoise_working_memory.py:504-526 | scripts/calibrate_flux3_denoise_working_memory.py:721-744 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py:1112— invokeai/app/invocations/anima/anima_denoise.py:1112-1134 | invokeai/app/invocations/text_encoder/anima_text_encoder.py:286-294 | invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:256-265 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:213-221 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:213-221 | invokeai/app/invocations/z_image/z_image_denoise.py:774-782 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/flux3/flux3_denoise.py:298— invokeai/app/invocations/flux3/flux3_denoise.py:298-304 | invokeai/app/invocations/moss_image/moss_image_denoise.py:222-228 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:811-818 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:626-632 | invokeai/app/invocations/text_encoder/krea2_text_encoder.py:210-217 | invokeai/app/invocations/text_encoder/qwen_image_text_encoder.py:443-450 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/vae/anima_image_to_latents.py:69— invokeai/app/invocations/vae/anima_image_to_latents.py:69-120 | invokeai/app/invocations/vae/anima_latents_to_image.py:82-197 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:56-134 | invokeai/app/invocations/vae/wan_image_to_latents.py:54-89 | invokeai/app/invocations/vae/wan_latents_to_image.py:51-121 | invokeai/app/invocations/vae/wan_latents_to_video.py:99-272 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/util/user_management.py:82— invokeai/app/util/user_management.py:82-140 | invokeai/app/util/user_management.py:144-180 | invokeai/app/util/user_management.py:218-268 | invokeai/app/util/user_management.py:272-316 | invokeai/app/util/user_management.py:450-542 | invokeai/app/util/user_management.py:551-599 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×4
Edited copy of a member (25 corresponding lines) invokeai/app/services/session_processor/workflow_call_batch.py:236— invokeai/app/services/session_processor/workflow_call_batch.py:236-264 | invokeai/app/services/session_processor/workflow_call_batch.py:268-292 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) invokeai/app/api/routers/images.py:555— invokeai/app/api/routers/images.py:555-579 | invokeai/app/api/routers/images.py:992-1018 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) invokeai/backend/model_manager/load/model_loaders/krea2.py:143— invokeai/backend/model_manager/load/model_loaders/krea2.py:143-167 | invokeai/backend/model_manager/load/model_loaders/z_image.py:90-116 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:215— scripts/calibrate_flux2_denoise_working_memory.py:215-239 | scripts/calibrate_flux3_denoise_working_memory.py:315-357 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×4
Edited copy of a member (21 corresponding lines) invokeai/app/services/image_files/image_files_disk.py:418— invokeai/app/services/image_files/image_files_disk.py:418-447 | invokeai/app/services/video_files/video_files_disk.py:161-181 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) invokeai/backend/quantization/bnb_llm_int8.py:129— invokeai/backend/quantization/bnb_llm_int8.py:129-149 | invokeai/backend/quantization/bnb_nf4.py:101-128 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) invokeai/backend/util/level_zero.py:183— invokeai/backend/util/level_zero.py:183-203 | invokeai/backend/util/level_zero.py:232-261 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:476— scripts/calibrate_flux2_denoise_working_memory.py:476-500 | scripts/calibrate_flux3_denoise_working_memory.py:662-682 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×4
Edited copy of a member (26 corresponding lines) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88-113 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81-106 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) invokeai/app/util/user_management.py:184— invokeai/app/util/user_management.py:184-209 | invokeai/app/util/user_management.py:603-633 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_16_add_qwen3_vl_encoder_variant.py:31— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_16_add_qwen3_vl_encoder_variant.py:31-56 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_01_add_anima_variant.py:45-72 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) invokeai/app/invocations/anima/anima_denoise.py:589— invokeai/app/invocations/anima/anima_denoise.py:589-622 | invokeai/backend/z_image/text_conditioning.py:49-74 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×4
Edited copy of a member (29 corresponding lines) invokeai/backend/model_manager/load/model_loaders/ernie_image.py:150— invokeai/backend/model_manager/load/model_loaders/ernie_image.py:150-178 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:538-568 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) invokeai/app/services/images/images_default.py:490— invokeai/app/services/images/images_default.py:490-525 | invokeai/app/services/videos/videos_default.py:341-369 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) invokeai/app/api/routers/images.py:670— invokeai/app/api/routers/images.py:670-698 | invokeai/app/api/routers/videos.py:689-718 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) invokeai/backend/model_manager/load/model_cache/model_cache.py:1328— invokeai/backend/model_manager/load/model_cache/model_cache.py:1328-1391 | invokeai/backend/model_manager/load/model_cache/model_cache.py:1394-1422 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×4
Edited copy of a member (22 corresponding lines) invokeai/app/api/routers/session_queue.py:639— invokeai/app/api/routers/session_queue.py:639-679 | invokeai/app/api/routers/session_queue.py:905-926 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:54— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:54-75 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py:162-184 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) invokeai/app/services/shared/graph.py:3433— invokeai/app/services/shared/graph.py:3433-3456 | invokeai/app/services/shared/graph_scheduler.py:409-430 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) invokeai/app/services/gallery/gallery_default.py:95— invokeai/app/services/gallery/gallery_default.py:95-116 | invokeai/app/services/gallery/gallery_default.py:135-157 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×4
Edited copies of one member (3 members, 4+ corresponding lines) invokeai/app/invocations/vae/ltx2_latents_to_video.py:44— invokeai/app/invocations/vae/ltx2_latents_to_video.py:44-47 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:45-48 | invokeai/app/invocations/vae/wan_latents_to_video.py:59-62 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) invokeai/app/services/shared/database/queries/intermediates.py:666— invokeai/app/services/shared/database/queries/intermediates.py:666-675 | invokeai/app/services/shared/database/queries/intermediates.py:734-737 | invokeai/app/services/shared/database/queries/media_references.py:110-114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) invokeai/app/invocations/flux2/flux2_denoise.py:720— invokeai/app/invocations/flux2/flux2_denoise.py:720-730 | invokeai/app/invocations/text_encoder/flux_text_encoder.py:206-209 | invokeai/app/invocations/text_encoder/sd3_text_encoder.py:220-223 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:562— scripts/calibrate_flux2_denoise_working_memory.py:562-565 | scripts/calibrate_flux3_denoise_working_memory.py:799-802 | scripts/calibrate_krea2_working_memory.py:675-678 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (18 lines × 2) invokeai/app/services/shared/database/queries/videos.py:312— invokeai/app/services/shared/database/queries/videos.py:312-329 | invokeai/app/services/shared/database/queries/videos.py:349-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/videos.py:312` it does not close everything it opens, so those 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 (18 lines × 2) invokeai/backend/flux2/denoise.py:169— invokeai/backend/flux2/denoise.py:169-186 | invokeai/backend/flux2/denoise.py:287-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) invokeai/backend/flux2/denoise_working_memory.py:137— invokeai/backend/flux2/denoise_working_memory.py:137-154 | invokeai/backend/flux3/denoise_working_memory.py:158-175 — 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 (18 lines × 2) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:328— invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:328-345 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:185-202 — 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 `layer` to `Mapping[str, Any]` in one and `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 (14–15 lines × 2) invokeai/app/api/routers/style_presets.py:109— invokeai/app/api/routers/style_presets.py:109-123 | invokeai/app/api/routers/style_presets.py:201-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:330— invokeai/app/invocations/cogview4/cogview4_denoise.py:330-344 | invokeai/app/invocations/z_image/z_image_denoise.py:678-691 — 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 `invokeai/app/invocations/cogview4/cogview4_denoise.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 (14–15 lines × 2) invokeai/app/services/shared/graph_materializer.py:984— invokeai/app/services/shared/graph_materializer.py:984-998 | invokeai/app/services/shared/graph_materializer.py:1092-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:984` it begins part-way through the construct above it, so those 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) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:256— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:256-269 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:199-213 — 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 (10–11 lines × 2) invokeai/app/invocations/resize_latents.py:54— invokeai/app/invocations/resize_latents.py:54-64 | invokeai/app/invocations/resize_latents.py:94-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 `invokeai/app/invocations/resize_latents.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. 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–11 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:1187— invokeai/app/invocations/sd/denoise_latents.py:1187-1197 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:220-229 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 2) invokeai/app/services/shared/graph_materializer.py:938— invokeai/app/services/shared/graph_materializer.py:938-948 | invokeai/app/services/shared/graph_materializer.py:979-988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:938` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 2) invokeai/backend/image_util/lineart_anime.py:184— invokeai/backend/image_util/lineart_anime.py:184-193 | invokeai/backend/image_util/lineart_anime.py:251-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:1155— invokeai/app/invocations/sd/denoise_latents.py:1155-1162 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:195-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8–9 lines × 2) invokeai/app/services/shared/graph_materializer.py:910— invokeai/app/services/shared/graph_materializer.py:910-918 | invokeai/app/services/shared/graph_materializer.py:1029-1036 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) invokeai/app/util/aac_splice.py:160— invokeai/app/util/aac_splice.py:160-168 | invokeai/app/util/h264_splice.py:355-362 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 2) invokeai/backend/patches/lora_conversions/ideogram4_lora_constants.py:189— invokeai/backend/patches/lora_conversions/ideogram4_lora_constants.py:189-197 | invokeai/backend/patches/lora_conversions/sd3_lora_constants.py:395-402 — 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 × 4) invokeai/app/invocations/flux/flux_lora_loader.py:160— invokeai/app/invocations/flux/flux_lora_loader.py:160-167 | invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:155-161 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:174-181 | invokeai/app/invocations/z_image/z_image_lora_loader.py:146-153 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 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 (7 lines × 4) invokeai/app/invocations/text_encoder/anima_text_encoder.py:288— invokeai/app/invocations/text_encoder/anima_text_encoder.py:288-294 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:215-221 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:215-221 | invokeai/app/invocations/z_image/z_image_denoise.py:776-782 — 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 (7 lines × 4) invokeai/backend/pid/_src/networks/pid_net.py:373— invokeai/backend/pid/_src/networks/pid_net.py:373-379 | invokeai/backend/pid/_src/networks/pid_net.py:409-415 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1467-1473 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1492-1498 — 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.
Duplicated block (7 lines × 4) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_diffusers_rms_norm.py:34— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_diffusers_rms_norm.py:34-40 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_embedding.py:23-29 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_group_norm.py:16-22 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_layer_norm.py:19-25 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 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.
promptAST.parseTokens::tryParseUnquotedPromptFunction (cyclomatic 24) invokeai/frontend/webv1/src/common/util/promptAST.ts:535— promptAST.parseTokens::tryParseUnquotedPromptFunction has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
promptAST.parseTokens::parseGroup (cyclomatic 23) invokeai/frontend/webv1/src/common/util/promptAST.ts:651— promptAST.parseTokens::parseGroup has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::tryParseUnquotedPromptFunction) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
promptAST.parseTokens::tryParsePromptFunction (cyclomatic 19) invokeai/frontend/webv1/src/common/util/promptAST.ts:407— promptAST.parseTokens::tryParsePromptFunction 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. This shape REPEATS in the file: 2 other methods here (promptAST.parseTokens::tryParseUnquotedPromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×3
Edited copy of a member (37 corresponding lines) invokeai/app/api/routers/utilities.py:510— invokeai/app/api/routers/utilities.py:510-549 | invokeai/app/api/routers/utilities.py:629-665 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) invokeai/app/services/shared/graph_iterator_ancestry.py:57— invokeai/app/services/shared/graph_iterator_ancestry.py:57-93 | invokeai/app/services/shared/graph_iterator_ancestry.py:114-158 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:188— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:188-224 | invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:230-271 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×3
Edited copy of a member (36 corresponding lines) invokeai/app/invocations/flux2/flux2_denoise.py:641— invokeai/app/invocations/flux2/flux2_denoise.py:641-678 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:767-802 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) invokeai/backend/minimax_h3/contiguous_attention.py:59— invokeai/backend/minimax_h3/contiguous_attention.py:59-102 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:170-205 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) invokeai/app/invocations/text_encoder/flux_text_encoder.py:222— invokeai/app/invocations/text_encoder/flux_text_encoder.py:222-257 | invokeai/app/invocations/text_encoder/flux_text_encoder.py:264-300 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×3
Edited copy of a member (30 corresponding lines) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:142— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:142-171 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:135-164 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) invokeai/app/invocations/image.py:996— invokeai/app/invocations/image.py:996-1025 | invokeai/app/invocations/image.py:1061-1090 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) invokeai/app/api/routers/projects.py:235— invokeai/app/api/routers/projects.py:235-264 | invokeai/app/api/routers/projects.py:368-397 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×3
Edited copies of one member (3 members, 14+ corresponding lines) invokeai/app/invocations/model.py:404— invokeai/app/invocations/model.py:404-417 | invokeai/app/invocations/sd/sdxl.py:39-58 | invokeai/app/invocations/sd/sdxl.py:79-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:47— invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:47-60 | invokeai/app/invocations/ideogram4/ideogram4_lora_loader.py:47-60 | invokeai/app/invocations/sd3/sd3_lora_loader.py:51-64 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) invokeai/backend/model_manager/configs/main.py:1798— invokeai/backend/model_manager/configs/main.py:1798-1813 | invokeai/backend/model_manager/configs/main.py:2670-2695 | invokeai/backend/model_manager/configs/main.py:2798-2811 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×3
Edited copy of a member (28 corresponding lines) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:710— invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:710-737 | invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:740-767 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) invokeai/backend/model_manager/load/model_loaders/ernie_image.py:56— invokeai/backend/model_manager/load/model_loaders/ernie_image.py:56-87 | invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py:66-93 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) invokeai/backend/model_manager/load/model_loaders/flux.py:1662— invokeai/backend/model_manager/load/model_loaders/flux.py:1662-1689 | invokeai/backend/model_manager/load/model_loaders/z_image.py:823-851 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×3
Edited copies of one member (3 members, 15+ corresponding lines) invokeai/app/invocations/flux3/flux3_lora_loader.py:100— invokeai/app/invocations/flux3/flux3_lora_loader.py:100-114 | invokeai/app/invocations/moss_image/moss_image_lora_loader.py:101-115 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:101-115 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) invokeai/app/api/routers/model_manager.py:673— invokeai/app/api/routers/model_manager.py:673-687 | invokeai/app/api/routers/style_presets.py:293-309 | invokeai/app/api/routers/workflows.py:425-443 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) invokeai/backend/model_manager/configs/main.py:650— invokeai/backend/model_manager/configs/main.py:650-664 | invokeai/backend/model_manager/configs/main.py:728-742 | invokeai/backend/model_manager/configs/main.py:846-860 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×3
Edited copies of one member (3 members, 11+ corresponding lines) invokeai/app/services/shared/database/queries/images.py:475— invokeai/app/services/shared/database/queries/images.py:475-487 | invokeai/app/services/shared/database/queries/style_presets.py:116-126 | invokeai/app/services/shared/database/queries/videos.py:422-434 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) invokeai/app/api/routers/workflows.py:487— invokeai/app/api/routers/workflows.py:487-497 | invokeai/app/api/routers/workflows.py:508-518 | invokeai/app/api/routers/workflows.py:528-538 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:79— invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:79-98 | invokeai/app/invocations/text_encoder/flux_text_encoder.py:63-78 | invokeai/app/invocations/text_encoder/wan_text_encoder.py:55-65 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 4+ corresponding lines) · ×3
Edited copies of one member (4 members, 4+ corresponding lines) invokeai/app/invocations/metadata_linked.py:334— invokeai/app/invocations/metadata_linked.py:334-337 | invokeai/app/invocations/metadata_linked.py:366-369 | invokeai/app/invocations/metadata_linked.py:398-401 | invokeai/app/invocations/metadata_linked.py:430-433 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 4+ corresponding lines) scripts/calibrate_flux3_denoise_working_memory.py:775— scripts/calibrate_flux3_denoise_working_memory.py:775-778 | scripts/calibrate_krea2_working_memory.py:682-685 | scripts/calibrate_vae_tiling_working_memory.py:669-672 | scripts/calibrate_z_image_working_memory.py:499-502 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 4+ corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:530— scripts/calibrate_flux2_denoise_working_memory.py:530-533 | scripts/calibrate_flux3_denoise_working_memory.py:748-751 | scripts/calibrate_krea2_working_memory.py:652-655 | scripts/calibrate_vae_tiling_working_memory.py:645-648 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (30 lines × 2) invokeai/app/invocations/vae/cogview4_latents_to_image.py:49— invokeai/app/invocations/vae/cogview4_latents_to_image.py:49-78 | invokeai/app/invocations/vae/sd3_latents_to_image.py:51-80 — 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 `invokeai/app/invocations/vae/cogview4_latents_to_image.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 (30 lines × 2) invokeai/backend/llava_onevision_pipeline.py:90— invokeai/backend/llava_onevision_pipeline.py:90-119 | invokeai/backend/text_llm_pipeline.py:267-296 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 (30 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:319— invokeai/backend/pid/_src/networks/pid_net.py:319-348 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1420-1449 — 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, `invokeai/backend/pid/_src/networks/pid_net.py:353` calls `split_inputs_cp` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:1450` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 2) invokeai/backend/flux2/denoise.py:141— invokeai/backend/flux2/denoise.py:141-164 | invokeai/backend/flux2/denoise.py:259-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) invokeai/backend/ltx2/denoise.py:387— invokeai/backend/ltx2/denoise.py:387-410 | invokeai/backend/ltx2/denoise.py:569-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 (24 lines × 2) invokeai/backend/model_manager/configs/qwen3_encoder.py:309— invokeai/backend/model_manager/configs/qwen3_encoder.py:309-332 | invokeai/backend/model_manager/configs/qwen3_encoder.py:498-521 — both copies are in the same file, so extract the block into 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) invokeai/app/invocations/wan/wan_denoise.py:688— invokeai/app/invocations/wan/wan_denoise.py:688-709 | invokeai/app/invocations/wan/wan_video_denoise.py:364-385 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/wan/wan_video_denoise.py:359` calls `expand` and `invokeai/app/invocations/wan/wan_denoise.py:686` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22 lines × 2) invokeai/app/services/shared/database/queries/images.py:356— invokeai/app/services/shared/database/queries/images.py:356-377 | invokeai/app/services/shared/database/queries/images.py:399-420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:356` it does not close everything it opens, so those 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 (22 lines × 2) invokeai/app/util/user_management.py:521— invokeai/app/util/user_management.py:521-542 | invokeai/app/util/user_management.py:578-599 — both copies are in the same file, so extract the 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–16 lines × 2) invokeai/app/invocations/composition-nodes.py:123— invokeai/app/invocations/composition-nodes.py:123-136 | invokeai/app/invocations/composition-nodes.py:220-235 — both copies are in the same file, so extract the block into 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–16 lines × 2) invokeai/app/services/images/images_default.py:108— invokeai/app/services/images/images_default.py:108-123 | invokeai/app/services/videos/videos_default.py:92-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/images/images_default.py:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:45— invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:45-58 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:58-73 — before extracting anything, compare `invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py` and `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.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 (12–15 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88-102 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:153-164 — both copies are in the same file, so extract the block into 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–15 lines × 2) invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81— invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81-95 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:146-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–15 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:576— scripts/calibrate_flux2_denoise_working_memory.py:576-587 | scripts/calibrate_krea2_working_memory.py:698-712 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_krea2_working_memory.py:698` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) invokeai/app/api/routers/image_map.py:643— invokeai/app/api/routers/image_map.py:643-654 | invokeai/app/api/routers/image_map.py:869-879 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/image_map.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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:87— invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:87-98 | invokeai/app/invocations/text_encoder/flux_text_encoder.py:68-78 — 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 (11–12 lines × 2) invokeai/app/services/shared/graph_if_dependencies.py:42— invokeai/app/services/shared/graph_if_dependencies.py:42-53 | invokeai/app/services/shared/graph_if_dependencies.py:116-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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, `invokeai/app/services/shared/graph_if_dependencies.py:127` calls `_get_input_edges` and `invokeai/app/services/shared/graph_if_dependencies.py:55` 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 × 3) invokeai/app/api/sockets.py:1063— invokeai/app/api/sockets.py:1063-1073 | invokeai/app/api/sockets.py:1122-1131 | invokeai/app/api/sockets.py:1169-1177 — 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 `invokeai/app/api/sockets.py:1063` it begins part-way through the construct above it, so those exact lines 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 × 3) invokeai/app/invocations/vae/anima_image_to_latents.py:124— invokeai/app/invocations/vae/anima_image_to_latents.py:124-134 | invokeai/app/invocations/vae/wan_image_to_latents.py:93-101 | invokeai/app/invocations/vae/z_image_image_to_latents.py:110-120 — before extracting anything, compare `invokeai/app/invocations/vae/anima_image_to_latents.py` and `invokeai/app/invocations/vae/z_image_image_to_latents.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 `invokeai/app/invocations/vae/anima_image_to_latents.py:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 3) invokeai/app/services/images/images_default.py:405— invokeai/app/services/images/images_default.py:405-413 | invokeai/app/services/images/images_default.py:419-427 | invokeai/app/services/images/images_default.py:433-443 — 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 `invokeai/app/services/images/images_default.py:433` it begins part-way through the construct above it, so those exact lines 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) invokeai/app/services/shared/graph_materializer.py:503— invokeai/app/services/shared/graph_materializer.py:503-513 | invokeai/app/services/shared/graph_materializer.py:615-625 | invokeai/app/services/shared/graph_materializer.py:943-953 | invokeai/app/services/shared/graph_materializer.py:1049-1058 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:503` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 4) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16-25 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:19-28 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:21-30 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py:88-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 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.
Duplicated block (10 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:592— scripts/calibrate_flux2_denoise_working_memory.py:592-601 | scripts/calibrate_krea2_working_memory.py:725-734 | scripts/calibrate_vae_tiling_working_memory.py:685-694 | scripts/calibrate_z_image_working_memory.py:526-535 — 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 `scripts/calibrate_flux2_denoise_working_memory.py:592` it begins part-way through the construct above it, so those 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, `scripts/calibrate_flux2_denoise_working_memory.py:602` calls `list` and `scripts/calibrate_z_image_working_memory.py:536` 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) invokeai/app/api/routers/workflows.py:394— invokeai/app/api/routers/workflows.py:394-402 | invokeai/app/api/routers/workflows.py:458-466 | invokeai/app/api/routers/workflows.py:549-557 | invokeai/app/api/routers/workflows.py:572-580 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:92— invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:92-100 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:194-202 | invokeai/app/invocations/z_image/z_image_lora_loader.py:71-79 | invokeai/app/invocations/z_image/z_image_lora_loader.py:163-171 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 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, `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:191` calls `_assert_not_dev_lora` and `invokeai/app/invocations/z_image/z_image_lora_loader.py:162` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 4) invokeai/app/invocations/vae/anima_image_to_latents.py:134— invokeai/app/invocations/vae/anima_image_to_latents.py:134-142 | invokeai/app/invocations/vae/flux2_vae_encode.py:139-147 | invokeai/app/invocations/vae/qwen_image_image_to_latents.py:190-198 | invokeai/app/invocations/vae/z_image_image_to_latents.py:120-128 — before extracting anything, compare `invokeai/app/invocations/vae/anima_image_to_latents.py` and `invokeai/app/invocations/vae/z_image_image_to_latents.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 `invokeai/app/invocations/vae/anima_image_to_latents.py:134` it begins part-way through the construct above it, so those 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, `invokeai/app/invocations/vae/anima_image_to_latents.py:132` calls `signal_progress` and `invokeai/app/invocations/vae/qwen_image_image_to_latents.py:187` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 2) invokeai/app/invocations/model.py:537— invokeai/app/invocations/model.py:537-543 | invokeai/app/invocations/model.py:697-704 — both copies are in the same file, so extract the 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, `invokeai/app/invocations/model.py:707` calls `model_copy` and `invokeai/app/invocations/model.py:545` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 2) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:149— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:149-155 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:116-123 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7–8 lines × 2) invokeai/backend/image_util/imwatermark/vendor.py:229— invokeai/backend/image_util/imwatermark/vendor.py:229-236 | invokeai/backend/image_util/imwatermark/vendor.py:295-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/imwatermark/vendor.py:229` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) invokeai/app/invocations/flux3/flux3_lora_loader.py:26— invokeai/app/invocations/flux3/flux3_lora_loader.py:26-31 | invokeai/app/invocations/moss_image/moss_image_lora_loader.py:26-32 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:26-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) invokeai/app/services/shared/execution_engine/child.py:38— invokeai/app/services/shared/execution_engine/child.py:38-43 | invokeai/app/services/shared/execution_engine/primitives.py:99-104 | invokeai/app/services/shared/execution_engine/scheduler.py:47-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:425— scripts/calibrate_flux2_denoise_working_memory.py:425-430 | scripts/calibrate_flux3_denoise_working_memory.py:600-605 | scripts/calibrate_z_image_working_memory.py:406-411 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
IC1 · Incompleteness & stubs· Both branches are identical · ×3
Both branches are identical — the condition decides nothing invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:839— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:840— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:346— The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body.
AC2 · Forms & labels· <RadioGroup> field component without a label · ×2
<RadioGroup> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectModel.tsx:25— 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.
<RadioGroup> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectPointType.tsx:26— 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.
forLoops.validateForLoopGraph::getSupportedNestedForBody (cyclomatic 59) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:414— forLoops.validateForLoopGraph::getSupportedNestedForBody has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::supportsNestedIterateBody) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
forLoops.validateForLoopGraph::supportsNestedIterateBody (cyclomatic 25) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:333— forLoops.validateForLoopGraph::supportsNestedIterateBody has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documentModel.createDocumentModel::checkReparent (cyclomatic 23) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:848— documentModel.createDocumentModel::checkReparent has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (documentModel.createDocumentModel::prepareInsert) 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.
documentModel.createDocumentModel::prepareInsert (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:546— documentModel.createDocumentModel::prepareInsert 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 (documentModel.createDocumentModel::checkReparent) 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.
D10 · Test Quality· Fixed-sleep synchronisation · ×2
Fixed-sleep synchronisation: extracts through a live unflushed mask whose contract bitmap is still null invokeai/frontend/webv2/src/workbench/canvas-engine/engine.mask.test.ts:565— This test starts work it did not wait for (`engine`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => {
setTimeout(resolve, 0);
})` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: waits for a held lock until its holder lets it go, and stops waiting once aborted invokeai/frontend/webv2/src/platform/browser/webLocks.browser.test.ts:58— This test starts work it did not wait for (`waiting`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => {
setTimeout(resolve, 20);
})` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
forLoops.validateForLoopGraph::getSupportedNestedForBody (cognitive 76) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:414— forLoops.validateForLoopGraph::getSupportedNestedForBody has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (38 pts), boolean chains 20, loops 9 (16 pts), ternaries 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. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::supportsNestedIterateBody) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
forLoops.validateForLoopGraph::supportsNestedIterateBody (cognitive 23) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:333— forLoops.validateForLoopGraph::supportsNestedIterateBody has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
onInvocationComplete.buildOnInvocationComplete::addImagesToGallery (cognitive 21) invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:117— onInvocationComplete.buildOnInvocationComplete::addImagesToGallery has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (onInvocationComplete.buildOnInvocationComplete::getResultVideoDTOs) 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.
onInvocationComplete.buildOnInvocationComplete::getResultVideoDTOs (cognitive 16) invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:365— onInvocationComplete.buildOnInvocationComplete::getResultVideoDTOs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (onInvocationComplete.buildOnInvocationComplete::addImagesToGallery) 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· Edited copy of a member (50 corresponding lines) · ×2
Edited copy of a member (50 corresponding lines) invokeai/backend/minimax_h3/transformer_minimax_h3.py:543— invokeai/backend/minimax_h3/transformer_minimax_h3.py:543-642 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:190-239 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (50 corresponding lines) invokeai/app/invocations/vae/flux_vae_encode.py:57— invokeai/app/invocations/vae/flux_vae_encode.py:57-106 | invokeai/app/invocations/vae/z_image_image_to_latents.py:55-106 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×2
Edited copy of a member (41 corresponding lines) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:42— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:42-105 | invokeai/backend/flux/model.py:48-88 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (41 corresponding lines) invokeai/backend/model_manager/configs/main.py:165— invokeai/backend/model_manager/configs/main.py:165-205 | invokeai/backend/model_manager/configs/main.py:231-276 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×2
Edited copy of a member (60 corresponding lines) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:153— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:153-214 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:152-211 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (60 corresponding lines) invokeai/app/services/shared/invocation_context.py:323— invokeai/app/services/shared/invocation_context.py:323-397 | invokeai/app/services/shared/invocation_context.py:499-558 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×2
Edited copy of a member (56 corresponding lines) invokeai/app/invocations/vae/ltx2_latents_to_video.py:107— invokeai/app/invocations/vae/ltx2_latents_to_video.py:107-166 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:164-219 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (56 corresponding lines) invokeai/backend/flux/extensions/regional_prompting_extension.py:123— invokeai/backend/flux/extensions/regional_prompting_extension.py:123-208 | invokeai/backend/flux2/extensions/regional_prompting_extension.py:65-120 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×2
Edited copy of a member (44 corresponding lines) invokeai/app/invocations/metadata_linked.py:1001— invokeai/app/invocations/metadata_linked.py:1001-1044 | invokeai/app/invocations/metadata_linked.py:1078-1135 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (44 corresponding lines) invokeai/backend/model_manager/load/model_loaders/vae.py:366— invokeai/backend/model_manager/load/model_loaders/vae.py:366-409 | invokeai/backend/model_manager/load/model_loaders/vae.py:487-532 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×2
Edited copy of a member (39 corresponding lines) invokeai/app/invocations/vae/cogview4_latents_to_image.py:44— invokeai/app/invocations/vae/cogview4_latents_to_image.py:44-82 | invokeai/app/invocations/vae/sd3_latents_to_image.py:46-84 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) invokeai/app/invocations/flux/flux_redux.py:145— invokeai/app/invocations/flux/flux_redux.py:145-183 | invokeai/app/invocations/sd/ip_adapter.py:207-245 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) invokeai/app/services/image_records/image_records_common.py:176— invokeai/app/services/image_records/image_records_common.py:176-215 | invokeai/app/services/video_records/video_records_common.py:107-149 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (40 corresponding lines) invokeai/backend/quantization/gguf/ggml_tensor.py:16— invokeai/backend/quantization/gguf/ggml_tensor.py:16-55 | invokeai/backend/quantization/sdnq/sdnq_tensor.py:21-70 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (61 corresponding lines) · ×2
Edited copy of a member (61 corresponding lines) invokeai/backend/anima/regional_prompting.py:76— invokeai/backend/anima/regional_prompting.py:76-136 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:75-166 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (61 corresponding lines) scripts/calibrate_flux2_denoise_working_memory.py:335— scripts/calibrate_flux2_denoise_working_memory.py:335-395 | scripts/calibrate_flux3_denoise_working_memory.py:494-559 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×2
Edited copy of a member (32 corresponding lines) invokeai/app/invocations/model.py:453— invokeai/app/invocations/model.py:453-484 | invokeai/app/invocations/model.py:613-656 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) invokeai/backend/pid/_src/networks/pixeldit_official.py:1025— invokeai/backend/pid/_src/networks/pixeldit_official.py:1025-1056 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1099-1130 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (55 corresponding lines) · ×2
Edited copy of a member (55 corresponding lines) invokeai/backend/util/vae_working_memory.py:733— invokeai/backend/util/vae_working_memory.py:733-787 | invokeai/backend/util/vae_working_memory.py:855-936 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (55 corresponding lines) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:182— invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:182-236 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:81-156 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) invokeai/app/services/images/images_default.py:582— invokeai/app/services/images/images_default.py:582-611 | invokeai/app/services/videos/videos_default.py:431-457 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:39— invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:39-65 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_34.py:8-70 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×2
Edited copy of a member (35 corresponding lines) invokeai/app/api/routers/images.py:717— invokeai/app/api/routers/images.py:717-759 | invokeai/app/api/routers/videos.py:1080-1114 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) invokeai/backend/minimax_h3/packing.py:188— invokeai/backend/minimax_h3/packing.py:188-222 | invokeai/backend/minimax_h3/presets.py:43-78 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×2
Edited copies of one member (3 members, 9+ corresponding lines) invokeai/app/invocations/flux3/flux3_lora_loader.py:63— invokeai/app/invocations/flux3/flux3_lora_loader.py:63-71 | invokeai/app/invocations/moss_image/moss_image_lora_loader.py:64-72 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:64-72 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) invokeai/app/invocations/flux3/flux3_lora_loader.py:26— invokeai/app/invocations/flux3/flux3_lora_loader.py:26-34 | invokeai/app/invocations/moss_image/moss_image_lora_loader.py:26-35 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:26-35 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×2
Edited copies of one member (3 members, 18+ corresponding lines) invokeai/backend/model_manager/configs/main.py:4091— invokeai/backend/model_manager/configs/main.py:4091-4108 | invokeai/backend/model_manager/configs/main.py:4259-4278 | invokeai/backend/model_manager/configs/main.py:4418-4437 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:317— invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:317-343 | invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:399-416 | invokeai/backend/model_manager/configs/qwen_vl_encoder.py:286-304 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×2
Edited copies of one member (4 members, 12+ corresponding lines) invokeai/backend/model_manager/configs/main.py:2210— invokeai/backend/model_manager/configs/main.py:2210-2221 | invokeai/backend/model_manager/configs/main.py:2242-2255 | invokeai/backend/model_manager/configs/main.py:2480-2496 | invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:234-249 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) invokeai/app/services/image_records/image_records_default.py:80— invokeai/app/services/image_records/image_records_default.py:80-95 | invokeai/app/services/image_records/image_records_default.py:199-212 | invokeai/app/services/video_records/video_records_default.py:90-103 | invokeai/app/services/video_records/video_records_default.py:169-180 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×2
Edited copies of one member (3 members, 8+ corresponding lines) invokeai/app/invocations/cogview4/cogview4_denoise.py:156— invokeai/app/invocations/cogview4/cogview4_denoise.py:156-173 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:214-221 | invokeai/app/invocations/sd3/sd3_denoise.py:255-272 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) invokeai/app/invocations/text_encoder/ernie_image_text_encoder.py:52— invokeai/app/invocations/text_encoder/ernie_image_text_encoder.py:52-60 | invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:105-129 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:61-68 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (37 lines × 2) invokeai/app/invocations/z_image/z_image_denoise.py:548— invokeai/app/invocations/z_image/z_image_denoise.py:548-584 | invokeai/app/invocations/z_image/z_image_denoise.py:643-679 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (37 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1656— invokeai/backend/hidiffusion/hidiffusion.py:1656-1692 | invokeai/backend/hidiffusion/hidiffusion.py:1774-1810 — both copies are in the same file, so extract the block into 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–35 lines × 2) invokeai/backend/anima/regional_prompting.py:146— invokeai/backend/anima/regional_prompting.py:146-176 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:176-210 — 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 `invokeai/backend/z_image/extensions/regional_prompting_extension.py:176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–35 lines × 2) invokeai/backend/model_manager/configs/main.py:4207— invokeai/backend/model_manager/configs/main.py:4207-4241 | invokeai/backend/model_manager/configs/main.py:4361-4391 — both copies are in the same file, so extract the 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 (29 lines × 2) invokeai/app/services/session_processor/workflow_call_batch.py:106— invokeai/app/services/session_processor/workflow_call_batch.py:106-134 | invokeai/app/services/shared/workflow_graph_builder.py:282-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `workflow_nodes` to `Mapping[str, Mapping[str, Any]]` in one and `dict[str, Mapping[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 (29 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14— invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14-42 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:27-55 — before extracting anything, compare `invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py` and `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (27–28 lines × 2) invokeai/backend/model_manager/load/model_loaders/cogview4.py:32— invokeai/backend/model_manager/load/model_loaders/cogview4.py:32-59 | invokeai/backend/model_manager/load/model_loaders/flux.py:1137-1163 — 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 (27–28 lines × 2) REDACTED:530— REDACTED:530-557 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1046-1072 — 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 (27 lines × 2) invokeai/app/invocations/metadata_linked.py:1016— invokeai/app/invocations/metadata_linked.py:1016-1042 | invokeai/app/invocations/metadata_linked.py:1096-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.
Duplicated block (27 lines × 2) invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:148— invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:148-174 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:125-151 — 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 (26 lines × 2) invokeai/app/services/shared/graph_iterate_planner.py:44— invokeai/app/services/shared/graph_iterate_planner.py:44-69 | invokeai/app/services/shared/graph_iterate_planner.py:94-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/util/user_management.py:243— invokeai/app/util/user_management.py:243-268 | invokeai/app/util/user_management.py:291-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:262— invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:262-286 | invokeai/app/invocations/ltx2/ltx2_video_conditioning.py:131-155 — 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 `invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:262` it does not close everything it opens, so those exact lines 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) invokeai/app/util/user_management.py:116— invokeai/app/util/user_management.py:116-140 | invokeai/app/util/user_management.py:156-180 — both copies are in the same file, so extract the 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–24 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:354— invokeai/backend/model_manager/load/model_loaders/z_image.py:354-375 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1516-1539 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1700-1723 — 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 `invokeai/backend/model_manager/load/model_loaders/z_image.py:354` it begins part-way through the construct above it, so those exact lines 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 × 3) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:231— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:231-252 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:322-343 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:246-269 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–23 lines × 2) invokeai/backend/model_manager/configs/qwen3_encoder.py:372— invokeai/backend/model_manager/configs/qwen3_encoder.py:372-394 | invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:144-163 — 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–23 lines × 2) invokeai/backend/minimax_h3/rocm_causal_conv3d.py:50— invokeai/backend/minimax_h3/rocm_causal_conv3d.py:50-69 | invokeai/backend/wan/rocm_causal_conv3d.py:41-63 — 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 (20–22 lines × 2) invokeai/backend/flux/extensions/instantx_controlnet_extension.py:60— invokeai/backend/flux/extensions/instantx_controlnet_extension.py:60-81 | invokeai/backend/flux/extensions/instantx_controlnet_extension.py:99-118 — both copies are in the same file, so extract the 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 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–22 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:354— invokeai/backend/pid/_src/networks/pid_net.py:354-375 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1450-1469 — 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 `invokeai/backend/pid/_src/networks/pid_net.py:354` it does not close everything it opens, so those 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, `invokeai/backend/pid/_src/networks/pid_net.py:353` calls `split_inputs_cp` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:1449` 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–19 lines × 2) invokeai/app/services/image_files/image_files_disk.py:643— invokeai/app/services/image_files/image_files_disk.py:643-661 | invokeai/app/services/video_files/video_files_disk.py:286-300 — 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–19 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:476— scripts/calibrate_flux2_denoise_working_memory.py:476-494 | scripts/calibrate_flux3_denoise_working_memory.py:662-676 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (17–19 lines × 2) invokeai/app/services/shared/graph_nested_iterate_planner.py:265— invokeai/app/services/shared/graph_nested_iterate_planner.py:265-281 | invokeai/app/services/shared/graph_nested_iterate_planner.py:311-329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_nested_iterate_planner.py:264` calls `_discard_source_executed` and `invokeai/app/services/shared/graph_nested_iterate_planner.py:310` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–19 lines × 2) invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:282— invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:282-298 | invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:402-420 — both copies are in the same file, so extract the block into 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–18 lines × 2) invokeai/app/invocations/vae/qwen_image_2_1_image_to_latents.py:72— invokeai/app/invocations/vae/qwen_image_2_1_image_to_latents.py:72-89 | invokeai/app/invocations/vae/qwen_image_2_1_latents_to_image.py:37-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16–18 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:61— invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:61-76 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:76-93 — before extracting anything, compare `invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py` and `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.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. 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–18 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1420— invokeai/backend/model_manager/load/model_loaders/flux.py:1420-1437 | invokeai/backend/model_manager/load/model_loaders/flux.py:1764-1776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:1420` it begins part-way through the construct above it, so those exact lines 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) invokeai/backend/util/vae_working_memory.py:757— invokeai/backend/util/vae_working_memory.py:757-774 | invokeai/backend/util/vae_working_memory.py:905-917 — both copies are in the same file, so extract the block into 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 × 3) invokeai/app/invocations/anima/anima_lora_loader.py:134— invokeai/app/invocations/anima/anima_lora_loader.py:134-149 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:165-180 | invokeai/app/invocations/z_image/z_image_lora_loader.py:137-152 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 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 (16 lines × 3) invokeai/app/services/shared/sqlite_migrator/migrations/migration_11.py:61— invokeai/app/services/shared/sqlite_migrator/migrations/migration_11.py:61-77 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2.py:143-168 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_3.py:57-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `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 × 3) invokeai/app/api/dependencies.py:283— invokeai/app/api/dependencies.py:283-297 | invokeai/app/services/image_records/image_records_common.py:201-215 | invokeai/backend/pid/_src/networks/pid_net.py:114-128 — 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 `invokeai/app/api/dependencies.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.
Duplicated block (15 lines × 3) invokeai/app/invocations/pid/flux_pid_decode.py:149— invokeai/app/invocations/pid/flux_pid_decode.py:149-163 | invokeai/app/invocations/pid/pid_upscale.py:188-202 | invokeai/app/invocations/pid/z_image_pid_decode.py:162-176 — before extracting anything, compare `invokeai/app/invocations/pid/flux_pid_decode.py` and `invokeai/app/invocations/pid/pid_upscale.py` as WHOLE FILES: this scan already matched 3 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13–14 lines × 3) invokeai/app/invocations/cogview4/cogview4_denoise.py:334— invokeai/app/invocations/cogview4/cogview4_denoise.py:334-347 | invokeai/app/invocations/sd3/sd3_denoise.py:427-439 | invokeai/app/invocations/z_image/z_image_denoise.py:682-694 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.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 7 separate duplicated blocks between them, totalling at least 126 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 `invokeai/app/invocations/cogview4/cogview4_denoise.py:334` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 3) invokeai/app/invocations/flux/flux_lora_loader.py:84— invokeai/app/invocations/flux/flux_lora_loader.py:84-96 | invokeai/app/invocations/model.py:469-482 | invokeai/app/invocations/model.py:632-645 — 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 `invokeai/app/invocations/flux/flux_lora_loader.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 (12–14 lines × 3) invokeai/backend/model_manager/configs/main.py:753— invokeai/backend/model_manager/configs/main.py:753-766 | invokeai/backend/model_manager/configs/main.py:946-959 | invokeai/backend/model_manager/configs/main.py:3861-3872 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–14 lines × 3) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:262— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:262-273 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:274-286 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:206-219 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–14 lines × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:169— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:169-182 | invokeai/backend/patches/lora_conversions/flux_onetrainer_bfl_lora_conversion_utils.py:81-92 — 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 (12–14 lines × 2) invokeai/backend/quantization/gguf/ggml_tensor.py:42— invokeai/backend/quantization/gguf/ggml_tensor.py:42-55 | invokeai/backend/quantization/sdnq/sdnq_tensor.py:59-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 before the matched lines, `invokeai/backend/quantization/sdnq/sdnq_tensor.py:57` calls `isinstance`, `process_tensor` and `invokeai/backend/quantization/gguf/ggml_tensor.py:41` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–13 lines × 2) invokeai/app/api/routers/image_map.py:498— invokeai/app/api/routers/image_map.py:498-508 | invokeai/app/api/routers/image_map.py:1002-1014 — both copies are in the same file, so extract the block into 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–13 lines × 2) invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:317— invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:317-329 | invokeai/backend/model_manager/configs/qwen_vl_encoder.py:286-296 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 5) invokeai/backend/model_manager/configs/base.py:244— invokeai/backend/model_manager/configs/base.py:244-255 | invokeai/backend/model_manager/configs/main.py:4168-4179 | invokeai/backend/model_manager/configs/main.py:4322-4333 | invokeai/backend/model_manager/configs/main.py:4487-4498 | invokeai/backend/model_manager/model_on_disk.py:199-210 — 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. 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 × 5) invokeai/app/services/shared/sqlite_migrator/migrations/migration_22.py:78— invokeai/app/services/shared/sqlite_migrator/migrations/migration_22.py:78-91 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_23.py:184-195 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:228-250 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_25.py:51-63 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py:104-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–12 lines × 2) invokeai/backend/model_manager/configs/main.py:4097— invokeai/backend/model_manager/configs/main.py:4097-4106 | invokeai/backend/model_manager/configs/main.py:4424-4435 — both copies are in the same file, so extract the block into 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–12 lines × 2) invokeai/backend/tiles/tiles.py:281— invokeai/backend/tiles/tiles.py:281-290 | invokeai/backend/tiles/tiles.py:384-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 2) invokeai/app/api/routers/session_queue.py:647— invokeai/app/api/routers/session_queue.py:647-657 | invokeai/app/api/routers/session_queue.py:906-914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 2) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:48— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:48-58 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:30-38 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9–10 lines × 2) invokeai/app/invocations/mask.py:157— invokeai/app/invocations/mask.py:157-166 | invokeai/app/invocations/mask.py:191-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) invokeai/app/invocations/vae/flux2_vae_encode.py:127— invokeai/app/invocations/vae/flux2_vae_encode.py:127-136 | invokeai/app/invocations/vae/flux_vae_encode.py:110-118 — 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 × 4) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:238— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:238-246 | invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:297-304 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:329-337 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:254-263 — 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 matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:590— scripts/calibrate_flux2_denoise_working_memory.py:590-597 | scripts/calibrate_flux3_denoise_working_memory.py:829-836 | scripts/calibrate_vae_tiling_working_memory.py:683-690 | scripts/calibrate_z_image_working_memory.py:523-531 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_z_image_working_memory.py:523` it begins part-way through the construct above it, so those 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, `scripts/calibrate_flux3_denoise_working_memory.py:826` calls `add_argument` and `scripts/calibrate_flux2_denoise_working_memory.py:587` 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 × 6) invokeai/app/invocations/flux3/flux3_denoise.py:299— invokeai/app/invocations/flux3/flux3_denoise.py:299-304 | invokeai/app/invocations/moss_image/moss_image_denoise.py:223-228 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:813-818 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:627-632 | invokeai/app/invocations/text_encoder/krea2_text_encoder.py:212-217 | invokeai/app/invocations/text_encoder/qwen_image_text_encoder.py:445-450 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 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 6 times. Note first that the copies are not typed on the same thing: `Iterator` names `collections.abc` in one and `typing` 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 (6 lines × 6) invokeai/app/invocations/pid/flux2_pid_decode.py:194— invokeai/app/invocations/pid/flux2_pid_decode.py:194-199 | invokeai/app/invocations/pid/flux_pid_decode.py:163-168 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:192-197 | invokeai/app/invocations/pid/sd3_pid_decode.py:157-162 | invokeai/app/invocations/pid/sdxl_pid_decode.py:175-180 | invokeai/app/invocations/pid/z_image_pid_decode.py:183-189 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/pid/flux2_pid_decode.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 (5 lines × 4) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:98— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:98-102 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:160-164 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:91-95 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:153-157 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.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 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (5 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:574— scripts/calibrate_flux2_denoise_working_memory.py:574-578 | scripts/calibrate_krea2_working_memory.py:696-700 | scripts/calibrate_krea2_working_memory.py:711-717 | scripts/calibrate_z_image_working_memory.py:513-518 — 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 `scripts/calibrate_flux2_denoise_working_memory.py:574` it begins part-way through the construct above it, so those 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, `scripts/calibrate_z_image_working_memory.py:520` calls `list` and `scripts/calibrate_krea2_working_memory.py:719` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) invokeai/backend/flux/custom_block_processor.py:42— invokeai/backend/flux/custom_block_processor.py:42-46 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:57-61 | invokeai/backend/flux/modules/layers.py:171-175 — 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 `invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) invokeai/backend/patches/lora_conversions/ernie_image_lora_constants.py:137— invokeai/backend/patches/lora_conversions/ernie_image_lora_constants.py:137-141 | invokeai/backend/patches/lora_conversions/ideogram4_lora_constants.py:100-104 | invokeai/backend/patches/lora_conversions/sd3_lora_constants.py:131-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
P8 · Schema migrations· Schema created by SQLAlchemy create_all() (no migration path) · ×2
Schema created by SQLAlchemy create_all() (no migration path) invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_impl.py:565— SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment.
Schema created by SQLAlchemy create_all() (no migration path) invokeai/app/services/shared/database/copy.py:213— SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment.
Duplication concentrated across 2 sibling directories (7 clone groups) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/StringFieldCollectionInputComponent.tsx:117— 7 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/components/ have copies in at least two of the sibling directories flow, sidePanel — 3 of them are reported below, and 4 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 7 and which does not depend on how exactly each block's copies still match. 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 2 sibling directories (7 clone groups) invokeai/frontend/webv2/scripts/mock-backend.mjs:661— 7 duplicated blocks under invokeai/frontend/webv2/ have copies in at least two of the sibling directories scripts, src — 5 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 7 and which does not depend on how exactly each block's copies still match. 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.
Wholesale file copy (168 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1— invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 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 (168 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1— invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 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 (103 matched lines × 2 locations) · ×2
Duplicated block with local edits (103 matched lines × 2 locations) invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26— invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 · invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25 — the two spans are one implementation copied and then locally edited — 689 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 (103 matched lines × 2 locations) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339— invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339 · invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:640 — the two spans are one implementation copied and then locally edited — 669 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.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×2
Length read from the parsed input is spent without ever being bounded invokeai/backend/quantization/int8_convrot.py:243— `header_len` is read from the bytes being parsed at line 242 (`struct.unpack("<Q")`), then passed as the size of `read` at line 243 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
Length read from the parsed input is spent without ever being bounded invokeai/backend/model_manager/util/model_util.py:25— `definition_len` is read from the bytes being parsed at line 24 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 25 — and nowhere in its function is `definition_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `definition_len` against the bytes actually remaining and a maximum the format allows before reading.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×2
Untrusted text written into markup unescaped invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:465— `label` is text this program did not author, and it is written into the text of an element through `document.write` 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 invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468— `url` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
AC2 · Forms & labels· <SearchInput> field component without a label · ×1
<SearchInput> field component without a label invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:797— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC2 · Forms & labels· <FilterTypeSelect> field component without a label · ×1
<FilterTypeSelect> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:84— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC2 · Forms & labels· <BoardAutoAddSelect> field component without a label · ×1
<BoardAutoAddSelect> field component without a label invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsSettingsPopover.tsx:52— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
Focus outline removed inline invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:393— <video> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×1
Focus outline removed in CSS without a :focus replacement docs/src/styles/custom.css:763— `:is(.sl-link-card, .docs-link-card) a:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
mock-backend.startMockBackend.server (cyclomatic 668) invokeai/frontend/webv2/scripts/mock-backend.mjs:1332— mock-backend.startMockBackend.server has cyclomatic complexity 668 (threshold 15). Of this number, 631 points are the body's own statements and 37 belong to 20 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.
workbenchState.reduceWorkbenchAction (cyclomatic 425) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4738— workbenchState.reduceWorkbenchAction has cyclomatic complexity 425 (threshold 15). Of this number, 230 points are the body's own statements and 195 belong to 74 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.
GalleryImageGrid.GalleryImageGrid (cyclomatic 322) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:445— GalleryImageGrid.GalleryImageGrid has cyclomatic complexity 322 (threshold 15). Of this number, 88 points are the body's own statements and 234 belong to 47 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.
LayersTree.LayersTree (cyclomatic 231) invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:174— LayersTree.LayersTree has cyclomatic complexity 231 (threshold 15). Of this number, 29 points are the body's own statements and 202 belong to 50 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.
modelSelected.addModelSelectedListener (cyclomatic 205) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97— modelSelected.addModelSelectedListener has cyclomatic complexity 205 (threshold 15). Most of this is not in the body itself: 1 of the 205 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 100, 739, 118, …). 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.
WorkflowEditorView.WorkflowFlow (cyclomatic 163) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:326— WorkflowEditorView.WorkflowFlow has cyclomatic complexity 163 (threshold 15). Of this number, 22 points are the body's own statements and 141 belong to 52 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.
GraphExecutionState._validate_effects (cyclomatic 155) invokeai/app/services/shared/graph.py:2565— GraphExecutionState._validate_effects has cyclomatic complexity 155 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useImageActions.useImageActions (cyclomatic 155) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:263— useImageActions.useImageActions has cyclomatic complexity 155 (threshold 15). Most of this is not in the body itself: 1 of the 155 points is its own statement and the rest belongs to 51 function literals inside it that branch (lines 529, 1027, 644, …). 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.
readiness.getReasonsWhyCannotEnqueueCanvasTab (cyclomatic 150) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773— readiness.getReasonsWhyCannotEnqueueCanvasTab has cyclomatic complexity 150 (threshold 15). Of this number, 145 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LayerContextMenu.LayerMenu (cyclomatic 136) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:224— LayerContextMenu.LayerMenu has cyclomatic complexity 136 (threshold 15). Most of this is not in the body itself: 8 of the 136 points are its own statements and the rest belongs to 39 function literals inside it that branch (lines 505, 703, 380, …). 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.
WorkflowLibraryGrid.WorkflowLibraryGrid (cyclomatic 122) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:152— WorkflowLibraryGrid.WorkflowLibraryGrid has cyclomatic complexity 122 (threshold 15). Of this number, 18 points are the body's own statements and 104 belong to 23 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
canvasRecall.prepareCanvasRecall (cyclomatic 121) invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:155— canvasRecall.prepareCanvasRecall has cyclomatic complexity 121 (threshold 15). Of this number, 53 points are the body's own statements and 68 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
setEventListeners.setEventListeners (cyclomatic 112) invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:86— setEventListeners.setEventListeners has cyclomatic complexity 112 (threshold 15). Most of this is not in the body itself: 1 of the 112 points is its own statement and the rest belongs to 39 function items inside it that branch (a function literal at line 594, a function literal at line 836, a function literal at line 719, …). 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.
recallParameters.buildRecallParametersSettings (cyclomatic 112) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:189— recallParameters.buildRecallParametersSettings has cyclomatic complexity 112 (threshold 15). Of this number, 93 points are the body's own statements and 19 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
videoRecall.buildVideoRecallSettings (cyclomatic 103) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:667— videoRecall.buildVideoRecallSettings has cyclomatic complexity 103 (threshold 15). Of this number, 100 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
document.applyProjectGraphAction (cyclomatic 101) invokeai/frontend/webv2/src/features/workflow/core/document.ts:915— document.applyProjectGraphAction has cyclomatic complexity 101 (threshold 15). Of this number, 71 points are the body's own statements and 30 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cyclomatic 101) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:110— WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel has cyclomatic complexity 101 (threshold 15). Of this number, 58 points are the body's own statements and 43 belong to 13 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ScrubberField.ScrubberField (cyclomatic 99) invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:235— ScrubberField.ScrubberField has cyclomatic complexity 99 (threshold 15). Of this number, 18 points are the body's own statements and 81 belong to 28 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.
videoPolicies.getVideoValidationIssues (cyclomatic 98) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2424— videoPolicies.getVideoValidationIssues has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
canvasProjectMutations.applyCanvasProjectMutation (cyclomatic 96) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:796— canvasProjectMutations.applyCanvasProjectMutation has cyclomatic complexity 96 (threshold 15). Of this number, 81 points are the body's own statements and 15 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
queueRunRestoration.normalizeRestoredQueueItem (cyclomatic 94) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:56— queueRunRestoration.normalizeRestoredQueueItem has cyclomatic complexity 94 (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.
GalleryPickerView.GalleryPickerView (cyclomatic 93) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67— GalleryPickerView.GalleryPickerView has cyclomatic complexity 93 (threshold 15). Of this number, 56 points are the body's own statements and 37 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
readiness.getReasonsWhyCannotEnqueueGenerateTab (cyclomatic 90) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357— readiness.getReasonsWhyCannotEnqueueGenerateTab has cyclomatic complexity 90 (threshold 15). Of this number, 89 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
video_smart_concat.try_build_smart_render_plan (cyclomatic 89) invokeai/app/util/video_smart_concat.py:60— video_smart_concat.try_build_smart_render_plan has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createFontRuntime (cyclomatic 89) invokeai/frontend/webv2/src/features/fonts/runtime.ts:263— runtime.createFontRuntime has cyclomatic complexity 89 (threshold 15). Most of this is not in the body itself: 1 of the 89 points is its own statement and the rest belongs to 24 function items inside it that branch (a function literal at line 452, a function literal at line 575, removeState, …). 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.
VideoWidgetView.VideoWidgetView (cyclomatic 89) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:147— VideoWidgetView.VideoWidgetView has cyclomatic complexity 89 (threshold 15). Of this number, 60 points are the body's own statements and 29 belong to 14 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReferenceImageRow.ReferenceImageRowBase (cyclomatic 86) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageRow.tsx:207— ReferenceImageRow.ReferenceImageRowBase has cyclomatic complexity 86 (threshold 15). Of this number, 32 points are the body's own statements and 54 belong to 18 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.
PreviewWidgetView.PreviewWidgetView (cyclomatic 86) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:186— PreviewWidgetView.PreviewWidgetView has cyclomatic complexity 86 (threshold 15). Of this number, 31 points are the body's own statements and 55 belong to 17 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
lora._is_flux2_lora_state_dict (cyclomatic 85) invokeai/backend/model_manager/configs/lora.py:410— lora._is_flux2_lora_state_dict has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
previewMetadata.parsePreviewMetadata (cyclomatic 85) invokeai/frontend/webv2/src/workbench/widgets/preview/previewMetadata.ts:42— previewMetadata.parsePreviewMetadata has cyclomatic complexity 85 (threshold 15). Of this number, 44 points are the body's own statements and 41 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VideoPlayer.VideoPlayer (cyclomatic 84) invokeai/frontend/webv2/src/platform/ui/video-player/VideoPlayer.tsx:703— VideoPlayer.VideoPlayer has cyclomatic complexity 84 (threshold 15). Of this number, 31 points are the body's own statements and 53 belong to 15 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelInstallQueueItem.ModelInstallQueueItem (cyclomatic 81) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:109— ModelInstallQueueItem.ModelInstallQueueItem has cyclomatic complexity 81 (threshold 15). Of this number, 37 points are the body's own statements and 44 belong to 14 function literals inside it that branch. 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.
useGalleryData.useGalleryData (cyclomatic 81) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:280— useGalleryData.useGalleryData has cyclomatic complexity 81 (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.
workflow-demo-client.mountWorkflowDemo (cyclomatic 78) docs/src/lib/components/tour/workflow-demo-client.ts:43— workflow-demo-client.mountWorkflowDemo has cyclomatic complexity 78 (threshold 15). Most of this is not in the body itself: 12 of the 78 points are its own statements and the rest belongs to 19 function items inside it that branch (endConnection, a function literal at line 344, updateEdgePaths, …). 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.
WorkflowLibraryDialog.WorkflowLibraryDialog (cyclomatic 78) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx:280— WorkflowLibraryDialog.WorkflowLibraryDialog has cyclomatic complexity 78 (threshold 15). Of this number, 30 points are the body's own statements and 48 belong to 22 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkflowPublicationHost.WorkflowPublicationHost (cyclomatic 78) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowPublicationHost.tsx:91— WorkflowPublicationHost.WorkflowPublicationHost has cyclomatic complexity 78 (threshold 15). Of this number, 33 points are the body's own statements and 45 belong to 20 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
executeImageRecall.executeImageRecall (cyclomatic 77) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:340— executeImageRecall.executeImageRecall has cyclomatic complexity 77 (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.
GenerateAdvancedFields.GenerateAdvancedFields (cyclomatic 76) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:93— GenerateAdvancedFields.GenerateAdvancedFields has cyclomatic complexity 76 (threshold 15). Of this number, 65 points are the body's own statements and 11 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
canvasHotkeyCommands.executeCanvasHotkeyCommand (cyclomatic 74) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:179— canvasHotkeyCommands.executeCanvasHotkeyCommand has cyclomatic complexity 74 (threshold 15). Of this number, 70 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageMapPlot.ImageMapPlot (cyclomatic 74) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:114— ImageMapPlot.ImageMapPlot has cyclomatic complexity 74 (threshold 15). Most of this is not in the body itself: 5 of the 74 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 447, a function literal at line 393, a function literal at line 198, …). 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.
videoPolicies.getVideoModelSelectionResult (cyclomatic 73) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1966— videoPolicies.getVideoModelSelectionResult has cyclomatic complexity 73 (threshold 15). Of this number, 70 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LayerRow.LayerRowComponent (cyclomatic 73) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:77— LayerRow.LayerRowComponent has cyclomatic complexity 73 (threshold 15). Of this number, 53 points are the body's own statements and 20 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AddModelsView.AddModelsView (cyclomatic 72) invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx:78— AddModelsView.AddModelsView has cyclomatic complexity 72 (threshold 15). Of this number, 30 points are the body's own statements and 42 belong to 17 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.
PreviewFrame.PreviewVideo (cyclomatic 72) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:416— PreviewFrame.PreviewVideo has cyclomatic complexity 72 (threshold 15). Most of this is not in the body itself: 12 of the 72 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 520, 622, 775, …). 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.
FloatingWidgetWindow.FloatingWidgetWindow (cyclomatic 72) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:339— FloatingWidgetWindow.FloatingWidgetWindow has cyclomatic complexity 72 (threshold 15). Of this number, 25 points are the body's own statements and 47 belong to 16 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
validateWorkflow.validateWorkflow (cyclomatic 70) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140— validateWorkflow.validateWorkflow has cyclomatic complexity 70 (threshold 15). Of this number, 69 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowLibraryList.WorkflowLibraryList (cyclomatic 70) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryList.tsx:153— WorkflowLibraryList.WorkflowLibraryList has cyclomatic complexity 70 (threshold 15). Of this number, 32 points are the body's own statements and 38 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CanvasTextOverlay.TextEditor (cyclomatic 69) invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:95— CanvasTextOverlay.TextEditor has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 12 of the 69 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 307, 571, 230, …). 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.
IntermediatesManager.IntermediatesManager (cyclomatic 69) invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.tsx:63— IntermediatesManager.IntermediatesManager has cyclomatic complexity 69 (threshold 15). Of this number, 56 points are the body's own statements and 13 belong to 8 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
legacyCanvasMetadata.rasterizeLegacyObjects (cyclomatic 69) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:198— legacyCanvasMetadata.rasterizeLegacyObjects has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workbenchState.enqueueCompiledSnapshot (cyclomatic 68) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4227— workbenchState.enqueueCompiledSnapshot has cyclomatic complexity 68 (threshold 15). Of this number, 64 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.isVideoSettings (cyclomatic 67) invokeai/frontend/webv2/src/features/video/core/settings.ts:470— settings.isVideoSettings has cyclomatic complexity 67 (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.
AddNodeDialog.AddNodeDialogContent (cyclomatic 67) invokeai/frontend/webv2/src/features/workflow/ui/editor/AddNodeDialog.tsx:375— AddNodeDialog.AddNodeDialogContent has cyclomatic complexity 67 (threshold 15). Of this number, 27 points are the body's own statements and 40 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
imageRecall.buildImageRecallSettings (cyclomatic 67) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1505— imageRecall.buildImageRecallSettings has cyclomatic complexity 67 (threshold 15). Of this number, 66 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InvokeButton.InvokeButton (cyclomatic 66) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:72— InvokeButton.InvokeButton has cyclomatic complexity 66 (threshold 15). Of this number, 34 points are the body's own statements and 32 belong to 17 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
utils.pred_squares (cyclomatic 65) invokeai/backend/image_util/mlsd/utils.py:97— utils.pred_squares has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validateConnection.validateConnection (cyclomatic 65) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnection.ts:202— validateConnection.validateConnection has cyclomatic complexity 65 (threshold 15). Of this number, 59 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useGalleryActions.useGalleryActions (cyclomatic 65) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryActions.ts:38— useGalleryActions.useGalleryActions has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 2 of the 65 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 120, 320, 233, …). 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.
UpscaleWidgetView.UpscaleWidgetView (cyclomatic 65) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:483— UpscaleWidgetView.UpscaleWidgetView has cyclomatic complexity 65 (threshold 15). Of this number, 37 points are the body's own statements and 28 belong to 15 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProjectWorkflowsView.ProjectWorkflowDetailPanel (cyclomatic 65) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:432— ProjectWorkflowsView.ProjectWorkflowDetailPanel has cyclomatic complexity 65 (threshold 15). Of this number, 56 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RegionalGuidanceSettings.RegionalGuidanceSettings (cyclomatic 65) invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx:85— RegionalGuidanceSettings.RegionalGuidanceSettings has cyclomatic complexity 65 (threshold 15). Of this number, 33 points are the body's own statements and 32 belong to 10 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
InputFieldRenderer.InputFieldRenderer (cyclomatic 64) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx:93— InputFieldRenderer.InputFieldRenderer has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
addRegions.addRegions (cyclomatic 64) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addRegions.ts:84— addRegions.addRegions has cyclomatic complexity 64 (threshold 15). 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.
buildFLUXGraph.buildFLUXGraph (cyclomatic 64) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55— buildFLUXGraph.buildFLUXGraph has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (buildFLUXGraph.buildFLUXGraph::addFlux2Features) 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.
utilityGraph.runUtilityGraph (cyclomatic 64) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:612— utilityGraph.runUtilityGraph has cyclomatic complexity 64 (threshold 15). Most of this is not in the body itself: 5 of the 64 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 782, 638, 680, …). 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.
GalleryMediaSlot.GalleryMediaSlot (cyclomatic 63) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx:82— GalleryMediaSlot.GalleryMediaSlot has cyclomatic complexity 63 (threshold 15). Of this number, 47 points are the body's own statements and 16 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
List.List (cyclomatic 62) invokeai/frontend/webv2/src/platform/ui/list/List.tsx:190— List.List has cyclomatic complexity 62 (threshold 15). Of this number, 22 points are the body's own statements and 40 belong to 14 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkingMemorySection.WorkingMemoryBody (cyclomatic 61) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:211— WorkingMemorySection.WorkingMemoryBody has cyclomatic complexity 61 (threshold 15). Of this number, 29 points are the body's own statements and 32 belong to 10 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.
graph.buildLtx2VideoGraph (cyclomatic 61) invokeai/frontend/webv2/src/features/video/core/graph.ts:654— graph.buildLtx2VideoGraph has cyclomatic complexity 61 (threshold 15). Of this number, 59 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GenerationSettingsAccordion.GenerationSettingsAccordion (cyclomatic 60) invokeai/frontend/webv1/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx:62— GenerationSettingsAccordion.GenerationSettingsAccordion has cyclomatic complexity 60 (threshold 15). Of this number, 58 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ListItem.ListItem (cyclomatic 60) invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx:110— ListItem.ListItem has cyclomatic complexity 60 (threshold 15). Of this number, 44 points are the body's own statements and 16 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
executeVideoRecall.applyVideoRecallMetadata (cyclomatic 60) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:303— executeVideoRecall.applyVideoRecallMetadata has cyclomatic complexity 60 (threshold 15). Of this number, 58 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createQueueRuntime.reconcile (cyclomatic 59) invokeai/frontend/webv2/src/features/queue/runtime.ts:2510— runtime.createQueueRuntime.reconcile has cyclomatic complexity 59 (threshold 15). Most of this is not in the body itself: 8 of the 59 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2602, 2555, 2526, …). 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.
GraphPreviewDialog.GraphPreviewDialog (cyclomatic 59) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx:110— GraphPreviewDialog.GraphPreviewDialog has cyclomatic complexity 59 (threshold 15). Of this number, 44 points are the body's own statements and 15 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CanvasWidgetView.CanvasWidgetView (cyclomatic 59) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:110— CanvasWidgetView.CanvasWidgetView has cyclomatic complexity 59 (threshold 15). Of this number, 21 points are the body's own statements and 38 belong to 18 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MergeLayerController.mergeDown (cyclomatic 59) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186— MergeLayerController.mergeDown has cyclomatic complexity 59 (threshold 15). Of this number, 46 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
legacyCanvasMetadata.convertLegacyCanvasMetadata (cyclomatic 59) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:486— legacyCanvasMetadata.convertLegacyCanvasMetadata has cyclomatic complexity 59 (threshold 15). Of this number, 58 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hidiffusion.apply_hidiffusion (cyclomatic 57) invokeai/backend/hidiffusion/hidiffusion.py:1990— hidiffusion.apply_hidiffusion has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.normalizeGenerateSettings (cyclomatic 57) invokeai/frontend/webv2/src/features/generation/core/settings.ts:959— settings.normalizeGenerateSettings 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.
graph_loop_topology._recognize_nested_for_body (cyclomatic 56) invokeai/app/services/shared/graph_loop_topology.py:465— graph_loop_topology._recognize_nested_for_body has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryItemSearch.GalleryItemSearch (cyclomatic 56) invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:66— GalleryItemSearch.GalleryItemSearch has cyclomatic complexity 56 (threshold 15). Of this number, 24 points are the body's own statements and 32 belong to 13 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cyclomatic 56) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2175— baseGenerationPolicies.getSettingsWithCompatibleModelSelections has cyclomatic complexity 56 (threshold 15). Of this number, 41 points are the body's own statements and 15 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
executeRecallParameters.executeRecallParameters (cyclomatic 56) invokeai/frontend/webv2/src/workbench/image-actions/executeRecallParameters.ts:70— executeRecallParameters.executeRecallParameters has cyclomatic complexity 56 (threshold 15). Of this number, 52 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkflowFieldRenderer.WorkflowFieldRenderer (cyclomatic 55) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:50— WorkflowFieldRenderer.WorkflowFieldRenderer has cyclomatic complexity 55 (threshold 15). Of this number, 18 points are the body's own statements and 37 belong to 10 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ReferenceImageCropDialog.ReferenceImageCropDialog (cyclomatic 55) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCropDialog.tsx:212— ReferenceImageCropDialog.ReferenceImageCropDialog has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 7 of the 55 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 459, 389, 403, …). 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.
workflowPreview.buildModel (cyclomatic 55) invokeai/frontend/webv2/src/features/workflow/core/workflowPreview.ts:493— workflowPreview.buildModel has cyclomatic complexity 55 (threshold 15). Of this number, 34 points are the body's own statements and 21 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExtractMaskedAreaController.extract (cyclomatic 55) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122— ExtractMaskedAreaController.extract has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 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.
lora._get_flux2_lora_variant (cyclomatic 54) invokeai/backend/model_manager/configs/lora.py:614— lora._get_flux2_lora_variant 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.
ModelSelect.ModelSelect (cyclomatic 54) invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx:99— ModelSelect.ModelSelect has cyclomatic complexity 54 (threshold 15). Of this number, 45 points are the body's own statements and 9 belong to 8 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
forLoops.validateForLoopGraph (cyclomatic 54) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:268— forLoops.validateForLoopGraph has cyclomatic complexity 54 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph::supportsNestedIterateBody, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
widgetValues.syncVideoWidgetValuesWithModels (cyclomatic 53) invokeai/frontend/webv2/src/features/video/core/widgetValues.ts:43— widgetValues.syncVideoWidgetValuesWithModels has cyclomatic complexity 53 (threshold 15). Of this number, 44 points are the body's own statements and 9 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.
WorkflowDocumentGraph.GraphView (cyclomatic 53) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:1003— WorkflowDocumentGraph.GraphView has cyclomatic complexity 53 (threshold 15). Of this number, 23 points are the body's own statements and 30 belong to 11 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AdvancedSettingsAccordion.AdvancedSettingsAccordion (cyclomatic 52) invokeai/frontend/webv1/src/features/settingsAccordions/components/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx:69— AdvancedSettingsAccordion.AdvancedSettingsAccordion has cyclomatic complexity 52 (threshold 15). Of this number, 37 points are the body's own statements and 15 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
settings.getUpscaleValidationIssues (cyclomatic 52) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1026— settings.getUpscaleValidationIssues has cyclomatic complexity 52 (threshold 15). Of this number, 51 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
batch.planWorkflowBatch (cyclomatic 52) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:682— batch.planWorkflowBatch has cyclomatic complexity 52 (threshold 15). Of this number, 49 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DownloadQueueService._do_download (cyclomatic 51) invokeai/app/services/download/download_default.py:425— DownloadQueueService._do_download has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PreviewFrame.PreviewImageFrame (cyclomatic 51) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:121— PreviewFrame.PreviewImageFrame has cyclomatic complexity 51 (threshold 15). Of this number, 36 points are the body's own statements and 15 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_ExecutionNodeBuilder.prepare (cyclomatic 50) invokeai/app/services/shared/graph_materializer.py:2385— _ExecutionNodeBuilder.prepare has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VideoReferenceListField.VideoReferenceListField (cyclomatic 50) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:363— VideoReferenceListField.VideoReferenceListField has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 14 of the 50 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 539, 557, 469, …). 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.
layerChildRows.layerChildRowCommand (cyclomatic 50) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:540— layerChildRows.layerChildRowCommand has cyclomatic complexity 50 (threshold 15). Of this number, 46 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler (cyclomatic 49) invokeai/app/services/shared/graph.py:1050— GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FontsPage.FontLibrary (cyclomatic 49) invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:297— FontsPage.FontLibrary has cyclomatic complexity 49 (threshold 15). Of this number, 25 points are the body's own statements and 24 belong to 14 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryBoardMenu.BoardDeleteDialog (cyclomatic 49) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:266— GalleryBoardMenu.BoardDeleteDialog has cyclomatic complexity 49 (threshold 15). Of this number, 42 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
libraryBrowseStore.loadWorkflowLibraryWindow (cyclomatic 49) invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:580— libraryBrowseStore.loadWorkflowLibraryWindow has cyclomatic complexity 49 (threshold 15). Of this number, 23 points are the body's own statements and 26 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.
ControlLayerSettings.ControlLayerSettings (cyclomatic 49) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx:94— ControlLayerSettings.ControlLayerSettings has cyclomatic complexity 49 (threshold 15). Of this number, 20 points are the body's own statements and 29 belong to 16 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GraphExecutionState._can_use_generic_for_scheduler (cyclomatic 48) invokeai/app/services/shared/graph.py:1251— GraphExecutionState._can_use_generic_for_scheduler has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useGalleryUploadAction.uploadGalleryFiles (cyclomatic 48) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts:80— useGalleryUploadAction.uploadGalleryFiles has cyclomatic complexity 48 (threshold 15). Of this number, 39 points are the body's own statements and 9 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
draftStore.isProjectDraftCandidate (cyclomatic 48) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:452— draftStore.isProjectDraftCandidate has cyclomatic complexity 48 (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.
compositor.compositeDocument (cyclomatic 48) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:560— compositor.compositeDocument has cyclomatic complexity 48 (threshold 15). Of this number, 31 points are the body's own statements and 17 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProjectConflictBanner.ProjectConflictBanner (cyclomatic 48) invokeai/frontend/webv2/src/workbench/shell/ProjectConflictBanner.tsx:28— ProjectConflictBanner.ProjectConflictBanner has cyclomatic complexity 48 (threshold 15). Of this number, 33 points are the body's own statements and 15 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.normalizeVideoSettings (cyclomatic 47) invokeai/frontend/webv2/src/features/video/core/settings.ts:347— settings.normalizeVideoSettings has cyclomatic complexity 47 (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.
workflow_graph_builder.build_graph_from_workflow (cyclomatic 46) invokeai/app/services/shared/workflow_graph_builder.py:367— workflow_graph_builder.build_graph_from_workflow 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.
useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute (cyclomatic 46) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/useCanvasWorkflowIntegrationExecute.tsx:40— useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute has cyclomatic complexity 46 (threshold 15). Of this number, 35 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Editor.getNextCropBoxByHandleWithAspectRatio (cyclomatic 46) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:746— Editor.getNextCropBoxByHandleWithAspectRatio has cyclomatic complexity 46 (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.
CurrentVideoPreview.CurrentVideoPreview (cyclomatic 46) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:66— CurrentVideoPreview.CurrentVideoPreview has cyclomatic complexity 46 (threshold 15). Of this number, 17 points are the body's own statements and 29 belong to 12 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.
GalleryBoardsPanel.GalleryBoardsPanel (cyclomatic 46) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx:47— GalleryBoardsPanel.GalleryBoardsPanel has cyclomatic complexity 46 (threshold 15). Of this number, 25 points are the body's own statements and 21 belong to 12 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.
templates.parseInvocationSchema (cyclomatic 46) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:331— templates.parseInvocationSchema has cyclomatic complexity 46 (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.
usePreviewNavigation.usePreviewNavigation.navigate (cyclomatic 46) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:705— usePreviewNavigation.usePreviewNavigation.navigate has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 12 of the 46 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 774, stepTo, isCurrentNavigation, …). 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.
useCompareLoupe.useCompareLoupe (cyclomatic 46) invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:64— useCompareLoupe.useCompareLoupe has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 2 of the 46 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 454, 378, 243, …). 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.
layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cyclomatic 46) invokeai/frontend/webv2/src/workbench/canvas-engine/layerRasterizer.ts:138— layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 13 of the 46 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 216, 185). 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.
StatusBar.CompactBottomWidget (cyclomatic 46) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:297— StatusBar.CompactBottomWidget has cyclomatic complexity 46 (threshold 15). Of this number, 33 points are the body's own statements and 13 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
graph_if_dependencies._can_use_fresh_flat_if_activation (cyclomatic 45) invokeai/app/services/shared/graph_if_dependencies.py:195— graph_if_dependencies._can_use_fresh_flat_if_activation 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.
video_smart_concat.encode_rgb_frames (cyclomatic 45) invokeai/app/util/video_smart_concat.py:340— video_smart_concat.encode_rgb_frames 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.
AspectRatioPicker.AspectRatioPicker (cyclomatic 45) invokeai/frontend/webv2/src/features/generation/ui/shared/AspectRatioPicker.tsx:437— AspectRatioPicker.AspectRatioPicker has cyclomatic complexity 45 (threshold 15). Of this number, 22 points are the body's own statements and 23 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BooleanMergeController.merge (cyclomatic 45) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75— BooleanMergeController.merge has cyclomatic complexity 45 (threshold 15). Of this number, 44 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryMaintenance.GalleryMaintenance (cyclomatic 45) invokeai/frontend/webv2/src/workbench/settings/GalleryMaintenance.tsx:79— GalleryMaintenance.GalleryMaintenance has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 13 of the 45 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 154, 230, 105, …). 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.
AnimaDenoiseInvocation._run_diffusion (cyclomatic 44) invokeai/app/invocations/anima/anima_denoise.py:644— AnimaDenoiseInvocation._run_diffusion 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.
WanDenoiseInvocation._run_diffusion (cyclomatic 44) invokeai/app/invocations/wan/wan_denoise.py:426— WanDenoiseInvocation._run_diffusion 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.
GraphExecutionState._can_use_generic_nested_iterate_scheduler (cyclomatic 44) invokeai/app/services/shared/graph.py:1404— GraphExecutionState._can_use_generic_nested_iterate_scheduler has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.dynamicBaseQuery (cyclomatic 44) invokeai/frontend/webv1/src/services/api/index.ts:99— index.dynamicBaseQuery has cyclomatic complexity 44 (threshold 15). Of this number, 42 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MergeLayerController.mergeVisible (cyclomatic 44) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394— MergeLayerController.mergeVisible has cyclomatic complexity 44 (threshold 15). Of this number, 33 points are the body's own statements and 11 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.
strokeSession.createStrokeSession.paint (cyclomatic 44) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/strokeSession.ts:323— strokeSession.createStrokeSession.paint has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ZImageDenoiseInvocation._run_diffusion (cyclomatic 43) invokeai/app/invocations/z_image/z_image_denoise.py:259— ZImageDenoiseInvocation._run_diffusion 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.
PidNet.forward (cyclomatic 43) invokeai/backend/pid/_src/networks/pid_net.py:274— PidNet.forward 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.
CanvasEntityObjectRenderer.renderObject (cyclomatic 43) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityObjectRenderer.ts:348— CanvasEntityObjectRenderer.renderObject 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.
ModelView.ModelView (cyclomatic 43) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx:64— ModelView.ModelView has cyclomatic complexity 43 (threshold 15). Of this number, 34 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
measure-architecture-performance.runSample (cyclomatic 43) invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:317— measure-architecture-performance.runSample has cyclomatic complexity 43 (threshold 15). Of this number, 31 points are the body's own statements and 12 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WildcardsPanel.WildcardsPanel (cyclomatic 43) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx:71— WildcardsPanel.WildcardsPanel has cyclomatic complexity 43 (threshold 15). Of this number, 29 points are the body's own statements and 14 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GeminiProvider.generate (cyclomatic 42) invokeai/app/services/external_generation/providers/gemini.py:29— GeminiProvider.generate has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryThumbnail.GalleryThumbnail (cyclomatic 42) invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx:84— GalleryThumbnail.GalleryThumbnail has cyclomatic complexity 42 (threshold 15). Of this number, 20 points are the body's own statements and 22 belong to 15 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkflowLibraryList.WorkflowLibraryListRow (cyclomatic 42) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryList.tsx:524— WorkflowLibraryList.WorkflowLibraryListRow has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
store.normalizeWorkbenchPreferences (cyclomatic 42) invokeai/frontend/webv2/src/workbench/settings/store.ts:435— store.normalizeWorkbenchPreferences has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
groupSurfaceCache.createGroupSurfaceCache.resolve (cyclomatic 42) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:706— groupSurfaceCache.createGroupSurfaceCache.resolve has cyclomatic complexity 42 (threshold 15). Of this number, 39 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
imageRecall.getImageRecallCapabilities (cyclomatic 42) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1413— imageRecall.getImageRecallCapabilities has cyclomatic complexity 42 (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.
QueueRecoveryNotice.QueueRecoveryNotice (cyclomatic 42) invokeai/frontend/webv2/src/workbench/queue-integration/QueueRecoveryNotice.tsx:34— QueueRecoveryNotice.QueueRecoveryNotice has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 14 of the 42 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 71, 97, 118, …). 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.
working_memory_calibration_fits.model_lines (cyclomatic 41) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:223— working_memory_calibration_fits.model_lines has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parseFieldType.parseFieldType (cyclomatic 41) invokeai/frontend/webv1/src/features/nodes/util/schema/parseFieldType.ts:45— parseFieldType.parseFieldType has cyclomatic complexity 41 (threshold 15). Of this number, 39 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateCollapsibleSection.GenerateCollapsibleSection (cyclomatic 41) invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateCollapsibleSection.tsx:145— GenerateCollapsibleSection.GenerateCollapsibleSection has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 12 of the 41 points are its own statements and the rest belongs to 10 function items inside it that branch (handleKeyDown, handleContextMenu, handleClick, …). 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.
fields.isWorkflowFieldValueValid (cyclomatic 41) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:385— fields.isWorkflowFieldValueValid has cyclomatic complexity 41 (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.
imageRecall.getMetadataExternalProvider (cyclomatic 41) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:732— imageRecall.getMetadataExternalProvider has cyclomatic complexity 41 (threshold 15). Of this number, 28 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InvokeImageBlendInvocation.apply_blend (cyclomatic 40) invokeai/app/invocations/composition-nodes.py:679— InvokeImageBlendInvocation.apply_blend 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.
GraphExecutionState._can_use_generic_serial_nested_for_scheduler (cyclomatic 40) invokeai/app/services/shared/graph.py:1158— GraphExecutionState._can_use_generic_serial_nested_for_scheduler 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.
denoise.denoise (cyclomatic 40) invokeai/backend/flux2/denoise.py:25— denoise.denoise 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.
UserProfile.UserProfile (cyclomatic 40) invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:38— UserProfile.UserProfile has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 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.
ExternalModelSection.ExternalModelSection (cyclomatic 40) invokeai/frontend/webv2/src/features/models/ui/detail/ExternalModelSection.tsx:160— ExternalModelSection.ExternalModelSection has cyclomatic complexity 40 (threshold 15). Of this number, 26 points are the body's own statements and 14 belong to 11 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InvocationFlowNode.ExpandedInvocationNode (cyclomatic 40) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1374— InvocationFlowNode.ExpandedInvocationNode has cyclomatic complexity 40 (threshold 15). Of this number, 39 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LayerMutationController.commitDuplicate (cyclomatic 40) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:206— LayerMutationController.commitDuplicate has cyclomatic complexity 40 (threshold 15). Of this number, 17 points are the body's own statements and 23 belong to 11 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.
bitmapStore.createBitmapStore.flushLayer (cyclomatic 40) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:397— bitmapStore.createBitmapStore.flushLayer has cyclomatic complexity 40 (threshold 15). Of this number, 38 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Flux2DenoiseInvocation._run_diffusion (cyclomatic 39) invokeai/app/invocations/flux2/flux2_denoise.py:229— Flux2DenoiseInvocation._run_diffusion has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
select_hf_files._filter_by_variant (cyclomatic 39) invokeai/backend/model_manager/util/select_hf_files.py:114— select_hf_files._filter_by_variant has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UserManagement.UserFormModal (cyclomatic 39) invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:77— UserManagement.UserFormModal has cyclomatic complexity 39 (threshold 15). Of this number, 22 points are the body's own statements and 17 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.
usePreviewNavigation.usePreviewNavigation (cyclomatic 39) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:205— usePreviewNavigation.usePreviewNavigation has cyclomatic complexity 39 (threshold 15). Of this number, 35 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.
Krea2DenoiseInvocation._run_diffusion (cyclomatic 38) invokeai/app/invocations/krea2/krea2_denoise.py:491— Krea2DenoiseInvocation._run_diffusion has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
QwenImageDenoiseInvocation._run_diffusion (cyclomatic 38) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:311— QwenImageDenoiseInvocation._run_diffusion has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryMaintenanceService._remove_missing_page (cyclomatic 38) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:595— GalleryMaintenanceService._remove_missing_page has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
graph_iterate_planner._get_direct_iterate_collect_nodes (cyclomatic 38) invokeai/app/services/shared/graph_iterate_planner.py:164— graph_iterate_planner._get_direct_iterate_collect_nodes has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
baseGenerationPolicies.getReferenceImageValidationIssues (cyclomatic 38) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2687— baseGenerationPolicies.getReferenceImageValidationIssues has cyclomatic complexity 38 (threshold 15). Of this number, 22 points are the body's own statements and 16 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createQueueRuntime.submitQueueItem (cyclomatic 38) invokeai/frontend/webv2/src/features/queue/runtime.ts:2110— runtime.createQueueRuntime.submitQueueItem has cyclomatic complexity 38 (threshold 15). Of this number, 18 points are the body's own statements and 20 belong to 4 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.
ResizeHandle.ResizeHandle (cyclomatic 38) invokeai/frontend/webv2/src/platform/ui/ResizeHandle.tsx:197— ResizeHandle.ResizeHandle has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 4 of the 38 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 299, 224, 277, …). 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.
MergeLayerController.mergeSelectedInto (cyclomatic 38) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:628— MergeLayerController.mergeSelectedInto has cyclomatic complexity 38 (threshold 15). Of this number, 34 points are the body's own statements and 4 belong to 4 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.
paintTool.resolveTarget (cyclomatic 38) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:133— paintTool.resolveTarget has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useProjectActions.useProjectActions (cyclomatic 38) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts:56— useProjectActions.useProjectActions has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 1 of the 38 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 73, 190, 239, …). 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.
GraphExecutionState._rehydrate_generic_runtime_state (cyclomatic 37) invokeai/app/services/shared/graph.py:3771— GraphExecutionState._rehydrate_generic_runtime_state has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
aac_splice._read_audio_track (cyclomatic 37) invokeai/app/util/aac_splice.py:145— aac_splice._read_audio_track has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LoRALoader._load_model (cyclomatic 37) invokeai/backend/model_manager/load/model_loaders/lora.py:133— LoRALoader._load_model has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UseDefaultSettingsButton.UseDefaultSettingsButton (cyclomatic 37) invokeai/frontend/webv1/src/features/parameters/components/MainModel/UseDefaultSettingsButton.tsx:24— UseDefaultSettingsButton.UseDefaultSettingsButton has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 3 of the 37 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 62, 51, 56, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GalleryBoardMenu.GalleryBoardMenu (cyclomatic 37) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:47— GalleryBoardMenu.GalleryBoardMenu has cyclomatic complexity 37 (threshold 15). Of this number, 25 points are the body's own statements and 12 belong to 9 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.
compileCanvasGraph.getCanvasValidationReasons (cyclomatic 37) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:123— compileCanvasGraph.getCanvasValidationReasons has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createQueueItemBackendSubmission (cyclomatic 37) invokeai/frontend/webv2/src/features/queue/runtime.ts:276— runtime.createQueueItemBackendSubmission has cyclomatic complexity 37 (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.
VideoReferenceListField.ReferenceCard (cyclomatic 37) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:82— VideoReferenceListField.ReferenceCard has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 15 of the 37 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 216, 132, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
validation.isValidLoopLinkageConnection (cyclomatic 37) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:370— validation.isValidLoopLinkageConnection has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cyclomatic 37) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryThumbnail.tsx:94— WorkflowLibraryThumbnail.WorkflowLibraryThumbnail has cyclomatic complexity 37 (threshold 15). Of this number, 25 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RasterExportController.rasterize (cyclomatic 37) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts:167— RasterExportController.rasterize has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
createCanvasEngine.createCanvasEngine (cyclomatic 37) invokeai/frontend/webv2/src/workbench/canvas-operations/createCanvasEngine.ts:81— createCanvasEngine.createCanvasEngine has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 3 of the 37 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 161, resolveUploadProjectId, uploadImage, …). 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.
graph_if_runtime._get_if_iteration_paths_with_ancestry (cyclomatic 36) invokeai/app/services/shared/graph_if_runtime.py:393— graph_if_runtime._get_if_iteration_paths_with_ancestry has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProtectedRoute.ProtectedRoute (cyclomatic 36) invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:21— ProtectedRoute.ProtectedRoute has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 11 of the 36 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 114, 100, 42, …). 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.
ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cyclomatic 36) invokeai/frontend/webv2/src/workbench/widgets/canvas/ControlLayerCanvasOverlay.tsx:74— ControlLayerCanvasOverlay.SelectedControlLayerOverlay has cyclomatic complexity 36 (threshold 15). Of this number, 30 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LayerChildRow.LayerChildRowComponent (cyclomatic 36) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:92— LayerChildRow.LayerChildRowComponent has cyclomatic complexity 36 (threshold 15). Of this number, 17 points are the body's own statements and 19 belong to 8 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cyclomatic 36) invokeai/frontend/webv2/src/workbench/canvas-engine/rasterSnapshotCapture.ts:85— rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
unloadJournal.scenarios.testUnloadJournalScenarios (cyclomatic 36) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:189— unloadJournal.scenarios.testUnloadJournalScenarios has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 19 function literals inside it that branch (lines 1239, 629, 1185, …). 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.
CanvasEntityBufferObjectRenderer.renderBufferObject (cyclomatic 35) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityBufferObjectRenderer.ts:115— CanvasEntityBufferObjectRenderer.renderBufferObject 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.
modelSettingsIO.validateImportData (cyclomatic 35) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:100— modelSettingsIO.validateImportData 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.
buildNodesGraph.buildNodesGraph (cyclomatic 35) invokeai/frontend/webv1/src/features/nodes/util/graph/buildNodesGraph.ts:48— buildNodesGraph.buildNodesGraph has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 130, 68, 211, …). 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.
ModelEditForm.ModelEditForm (cyclomatic 35) invokeai/frontend/webv2/src/features/models/ui/detail/ModelEditForm.tsx:73— ModelEditForm.ModelEditForm has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 163, 135, 104, …). 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.
WorkflowWidgetChrome.WorkflowDialogHost (cyclomatic 35) invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx:839— WorkflowWidgetChrome.WorkflowDialogHost has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 925, 1023, 878, …). 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.
indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy (cyclomatic 35) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:991— indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 1025). 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.
canvasProjectMutations.patchLayerConfig (cyclomatic 35) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:630— canvasProjectMutations.patchLayerConfig 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.
OverviewPane.ConnectedOverview (cyclomatic 35) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/OverviewPane.tsx:79— OverviewPane.ConnectedOverview has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 268, 91, 148, …). 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.
PsdExportController.export (cyclomatic 35) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:130— PsdExportController.export has cyclomatic complexity 35 (threshold 15). Of this number, 22 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mediaUsageReport.buildReport (cyclomatic 35) invokeai/frontend/webv2/src/workbench/image-actions/mediaUsageReport.ts:351— mediaUsageReport.buildReport has cyclomatic complexity 35 (threshold 15). Of this number, 23 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChildExecutionCapability.create_dependency (cyclomatic 34) invokeai/app/services/shared/execution_engine/child.py:305— ChildExecutionCapability.create_dependency has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PixDiT_T2I.forward (cyclomatic 34) invokeai/backend/pid/_src/networks/pixeldit_official.py:1412— PixDiT_T2I.forward has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StagingAreaApi.onItemsChangedEvent (cyclomatic 34) invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:460— StagingAreaApi.onItemsChangedEvent has cyclomatic complexity 34 (threshold 15). Of this number, 32 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultSettingsSection.DefaultSettingsSection (cyclomatic 34) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:163— DefaultSettingsSection.DefaultSettingsSection has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 319, a function literal at line 191, retrySchedulerRules, …). 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.
runtime.createQueueRuntime.handleUnadoptedRerunSettled (cyclomatic 34) invokeai/frontend/webv2/src/features/queue/runtime.ts:2002— runtime.createQueueRuntime.handleUnadoptedRerunSettled has cyclomatic complexity 34 (threshold 15). Of this number, 16 points are the body's own statements and 18 belong to 6 function items inside it that branch. To reduce it, split the body: 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.
CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile (cyclomatic 34) invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.tsx:175— CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NodeFieldControl.NodeFieldControl (cyclomatic 34) invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx:62— NodeFieldControl.NodeFieldControl has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 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.
HsvWheelPicker.HsvWheelPicker (cyclomatic 34) invokeai/frontend/webv2/src/platform/ui/HsvWheelPicker.tsx:38— HsvWheelPicker.HsvWheelPicker has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 7 of the 34 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 62, 171, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
layerPanelRows.navigateTree (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:202— layerPanelRows.navigateTree has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RunLayerWorkflowDialog.RunLayerWorkflowDialog (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx:198— RunLayerWorkflowDialog.RunLayerWorkflowDialog has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 13 of the 34 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 354, 320, 255, …). 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.
imageRecall.getFamilyTuning (cyclomatic 34) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:563— imageRecall.getFamilyTuning has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
imageRecall.getMetadataReferenceEntries (cyclomatic 34) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1202— imageRecall.getMetadataReferenceEntries has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 12 of the 34 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1232, 1216). 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.
projectFile.importProjectFile (cyclomatic 34) invokeai/frontend/webv2/src/workbench/projects/projectFile.ts:283— projectFile.importProjectFile has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
WorkbenchShell.WorkbenchShell (cyclomatic 34) invokeai/frontend/webv2/src/workbench/shell/WorkbenchShell.tsx:66— WorkbenchShell.WorkbenchShell has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 10 of the 34 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 222, 148, 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.
QwenImage21DenoiseInvocation._run_diffusion (cyclomatic 33) invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:321— QwenImage21DenoiseInvocation._run_diffusion has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenAIProvider.generate (cyclomatic 33) invokeai/app/services/external_generation/providers/openai.py:31— OpenAIProvider.generate 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.
SeedreamProvider.generate (cyclomatic 33) invokeai/app/services/external_generation/providers/seedream.py:39— SeedreamProvider.generate 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.
working_memory_calibration_plan.build_plan (cyclomatic 33) invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py:570— working_memory_calibration_plan.build_plan has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
denoise.denoise (cyclomatic 33) invokeai/backend/flux/denoise.py:26— denoise.denoise 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.
ControlNetModel.__init__ (cyclomatic 33) invokeai/backend/util/hotfixes.py:109— ControlNetModel.__init__ has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ToolWidthPicker.ToolWidthPicker (cyclomatic 33) invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:223— ToolWidthPicker.ToolWidthPicker has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 388, 314, 233, …). 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.
browser-validation.waitForRenderedMedia (cyclomatic 33) invokeai/frontend/webv2/scripts/browser-validation.mjs:156— browser-validation.waitForRenderedMedia has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 189, 164, 230, …). 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.
mock-working-memory.createWorkingMemoryMock.calibrate (cyclomatic 33) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:710— mock-working-memory.createWorkingMemoryMock.calibrate has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
galleryBoardGroups.getGalleryBoardGroups (cyclomatic 33) invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts:61— galleryBoardGroups.getGalleryBoardGroups has cyclomatic complexity 33 (threshold 15). Of this number, 18 points are the body's own statements and 15 belong to 9 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.
GenerateReferenceImagesSection.GenerateReferenceImagesContent (cyclomatic 33) invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx:84— GenerateReferenceImagesSection.GenerateReferenceImagesContent has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 13 function items inside it that branch (addGalleryImages, a function literal at line 295, a function literal at line 341, …). 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.
settings.normalizeUpscaleWidgetValues (cyclomatic 33) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:811— settings.normalizeUpscaleWidgetValues has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
buildGraph.getProjectGraphReadiness (cyclomatic 33) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:130— buildGraph.getProjectGraphReadiness 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.
InvocationFlowNode.InputFieldRow (cyclomatic 33) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:807— InvocationFlowNode.InputFieldRow has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
outputImages.visitOutputImageNames (cyclomatic 33) invokeai/frontend/webv2/src/platform/core/outputImages.ts:10— outputImages.visitOutputImageNames has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (visitWorkflowReturnValue, visitImageField, visitImageCollection, …). 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.
LayerGroupContextMenu.LayerGroupContextMenu (cyclomatic 33) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:73— LayerGroupContextMenu.LayerGroupContextMenu has cyclomatic complexity 33 (threshold 15). Of this number, 21 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FilterResultController.commit (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:66— FilterResultController.commit has cyclomatic complexity 33 (threshold 15). Of this number, 30 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
maskOutline.traceMaskOutlinePath (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/maskOutline.ts:22— maskOutline.traceMaskOutlinePath has cyclomatic complexity 33 (threshold 15). Of this number, 23 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
selectObjectSession.createSelectObjectSession.runRequest (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:328— selectObjectSession.createSelectObjectSession.runRequest has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 339, 401). 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.
generationComposite.composeForGeneration (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-operations/generationComposite.ts:144— generationComposite.composeForGeneration has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
revealGalleryItem.revealGalleryItem (cyclomatic 33) invokeai/frontend/webv2/src/workbench/image-actions/revealGalleryItem.ts:54— revealGalleryItem.revealGalleryItem has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 70, isCurrent). 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.
TextOptions.TextFontSettings (cyclomatic 33) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:566— TextOptions.TextFontSettings has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 7 of the 33 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 637, 680, 705, …). 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.
InvokeAdjustImageHuePlusInvocation.invoke (cyclomatic 32) invokeai/app/invocations/composition-nodes.py:85— InvokeAdjustImageHuePlusInvocation.invoke 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.
WanModelLoaderInvocation.invoke (cyclomatic 32) invokeai/app/invocations/wan/wan_model_loader.py:125— WanModelLoaderInvocation.invoke 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.
WanVideoDenoiseInvocation._run_diffusion (cyclomatic 32) invokeai/app/invocations/wan/wan_video_denoise.py:172— WanVideoDenoiseInvocation._run_diffusion 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.
Qwen3EncoderCheckpointLoader._load_from_singlefile (cyclomatic 32) invokeai/backend/model_manager/load/model_loaders/z_image.py:1112— Qwen3EncoderCheckpointLoader._load_from_singlefile 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.
moss_image_lora_constants.read_moss_image_lora_keys (cyclomatic 32) invokeai/backend/patches/lora_conversions/moss_image_lora_constants.py:236— moss_image_lora_constants.read_moss_image_lora_keys 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.
validators.getRegionalGuidanceWarnings (cyclomatic 32) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:37— validators.getRegionalGuidanceWarnings has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AddNodeCmdk.NodeCommandList (cyclomatic 32) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:386— AddNodeCmdk.NodeCommandList has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 426, 514, 486, …). 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.
QueueItemRow.QueueItemRow (cyclomatic 32) invokeai/frontend/webv2/src/features/queue/ui/QueueItemRow.tsx:32— QueueItemRow.QueueItemRow has cyclomatic complexity 32 (threshold 15). Of this number, 27 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GraphPreviewMoreMenu.GraphPreviewMoreMenu (cyclomatic 32) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewMoreMenu.tsx:133— GraphPreviewMoreMenu.GraphPreviewMoreMenu has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 7 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 183, 238, 274, …). 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.
Picker.Picker (cyclomatic 32) invokeai/frontend/webv2/src/platform/ui/Picker.tsx:125— Picker.Picker has cyclomatic complexity 32 (threshold 15). Of this number, 16 points are the body's own statements and 16 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal (cyclomatic 32) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:784— indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal has cyclomatic complexity 32 (threshold 15). Of this number, 16 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
indexedDbDraftStore.createIndexedDbProjectDraftStore.stage (cyclomatic 32) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1275— indexedDbDraftStore.createIndexedDbProjectDraftStore.stage 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.
ControlDerivationController.commitControlMap (cyclomatic 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:198— ControlDerivationController.commitControlMap has cyclomatic complexity 32 (threshold 15). Of this number, 20 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GeneratedResultController.commit (cyclomatic 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:56— GeneratedResultController.commit has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FluxDenoiseInvocation._run_diffusion (cyclomatic 31) invokeai/app/invocations/flux/flux_denoise.py:220— FluxDenoiseInvocation._run_diffusion has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
h264_splice._read_video_stbl (cyclomatic 31) invokeai/app/util/h264_splice.py:344— h264_splice._read_video_stbl has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AdministratorSetup.AdministratorSetup (cyclomatic 31) invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26— AdministratorSetup.AdministratorSetup has cyclomatic complexity 31 (threshold 15). Of this number, 24 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelInstallQueue.ModelInstallQueue (cyclomatic 31) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueue.tsx:75— ModelInstallQueue.ModelInstallQueue has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 11 of the 31 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 90, 127, 137, …). 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.
validateConnectionTypes.validateConnectionTypes (cyclomatic 31) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnectionTypes.ts:10— validateConnectionTypes.validateConnectionTypes has cyclomatic complexity 31 (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.
AspectRatioPicker.PresetForm (cyclomatic 31) invokeai/frontend/webv2/src/features/generation/ui/shared/AspectRatioPicker.tsx:172— AspectRatioPicker.PresetForm has cyclomatic complexity 31 (threshold 15). Of this number, 21 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validation.validateConnection (cyclomatic 31) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:511— validation.validateConnection has cyclomatic complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
layerTreeDrop.projectLayerDrop (cyclomatic 31) invokeai/frontend/webv2/src/workbench/widgets/layers/layerTreeDrop.ts:52— layerTreeDrop.projectLayerDrop 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.
LayerFilterControls.FilterParamField (cyclomatic 31) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterControls.tsx:143— LayerFilterControls.FilterParamField has cyclomatic complexity 31 (threshold 15). Of this number, 24 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelInstallService._enqueue_remote_download (cyclomatic 30) invokeai/app/services/model_install/model_install_default.py:2184— ModelInstallService._enqueue_remote_download 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.
promptAttention.groupTerminals (cyclomatic 30) invokeai/frontend/webv1/src/common/util/promptAttention.ts:463— promptAttention.groupTerminals has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CanvasToolModule.onKeyDown (cyclomatic 30) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:796— CanvasToolModule.onKeyDown 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.
run-project-file-journey.executeProjectFileJourney (cyclomatic 30) REDACTED:1170— run-project-file-journey.executeProjectFileJourney has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 9 function items inside it that branch (stopPreview, a function literal at line 1307, a function literal at line 1375, …). 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.
dependencyPolicy.checkDependency (cyclomatic 30) invokeai/frontend/webv2/src/architecture/dependencyPolicy.ts:227— dependencyPolicy.checkDependency has cyclomatic complexity 30 (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.
queries.ensureLifecycle (cyclomatic 30) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:424— queries.ensureLifecycle has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 491, a function literal at line 446, pruneListing, …). 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.
GalleryBoardRow.GalleryBoardRow (cyclomatic 30) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx:42— GalleryBoardRow.GalleryBoardRow has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 8 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useGalleryGridHotkeys.useGalleryGridHotkeys (cyclomatic 30) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridHotkeys.ts:73— useGalleryGridHotkeys.useGalleryGridHotkeys 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 6 function items inside it that branch (a function literal at line 205, a function literal at line 137, getRangeAnchorKey, …). 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.
baseGenerationPolicies.getBaseComponentSectionPolicy (cyclomatic 30) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1201— baseGenerationPolicies.getBaseComponentSectionPolicy has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
graph.buildMiniMaxH3VideoGraph (cyclomatic 30) invokeai/frontend/webv2/src/features/video/core/graph.ts:438— graph.buildMiniMaxH3VideoGraph has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
validation.validateConnectionTypes (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:40— validation.validateConnectionTypes has cyclomatic complexity 30 (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.
callSavedWorkflow.syncCallSavedWorkflowFields (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts:220— callSavedWorkflow.syncCallSavedWorkflowFields has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
graphToDocument.previewGraphToDocument (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/graphToDocument.ts:37— graphToDocument.previewGraphToDocument 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.
FileFieldInput.FileFieldInput (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/ui/fields/FileFieldInput.tsx:35— FileFieldInput.FileFieldInput has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 10 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 60, 152, 166, …). 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.
draftStore.isProjectDraftWriterClaim (cyclomatic 30) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:559— draftStore.isProjectDraftWriterClaim has cyclomatic complexity 30 (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.
indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt (cyclomatic 30) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:557— indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt 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 one function literal inside it that branches (line 559). 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.
invocation.resolveInvocationRouteInput (cyclomatic 30) invokeai/frontend/webv2/src/workbench/invocation.ts:385— invocation.resolveInvocationRouteInput 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.
PixelEditController.begin (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:130— PixelEditController.begin has cyclomatic complexity 30 (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.
TransformEditingController.apply (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/transformEditingController.ts:267— TransformEditingController.apply has cyclomatic complexity 30 (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.
executeQueueItemRecall.executeQueueItemRecall (cyclomatic 30) invokeai/frontend/webv2/src/workbench/queue-integration/executeQueueItemRecall.ts:37— executeQueueItemRecall.executeQueueItemRecall has cyclomatic complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
controlPanelModel.deriveModel (cyclomatic 30) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:233— controlPanelModel.deriveModel has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelInstallService._install_path_with_info_claimed (cyclomatic 29) invokeai/app/services/model_install/model_install_default.py:1008— ModelInstallService._install_path_with_info_claimed has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_ExecutionNodeBuilder._create_nested_iterate_body_iteration (cyclomatic 29) invokeai/app/services/shared/graph_materializer.py:1017— _ExecutionNodeBuilder._create_nested_iterate_body_iteration has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph._is_for_connection_valid (cyclomatic 29) invokeai/app/services/shared/graph_validation.py:1414— Graph._is_for_connection_valid has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TextToolOptions.FontSelect (cyclomatic 29) invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:97— TextToolOptions.FontSelect has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 14 function literals inside it that branch (lines 123, 265, 137, …). 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.
buildGraph.compileProjectGraph (cyclomatic 29) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:327— buildGraph.compileProjectGraph has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowLibraryPreviewStage.WorkflowLibraryPreviewStage (cyclomatic 29) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryPreviewStage.tsx:89— WorkflowLibraryPreviewStage.WorkflowLibraryPreviewStage has cyclomatic complexity 29 (threshold 15). Of this number, 18 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowFieldInput.SavedWorkflowInput (cyclomatic 29) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1718— WorkflowFieldInput.SavedWorkflowInput has cyclomatic complexity 29 (threshold 15). Of this number, 19 points are the body's own statements and 10 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useLayerStackActions.useLayerStackActions (cyclomatic 29) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerStackActions.ts:48— useLayerStackActions.useLayerStackActions has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 81, 130, 71, …). 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.
CropLayerController.crop (cyclomatic 29) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:175— CropLayerController.crop has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
shapeTool.createShapeTool.commitPixels (cyclomatic 29) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:259— shapeTool.createShapeTool.commitPixels has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
imageRecall.readMetadataReferenceImages (cyclomatic 29) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1286— imageRecall.readMetadataReferenceImages has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 4 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 1298). 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.
ImageStorageSettings.ImageStorageEditor (cyclomatic 29) invokeai/frontend/webv2/src/workbench/settings/ImageStorageSettings.tsx:106— ImageStorageSettings.ImageStorageEditor has cyclomatic complexity 29 (threshold 15). Of this number, 16 points are the body's own statements and 13 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LTX2DenoiseInvocation.invoke (cyclomatic 28) invokeai/app/invocations/ltx2/ltx2_denoise.py:398— LTX2DenoiseInvocation.invoke has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiniMaxH3DenoiseInvocation.invoke (cyclomatic 28) invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:319— MiniMaxH3DenoiseInvocation.invoke has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ExtractVideoRangeInvocation.invoke (cyclomatic 28) invokeai/app/invocations/video_frame_extract_range.py:187— ExtractVideoRangeInvocation.invoke has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GraphExecutionState._record_effect_streams (cyclomatic 28) invokeai/app/services/shared/graph.py:1698— GraphExecutionState._record_effect_streams 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.
GraphExecutionState.apply (cyclomatic 28) invokeai/app/services/shared/graph.py:3153— GraphExecutionState.apply 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.
graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect (cyclomatic 28) invokeai/app/services/shared/graph_if_dependencies.py:30— graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Flux2CheckpointModel._load_from_singlefile (cyclomatic 28) invokeai/backend/model_manager/load/model_loaders/flux.py:1283— Flux2CheckpointModel._load_from_singlefile 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.
Qwen3EncoderGGUFLoader._load_from_gguf (cyclomatic 28) invokeai/backend/model_manager/load/model_loaders/z_image.py:1419— Qwen3EncoderGGUFLoader._load_from_gguf 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.
hidiffusion_utils.hidiffusion_patch (cyclomatic 28) invokeai/backend/stable_diffusion/hidiffusion_utils.py:11— hidiffusion_utils.hidiffusion_patch 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.
ControlNetModel.forward (cyclomatic 28) invokeai/backend/util/hotfixes.py:570— ControlNetModel.forward 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.
DeleteBoardModal.DeleteBoardModal (cyclomatic 28) invokeai/frontend/webv1/src/features/gallery/components/Boards/DeleteBoardModal.tsx:43— DeleteBoardModal.DeleteBoardModal has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 105, 123, 154, …). 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.
buildQwenImageGraph.buildQwenImageGraph (cyclomatic 28) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:87— buildQwenImageGraph.buildQwenImageGraph has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryPickerGrid.GalleryPickerGrid (cyclomatic 28) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerGrid.tsx:198— GalleryPickerGrid.GalleryPickerGrid has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 392, 287, 328, …). 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.
controlValidation.getControlValidationReason (cyclomatic 28) invokeai/frontend/webv2/src/features/generation/core/canvas/controlValidation.ts:113— controlValidation.getControlValidationReason has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GeneratePresetsPopover.GeneratePresetsPopover (cyclomatic 28) invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx:174— GeneratePresetsPopover.GeneratePresetsPopover has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 303, 242, 204, …). 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.
holdLease.startIntermediatesHoldLease (cyclomatic 28) invokeai/frontend/webv2/src/features/intermediates/holdLease.ts:32— holdLease.startIntermediatesHoldLease has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 9 function items inside it that branch (sendOnce, bodyFor, send, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
modelSettingsIO.validateImportData (cyclomatic 28) invokeai/frontend/webv2/src/features/models/core/modelSettingsIO.ts:78— modelSettingsIO.validateImportData 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.
workingMemory.deriveCalibrationProgress (cyclomatic 28) invokeai/frontend/webv2/src/features/models/core/workingMemory.ts:300— workingMemory.deriveCalibrationProgress has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
coordinator.createQueueCoordinator.reconcile (cyclomatic 28) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1093— coordinator.createQueueCoordinator.reconcile has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.syncUpscaleWidgetValuesWithModels (cyclomatic 28) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:887— settings.syncUpscaleWidgetValuesWithModels has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: 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.
VideoPlayer.Scrubber (cyclomatic 28) invokeai/frontend/webv2/src/platform/ui/video-player/VideoPlayer.tsx:300— VideoPlayer.Scrubber has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 385, 373, 338, …). 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.
CropLayerController.cropAll (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:282— CropLayerController.cropAll has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
documentIndex.deriveIndexForValueEdit (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:292— documentIndex.deriveIndexForValueEdit has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rasterComposite.renderRasterComposite (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterComposite.ts:457— rasterComposite.renderRasterComposite has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 6 function items inside it that branch (drawLayer, renderRange, drawSpatialScope, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
paletteQueryModel.derivePaletteQueryModel (cyclomatic 28) invokeai/frontend/webv2/src/workbench/palette/paletteQueryModel.ts:31— paletteQueryModel.derivePaletteQueryModel has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Flux3DenoiseInvocation._run_diffusion (cyclomatic 27) invokeai/app/invocations/flux3/flux3_denoise.py:113— Flux3DenoiseInvocation._run_diffusion has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChildDependencyRecord._validate_relationship (cyclomatic 27) invokeai/app/services/shared/execution_engine/child.py:467— ChildDependencyRecord._validate_relationship has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
graph_loop_topology._recognize_nested_iterate_sequence (cyclomatic 27) invokeai/app/services/shared/graph_loop_topology.py:370— graph_loop_topology._recognize_nested_iterate_sequence 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.
_ExecutionNodeBuilder._create_nested_for_body_iteration (cyclomatic 27) invokeai/app/services/shared/graph_materializer.py:894— _ExecutionNodeBuilder._create_nested_for_body_iteration 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.
color.restore_lightness (cyclomatic 27) invokeai/backend/image_util/color.py:70— color.restore_lightness 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.
ModelCache.put (cyclomatic 27) invokeai/backend/model_manager/load/model_cache/model_cache.py:902— ModelCache.put has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
loaders.sdnq_sd_loader (cyclomatic 27) invokeai/backend/quantization/sdnq/loaders.py:195— loaders.sdnq_sd_loader 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.
setDefaultSettings.addSetDefaultSettingsListener (cyclomatic 27) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/setDefaultSettings.ts:34— setDefaultSettings.addSetDefaultSettingsListener has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to one function literal inside it that branches (line 37). 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.
CurrentImagePreview.CurrentImagePreview (cyclomatic 27) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentImagePreview.tsx:30— CurrentImagePreview.CurrentImagePreview has cyclomatic complexity 27 (threshold 15). Of this number, 15 points are the body's own statements and 12 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.
connectorTopology.getConnectorDeletionSpliceConnections (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/store/util/connectorTopology.ts:108— connectorTopology.getConnectorDeletionSpliceConnections has cyclomatic complexity 27 (threshold 15). Of this number, 18 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
buildSDXLGraph.buildSDXLGraph (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:41— buildSDXLGraph.buildSDXLGraph has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
buildZImageGraph.buildZImageGraph (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:49— buildZImageGraph.buildZImageGraph has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
settings.syncGenerateWidgetValuesWithModels (cyclomatic 27) invokeai/frontend/webv2/src/features/generation/core/settings.ts:808— settings.syncGenerateWidgetValuesWithModels has cyclomatic complexity 27 (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.
InstallJobRow.InstallJobRow (cyclomatic 27) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallJobRow.tsx:61— InstallJobRow.InstallJobRow has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runtime.createQueueRuntime.synchronizeRunPersistence (cyclomatic 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:2291— runtime.createQueueRuntime.synchronizeRunPersistence 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.
runtime.createQueueRuntime.initialize (cyclomatic 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:2807— runtime.createQueueRuntime.initialize has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 5 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (initializeProjects, a function literal at line 2853, a function literal at line 2872). 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.
deliveryClaims.createDeliveryConfirmations.recover (cyclomatic 27) invokeai/frontend/webv2/src/features/queue/runtime/deliveryClaims.ts:180— deliveryClaims.createDeliveryConfirmations.recover has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 204, 208, 260). 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.
templates.parseFieldType (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:71— templates.parseFieldType has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GeneratorFieldInput.GeneratorFieldInput (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/ui/fields/GeneratorFieldInput.tsx:396— GeneratorFieldInput.GeneratorFieldInput has cyclomatic complexity 27 (threshold 15). Of this number, 20 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkflowFieldInput.VideoFrameIndexInput (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1257— WorkflowFieldInput.VideoFrameIndexInput has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowFieldInput.WorkflowFieldInput (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1858— WorkflowFieldInput.WorkflowFieldInput has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SettingControl.SettingControl (cyclomatic 27) invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx:29— SettingControl.SettingControl has cyclomatic complexity 27 (threshold 15). Of this number, 23 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy (cyclomatic 27) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1355— draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy 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.
restoreProjectMedia.restoreProjectMedia (cyclomatic 27) invokeai/frontend/webv2/src/workbench/projects/invk/restoreProjectMedia.ts:204— restoreProjectMedia.restoreProjectMedia has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ToolStripFlyout.ToolFamilyButton (cyclomatic 27) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:49— ToolStripFlyout.ToolFamilyButton has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 118, 148, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SelectionPixelController.edit (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:199— SelectionPixelController.edit has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StagedResultController.commit (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:78— StagedResultController.commit has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pointerPipeline.createPointerPipeline.onKeyDown (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:425— pointerPipeline.createPointerPipeline.onKeyDown 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.
groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:566— groupSurfaceCache.createGroupSurfaceCache.damagedRegion 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.
firstPartyCommands.useRegisterFirstPartyCommands (cyclomatic 27) invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts:115— firstPartyCommands.useRegisterFirstPartyCommands has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 12 function items inside it that branch (recallSelectedImage, a function literal at line 311, loadSelectedItemWorkflow, …). 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.
PreferencesPage.PreferencesPage (cyclomatic 27) invokeai/frontend/webv2/src/workbench/settings/PreferencesPage.tsx:30— PreferencesPage.PreferencesPage has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
recall_parameters.update_recall_parameters (cyclomatic 26) invokeai/app/api/routers/recall_parameters.py:380— recall_parameters.update_recall_parameters 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.
ModelInstallService._restore_incomplete_installs (cyclomatic 26) invokeai/app/services/model_install/model_install_default.py:337— ModelInstallService._restore_incomplete_installs 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.
graph_iterate_planner._get_body_iterate_collect_fan_in (cyclomatic 26) invokeai/app/services/shared/graph_iterate_planner.py:80— graph_iterate_planner._get_body_iterate_collect_fan_in 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.
graph_loop_topology._recognize_nested_iterate_chain (cyclomatic 26) invokeai/app/services/shared/graph_loop_topology.py:263— graph_loop_topology._recognize_nested_iterate_chain has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_ExecutionNodeBuilder.create_nested_for_return (cyclomatic 26) invokeai/app/services/shared/graph_materializer.py:543— _ExecutionNodeBuilder.create_nested_for_return 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.
nvfp4.find_nvfp4_layers (cyclomatic 26) invokeai/backend/quantization/nvfp4.py:215— nvfp4.find_nvfp4_layers has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GalleryImageGridPaged.GalleryImageGridPaged (cyclomatic 26) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGridPaged.tsx:13— GalleryImageGridPaged.GalleryImageGridPaged has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 36, 84, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RelatedModels.RelatedModels (cyclomatic 26) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx:108— RelatedModels.RelatedModels has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 162, 220, 246, …). 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.
QueueItemComponent.QueueItemComponent (cyclomatic 26) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemComponent.tsx:34— QueueItemComponent.QueueItemComponent has cyclomatic complexity 26 (threshold 15). Of this number, 15 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HotkeyListItem.HotkeyItem (cyclomatic 26) invokeai/frontend/webv1/src/features/system/components/HotkeysModal/HotkeyListItem.tsx:92— HotkeyListItem.HotkeyItem has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 151, renderHotkeyKeys, a function literal at line 116, …). 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.
mock-backend.filterGalleryItems (cyclomatic 26) invokeai/frontend/webv2/scripts/mock-backend.mjs:954— mock-backend.filterGalleryItems has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 966, 1009). 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.
react.createDeferredFontRuntime (cyclomatic 26) invokeai/frontend/webv2/src/features/fonts/react.tsx:32— react.createDeferredFontRuntime has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 13 function items inside it that branch (a function literal at line 107, a function literal at line 132, a function literal at line 156, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
semanticImageQuery.parseGallerySemanticReference (cyclomatic 26) invokeai/frontend/webv2/src/features/gallery/core/semanticImageQuery.ts:232— semanticImageQuery.parseGallerySemanticReference 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.
compileCanvasGraph.compileCanvasGraph (cyclomatic 26) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:1026— compileCanvasGraph.compileCanvasGraph has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateDimensionFields.GenerateDimensionFields (cyclomatic 26) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:367— GenerateDimensionFields.GenerateDimensionFields has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (GenerateDimensionFields.GenerateDimensionFields::renderSection) 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.
SystemPromptsField.SystemPromptsField (cyclomatic 26) invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx:101— SystemPromptsField.SystemPromptsField has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 141, 204, 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.
ClearDialog.ClearDialog (cyclomatic 26) invokeai/frontend/webv2/src/features/intermediates/ui/ClearDialog.tsx:151— ClearDialog.ClearDialog has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
templates.buildInputTemplate (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:237— templates.buildInputTemplate has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkflowLibraryCard.WorkflowLibraryCard (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx:153— WorkflowLibraryCard.WorkflowLibraryCard has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
layerPanelState.reconcileLayerPanelState (cyclomatic 26) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:204— layerPanelState.reconcileLayerPanelState 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.
CanvasHeaderActions.CanvasHeaderActionsInner (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx:105— CanvasHeaderActions.CanvasHeaderActionsInner has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
canvasToolCommands.executeCanvasToolCommand (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasToolCommands.ts:232— canvasToolCommands.executeCanvasToolCommand 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.
shortcutHints.getCanvasShortcutHints (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/shortcutHints.ts:23— shortcutHints.getCanvasShortcutHints has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MissingFontsDialog.RecoveryRow (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx:139— MissingFontsDialog.RecoveryRow has cyclomatic complexity 26 (threshold 15). Of this number, 13 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LayerMutationController.convertToControl (cyclomatic 26) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:484— LayerMutationController.convertToControl has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
psdExport.planPsdExport (cyclomatic 26) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:195— psdExport.planPsdExport has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 3 function items inside it that branch (buildTree, walk, a function literal at line 318). 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.
QueueCluster.QueueCluster (cyclomatic 26) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:62— QueueCluster.QueueCluster has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InvokeImageBlendInvocation.image_convert_with_xform (cyclomatic 25) invokeai/app/invocations/composition-nodes.py:449— InvokeImageBlendInvocation.image_convert_with_xform 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.
InvokeImageCompositorInvocation.invoke (cyclomatic 25) invokeai/app/invocations/composition-nodes.py:1312— InvokeImageCompositorInvocation.invoke 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.
fonts_parsing.parse_font_bytes (cyclomatic 25) invokeai/app/services/fonts/fonts_parsing.py:91— fonts_parsing.parse_font_bytes has cyclomatic complexity 25 (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.
InstallStagingLedger._sweep_stale_claims_locked (cyclomatic 25) invokeai/app/services/model_install/install_staging_ledger.py:689— InstallStagingLedger._sweep_stale_claims_locked 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.
ModelInstallService._clear_pending_jobs (cyclomatic 25) invokeai/app/services/model_install/model_install_default.py:808— ModelInstallService._clear_pending_jobs 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.
GraphExecutionState._build_execution_tokens (cyclomatic 25) invokeai/app/services/shared/graph.py:3027— GraphExecutionState._build_execution_tokens 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.
_ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches (cyclomatic 25) invokeai/app/services/shared/graph_materializer.py:1844— _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches 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.
checkpoint_quantization.reject_unloadable_quantization (cyclomatic 25) invokeai/backend/flux3/checkpoint_quantization.py:61— checkpoint_quantization.reject_unloadable_quantization 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.
MistralEncoderCheckpointLoader._load_text_encoder (cyclomatic 25) REDACTED:1149— MistralEncoderCheckpointLoader._load_text_encoder 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.
WanCheckpointModel._load_from_singlefile (cyclomatic 25) invokeai/backend/model_manager/load/model_loaders/wan.py:569— WanCheckpointModel._load_from_singlefile 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.
Qwen3EncoderSDNQLoader._load_from_sdnq (cyclomatic 25) invokeai/backend/model_manager/load/model_loaders/z_image.py:1624— Qwen3EncoderSDNQLoader._load_from_sdnq 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.
loaders._infer_quantization_type (cyclomatic 25) invokeai/backend/quantization/sdnq/loaders.py:70— loaders._infer_quantization_type 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.
SyncModelsDialog.SyncModelsDialog (cyclomatic 25) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/SyncModelsDialog.tsx:36— SyncModelsDialog.SyncModelsDialog has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 56, 80, 111, …). 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.
useConnection.useConnection (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/hooks/useConnection.ts:27— useConnection.useConnection has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 33, 108). 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.
addOutpaint.addOutpaint (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:39— addOutpaint.addOutpaint 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.
parseSchema.parseSchema.invocations (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:108— parseSchema.parseSchema.invocations has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 120, 200). 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.
run-graph._runGraph (cyclomatic 25) invokeai/frontend/webv1/src/services/api/run-graph.ts:152— run-graph._runGraph has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 327, onQueueItemStatusChanged, a function literal at line 216, …). 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.
mock-working-memory.createWorkingMemoryMock.linesOf (cyclomatic 25) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:470— mock-working-memory.createWorkingMemoryMock.linesOf has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 483, a function literal at line 499, judged, …). 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.
tsSourceAnalysis.collectModuleReferences::visit (cyclomatic 25) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:224— tsSourceAnalysis.collectModuleReferences::visit 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.
selection.getGalleryNavigationStep (cyclomatic 25) invokeai/frontend/webv2/src/features/gallery/core/selection.ts:311— selection.getGalleryNavigationStep has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
PromptTextarea.PromptTextarea (cyclomatic 25) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTextarea.tsx:64— PromptTextarea.PromptTextarea has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateResetMenuItems.GenerateResetMenuItems (cyclomatic 25) invokeai/frontend/webv2/src/features/generation/ui/GenerateResetMenuItems.tsx:34— GenerateResetMenuItems.GenerateResetMenuItems has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 49, a function literal at line 109, a function literal at line 71, …). 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.
installsStore.refreshInstalls (cyclomatic 25) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:146— installsStore.refreshInstalls has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 152, 158, 231, …). 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.
graph.buildWanVideoGraph (cyclomatic 25) invokeai/frontend/webv2/src/features/video/core/graph.ts:280— graph.buildWanVideoGraph 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.
normalize.normalizeValue (cyclomatic 25) invokeai/frontend/webv2/src/platform/logging/normalize.ts:123— normalize.normalizeValue has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HsvBoxPicker.HsvBoxPicker (cyclomatic 25) invokeai/frontend/webv2/src/platform/ui/HsvBoxPicker.tsx:27— HsvBoxPicker.HsvBoxPicker has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 106, 127, 48, …). 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.
ImageMapWidgetView.ImageMapWidgetView (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx:79— ImageMapWidgetView.ImageMapWidgetView 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.
CopyLayerController.copy (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/copyLayerController.ts:85— CopyLayerController.copy 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.
workbenchState.removeGalleryItemsFromAllProjects (cyclomatic 25) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3680— workbenchState.removeGalleryItemsFromAllProjects has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3707, 3751, 3691, …). 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.
workbenchStore.createCommands (cyclomatic 25) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:89— workbenchStore.createCommands has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 444, 390, 476, …). 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.
compositeFrame.createCompositeFrame.draw (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositeFrame.ts:233— compositeFrame.createCompositeFrame.draw 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.
importGalleryImages.commitCanvasRecall (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:369— importGalleryImages.commitCanvasRecall has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
widgetDnd.resolveWidgetDragEnd (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgetDnd.ts:224— widgetDnd.resolveWidgetDragEnd 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.
ClusterStrengthField.ClusterStrengthField (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/image-map/ClusterStrengthField.tsx:40— ClusterStrengthField.ClusterStrengthField has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 144, 72, 115, …). 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.
ControlDetectionRow.ControlDetectionRow (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlDetectionRow.tsx:40— ControlDetectionRow.ControlDetectionRow has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReferenceImageSettings.ReferenceImageEditor (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/layers/ReferenceImageSettings.tsx:225— ReferenceImageSettings.ReferenceImageEditor has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 278, 328, 291, …). 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.
video_recall.resolve_video_recall_parameters (cyclomatic 24) invokeai/app/api/routers/video_recall.py:295— video_recall.resolve_video_recall_parameters 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.
fields.InputField (cyclomatic 24) invokeai/app/invocations/fields.py:948— fields.InputField has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: fields.migrate_model_ui_type (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
GraphExecutionState._coerce_execution_ref (cyclomatic 24) invokeai/app/services/shared/graph.py:2310— GraphExecutionState._coerce_execution_ref 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.
graph_if_dependencies._can_use_fresh_literal_if_iterate_collect (cyclomatic 24) invokeai/app/services/shared/graph_if_dependencies.py:107— graph_if_dependencies._can_use_fresh_literal_if_iterate_collect 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.
user_management._modify_user_interactive (cyclomatic 24) invokeai/app/util/user_management.py:449— user_management._modify_user_interactive 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.
Flow.Flow (cyclomatic 24) invokeai/frontend/webv1/src/features/nodes/components/flow/Flow.tsx:89— Flow.Flow has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 284, 342, 111, …). 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.
addInpaint.addInpaint (cyclomatic 24) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:47— addInpaint.addInpaint 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.
buildKrea2Graph.buildKrea2Graph (cyclomatic 24) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildKrea2Graph.ts:29— buildKrea2Graph.buildKrea2Graph has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SettingsImageStorageMaintenance.SettingsImageStorageMaintenance (cyclomatic 24) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsImageStorageMaintenance.tsx:48— SettingsImageStorageMaintenance.SettingsImageStorageMaintenance has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 belong to 5 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.
galleryStateView.getGallerySelectedImageQuery (cyclomatic 24) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:370— galleryStateView.getGallerySelectedImageQuery has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PositivePromptActions.ExpandPromptButton (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:658— PositivePromptActions.ExpandPromptButton has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dynamicPromptSyntax.scanDynamicPromptSyntax (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/core/prompt/dynamicPromptSyntax.ts:57— dynamicPromptSyntax.scanDynamicPromptSyntax has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExternalProviderKeyCards.ExternalProviderKeyCard (cyclomatic 24) invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx:103— ExternalProviderKeyCards.ExternalProviderKeyCard has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (handleSave, a function literal at line 127, a function literal at line 186, …). 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.
settings.sanitizeVideoReferences (cyclomatic 24) invokeai/frontend/webv2/src/features/video/core/settings.ts:190— settings.sanitizeVideoReferences has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workflowJson.parseWorkflowJson (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:283— workflowJson.parseWorkflowJson has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
libraryBrowseStore.pumpEnrichment (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:453— libraryBrowseStore.pumpEnrichment has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowLibraryBrowsePanes.WorkflowLibraryBrowsePanes (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryBrowsePanes.tsx:184— WorkflowLibraryBrowsePanes.WorkflowLibraryBrowsePanes has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 269, 252, 289, …). 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.
flowAdapters.toFlowNodes (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:205— flowAdapters.toFlowNodes has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 220). 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.
flowAdapters.toFlowEdges (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:598— flowAdapters.toFlowEdges has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 610). 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.
WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowSelectionRequestRuntime.tsx:95— WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 169, a function literal at line 147, getRequestTargets, …). 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.
canvasProjectMutations.applyMoves (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:395— canvasProjectMutations.applyMoves has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 436, survivingGroup, a function literal at line 461, …). 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.
PreviewDetailsPanel.PreviewDetailsPanel (cyclomatic 24) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewDetailsPanel.tsx:88— PreviewDetailsPanel.PreviewDetailsPanel has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RasterizeLayerController.rasterize (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterizeLayerController.ts:72— RasterizeLayerController.rasterize 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.
selectObjectSession.createSelectObjectSession.update (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:587— selectObjectSession.createSelectObjectSession.update has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
imageRecall.getRefinerRecall (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1024— imageRecall.getRefinerRecall has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
imageMapStore.refreshImageIndexStatus (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts:436— imageMapStore.refreshImageIndexStatus 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 2 function literals inside it that branch (lines 449, 508). 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.
exportProject.executeInvkExport (cyclomatic 24) invokeai/frontend/webv2/src/workbench/projects/invk/exportProject.ts:148— exportProject.executeInvkExport has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
controlPanelModel.deriveDetection (cyclomatic 24) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:148— controlPanelModel.deriveDetection 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.
Krea2LoRACollectionLoader.invoke (cyclomatic 23) invokeai/app/invocations/krea2/krea2_lora_loader.py:132— Krea2LoRACollectionLoader.invoke 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.
graph_loop_topology._recognize_nested_iterate_body (cyclomatic 23) invokeai/app/services/shared/graph_loop_topology.py:187— graph_loop_topology._recognize_nested_iterate_body has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
quantized_loading.load_bnb4bit_state_dict (cyclomatic 23) invokeai/backend/ideogram4/quantized_loading.py:67— quantized_loading.load_bnb4bit_state_dict 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.
flux2_state_dict_utils._convert_flux2_double_block_key (cyclomatic 23) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:61— flux2_state_dict_utils._convert_flux2_double_block_key has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Krea2CheckpointModel._load_from_singlefile (cyclomatic 23) invokeai/backend/model_manager/load/model_loaders/krea2.py:542— Krea2CheckpointModel._load_from_singlefile 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.
model_util.calc_model_size_by_fs (cyclomatic 23) invokeai/backend/model_manager/load/model_util.py:118— model_util.calc_model_size_by_fs has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PidDistillModel.generate_samples_from_batch (cyclomatic 23) invokeai/backend/pid/_src/models/pid_distill_model.py:168— PidDistillModel.generate_samples_from_batch has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sage_attention._ineligible (cyclomatic 23) invokeai/backend/util/sage_attention.py:187— sage_attention._ineligible has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
route-data.onRequest (cyclomatic 23) docs/src/route-data.ts:38— route-data.onRequest has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChangeBoardModal.ChangeBoardModal (cyclomatic 23) invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:40— ChangeBoardModal.ChangeBoardModal has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 87, 59, 182, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GalleryImageGrid.useKeyboardNavigation (cyclomatic 23) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:135— GalleryImageGrid.useKeyboardNavigation has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to one function literal inside it that branches (line 144). 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.
LoRASelect.LoRASelect (cyclomatic 23) invokeai/frontend/webv1/src/features/lora/components/LoRASelect.tsx:19— LoRASelect.LoRASelect has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 33, 88, 29, …). 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.
buildAnimaGraph.buildAnimaGraph (cyclomatic 23) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildAnimaGraph.ts:32— buildAnimaGraph.buildAnimaGraph has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelPicker.ModelPicker (cyclomatic 23) invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx:166— ModelPicker.ModelPicker has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 202, 287, 211, …). 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.
QueueItemDetail.QueueItemComponent (cyclomatic 23) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemDetail.tsx:24— QueueItemDetail.QueueItemComponent has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
QueueRuntimeAdapter.QueueRuntimeAdapter (cyclomatic 23) invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx:26— QueueRuntimeAdapter.QueueRuntimeAdapter has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 42, 172, 76, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
settings.normalizeReferenceImageConfig (cyclomatic 23) invokeai/frontend/webv2/src/features/generation/core/settings.ts:434— settings.normalizeReferenceImageConfig has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
UserFormDialog.UserForm (cyclomatic 23) invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:76— UserFormDialog.UserForm has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useCleanupDialog.useCleanupDialog.confirm (cyclomatic 23) invokeai/frontend/webv2/src/features/intermediates/ui/useCleanupDialog.ts:85— useCleanupDialog.useCleanupDialog.confirm has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
batch.readProperty (cyclomatic 23) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:301— batch.readProperty 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.
ProjectWorkflowsView.ProjectWorkflowsView (cyclomatic 23) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:116— ProjectWorkflowsView.ProjectWorkflowsView has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Combobox.Combobox (cyclomatic 23) invokeai/frontend/webv2/src/platform/ui/Combobox.tsx:93— Combobox.Combobox has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 128, 168, 177, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
StagingBar.StagingBar (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:123— StagingBar.StagingBar has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (StagingBar.StagingBar::handleKeyDown) 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.
TransformPane.ConnectedTransform (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx:56— TransformPane.ConnectedTransform has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body: 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.
workbenchState.assembleWorkbenchProject (cyclomatic 23) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2324— workbenchState.assembleWorkbenchProject 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.
focusRegions.createWorkbenchFocusController.focusAdjacentRegion (cyclomatic 23) invokeai/frontend/webv2/src/workbench/focusRegions.tsx:246— focusRegions.createWorkbenchFocusController.focusAdjacentRegion has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
alphaFill.propagateNearestVisibleLabels (cyclomatic 23) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/alphaFill.ts:28— alphaFill.propagateNearestVisibleLabels 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.
mediaUsageReport.resolveMediaUsage (cyclomatic 23) invokeai/frontend/webv2/src/workbench/image-actions/mediaUsageReport.ts:236— mediaUsageReport.resolveMediaUsage has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageContextMenu.SingleItemMenuItems (cyclomatic 23) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:286— ImageContextMenu.SingleItemMenuItems has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ControlModelRow.ControlModelRow (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlModelRow.tsx:65— ControlModelRow.ControlModelRow has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VideoConcatInvocation._build_audio_track (cyclomatic 22) invokeai/app/invocations/video_concat.py:699— VideoConcatInvocation._build_audio_track 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.
ExternalGenerationService._validate_request (cyclomatic 22) invokeai/app/services/external_generation/external_generation_default.py:96— ExternalGenerationService._validate_request has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration (cyclomatic 22) invokeai/app/services/shared/graph_materializer.py:771— _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration 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.
Graph._validate_type_dependents_after_edge (cyclomatic 22) invokeai/app/services/shared/graph_validation.py:822— Graph._validate_type_dependents_after_edge 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.
sampling.build_ref2va_denoise_state (cyclomatic 22) invokeai/backend/minimax_h3/sampling.py:290— sampling.build_ref2va_denoise_state 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.
ZImageDiffusersModel._load_sdnq_text_encoder (cyclomatic 22) invokeai/backend/model_manager/load/model_loaders/z_image.py:297— ZImageDiffusersModel._load_sdnq_text_encoder 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.
useImageUploadButton.useImageUploadButton (cyclomatic 22) invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx:68— useImageUploadButton.useImageUploadButton has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 89, 140, 83, …). 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.
LoginPage.LoginPage (cyclomatic 22) invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25— LoginPage.LoginPage has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkflowFormPreview.WorkflowFormPreview (cyclomatic 22) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:81— WorkflowFormPreview.WorkflowFormPreview has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 112, 93, 102). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CanvasTextToolModule.commitSession (cyclomatic 22) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:361— CanvasTextToolModule.commitSession 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.
CanvasToolModule.syncCursorStyle (cyclomatic 22) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:299— CanvasToolModule.syncCursorStyle 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.
ModelSettingsImportButton.ModelSettingsImportButton (cyclomatic 22) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelSettingsImportButton.tsx:16— ModelSettingsImportButton.ModelSettingsImportButton has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 23, 129, 122). 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.
galleryStateView.getGalleryStateView (cyclomatic 22) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:512— galleryStateView.getGalleryStateView has cyclomatic complexity 22 (threshold 15). Of this number, 20 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.
PromptTemplateEditor.PromptTemplateEditor (cyclomatic 22) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplateEditor.tsx:58— PromptTemplateEditor.PromptTemplateEditor has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 103, 81, 216, …). 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.
graphInputMedia.collectSubmissionInputMediaNames (cyclomatic 22) invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:19— graphInputMedia.collectSubmissionInputMediaNames has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createQueueRuntime (cyclomatic 22) invokeai/frontend/webv2/src/features/queue/runtime.ts:537— runtime.createQueueRuntime has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 1539, 567, 1508, …). 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.
queueMenuActions.useQueueActions (cyclomatic 22) invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx:302— queueMenuActions.useQueueActions has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 379, 464, 505, …). 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.
utilityGraph.reconcileUtilityCompletedOutput (cyclomatic 22) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:177— utilityGraph.reconcileUtilityCompletedOutput 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.
videoPolicies.getVideoComponentSectionPolicy (cyclomatic 22) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1510— videoPolicies.getVideoComponentSectionPolicy has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
batch.resolveWorkflowGeneratorValue (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:556— batch.resolveWorkflowGeneratorValue 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.
layerWorkflow.buildLayerWorkflowGraph (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/core/layerWorkflow.ts:204— layerWorkflow.buildLayerWorkflowGraph has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkflowFieldInput.useMediaUpload.onFileChange (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:692— WorkflowFieldInput.useMediaUpload.onFileChange has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 717). 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.
WorkflowFieldInput.MediaInput (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1051— WorkflowFieldInput.MediaInput has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
controlModelResolution.resolveControlModel (cyclomatic 22) invokeai/frontend/webv2/src/workbench/controlModelResolution.ts:100— controlModelResolution.resolveControlModel has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
workbenchState.compileInvocationSnapshot (cyclomatic 22) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3376— workbenchState.compileInvocationSnapshot 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.
StructuralLayerController.beginPreview (cyclomatic 22) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/structuralLayerController.ts:191— StructuralLayerController.beginPreview has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 225, a function literal at line 257, flushPending, …). 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.
fontLoader.createFontLoader.track (cyclomatic 22) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:265— fontLoader.createFontLoader.track has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
videoRecallRuntime.createVideoRecallRuntime::apply (cyclomatic 22) invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.ts:145— videoRecallRuntime.createVideoRecallRuntime::apply 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.
CommandPaletteDialog.CommandPaletteContent (cyclomatic 22) invokeai/frontend/webv2/src/workbench/palette/CommandPaletteDialog.tsx:98— CommandPaletteDialog.CommandPaletteContent 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.
queueRunJournal.createIndexedDbQueueRunJournal.record (cyclomatic 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:384— queueRunJournal.createIndexedDbQueueRunJournal.record 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.
GenerationDevicesSettings.GenerationDevicesSettings (cyclomatic 22) invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx:24— GenerationDevicesSettings.GenerationDevicesSettings has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LayoutPresetStrip.PresetTab (cyclomatic 22) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:407— LayoutPresetStrip.PresetTab has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 490, 467, 433, …). 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.
AdjustmentSettings.CurvesEditor (cyclomatic 22) invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx:710— AdjustmentSettings.CurvesEditor has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 810, 784, 840, …). 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.
MiniMaxH3ReferenceConditioningInvocation.invoke (cyclomatic 21) invokeai/app/invocations/minimax_h3/minimax_h3_reference.py:348— MiniMaxH3ReferenceConditioningInvocation.invoke 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.
WanLatentsToVideoInvocation.invoke (cyclomatic 21) invokeai/app/invocations/vae/wan_latents_to_video.py:98— WanLatentsToVideoInvocation.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.
ExecutionPlan.from_snapshot (cyclomatic 21) invokeai/app/services/shared/execution_engine/scheduler.py:151— ExecutionPlan.from_snapshot 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.
GraphExecutionState._record_continuation_effects (cyclomatic 21) invokeai/app/services/shared/graph.py:1841— GraphExecutionState._record_continuation_effects 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.
graph_if_runtime._get_effective_iteration_paths_for_edge (cyclomatic 21) invokeai/app/services/shared/graph_if_runtime.py:300— graph_if_runtime._get_effective_iteration_paths_for_edge 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.
denoise.denoise (cyclomatic 21) invokeai/backend/ltx2/denoise.py:621— denoise.denoise 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.
loaders.gguf_sd_loader (cyclomatic 21) invokeai/backend/quantization/gguf/loaders.py:290— loaders.gguf_sd_loader 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.
TextLLMPipeline.run (cyclomatic 21) invokeai/backend/text_llm_pipeline.py:156— TextLLMPipeline.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.
translation-checks.inventory (cyclomatic 21) docs/src/lib/translation-checks.mjs:197— translation-checks.inventory has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 213, 216). 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.
addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener (cyclomatic 21) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts:19— addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 64, 26, 47, …). 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.
Picker.useKeyboardNavigation (cyclomatic 21) invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:386— Picker.useKeyboardNavigation has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 407, 438, 470, …). 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.
RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph (cyclomatic 21) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:240— RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 260, 306, 369, …). 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.
needsPixelBbox.objectStateNeedsPixelBbox (cyclomatic 21) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasObject/needsPixelBbox.ts:3— needsPixelBbox.objectStateNeedsPixelBbox has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PromptTriggerSelect.PromptTriggerSelect (cyclomatic 21) invokeai/frontend/webv1/src/features/prompt/PromptTriggerSelect.tsx:23— PromptTriggerSelect.PromptTriggerSelect has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 67, 100, 140, …). 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.
browser-validation.observeBrowserDiagnostics (cyclomatic 21) invokeai/frontend/webv2/scripts/browser-validation.mjs:31— browser-validation.observeBrowserDiagnostics has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 95, 68, 123, …). 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.
GalleryUiAdapter.GalleryUiAdapterProvider (cyclomatic 21) invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:66— GalleryUiAdapter.GalleryUiAdapterProvider has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 143, 175, 113, …). 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.
tsSourceAnalysis.collectTypographyLiterals::collectValue (cyclomatic 21) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:329— tsSourceAnalysis.collectTypographyLiterals::collectValue 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.
baseGenerationPolicies.getReferenceImageConfigSupported (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1884— baseGenerationPolicies.getReferenceImageConfigSupported has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
graph.buildFlux2Graph (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/core/graph.ts:798— graph.buildFlux2Graph 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.
ExternalSizeSelect.ExternalSizeSelect (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/shared/ExternalSizeSelect.tsx:44— ExternalSizeSelect.ExternalSizeSelect has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GenerateModelCard.GenerateModelCard (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx:51— GenerateModelCard.GenerateModelCard has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateRenderSection.GenerateRenderSection::renderFields (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:694— GenerateRenderSection.GenerateRenderSection::renderFields 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. This shape REPEATS in the file: one other method here (GenerateRenderSection.GenerateRenderSection) 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.
queries.applyQueueItemStatusChange (cyclomatic 21) invokeai/frontend/webv2/src/features/queue/data/queries.ts:185— queries.applyQueueItemStatusChange 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.
runtime.createQueueRuntime.routeRunResults (cyclomatic 21) invokeai/frontend/webv2/src/features/queue/runtime.ts:1238— runtime.createQueueRuntime.routeRunResults has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
connectors.resolveLoopLinkagePath (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/connectors.ts:56— connectors.resolveLoopLinkagePath has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fields.getWorkflowFieldIssue (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:483— fields.getWorkflowFieldIssue 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.
ColorPicker.ColorPicker (cyclomatic 21) invokeai/frontend/webv2/src/platform/ui/ColorPicker.tsx:151— ColorPicker.ColorPicker has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Select.Select (cyclomatic 21) invokeai/frontend/webv2/src/platform/ui/Select.tsx:102— Select.Select has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:196— indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 200). 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.
indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:364— indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 370). 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.
projectHalves.joinProjectDocument (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:157— projectHalves.joinProjectDocument has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ColorPane.ColorPane (cyclomatic 21) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx:44— ColorPane.ColorPane has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 54, 127, 89, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PreviewActionStrip.PreviewActionStrip (cyclomatic 21) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewActionStrip.tsx:43— PreviewActionStrip.PreviewActionStrip has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
workbenchState.isWidgetRegionState (cyclomatic 21) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2818— workbenchState.isWidgetRegionState has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: workbenchState.isLayoutPresetSnapshot (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
workbenchStore.recordDiagnosticForAction (cyclomatic 21) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:805— workbenchStore.recordDiagnosticForAction 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.
PixelEditController.beginMaterialized (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:351— PixelEditController.beginMaterialized has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 4 function items inside it that branch (commit, a function literal at line 430, a function literal at line 454, …). 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.
selectObjectBridge.createSelectObjectBridge (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-engine/selectObjectBridge.ts:37— selectObjectBridge.createSelectObjectBridge has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 73, 39, 38). 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.
selectionState.createSelectionState.commit (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/selectionState.ts:264— selectionState.createSelectionState.commit 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.
executeImageRecall.executeLoadMediaWorkflow (cyclomatic 21) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:99— executeImageRecall.executeLoadMediaWorkflow 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.
LayoutPresetStrip.LayoutPresetStrip (cyclomatic 21) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:121— LayoutPresetStrip.LayoutPresetStrip has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 152, 157, 261, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model_manager.get_is_installed (cyclomatic 20) invokeai/app/api/routers/model_manager.py:1483— model_manager.get_is_installed 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.
session_queue.strip_missing_image_results (cyclomatic 20) invokeai/app/api/routers/session_queue.py:81— session_queue.strip_missing_image_results 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.
baseinvocation.validate_fields (cyclomatic 20) invokeai/app/invocations/baseinvocation.py:604— baseinvocation.validate_fields has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InvokeImageBlendInvocation.prepare_tensors_from_images (cyclomatic 20) invokeai/app/invocations/composition-nodes.py:515— InvokeImageBlendInvocation.prepare_tensors_from_images 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.
ImageIndexService._worker_loop (cyclomatic 20) invokeai/app/services/image_index/image_index_default.py:1195— ImageIndexService._worker_loop 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.
DefaultSessionRunner.run_node (cyclomatic 20) invokeai/app/services/session_processor/session_processor_default.py:451— DefaultSessionRunner.run_node 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.
workflow_call_batch.build_batch_child_workflow_session_results (cyclomatic 20) invokeai/app/services/session_processor/workflow_call_batch.py:517— workflow_call_batch.build_batch_child_workflow_session_results 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.
_ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch (cyclomatic 20) invokeai/app/services/shared/graph_materializer.py:2247— _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch 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.
graph_scheduler._prepare_deferred_nested_for_body (cyclomatic 20) invokeai/app/services/shared/graph_scheduler.py:28— graph_scheduler._prepare_deferred_nested_for_body 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.
aac_splice.splice_soundtrack (cyclomatic 20) invokeai/app/util/aac_splice.py:364— aac_splice.splice_soundtrack 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.
Main_Diffusers_LTX2_Config.from_model_on_disk (cyclomatic 20) invokeai/backend/model_manager/configs/main.py:2123— Main_Diffusers_LTX2_Config.from_model_on_disk 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.
loaders.parse_gguf_convrot_markers (cyclomatic 20) invokeai/backend/quantization/gguf/loaders.py:165— loaders.parse_gguf_convrot_markers 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.
StableDiffusionGeneratorPipeline.step (cyclomatic 20) invokeai/backend/stable_diffusion/diffusers_pipeline.py:438— StableDiffusionGeneratorPipeline.step 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.
coefficients.resolve_coefficients (cyclomatic 20) invokeai/backend/working_memory/coefficients.py:221— coefficients.resolve_coefficients 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.
fit.fit_points (cyclomatic 20) invokeai/backend/working_memory/fit.py:544— fit.fit_points 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.
fit._lowest_rounded (cyclomatic 20) invokeai/backend/working_memory/fit.py:843— fit._lowest_rounded 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.
RefImageImage.RefImageImage (cyclomatic 20) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:35— RefImageImage.RefImageImage has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 82, 59, 106, …). 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.
MainModelDefaultSettings.MainModelDefaultSettings (cyclomatic 20) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx:50— MainModelDefaultSettings.MainModelDefaultSettings has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 115). 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.
SettingsGenerationDevices.SettingsGenerationDevices (cyclomatic 20) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:39— SettingsGenerationDevices.SettingsGenerationDevices 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 7 function literals inside it that branch (lines 79, 114, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tsSourceAnalysis.collectPublicExports (cyclomatic 20) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:164— tsSourceAnalysis.collectPublicExports 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.
useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cyclomatic 20) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridSelection.ts:101— useGalleryGridSelection.useGalleryGridSelection.selectItemRange has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 4 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.
settings.cloneGenerateWidgetValues (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/settings.ts:715— settings.cloneGenerateWidgetValues 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.
graph.buildSDGraph (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/graph.ts:341— graph.buildSDGraph 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.
graph.buildKrea2Graph (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/graph.ts:1467— graph.buildKrea2Graph has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
ConditioningRebalanceBars.ConditioningRebalanceBars (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.tsx:100— ConditioningRebalanceBars.ConditioningRebalanceBars has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 162, 219, 115, …). 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.
InstallProgressCell.useInstallProgressCaption (cyclomatic 20) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallProgressCell.tsx:38— InstallProgressCell.useInstallProgressCaption has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createQueueRuntime.handleItemsRetried (cyclomatic 20) invokeai/frontend/webv2/src/features/queue/runtime.ts:1882— runtime.createQueueRuntime.handleItemsRetried 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.
QueueHeaderActions.InvocationCacheSection (cyclomatic 20) invokeai/frontend/webv2/src/features/queue/ui/QueueHeaderActions.tsx:178— QueueHeaderActions.InvocationCacheSection has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
formFieldSettings.applyNodeFieldFormSettings (cyclomatic 20) invokeai/frontend/webv2/src/features/workflow/core/formFieldSettings.ts:224— formFieldSettings.applyNodeFieldFormSettings has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowDocumentGraph.PreviewChip (cyclomatic 20) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:368— WorkflowDocumentGraph.PreviewChip 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.
normalize.serializeErrorAtDepth (cyclomatic 20) invokeai/frontend/webv2/src/platform/logging/normalize.ts:296— normalize.serializeErrorAtDepth 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.
canvasProjectMutations.applyLayerStackMutation (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:484— canvasProjectMutations.applyLayerStackMutation has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CanvasColorFeed.ColorSampleRouting (cyclomatic 20) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/CanvasColorFeed.tsx:110— CanvasColorFeed.ColorSampleRouting has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 143, a function literal at line 122, commitSourceColor, …). 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.
StagingBar.StagingBar::handleKeyDown (cyclomatic 20) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:228— StagingBar.StagingBar::handleKeyDown 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 (StagingBar.StagingBar) 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.
ThumbnailController.draw (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:74— ThumbnailController.draw 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.
filterOperationSession.createFilterOperationSession.commit (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts:254— filterOperationSession.createFilterOperationSession.commit 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.
controlSourceActions.sendGalleryImageAsControl (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/controlSourceActions.ts:274— controlSourceActions.sendGalleryImageAsControl has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DiagnosticsPanel.DiagnosticsPanel (cyclomatic 20) invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx:128— DiagnosticsPanel.DiagnosticsPanel has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
imageRecall.getHiDiffusionPatch (cyclomatic 20) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:270— imageRecall.getHiDiffusionPatch 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.
unloadJournal.scenarios.createUnloadJournalServer (cyclomatic 20) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:26— unloadJournal.scenarios.createUnloadJournalServer has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 125, a function literal at line 51, a function literal at line 98, …). 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.
QueueCluster.QueueTooltip (cyclomatic 20) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:335— QueueCluster.QueueTooltip 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.
board_images.remove_images_from_board (cyclomatic 19) invokeai/app/api/routers/board_images.py:304— board_images.remove_images_from_board has cyclomatic complexity 19 (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.
trusted_routes._copy_config (cyclomatic 19) invokeai/app/api/trusted_routes.py:46— trusted_routes._copy_config 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.
Ideogram4DenoiseInvocation._load_branches (cyclomatic 19) invokeai/app/invocations/ideogram4/ideogram4_denoise.py:266— Ideogram4DenoiseInvocation._load_branches 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.
sd3_denoise._delta_fits (cyclomatic 19) invokeai/app/invocations/sd3/sd3_denoise.py:68— sd3_denoise._delta_fits 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.
ImageIndexService._process_projection (cyclomatic 19) invokeai/app/services/image_index/image_index_default.py:1651— ImageIndexService._process_projection 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.
ImageMoveService._complete_partial_filesystem_move (cyclomatic 19) invokeai/app/services/image_moves/image_moves_default.py:463— ImageMoveService._complete_partial_filesystem_move 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.
DefaultSessionProcessor._process (cyclomatic 19) invokeai/app/services/session_processor/session_processor_default.py:1386— DefaultSessionProcessor._process 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.
ExecutionRef._accept_token_fields (cyclomatic 19) invokeai/app/services/shared/execution_effects.py:146— ExecutionRef._accept_token_fields 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.
execution_effects.normalize_persisted_execution_effects (cyclomatic 19) invokeai/app/services/shared/execution_effects.py:414— execution_effects.normalize_persisted_execution_effects 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.
StreamBuffer._coerce_event (cyclomatic 19) invokeai/app/services/shared/execution_engine/primitives.py:322— StreamBuffer._coerce_event 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.
graph_iterate_planner._get_direct_iterate_collect_fan_in (cyclomatic 19) invokeai/app/services/shared/graph_iterate_planner.py:26— graph_iterate_planner._get_direct_iterate_collect_fan_in 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.
_ExecutionNodeBuilder._attach_pending_if_inputs (cyclomatic 19) invokeai/app/services/shared/graph_materializer.py:1934— _ExecutionNodeBuilder._attach_pending_if_inputs 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.
aac_splice._set_audio_edit (cyclomatic 19) invokeai/app/util/aac_splice.py:280— aac_splice._set_audio_edit 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.
h264_splice._sample_locations (cyclomatic 19) invokeai/app/util/h264_splice.py:273— h264_splice._sample_locations 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.
checkpoint_layout.classify_roles (cyclomatic 19) invokeai/backend/ltx2/checkpoint_layout.py:96— checkpoint_layout.classify_roles 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.
StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention (cyclomatic 19) invokeai/backend/stable_diffusion/diffusers_pipeline.py:170— StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention 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.
CanvasEntityGroupList.CanvasEntityGroupList (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:31— CanvasEntityGroupList.CanvasEntityGroupList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 37). 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.
RasterLayerCurvesAdjustmentsGraph.drawHistogram (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:63— RasterLayerCurvesAdjustmentsGraph.drawHistogram 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.
RefImageSettings.RefImageSettingsContent (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx:68— RefImageSettings.RefImageSettingsContent 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.
validators.getGlobalReferenceImageWarnings (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:176— validators.getGlobalReferenceImageWarnings 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.
ModelIdentifierFieldInputComponent.ModelIdentifierFieldInputComponent (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ModelIdentifierFieldInputComponent.tsx:14— ModelIdentifierFieldInputComponent.ModelIdentifierFieldInputComponent has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 43, 34, 19). 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.
dnd-hooks.useBuilderDndMonitor (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.ts:203— dnd-hooks.useBuilderDndMonitor has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 224, 223). 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.
WorkflowListItem.WorkflowListItem (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowListItem.tsx:36— WorkflowListItem.WorkflowListItem has cyclomatic complexity 19 (threshold 15). Of this number, 15 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.
useNodeCopyPaste._pasteSelection (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/hooks/useNodeCopyPaste.ts:37— useNodeCopyPaste._pasteSelection has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 122, 59, 87, …). 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.
fieldValidators.validateNumberFieldCollectionValue (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:116— fieldValidators.validateNumberFieldCollectionValue 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.
fieldValidators.getFieldErrors (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:214— fieldValidators.getFieldErrors 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.
settings.getGallerySettings (cyclomatic 19) invokeai/frontend/webv2/src/features/gallery/core/settings.ts:205— settings.getGallerySettings 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.
referenceImage.resolveRatioDrag (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/referenceImage.ts:361— referenceImage.resolveRatioDrag 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.
PromptParser.parseQuotedPromptFunction (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:410— PromptParser.parseQuotedPromptFunction 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.
attention.adjustNodes (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:263— attention.adjustNodes has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/GenerateConditioningRebalanceField.tsx:61— GenerateConditioningRebalanceField.GenerateConditioningRebalanceField has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GenerateProviderOptionsSection.GenerateProviderOptionsSection (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/GenerateProviderOptionsSection.tsx:51— GenerateProviderOptionsSection.GenerateProviderOptionsSection has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateRenderSection.GenerateRenderSection (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:628— GenerateRenderSection.GenerateRenderSection has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (GenerateRenderSection.GenerateRenderSection::renderFields) 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.
PromptTemplatesPanel.PromptTemplatesPanel (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx:65— PromptTemplatesPanel.PromptTemplatesPanel has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WildcardTransferActions.WildcardTransferActions (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardTransferActions.tsx:39— WildcardTransferActions.WildcardTransferActions 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 8 function literals inside it that branch (lines 102, 62, 140, …). 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.
WorkingMemorySection.OutcomePanel (cyclomatic 19) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:644— WorkingMemorySection.OutcomePanel 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.
settings.clearDeletedVideoMedia (cyclomatic 19) invokeai/frontend/webv2/src/features/video/core/settings.ts:1107— settings.clearDeletedVideoMedia has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
connectors.resolveConnectorDeletionSource (cyclomatic 19) invokeai/frontend/webv2/src/features/workflow/core/connectors.ts:153— connectors.resolveConnectorDeletionSource has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkflowFieldInput.BoardInput (cyclomatic 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:524— WorkflowFieldInput.BoardInput has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement (cyclomatic 19) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1125— indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 1135). 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.
persistenceRuntime.createWorkbenchPersistenceRuntime.load (cyclomatic 19) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:526— persistenceRuntime.createWorkbenchPersistenceRuntime.load 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.
useCanvasRecovery.useStagingRecovery (cyclomatic 19) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasRecovery.ts:142— useCanvasRecovery.useStagingRecovery has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 208, 163, 186, …). 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.
runLayerWorkflow.runLayerWorkflow (cyclomatic 19) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:119— runLayerWorkflow.runLayerWorkflow 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.
PreviewFilmstrip.FilmstripLiveThumb (cyclomatic 19) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx:124— PreviewFilmstrip.FilmstripLiveThumb has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LayerMutationController.duplicate (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:147— LayerMutationController.duplicate 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.
documentIndex.updateNodeValues (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:435— documentIndex.updateNodeValues has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SelectionImageController.replace (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionImageController.ts:30— SelectionImageController.replace 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.
MaskLayerController.clear (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:41— MaskLayerController.clear has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MaskLayerController.invert (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:98— MaskLayerController.invert 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.
bitmapStore.createBitmapStore.flushPendingUploads (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:699— bitmapStore.createBitmapStore.flushPendingUploads has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
documentMirror.diffValueEdit (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:168— documentMirror.diffValueEdit 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.
engine.createCanvasEngine::getDuplicateRasterPlan (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2376— engine.createCanvasEngine::getDuplicateRasterPlan 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.
paintTool.createPaintTool.onPointerDown (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:330— paintTool.createPaintTool.onPointerDown 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.
videoRecall.parseVideoRecallRecord (cyclomatic 19) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:357— videoRecall.parseVideoRecallRecord has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: videoRecall.getVideoRecallCapabilities (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
canvasRecall.readCanvasSettings (cyclomatic 19) invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:68— canvasRecall.readCanvasSettings 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.
queueRecallCache.createIndexedDbQueueRecallCache.put (cyclomatic 19) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts:213— queueRecallCache.createIndexedDbQueueRecallCache.put has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MaxQueueHistorySettings.MaxQueueHistorySettings (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/MaxQueueHistorySettings.tsx:31— MaxQueueHistorySettings.MaxQueueHistorySettings has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CustomSettingsEditors.CustomSettingField (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/CustomSettingsEditors.tsx:224— CustomSettingsEditors.CustomSettingField has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
SettingsEntryView.SettingsEntryView (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/SettingsEntryView.tsx:96— SettingsEntryView.SettingsEntryView 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.
useInvocationState.useInvocationState (cyclomatic 19) invokeai/frontend/webv2/src/workbench/shell/topbar/useInvocationState.ts:142— useInvocationState.useInvocationState has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProjectSwitcher.ProjectSwitcher (cyclomatic 19) invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx:69— ProjectSwitcher.ProjectSwitcher has cyclomatic complexity 19 (threshold 15). Of this number, 10 points are the body's own statements and 9 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WidgetFailureBoundary.WidgetFailureFallback (cyclomatic 19) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFailureBoundary.tsx:287— WidgetFailureBoundary.WidgetFailureFallback has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: 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.
videos.ingest_uploaded_video (cyclomatic 18) invokeai/app/api/routers/videos.py:430— videos.ingest_uploaded_video has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
SocketIO._handle_queue_event (cyclomatic 18) invokeai/app/api/sockets.py:972— SocketIO._handle_queue_event 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.
Flux2KleinLoRACollectionLoader.invoke (cyclomatic 18) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:163— Flux2KleinLoRACollectionLoader.invoke 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.
Krea2LoRALoaderInvocation.invoke (cyclomatic 18) invokeai/app/invocations/krea2/krea2_lora_loader.py:57— Krea2LoRALoaderInvocation.invoke 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.
VideoConcatInvocation.invoke (cyclomatic 18) invokeai/app/invocations/video_concat.py:205— VideoConcatInvocation.invoke 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.
VideoConcatInvocation._execute_smart_render (cyclomatic 18) invokeai/app/invocations/video_concat.py:378— VideoConcatInvocation._execute_smart_render 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.
ZImageLoRACollectionLoader.invoke (cyclomatic 18) invokeai/app/invocations/z_image/z_image_lora_loader.py:135— ZImageLoRACollectionLoader.invoke 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.
GalleryMaintenanceService._archive_snapshot_files (cyclomatic 18) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:735— GalleryMaintenanceService._archive_snapshot_files 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.
ModelInstallService._restart_remote_download (cyclomatic 18) invokeai/app/services/model_install/model_install_default.py:1364— ModelInstallService._restart_remote_download 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.
WorkflowCallQueueLifecycle.apply_execution_effects (cyclomatic 18) invokeai/app/services/session_processor/workflow_call_runtime.py:150— WorkflowCallQueueLifecycle.apply_execution_effects 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.
GraphExecutionState._record_iterate_stream (cyclomatic 18) invokeai/app/services/shared/graph.py:1625— GraphExecutionState._record_iterate_stream 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.
_IfActivationController._branch_sources (cyclomatic 18) invokeai/app/services/shared/graph_if_activation.py:26— _IfActivationController._branch_sources has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
graph_if_runtime._validate_frame_axes (cyclomatic 18) invokeai/app/services/shared/graph_if_runtime.py:78— graph_if_runtime._validate_frame_axes 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.
_ExecutionNodeBuilder._get_known_iteration_path (cyclomatic 18) invokeai/app/services/shared/graph_materializer.py:118— _ExecutionNodeBuilder._get_known_iteration_path 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.
LLLiteModuleDiT.forward (cyclomatic 18) invokeai/backend/anima/control_net_lllite.py:287— LLLiteModuleDiT.forward 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.
Krea2MemoryEfficientAttnProcessor.__call__ (cyclomatic 18) invokeai/backend/krea2/attention.py:127— Krea2MemoryEfficientAttnProcessor.__call__ 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.
denoise.build_denoise_state (cyclomatic 18) invokeai/backend/ltx2/denoise.py:278— denoise.build_denoise_state 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.
main._detect_wan_expert (cyclomatic 18) invokeai/backend/model_manager/configs/main.py:3153— main._detect_wan_expert 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.
pid_decoder._int8_sidecar_keys (cyclomatic 18) invokeai/backend/model_manager/configs/pid_decoder.py:253— pid_decoder._int8_sidecar_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.
CachedModelWithPartialLoad.partial_load_to_vram_chunk (cyclomatic 18) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:402— CachedModelWithPartialLoad.partial_load_to_vram_chunk 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.
Flux2GGUFCheckpointModel._load_from_singlefile (cyclomatic 18) invokeai/backend/model_manager/load/model_loaders/flux.py:1837— Flux2GGUFCheckpointModel._load_from_singlefile 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.
krea2._convert_krea2_native_to_diffusers (cyclomatic 18) invokeai/backend/model_manager/load/model_loaders/krea2.py:186— krea2._convert_krea2_native_to_diffusers 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.
ZImageCheckpointModel._load_from_singlefile (cyclomatic 18) invokeai/backend/model_manager/load/model_loaders/z_image.py:482— ZImageCheckpointModel._load_from_singlefile 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.
layout._compile_draft_item (cyclomatic 18) invokeai/backend/moss_image/layout.py:233— layout._compile_draft_item 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.
int8_convrot.reject_unmarked_int8_weights (cyclomatic 18) invokeai/backend/quantization/int8_convrot.py:738— int8_convrot.reject_unmarked_int8_weights 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.
RefImagePreview.RefImagePreview (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx:79— RefImagePreview.RefImagePreview has cyclomatic complexity 18 (threshold 15). Of this number, 14 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.
CanvasEntityAdapterInpaintMask.sync (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterInpaintMask.ts:31— CanvasEntityAdapterInpaintMask.sync 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.
CanvasEntityAdapterRasterLayer.sync (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRasterLayer.ts:56— CanvasEntityAdapterRasterLayer.sync 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.
CanvasEntityAdapterRegionalGuidance.sync (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRegionalGuidance.ts:31— CanvasEntityAdapterRegionalGuidance.sync 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.
validators.getControlLayerWarnings (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:266— validators.getControlLayerWarnings has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
modelSettingsIO.buildExportData (cyclomatic 18) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:37— modelSettingsIO.buildExportData 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.
graphBuilderUtils.getDenoisingStartAndEnd (cyclomatic 18) invokeai/frontend/webv1/src/features/nodes/util/graph/graphBuilderUtils.ts:228— graphBuilderUtils.getDenoisingStartAndEnd 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.
buildFLUXGraph.buildFLUXGraph::addFlux2Features (cyclomatic 18) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:388— buildFLUXGraph.buildFLUXGraph::addFlux2Features 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 (buildFLUXGraph.buildFLUXGraph) 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.
ParamPositivePrompt.ParamPositivePrompt (cyclomatic 18) invokeai/frontend/webv1/src/features/parameters/components/Core/ParamPositivePrompt.tsx:147— ParamPositivePrompt.ParamPositivePrompt has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 199, 291, 163, …). 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.
SettingsGenerationDevices.DeviceTag (cyclomatic 18) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:208— SettingsGenerationDevices.DeviceTag has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, 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.
use-collapsible-gridview-panel.useCollapsibleGridviewPanel (cyclomatic 18) invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts:19— use-collapsible-gridview-panel.useCollapsibleGridviewPanel has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 49, 29, 72, …). 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.
onInvocationComplete.buildOnInvocationComplete::addImagesToGallery (cyclomatic 18) invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:117— onInvocationComplete.buildOnInvocationComplete::addImagesToGallery 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.
backend.moveGalleryVideoItemsToBoard (cyclomatic 18) REDACTED:1478— backend.moveGalleryVideoItemsToBoard has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (worker, claimNextVideo). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ConceptRow.ConceptRowContent (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.tsx:170— ConceptRow.ConceptRowContent has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sdxlRefiner.getRefinerValidationReasons (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/sdxlRefiner.ts:75— sdxlRefiner.getRefinerValidationReasons 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.
graph.buildQwenImageGraph (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/graph.ts:1050— graph.buildQwenImageGraph 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.
PromptParser.parseNodes (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:606— PromptParser.parseNodes 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.
installsStore.handleModelInstallSocketEvent (cyclomatic 18) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:455— installsStore.handleModelInstallSocketEvent 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.
ModelSettingsMenuItems.ModelSettingsMenuItems (cyclomatic 18) invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:21— ModelSettingsMenuItems.ModelSettingsMenuItems has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 59, handleExport, handleFileChange). 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.
InstallQueueBar.InstallQueueBar (cyclomatic 18) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallQueueBar.tsx:59— InstallQueueBar.InstallQueueBar has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.createQueueRuntime.deliverResultVideos (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:1117— runtime.createQueueRuntime.deliverResultVideos has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runtime.createQueueRuntime.routeBackendItemResults (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:1354— runtime.createQueueRuntime.routeBackendItemResults has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runtime.createQueueRuntime.prepareActiveRuns (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:2368— runtime.createQueueRuntime.prepareActiveRuns has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2391, 2374, 2418). 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.
VideoModelField.VideoModelField (cyclomatic 18) invokeai/frontend/webv2/src/features/video/ui/VideoModelField.tsx:68— VideoModelField.VideoModelField has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 4 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.
document.updateInvocationNodeToTemplate (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/core/document.ts:503— document.updateInvocationNodeToTemplate 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.
WorkflowDetailSheet.WorkflowDetailSheet (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowDetailSheet.tsx:212— WorkflowDetailSheet.WorkflowDetailSheet has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, 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.
clipboard.getBridgingConnectorIds (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/editor/clipboard.ts:57— clipboard.getBridgingConnectorIds has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (reachesCopiedNode, startsAtCopiedNode, isConnectorId). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WorkflowFieldInput.WorkflowFieldSnapshot (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:2071— WorkflowFieldInput.WorkflowFieldSnapshot 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.
useCanvasGallerySave.useCanvasGallerySave.save (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasGallerySave.ts:52— useCanvasGallerySave.useCanvasGallerySave.save has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 59, 90). 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.
layerChildRows.projectLayerChildRows (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:233— layerChildRows.projectLayerChildRows has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
exportRasterComposite.exportRasterComposite (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.ts:47— exportRasterComposite.exportRasterComposite 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.
adjustments.buildCurveLut (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:33— adjustments.buildCurveLut 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 is NOT this file's highest cyclomatic complexity: adjustments.isIdentityAdjustmentEntry (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
prepareCanvasInvocation.runCanvasInvocation (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:325— prepareCanvasInvocation.runCanvasInvocation has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
documentMirror.diffForests (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:99— documentMirror.diffForests 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.
fontLoader.createFontLoader.ensureSource (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:350— fontLoader.createFontLoader.ensureSource has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:323— SelectObjectCoordinator.createSelectObjectOperationCoordinator.save 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.
importGalleryImages.importGalleryImagesToCanvas (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:256— importGalleryImages.importGalleryImagesToCanvas has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
imageRecall.getMetadataConcepts (cyclomatic 18) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1117— imageRecall.getMetadataConcepts 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.
executeVideoRecall.placeVideoImage (cyclomatic 18) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:736— executeVideoRecall.placeVideoImage 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.
revealExternalGeneration.revealExternalGeneration (cyclomatic 18) invokeai/frontend/webv2/src/workbench/image-actions/revealExternalGeneration.ts:62— revealExternalGeneration.revealExternalGeneration has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (mayApplyWhenVisible, standDown, mayApply). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useCommandPaletteController.useCommandPaletteController (cyclomatic 18) invokeai/frontend/webv2/src/workbench/palette/useCommandPaletteController.ts:61— useCommandPaletteController.useCommandPaletteController 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.
OpenProjectDialog.OpenProjectDialog (cyclomatic 18) invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx:56— OpenProjectDialog.OpenProjectDialog has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 92, renderItem, a function literal at line 136, …). 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.
ImageMapVocabularySettings.ImageMapVocabularySettings (cyclomatic 18) invokeai/frontend/webv2/src/workbench/settings/ImageMapVocabularySettings.tsx:46— ImageMapVocabularySettings.ImageMapVocabularySettings has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (addTerms, a function literal at line 52, a function literal at line 62, …). 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.
invokeIssueActions.useInvokeIssueActions (cyclomatic 18) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueActions.ts:44— invokeIssueActions.useInvokeIssueActions has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 54, 78, 99, …). 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.
WidgetInstanceContextMenu.WidgetInstanceContextMenu (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetInstanceContextMenu.tsx:34— WidgetInstanceContextMenu.WidgetInstanceContextMenu has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenerateCanvasRenderSize.GenerateCanvasRenderSize (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasRenderSize.tsx:70— GenerateCanvasRenderSize.GenerateCanvasRenderSize has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 139, 113, 87, …). 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.
TextOptions.FontAxisSettings (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:381— TextOptions.FontAxisSettings has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 422, 408, 394, …). 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.
AnimaLoRACollectionLoader.invoke (cyclomatic 17) invokeai/app/invocations/anima/anima_lora_loader.py:124— AnimaLoRACollectionLoader.invoke 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.
FLUXLoRACollectionLoader.invoke (cyclomatic 17) invokeai/app/invocations/flux/flux_lora_loader.py:146— FLUXLoRACollectionLoader.invoke 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.
ExtractVideoRangeInvocation._write_spliced_range (cyclomatic 17) invokeai/app/invocations/video_frame_extract_range.py:373— ExtractVideoRangeInvocation._write_spliced_range 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.
_ExpertSwapper.get (cyclomatic 17) invokeai/app/invocations/wan/wan_denoise.py:211— _ExpertSwapper.get 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.
FontService._rescan_directory (cyclomatic 17) REDACTED:292— FontService._rescan_directory 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.
ModelInstallService._install_next_item (cyclomatic 17) invokeai/app/services/model_install/model_install_default.py:1716— ModelInstallService._install_next_item 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.
OrphanedModelsService.find_orphaned_models (cyclomatic 17) invokeai/app/services/orphaned_models/orphaned_models_service.py:73— OrphanedModelsService.find_orphaned_models 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.
GraphExecutionState._rehydrate_resolved_if_exec_branches (cyclomatic 17) invokeai/app/services/shared/graph.py:3667— GraphExecutionState._rehydrate_resolved_if_exec_branches 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.
graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer (cyclomatic 17) invokeai/app/services/shared/graph_nested_iterate_planner.py:207— graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer 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.
_GenericGraphSchedulerAdapter.complete (cyclomatic 17) invokeai/app/services/shared/graph_scheduler.py:605— _GenericGraphSchedulerAdapter.complete 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.
workflow_graph_builder._resolve_for_connector_loop_linkage_path (cyclomatic 17) invokeai/app/services/shared/workflow_graph_builder.py:313— workflow_graph_builder._resolve_for_connector_loop_linkage_path 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.
WorkingMemoryCalibrationService._canceled_runs (cyclomatic 17) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1637— WorkingMemoryCalibrationService._canceled_runs 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.
AnimaControlNetLLLite.from_state_dict (cyclomatic 17) invokeai/backend/anima/control_net_lllite.py:414— AnimaControlNetLLLite.from_state_dict 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.
denoise.denoise (cyclomatic 17) invokeai/backend/ernie_image/denoise.py:27— denoise.denoise 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.
PromptFormatter.normalize_prompt (cyclomatic 17) invokeai/backend/image_util/pngwriter.py:87— PromptFormatter.normalize_prompt 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.
Config_Base.get_model_discriminator_value (cyclomatic 17) invokeai/backend/model_manager/configs/base.py:159— Config_Base.get_model_discriminator_value 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.
ModelConfigFactory.from_model_on_disk (cyclomatic 17) invokeai/backend/model_manager/configs/factory.py:1005— ModelConfigFactory.from_model_on_disk 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.
ModelLoader._load_and_cache (cyclomatic 17) invokeai/backend/model_manager/load/load_default.py:364— ModelLoader._load_and_cache 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.
counted_dtypes.return_to_counted_dtypes (cyclomatic 17) invokeai/backend/model_manager/load/model_cache/counted_dtypes.py:21— counted_dtypes.return_to_counted_dtypes 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.
QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile (cyclomatic 17) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:492— QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile 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.
select_hf_files.filter_files (cyclomatic 17) invokeai/backend/model_manager/util/select_hf_files.py:22— select_hf_files.filter_files 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.
LayerPatcher.apply_smart_model_patch (cyclomatic 17) invokeai/backend/patches/layer_patcher.py:126— LayerPatcher.apply_smart_model_patch 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.
attention._report_unpinned_call (cyclomatic 17) invokeai/backend/util/attention.py:764— attention._report_unpinned_call 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.
TorchDevice.get_generation_devices (cyclomatic 17) invokeai/backend/util/devices.py:363— TorchDevice.get_generation_devices 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.
sage_attention.install_sage_attention (cyclomatic 17) invokeai/backend/util/sage_attention.py:281— sage_attention.install_sage_attention 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.
ProbeScope.open_window (cyclomatic 17) invokeai/backend/working_memory/probe.py:514— ProbeScope.open_window 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.
MediaImportProcessor.import_image (cyclomatic 17) invokeai/frontend/install/import_images.py:569— MediaImportProcessor.import_image 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.
translation-checks.comparePage (cyclomatic 17) docs/src/lib/translation-checks.mjs:145— translation-checks.comparePage 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.
useMediaCookieRefresh.useMediaCookieRefresh (cyclomatic 17) invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:68— useMediaCookieRefresh.useMediaCookieRefresh 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 7 function literals inside it that branch (lines 99, 136, 151, …). 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.
Filter.FilterContentAdvanced (cyclomatic 17) invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:33— Filter.FilterContentAdvanced 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.
paramsSlice.applyParamsVersionMigrations (cyclomatic 17) invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1080— paramsSlice.applyParamsVersionMigrations 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.
Editor.createKonvaCropInteractionHandle (cyclomatic 17) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:418— Editor.createKonvaCropInteractionHandle 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 4 function literals inside it that branch (lines 446, 434, 466, …). 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.
ModelList.ModelList (cyclomatic 17) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelList.tsx:40— ModelList.ModelList has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 63, 99, 153, …). 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.
AddNodeCmdk.filter (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:304— AddNodeCmdk.filter 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.
SavedWorkflowFieldInputComponent.SavedWorkflowFieldInputComponent (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SavedWorkflowFieldInputComponent.tsx:33— SavedWorkflowFieldInputComponent.SavedWorkflowFieldInputComponent has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 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.
buildSD1Graph.buildSD1Graph (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:30— buildSD1Graph.buildSD1Graph 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.
buildWanGraph.buildWanGraph (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildWanGraph.ts:40— buildWanGraph.buildWanGraph has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpscaleWarning.UpscaleWarning (cyclomatic 17) invokeai/frontend/webv1/src/features/settingsAccordions/components/UpscaleSettingsAccordion/UpscaleWarning.tsx:17— UpscaleWarning.UpscaleWarning has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 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.
SettingsModal.SettingsModal (cyclomatic 17) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsModal.tsx:79— SettingsModal.SettingsModal 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 3 function literals inside it that branch (lines 133, 126, 273). 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.
mock-backend.galleryMediaUsage (cyclomatic 17) invokeai/frontend/webv2/scripts/mock-backend.mjs:712— mock-backend.galleryMediaUsage has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 4 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.
run-accessibility-journeys.runNativeWidgetRecoveryJourney (cyclomatic 17) REDACTED:1669— run-accessibility-journeys.runNativeWidgetRecoveryJourney has cyclomatic complexity 17 (threshold 15). 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, 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.
GalleryProgressSection.GalleryProgressTile (cyclomatic 17) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:205— GalleryProgressSection.GalleryProgressTile has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
addRegionalGuidance.getDraftRejectionReason (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:173— addRegionalGuidance.getDraftRejectionReason 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.
baseGenerationPolicies.getGenerationModelAvailabilityIssues (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2452— baseGenerationPolicies.getGenerationModelAvailabilityIssues has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
baseGenerationPolicies.getGenerationValidationIssues (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:3058— baseGenerationPolicies.getGenerationValidationIssues 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.
graph.buildZImageGraph (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/graph.ts:1192— graph.buildZImageGraph 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.
resolveGenerateWidgetValues.resolveGenerateWidgetValues (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/resolveGenerateWidgetValues.ts:71— resolveGenerateWidgetValues.resolveGenerateWidgetValues 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.
modelDefaultSettings.getSettingDefaultSource (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/ui/shared/modelDefaultSettings.ts:31— modelDefaultSettings.getSettingDefaultSource 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.
GenerateDimensionFields.GenerateDimensionFields::renderSection (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:643— GenerateDimensionFields.GenerateDimensionFields::renderSection 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 (GenerateDimensionFields.GenerateDimensionFields) 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.
GenerateSettingsForm.GenerateSettingsForm (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx:53— GenerateSettingsForm.GenerateSettingsForm 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 10 function items inside it that branch (a function literal at line 264, a function literal at line 101, a function literal at line 205, …). 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.
WorkingMemorySection.WorkingMemorySection (cyclomatic 17) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:70— WorkingMemorySection.WorkingMemorySection has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runtime.createQueueRuntime.processQueueItems (cyclomatic 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:2471— runtime.createQueueRuntime.processQueueItems 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.
queueMenuActions.getQueueActionDescriptors (cyclomatic 17) invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx:123— queueMenuActions.getQueueActionDescriptors 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.
batch.getWorkflowGeneratorPropertyInvalidReason (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:402— batch.getWorkflowGeneratorPropertyInvalidReason 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.
useEraser.useEraser (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/ui/editor/useEraser.tsx:103— useEraser.useEraser has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (eraseSegment, onPointerDownCapture, addPoint, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
NumericInput.NumericInput (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx:79— NumericInput.NumericInput has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
selectorCore.shallowEqual (cyclomatic 17) invokeai/frontend/webv2/src/platform/state/selectorCore.ts:11— selectorCore.shallowEqual has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
FeatureHint.createHintSession.startCorridor (cyclomatic 17) invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.tsx:171— FeatureHint.createHintSession.startCorridor has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (isOverCard, a function literal at line 201, a function literal at line 219). 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.
draftStore.decideUnloadJournalEntry (cyclomatic 17) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:802— draftStore.decideUnloadJournalEntry has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: draftStore.isProjectUnloadJournalEntry (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
useStagedResultGallerySave.useStagedResultGallerySave.save (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/canvas/useStagedResultGallerySave.ts:50— useStagedResultGallerySave.useStagedResultGallerySave.save 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 2 function items inside it that branch (run, a function literal at line 62). 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.
layerRowSummary.layerRowSummary (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowSummary.ts:6— layerRowSummary.layerRowSummary 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.
LayerSurfaceHost.LayerSurfaceHost (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsx:39— LayerSurfaceHost.LayerSurfaceHost has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: 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.
LayerSection.resolveChildEditor (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx:84— LayerSection.resolveChildEditor 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.
compositor.drawCachedLayer (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:388— compositor.drawCachedLayer 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.
focusRegions.createWorkbenchFocusController.moveFocus (cyclomatic 17) invokeai/frontend/webv2/src/workbench/focusRegions.tsx:117— focusRegions.createWorkbenchFocusController.moveFocus has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (settle, attempt, isCurrent, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ThumbnailController.request (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:142— ThumbnailController.request 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.
groupSurfaceCache.createGroupSurfaceCache.showSpatial (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:642— groupSurfaceCache.createGroupSurfaceCache.showSpatial has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
overlayRenderer.traceBboxFrameBand (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts:749— overlayRenderer.traceBboxFrameBand 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.
filterOperationSession.createFilterOperationSession.process (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts:167— filterOperationSession.createFilterOperationSession.process has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 176). 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.
filterGraphs.buildFilterGraph (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-operations/filterGraphs.ts:332— filterGraphs.buildFilterGraph 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.
keys.eventToHotkeyString (cyclomatic 17) invokeai/frontend/webv2/src/workbench/hotkeys/keys.ts:75— keys.eventToHotkeyString 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.
usePaletteNavigation.usePaletteNavigation.onSearchKeyDown (cyclomatic 17) invokeai/frontend/webv2/src/workbench/palette/usePaletteNavigation.ts:157— usePaletteNavigation.usePaletteNavigation.onSearchKeyDown 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.
queueRecall.buildQueueRecallValues (cyclomatic 17) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:193— queueRecall.buildQueueRecallValues 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.
HotkeysSettingsSection.HotkeyListRow (cyclomatic 17) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:301— HotkeysSettingsSection.HotkeyListRow has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SettingsDialog.SettingsDialog (cyclomatic 17) invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx:74— SettingsDialog.SettingsDialog has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CenterArea.CenterArea (cyclomatic 17) invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:86— CenterArea.CenterArea has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WidgetFrames.WidgetPanelFrame (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx:34— WidgetFrames.WidgetPanelFrame has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ControlAdapterRows.ControlAdapterRows (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlAdapterRows.tsx:36— ControlAdapterRows.ControlAdapterRows has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 8 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MossImageDenoiseInvocation._run_diffusion (cyclomatic 16) invokeai/app/invocations/moss_image/moss_image_denoise.py:102— MossImageDenoiseInvocation._run_diffusion 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.
SD3DenoiseInvocation._run_diffusion (cyclomatic 16) invokeai/app/invocations/sd3/sd3_denoise.py:274— SD3DenoiseInvocation._run_diffusion 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.
run_app.run_app (cyclomatic 16) invokeai/app/run_app.py:111— run_app.run_app 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_default.migrate_v3_config_dict (cyclomatic 16) invokeai/app/services/config/config_default.py:584— config_default.migrate_v3_config_dict 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.
image_index_common.blobs_to_embeddings (cyclomatic 16) invokeai/app/services/image_index/image_index_common.py:94— image_index_common.blobs_to_embeddings 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.
ImageIndexService._process_batch (cyclomatic 16) invokeai/app/services/image_index/image_index_default.py:1422— ImageIndexService._process_batch 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.
gallery._conditions (cyclomatic 16) invokeai/app/services/shared/database/queries/gallery.py:163— gallery._conditions 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.
images._conditions (cyclomatic 16) invokeai/app/services/shared/database/queries/images.py:196— images._conditions 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.
ContinuationRecord.transition (cyclomatic 16) invokeai/app/services/shared/execution_engine/primitives.py:470— ContinuationRecord.transition 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.
GraphExecutionState._validate_for_continuation_output (cyclomatic 16) invokeai/app/services/shared/graph.py:2019— GraphExecutionState._validate_for_continuation_output 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.
GraphExecutionState._validate_output_owner (cyclomatic 16) invokeai/app/services/shared/graph.py:2531— GraphExecutionState._validate_output_owner 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.
_ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch (cyclomatic 16) invokeai/app/services/shared/graph_materializer.py:2170— _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch 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.
graph_nested_iterate_planner._get_exact_nested_iterate_body (cyclomatic 16) invokeai/app/services/shared/graph_nested_iterate_planner.py:21— graph_nested_iterate_planner._get_exact_nested_iterate_body 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.
Graph._get_upstream_collector_ids (cyclomatic 16) invokeai/app/services/shared/graph_validation.py:767— Graph._get_upstream_collector_ids 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.
graph_validation.are_connection_types_compatible (cyclomatic 16) invokeai/app/services/shared/graph_validation.py:275— graph_validation.are_connection_types_compatible 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.
workflow_call_compatibility._get_placeholder_for_annotation (cyclomatic 16) invokeai/app/services/shared/workflow_call_compatibility.py:56— workflow_call_compatibility._get_placeholder_for_annotation 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.
WorkingMemoryCalibrationService._prepare_run (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:826— WorkingMemoryCalibrationService._prepare_run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkingMemoryCalibrationService._attempt_blocks (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:962— WorkingMemoryCalibrationService._attempt_blocks 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.
WorkingMemoryCalibrationService._held_back (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1568— WorkingMemoryCalibrationService._held_back 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.
video_thumbnails._iter_video_frames_unbounded (cyclomatic 16) invokeai/app/util/video_thumbnails.py:211— video_thumbnails._iter_video_frames_unbounded 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.
ModelCache._load_locked_model (cyclomatic 16) invokeai/backend/model_manager/load/model_cache/model_cache.py:2118— ModelCache._load_locked_model has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelCache._log_cache_state (cyclomatic 16) invokeai/backend/model_manager/load/model_cache/model_cache.py:2694— ModelCache._log_cache_state 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.
Flux2DiffusersModel._load_model (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/flux.py:1170— Flux2DiffusersModel._load_model 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.
flux3.flux3_transformer_from_single_file (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/flux3.py:111— flux3.flux3_transformer_from_single_file 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.
GenericDiffusersLoader.get_hf_load_class (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py:52— GenericDiffusersLoader.get_hf_load_class 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.
Ideogram4CheckpointModel._load_model (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/ideogram4.py:357— Ideogram4CheckpointModel._load_model 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.
ModelSearch._walk_directory (cyclomatic 16) invokeai/backend/model_manager/search.py:107— ModelSearch._walk_directory 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.
model_util.lora_token_vector_length (cyclomatic 16) invokeai/backend/model_manager/util/model_util.py:87— model_util.lora_token_vector_length 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.
fp8_scaled.find_torchao_fp8_problem (cyclomatic 16) invokeai/backend/quantization/fp8_scaled.py:520— fp8_scaled.find_torchao_fp8_problem 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.
ggml_tensor.dequantize_and_run (cyclomatic 16) invokeai/backend/quantization/gguf/ggml_tensor.py:15— ggml_tensor.dequantize_and_run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fit.two_phase_envelope (cyclomatic 16) invokeai/backend/working_memory/fit.py:415— fit.two_phase_envelope 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.
_Window._close (cyclomatic 16) invokeai/backend/working_memory/probe.py:444— _Window._close 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.
remark-localize-assets.remarkLocalizeAssets.<returned closure> (cyclomatic 16) docs/plugins/remark-localize-assets.mjs:21— remark-localize-assets.remarkLocalizeAssets.<returned closure> has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 40, toSource). 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.
typegen.generateTypes (cyclomatic 16) invokeai/frontend/api/scripts/typegen.js:10— typegen.generateTypes has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CanvasEntityAdapterControlLayer.sync (cyclomatic 16) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterControlLayer.ts:35— CanvasEntityAdapterControlLayer.sync 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.
CanvasEntityTransformer.syncInteractionState (cyclomatic 16) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:664— CanvasEntityTransformer.syncInteractionState 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.
GalleryImage.buildOnClick.<returned closure> (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx:42— GalleryImage.buildOnClick.<returned closure> 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.
CurrentImageButtons.CurrentImageButtons (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentImageButtons.tsx:35— CurrentImageButtons.CurrentImageButtons has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
selectedItemReveal.createSelectedItemRevealMachine.sync (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/selectedItemReveal.ts:131— selectedItemReveal.createSelectedItemRevealMachine.sync has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ExternalProvidersForm.ProviderCard (cyclomatic 16) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ExternalProviders/ExternalProvidersForm.tsx:162— ExternalProvidersForm.ProviderCard has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 184, 205, 177, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
buildExternalGraph.buildExternalGraph (cyclomatic 16) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildExternalGraph.ts:33— buildExternalGraph.buildExternalGraph 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.
buildSD3Graph.buildSD3Graph (cyclomatic 16) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD3Graph.ts:32— buildSD3Graph.buildSD3Graph 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.
validateWorkflow.refreshCallSavedWorkflowDynamicInputs (cyclomatic 16) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:57— validateWorkflow.refreshCallSavedWorkflowDynamicInputs 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.
ExpandPromptButton.ExpandPromptButton (cyclomatic 16) invokeai/frontend/webv1/src/features/prompt/ExpandPromptButton.tsx:48— ExpandPromptButton.ExpandPromptButton has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
readiness.pushWanReasons (cyclomatic 16) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:308— readiness.pushWanReasons 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.
readiness.getReasonsWhyCannotEnqueueWorkflowsTab (cyclomatic 16) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:642— readiness.getReasonsWhyCannotEnqueueWorkflowsTab has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GalleryWidgetView.GalleryWidgetView (cyclomatic 16) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsx:93— GalleryWidgetView.GalleryWidgetView has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
addRegionalGuidance.addRegionalGuidance (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:393— addRegionalGuidance.addRegionalGuidance 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.
promptFocus.getActiveTriggerQuery (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptFocus.ts:189— promptFocus.getActiveTriggerQuery 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.
PositivePromptField.PositivePromptField (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx:80— PositivePromptField.PositivePromptField has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GenerateFieldContextMenu.GenerateFieldContextMenu (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateFieldContextMenu.tsx:85— GenerateFieldContextMenu.GenerateFieldContextMenu has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (handleContextMenu, a function literal at line 155, a function literal at line 158). 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.
baseGenerationPolicies.getDimensionValidationIssues (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2565— baseGenerationPolicies.getDimensionValidationIssues has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
baseGenerationPolicies.getModelFamilyValidationIssues (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2946— baseGenerationPolicies.getModelFamilyValidationIssues 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.
DefaultSettingsSection.FieldControl (cyclomatic 16) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:64— DefaultSettingsSection.FieldControl has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RelatedModelsSection.RelatedModelsForModel (cyclomatic 16) invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx:35— RelatedModelsSection.RelatedModelsForModel has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (handleAdd, handleRemove, a function literal at line 45, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
submissionApi.enqueueUtility (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/data/submissionApi.ts:123— submissionApi.enqueueUtility has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: submissionApi.mapEnqueueResult (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
utilityGraph.submitUtilityGraph (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:508— utilityGraph.submitUtilityGraph has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.cloneVideoWidgetValues (cyclomatic 16) invokeai/frontend/webv2/src/features/video/core/settings.ts:550— settings.cloneVideoWidgetValues has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
libraryBrowseStore.revalidateSelected (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:969— libraryBrowseStore.revalidateSelected has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: 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.
WorkflowDocumentGraph.NodeCard (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:658— WorkflowDocumentGraph.NodeCard has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, 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.
projectWorkflowEntries.queryProjectWorkflowEntries (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/ui/library/projectWorkflowEntries.ts:126— projectWorkflowEntries.queryProjectWorkflowEntries has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ManagerLayout.ManagerLayout::watchFocus::tick (cyclomatic 16) invokeai/frontend/webv2/src/platform/ui/ManagerLayout.tsx:228— ManagerLayout.ManagerLayout::watchFocus::tick has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
api.settleProjectCreate (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/api.ts:521— api.settleProjectCreate has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (settleConflict, settleUnanswered, classify). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
assetTransport.createAssetResponseReader.<returned closure> (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:144— assetTransport.createAssetResponseReader.<returned closure> has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useLayerSelectionCommands.useLayerSelectionCommands (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerSelectionCommands.ts:23— useLayerSelectionCommands.useLayerSelectionCommands has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
floatingWindows.validateFloatingWidgets (cyclomatic 16) invokeai/frontend/webv2/src/workbench/floatingWindows.ts:267— floatingWindows.validateFloatingWidgets has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
workbenchState.reconcileCanvasStagingFollow (cyclomatic 16) invokeai/frontend/webv2/src/workbench/workbenchState.ts:1522— workbenchState.reconcileCanvasStagingFollow has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: workbenchState.isLayoutPresetSnapshot (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
canvasDimsSync.reconcileCanvasDims (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:113— canvasDimsSync.reconcileCanvasDims has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
canvasDimsSync.createCanvasDimsSync.syncFrame (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:221— canvasDimsSync.createCanvasDimsSync.syncFrame 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.
canvasDimsSync.createCanvasDimsSync.syncRenderSize (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:306— canvasDimsSync.createCanvasDimsSync.syncRenderSize has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
invocationSubmit.submitResolvedInvocation (cyclomatic 16) invokeai/frontend/webv2/src/workbench/invocationSubmit.ts:210— invocationSubmit.submitResolvedInvocation 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.
ControlDerivationController.commitControlLayerPatch (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:110— ControlDerivationController.commitControlLayerPatch 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.
FloatingSelectionController.lift (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/floatingSelectionController.ts:116— FloatingSelectionController.lift 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.
shapeTool.resolveTarget (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:164— shapeTool.resolveTarget 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.
selectObjectSession.createSelectObjectSession.process (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:449— selectObjectSession.createSelectObjectSession.process has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
filterGraphs.resolveSettings (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/filterGraphs.ts:288— filterGraphs.resolveSettings has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
entries.buildSettingsEntries (cyclomatic 16) invokeai/frontend/webv2/src/workbench/palette/entries.ts:413— entries.buildSettingsEntries has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 421, 513, 512). 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.
fonts.readEmbeddedFonts (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:109— fonts.readEmbeddedFonts has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
importProject.readInvkArchive (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/invk/importProject.ts:104— importProject.readInvkArchive 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.
queueRecall.getQueueRecallAvailability (cyclomatic 16) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:125— queueRecall.getQueueRecallAvailability 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.
HotkeysSettingsSection.canScopesOverlap (cyclomatic 16) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:101— HotkeysSettingsSection.canScopesOverlap 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.
IterationsField.IterationsField (cyclomatic 16) invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx:22— IterationsField.IterationsField has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 43, 25, 37). 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.
WidgetRenderer.WidgetRecoveryBoundary (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.tsx:209— WidgetRenderer.WidgetRecoveryBoundary has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mock-backend.startMockBackend.server (cognitive 1147) invokeai/frontend/webv2/scripts/mock-backend.mjs:1332— mock-backend.startMockBackend.server has cognitive complexity 1147 (threshold 15). Drivers by points: if/else 318 (656 pts), boolean chains 214, ternaries 83 (201 pts), loops 26 (73 pts), error handling 2 (3 pts) (nesting depth added 504). Of this number, 1110 points are the body's own statements and 37 belong to 20 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
modelSelected.addModelSelectedListener (cognitive 565) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97— modelSelected.addModelSelectedListener has cognitive complexity 565 (threshold 15). Drivers by points: if/else 145 (452 pts), ternaries 14 (57 pts), boolean chains 48, loops 3 (8 pts) (nesting depth added 355). None of this is in the body itself: all 565 points belong to 9 function literals inside it that branch (lines 100, 739, 118, …). 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.
workbenchState.reduceWorkbenchAction (cognitive 502) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4738— workbenchState.reduceWorkbenchAction has cognitive complexity 502 (threshold 15). Drivers by points: ternaries 117 (252 pts), if/else 80 (163 pts), boolean chains 75, loops 5 (11 pts), match/switch 1 (nesting depth added 224). Of this number, 174 points are the body's own statements and 328 belong to 74 function items inside it that branch. 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.
GalleryImageGrid.GalleryImageGrid (cognitive 450) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:445— GalleryImageGrid.GalleryImageGrid has cognitive complexity 450 (threshold 15). Drivers by points: ternaries 94 (204 pts), if/else 90 (145 pts), boolean chains 92, loops 5 (9 pts) (nesting depth added 169). Of this number, 139 points are the body's own statements and 311 belong to 47 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.
GraphExecutionState._validate_effects (cognitive 360) invokeai/app/services/shared/graph.py:2565— GraphExecutionState._validate_effects has cognitive complexity 360 (threshold 15). Drivers by points: if/else 90 (246 pts), ternaries 29 (85 pts), boolean chains 24, error handling 1 (3 pts), loops 2 (nesting depth added 214). 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.
readiness.getReasonsWhyCannotEnqueueCanvasTab (cognitive 300) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773— readiness.getReasonsWhyCannotEnqueueCanvasTab has cognitive complexity 300 (threshold 15). Drivers by points: if/else 128 (274 pts), boolean chains 24, loops 1 (2 pts) (nesting depth added 147). Of this number, 294 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LayersTree.LayersTree (cognitive 281) invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:174— LayersTree.LayersTree has cognitive complexity 281 (threshold 15). Drivers by points: if/else 97 (128 pts), ternaries 64 (95 pts), boolean chains 53, loops 4 (5 pts) (nesting depth added 63). Of this number, 37 points are the body's own statements and 244 belong to 50 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.
setEventListeners.setEventListeners (cognitive 266) invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:86— setEventListeners.setEventListeners has cognitive complexity 266 (threshold 15). Drivers by points: if/else 79 (150 pts), ternaries 16 (68 pts), boolean chains 24, error handling 4 (19 pts), loops 3 (5 pts) (nesting depth added 140). None of this is in the body itself: all 266 points belong to 39 function items inside it that branch (a function literal at line 594, a function literal at line 836, a function literal at line 719, …). 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.
useImageActions.useImageActions (cognitive 200) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:263— useImageActions.useImageActions has cognitive complexity 200 (threshold 15). Drivers by points: if/else 82 (111 pts), ternaries 22 (31 pts), boolean chains 25, error handling 15 (21 pts), loops 12 (nesting depth added 44). None of this is in the body itself: all 200 points belong to 51 function literals inside it that branch (lines 529, 1027, 644, …). 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.
recallParameters.buildRecallParametersSettings (cognitive 177) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:189— recallParameters.buildRecallParametersSettings has cognitive complexity 177 (threshold 15). Drivers by points: if/else 58 (90 pts), ternaries 30 (59 pts), boolean chains 20, loops 5 (8 pts) (nesting depth added 64). Of this number, 157 points are the body's own statements and 20 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils.pred_squares (cognitive 163) invokeai/backend/image_util/mlsd/utils.py:97— utils.pred_squares has cognitive complexity 163 (threshold 15). Drivers by points: if/else 20 (81 pts), loops 17 (54 pts), boolean chains 20, error handling 4, ternaries 2 (4 pts) (nesting depth added 100). 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.
lora._is_flux2_lora_state_dict (cognitive 156) invokeai/backend/model_manager/configs/lora.py:410— lora._is_flux2_lora_state_dict has cognitive complexity 156 (threshold 15). Drivers by points: if/else 46 (125 pts), boolean chains 21, loops 8 (10 pts) (nesting depth added 81). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readiness.getReasonsWhyCannotEnqueueGenerateTab (cognitive 150) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357— readiness.getReasonsWhyCannotEnqueueGenerateTab has cognitive complexity 150 (threshold 15). Drivers by points: if/else 62 (124 pts), boolean chains 24, loops 1 (2 pts) (nesting depth added 63). Of this number, 148 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LayerContextMenu.LayerMenu (cognitive 150) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:224— LayerContextMenu.LayerMenu has cognitive complexity 150 (threshold 15). Drivers by points: if/else 61 (67 pts), ternaries 36 (64 pts), boolean chains 14, match/switch 3, error handling 1 (2 pts) (nesting depth added 35). Most of this is not in the body itself: 8 of the 150 points are its own statements and the rest belongs to 39 function literals inside it that branch (lines 505, 380, 777, …). 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.
WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cognitive 149) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:110— WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel has cognitive complexity 149 (threshold 15). Drivers by points: ternaries 50 (101 pts), if/else 15 (22 pts), boolean chains 21, loops 2 (3 pts), error handling 2 (nesting depth added 59). Of this number, 105 points are the body's own statements and 44 belong to 13 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
video_smart_concat.try_build_smart_render_plan (cognitive 147) invokeai/app/util/video_smart_concat.py:60— video_smart_concat.try_build_smart_render_plan has cognitive complexity 147 (threshold 15). Drivers by points: if/else 55 (109 pts), boolean chains 24, loops 7 (11 pts), ternaries 3 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
legacyCanvasMetadata.convertLegacyCanvasMetadata (cognitive 143) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:486— legacyCanvasMetadata.convertLegacyCanvasMetadata has cognitive complexity 143 (threshold 15). Drivers by points: ternaries 18 (62 pts), if/else 20 (56 pts), boolean chains 14, loops 3 (7 pts), error handling 1 (4 pts) (nesting depth added 87). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addRegions.addRegions (cognitive 141) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addRegions.ts:84— addRegions.addRegions has cognitive complexity 141 (threshold 15). Drivers by points: loops 20 (75 pts), if/else 45 (63 pts), boolean chains 3 (nesting depth added 73). 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.
validateConnection.validateConnection (cognitive 140) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnection.ts:202— validateConnection.validateConnection has cognitive complexity 140 (threshold 15). Drivers by points: if/else 42 (116 pts), boolean chains 13, loops 2 (8 pts), ternaries 1 (3 pts) (nesting depth added 82). Of this number, 133 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WorkflowEditorView.WorkflowFlow (cognitive 137) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:326— WorkflowEditorView.WorkflowFlow has cognitive complexity 137 (threshold 15). Drivers by points: if/else 59 (62 pts), ternaries 36 (39 pts), boolean chains 34, loops 1, match/switch 1 (nesting depth added 6). Of this number, 22 points are the body's own statements and 115 belong to 52 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
legacyCanvasMetadata.rasterizeLegacyObjects (cognitive 130) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:198— legacyCanvasMetadata.rasterizeLegacyObjects has cognitive complexity 130 (threshold 15). Drivers by points: if/else 46 (86 pts), loops 8 (22 pts), boolean chains 11, ternaries 3 (11 pts) (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validateWorkflow.validateWorkflow (cognitive 129) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140— validateWorkflow.validateWorkflow has cognitive complexity 129 (threshold 15). Drivers by points: if/else 34 (91 pts), boolean chains 13, loops 7 (12 pts), ternaries 4 (10 pts), error handling 1 (3 pts) (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryPickerView.GalleryPickerView (cognitive 128) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67— GalleryPickerView.GalleryPickerView has cognitive complexity 128 (threshold 15). Drivers by points: ternaries 39 (72 pts), if/else 22 (31 pts), boolean chains 24, loops 1 (nesting depth added 42). Of this number, 78 points are the body's own statements and 50 belong to 10 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
videoPolicies.getVideoValidationIssues (cognitive 123) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2424— videoPolicies.getVideoValidationIssues has cognitive complexity 123 (threshold 15). Drivers by points: if/else 39 (57 pts), boolean chains 32, ternaries 15 (31 pts), loops 2 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise.denoise (cognitive 121) invokeai/backend/flux2/denoise.py:25— denoise.denoise has cognitive complexity 121 (threshold 15). Drivers by points: if/else 27 (79 pts), ternaries 10 (34 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 78). 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.
executeVideoRecall.applyVideoRecallMetadata (cognitive 120) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:303— executeVideoRecall.applyVideoRecallMetadata has cognitive complexity 120 (threshold 15). Drivers by points: if/else 26 (65 pts), ternaries 13 (40 pts), boolean chains 11, loops 1 (3 pts), error handling 1 (nesting depth added 68). Of this number, 118 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WorkflowLibraryGrid.WorkflowLibraryGrid (cognitive 116) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:152— WorkflowLibraryGrid.WorkflowLibraryGrid has cognitive complexity 116 (threshold 15). Drivers by points: if/else 49 (55 pts), boolean chains 29, ternaries 22 (28 pts), loops 3 (4 pts) (nesting depth added 13). Of this number, 18 points are the body's own statements and 98 belong to 23 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
VideoWidgetView.VideoWidgetView (cognitive 110) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:147— VideoWidgetView.VideoWidgetView has cognitive complexity 110 (threshold 15). Drivers by points: ternaries 49 (76 pts), boolean chains 20, if/else 14 (nesting depth added 27). Of this number, 82 points are the body's own statements and 28 belong to 14 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildFLUXGraph.buildFLUXGraph (cognitive 108) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55— buildFLUXGraph.buildFLUXGraph has cognitive complexity 108 (threshold 15). Drivers by points: if/else 67 (104 pts), boolean chains 19, ternaries 3 (7 pts), loops 2 (6 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. This shape REPEATS in the file: one other method here (buildFLUXGraph.buildFLUXGraph::addFlux2Features) 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.
canvasRecall.prepareCanvasRecall (cognitive 107) invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:155— canvasRecall.prepareCanvasRecall has cognitive complexity 107 (threshold 15). Drivers by points: if/else 43 (84 pts), boolean chains 35, ternaries 8 (31 pts), loops 7 (15 pts), error handling 2 (4 pts) (nesting depth added 74). 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 (canvasRecall.prepareCanvasRecall::lookupImages) 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.
parseFieldType.parseFieldType (cognitive 106) invokeai/frontend/webv1/src/features/nodes/util/schema/parseFieldType.ts:45— parseFieldType.parseFieldType has cognitive complexity 106 (threshold 15). Drivers by points: if/else 32 (99 pts), boolean chains 7 (nesting depth added 67). Of this number, 97 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
canvasProjectMutations.applyCanvasProjectMutation (cognitive 105) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:796— canvasProjectMutations.applyCanvasProjectMutation has cognitive complexity 105 (threshold 15). Drivers by points: ternaries 28 (60 pts), if/else 13 (26 pts), boolean chains 16, loops 1 (2 pts), match/switch 1 (nesting depth added 46). Of this number, 80 points are the body's own statements and 25 belong to 10 function literals inside it that branch. 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.
videoRecall.buildVideoRecallSettings (cognitive 105) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:667— videoRecall.buildVideoRecallSettings has cognitive complexity 105 (threshold 15). Drivers by points: if/else 38 (53 pts), boolean chains 30, ternaries 12 (20 pts), loops 2 (nesting depth added 23). Of this number, 103 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch.planWorkflowBatch (cognitive 103) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:682— batch.planWorkflowBatch has cognitive complexity 103 (threshold 15). Drivers by points: if/else 26 (59 pts), ternaries 8 (26 pts), boolean chains 14, loops 3 (4 pts) (nesting depth added 52). Of this number, 95 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
workbenchState.enqueueCompiledSnapshot (cognitive 103) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4227— workbenchState.enqueueCompiledSnapshot has cognitive complexity 103 (threshold 15). Drivers by points: ternaries 49 (91 pts), boolean chains 12 (nesting depth added 42). Of this number, 97 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputFieldRenderer.InputFieldRenderer (cognitive 101) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx:93— InputFieldRenderer.InputFieldRenderer has cognitive complexity 101 (threshold 15). Drivers by points: if/else 62 (98 pts), boolean chains 3 (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.
LayerRow.LayerRowComponent (cognitive 98) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:77— LayerRow.LayerRowComponent has cognitive complexity 98 (threshold 15). Drivers by points: ternaries 42 (70 pts), boolean chains 16, if/else 12 (nesting depth added 28). Of this number, 79 points are the body's own statements and 19 belong to 9 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_if_dependencies._can_use_fresh_flat_if_activation (cognitive 95) invokeai/app/services/shared/graph_if_dependencies.py:195— graph_if_dependencies._can_use_fresh_flat_if_activation has cognitive complexity 95 (threshold 15). Drivers by points: if/else 26 (69 pts), boolean chains 13, loops 4 (12 pts), error handling 1 (nesting depth added 51). 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.
_ExecutionNodeBuilder.prepare (cognitive 95) invokeai/app/services/shared/graph_materializer.py:2385— _ExecutionNodeBuilder.prepare has cognitive complexity 95 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 8 (26 pts), boolean chains 15, ternaries 7 (15 pts), error handling 1 (2 pts) (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
workflow-demo-client.mountWorkflowDemo (cognitive 95) docs/src/lib/components/tour/workflow-demo-client.ts:43— workflow-demo-client.mountWorkflowDemo has cognitive complexity 95 (threshold 15). Drivers by points: if/else 31 (49 pts), loops 16 (18 pts), boolean chains 15, ternaries 8 (13 pts) (nesting depth added 25). Most of this is not in the body itself: 10 of the 95 points are its own statements and the rest belongs to 19 function items inside it that branch (endConnection, updateEdgePaths, a function literal at line 344, …). 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.
document.applyProjectGraphAction (cognitive 93) invokeai/frontend/webv2/src/features/workflow/core/document.ts:915— document.applyProjectGraphAction has cognitive complexity 93 (threshold 15). Drivers by points: if/else 19 (39 pts), ternaries 15 (32 pts), boolean chains 19, loops 1 (2 pts), match/switch 1 (nesting depth added 38). Of this number, 57 points are the body's own statements and 36 belong to 10 function literals inside it that branch. 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.
canvasHotkeyCommands.executeCanvasHotkeyCommand (cognitive 93) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:179— canvasHotkeyCommands.executeCanvasHotkeyCommand has cognitive complexity 93 (threshold 15). Drivers by points: if/else 37 (56 pts), boolean chains 22, ternaries 7 (15 pts) (nesting depth added 27). Of this number, 81 points are the body's own statements and 12 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
lora._get_flux2_lora_variant (cognitive 92) invokeai/backend/model_manager/configs/lora.py:614— lora._get_flux2_lora_variant has cognitive complexity 92 (threshold 15). Drivers by points: if/else 32 (75 pts), boolean chains 11, loops 6 (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.
ScrubberField.ScrubberField (cognitive 92) invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:235— ScrubberField.ScrubberField has cognitive complexity 92 (threshold 15). Drivers by points: if/else 33 (38 pts), ternaries 29 (36 pts), boolean chains 16, error handling 1, match/switch 1 (nesting depth added 12). Of this number, 19 points are the body's own statements and 73 belong to 28 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PreviewWidgetView.PreviewWidgetView (cognitive 92) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:186— PreviewWidgetView.PreviewWidgetView has cognitive complexity 92 (threshold 15). Drivers by points: ternaries 33 (48 pts), boolean chains 22, if/else 19 (20 pts), error handling 1 (2 pts) (nesting depth added 17). Of this number, 37 points are the body's own statements and 55 belong to 17 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AddModelsView.AddModelsView (cognitive 89) invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx:78— AddModelsView.AddModelsView has cognitive complexity 89 (threshold 15). Drivers by points: ternaries 24 (36 pts), if/else 22 (32 pts), boolean chains 20, loops 1 (nesting depth added 22). Of this number, 40 points are the body's own statements and 49 belong to 17 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.
WorkflowLibraryDialog.WorkflowLibraryDialog (cognitive 89) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx:280— WorkflowLibraryDialog.WorkflowLibraryDialog has cognitive complexity 89 (threshold 15). Drivers by points: ternaries 34 (45 pts), if/else 27 (28 pts), boolean chains 16 (nesting depth added 12). Of this number, 30 points are the body's own statements and 59 belong to 22 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GenerateAdvancedFields.GenerateAdvancedFields (cognitive 88) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:93— GenerateAdvancedFields.GenerateAdvancedFields has cognitive complexity 88 (threshold 15). Drivers by points: ternaries 28 (48 pts), boolean chains 31, if/else 5 (9 pts) (nesting depth added 24). Of this number, 72 points are the body's own statements and 16 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hidiffusion.apply_hidiffusion (cognitive 87) invokeai/backend/hidiffusion/hidiffusion.py:1990— hidiffusion.apply_hidiffusion has cognitive complexity 87 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 25, loops 5 (9 pts), ternaries 2 (3 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
videoPolicies.getVideoModelSelectionResult (cognitive 87) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1966— videoPolicies.getVideoModelSelectionResult has cognitive complexity 87 (threshold 15). Drivers by points: if/else 33 (50 pts), boolean chains 21, ternaries 8 (14 pts), loops 2 (nesting depth added 23). Of this number, 86 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZImageDenoiseInvocation._run_diffusion (cognitive 84) invokeai/app/invocations/z_image/z_image_denoise.py:259— ZImageDenoiseInvocation._run_diffusion has cognitive complexity 84 (threshold 15). Drivers by points: if/else 39 (66 pts), boolean chains 8, ternaries 4 (6 pts), loops 2 (4 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageRecall.buildImageRecallSettings (cognitive 84) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1505— imageRecall.buildImageRecallSettings has cognitive complexity 84 (threshold 15). Drivers by points: if/else 34 (60 pts), boolean chains 19, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 28). Of this number, 82 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.createFontRuntime (cognitive 82) invokeai/frontend/webv2/src/features/fonts/runtime.ts:263— runtime.createFontRuntime has cognitive complexity 82 (threshold 15). Drivers by points: if/else 46 (54 pts), boolean chains 20, loops 7, ternaries 1 (nesting depth added 8). None of this is in the body itself: all 82 points belong to 24 function items inside it that branch (a function literal at line 452, removeState, a function literal at line 509, …). 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.
forLoops.validateForLoopGraph (cognitive 81) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:268— forLoops.validateForLoopGraph has cognitive complexity 81 (threshold 15). Drivers by points: if/else 57 (98 pts), boolean chains 71, loops 18 (29 pts), ternaries 2 (4 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph::supportsNestedIterateBody, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ProjectConflictBanner.ProjectConflictBanner (cognitive 81) invokeai/frontend/webv2/src/workbench/shell/ProjectConflictBanner.tsx:28— ProjectConflictBanner.ProjectConflictBanner has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 26 (56 pts), if/else 11 (15 pts), boolean chains 7, error handling 2 (3 pts) (nesting depth added 35). Of this number, 60 points are the body's own statements and 21 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useGalleryActions.useGalleryActions (cognitive 80) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryActions.ts:38— useGalleryActions.useGalleryActions has cognitive complexity 80 (threshold 15). Drivers by points: if/else 26 (37 pts), ternaries 14 (20 pts), boolean chains 16, error handling 7 (nesting depth added 17). Most of this is not in the body itself: 1 of the 80 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 120, 320, 233, …). 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.
WorkflowPublicationHost.WorkflowPublicationHost (cognitive 80) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowPublicationHost.tsx:91— WorkflowPublicationHost.WorkflowPublicationHost has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 32 (41 pts), boolean chains 19, if/else 16 (17 pts), error handling 2, match/switch 1 (nesting depth added 10). Of this number, 36 points are the body's own statements and 44 belong to 20 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PidNet.forward (cognitive 79) invokeai/backend/pid/_src/networks/pid_net.py:274— PidNet.forward has cognitive complexity 79 (threshold 15). Drivers by points: if/else 26 (44 pts), ternaries 9 (25 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddNodeDialog.AddNodeDialogContent (cognitive 79) invokeai/frontend/webv2/src/features/workflow/ui/editor/AddNodeDialog.tsx:375— AddNodeDialog.AddNodeDialogContent has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 22 (32 pts), if/else 25 (28 pts), boolean chains 14, loops 3 (5 pts) (nesting depth added 15). Of this number, 28 points are the body's own statements and 51 belong to 13 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PixDiT_T2I.forward (cognitive 78) invokeai/backend/pid/_src/networks/pixeldit_official.py:1412— PixDiT_T2I.forward has cognitive complexity 78 (threshold 15). Drivers by points: if/else 19 (41 pts), ternaries 8 (24 pts), loops 4 (9 pts), boolean chains 4 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
select_hf_files._filter_by_variant (cognitive 77) invokeai/backend/model_manager/util/select_hf_files.py:114— select_hf_files._filter_by_variant has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (53 pts), loops 6 (12 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 41). 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.
ProjectWorkflowsView.ProjectWorkflowDetailPanel (cognitive 77) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:432— ProjectWorkflowsView.ProjectWorkflowDetailPanel has cognitive complexity 77 (threshold 15). Drivers by points: ternaries 41 (58 pts), boolean chains 17, if/else 2 (nesting depth added 17). Of this number, 67 points are the body's own statements and 10 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryMediaSlot.GalleryMediaSlot (cognitive 76) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx:82— GalleryMediaSlot.GalleryMediaSlot has cognitive complexity 76 (threshold 15). Drivers by points: ternaries 32 (50 pts), boolean chains 20, if/else 4 (5 pts), error handling 1 (nesting depth added 19). Of this number, 61 points are the body's own statements and 15 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryMaintenanceService._remove_missing_page (cognitive 75) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:595— GalleryMaintenanceService._remove_missing_page has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (46 pts), error handling 7 (15 pts), boolean chains 7, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 39). 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.
ReferenceImageRow.ReferenceImageRowBase (cognitive 75) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageRow.tsx:207— ReferenceImageRow.ReferenceImageRowBase has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 26 (34 pts), boolean chains 20, if/else 19 (20 pts), match/switch 1 (nesting depth added 9). Of this number, 32 points are the body's own statements and 43 belong to 18 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
workflow_graph_builder.build_graph_from_workflow (cognitive 74) invokeai/app/services/shared/workflow_graph_builder.py:367— workflow_graph_builder.build_graph_from_workflow has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (52 pts), boolean chains 11, loops 7 (9 pts), ternaries 2 (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.
IntermediatesManager.IntermediatesManager (cognitive 74) invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.tsx:63— IntermediatesManager.IntermediatesManager has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 33 (45 pts), boolean chains 22, if/else 6 (7 pts) (nesting depth added 13). Of this number, 62 points are the body's own statements and 12 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VideoPlayer.VideoPlayer (cognitive 74) invokeai/frontend/webv2/src/platform/ui/video-player/VideoPlayer.tsx:703— VideoPlayer.VideoPlayer has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 20 (33 pts), if/else 20 (22 pts), boolean chains 18, match/switch 1 (nesting depth added 15). Of this number, 37 points are the body's own statements and 37 belong to 15 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InvokeButton.InvokeButton (cognitive 74) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:72— InvokeButton.InvokeButton has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 29 (41 pts), if/else 21 (22 pts), boolean chains 11 (nesting depth added 13). Of this number, 43 points are the body's own statements and 31 belong to 17 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AnimaDenoiseInvocation._run_diffusion (cognitive 73) invokeai/app/invocations/anima/anima_denoise.py:644— AnimaDenoiseInvocation._run_diffusion has cognitive complexity 73 (threshold 15). Drivers by points: if/else 29 (46 pts), loops 8 (14 pts), boolean chains 8, ternaries 3, error handling 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layerChildRows.layerChildRowCommand (cognitive 73) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:540— layerChildRows.layerChildRowCommand has cognitive complexity 73 (threshold 15). Drivers by points: if/else 20 (39 pts), ternaries 10 (24 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 34). Of this number, 70 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkflowLibraryList.WorkflowLibraryList (cognitive 72) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryList.tsx:153— WorkflowLibraryList.WorkflowLibraryList has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 23 (29 pts), boolean chains 24, if/else 16 (18 pts), loops 1 (nesting depth added 8). Of this number, 32 points are the body's own statements and 40 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
graph.buildLtx2VideoGraph (cognitive 71) invokeai/frontend/webv2/src/features/video/core/graph.ts:654— graph.buildLtx2VideoGraph has cognitive complexity 71 (threshold 15). Drivers by points: if/else 27 (36 pts), ternaries 20 (24 pts), boolean chains 11 (nesting depth added 13). Of this number, 69 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
workflowPreview.buildModel (cognitive 71) invokeai/frontend/webv2/src/features/workflow/core/workflowPreview.ts:493— workflowPreview.buildModel has cognitive complexity 71 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 10 (18 pts), loops 10 (15 pts), boolean chains 14 (nesting depth added 25). Of this number, 49 points are the body's own statements and 22 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_loop_topology._recognize_nested_for_body (cognitive 70) invokeai/app/services/shared/graph_loop_topology.py:465— graph_loop_topology._recognize_nested_for_body has cognitive complexity 70 (threshold 15). Drivers by points: if/else 34 (48 pts), boolean chains 15, loops 4 (5 pts), 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.
working_memory_calibration_fits.model_lines (cognitive 70) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:223— working_memory_calibration_fits.model_lines has cognitive complexity 70 (threshold 15). Drivers by points: if/else 17 (37 pts), ternaries 8 (18 pts), loops 5 (8 pts), boolean chains 7 (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.
ImageMapPlot.ImageMapPlot (cognitive 70) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:114— ImageMapPlot.ImageMapPlot has cognitive complexity 70 (threshold 15). Drivers by points: if/else 32 (36 pts), boolean chains 20, ternaries 14 (nesting depth added 4). Most of this is not in the body itself: 3 of the 70 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 447, a function literal at line 294, a function literal at line 393, …). 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.
GraphExecutionState._can_use_generic_for_scheduler (cognitive 69) invokeai/app/services/shared/graph.py:1251— GraphExecutionState._can_use_generic_for_scheduler has cognitive complexity 69 (threshold 15). Drivers by points: if/else 29 (51 pts), boolean chains 18 (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.
validators.getRegionalGuidanceWarnings (cognitive 69) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:37— validators.getRegionalGuidanceWarnings has cognitive complexity 69 (threshold 15). Drivers by points: if/else 28 (67 pts), boolean chains 2 (nesting depth added 39). Of this number, 64 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graphCoverage.testing.candidatesForSlot (cognitive 69) invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts:111— graphCoverage.testing.candidatesForSlot has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 9 (54 pts), loops 5 (15 pts) (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkingMemorySection.WorkingMemoryBody (cognitive 68) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:211— WorkingMemorySection.WorkingMemoryBody has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 28 (34 pts), if/else 14 (17 pts), boolean chains 12, error handling 3, loops 1 (2 pts) (nesting depth added 10). Of this number, 31 points are the body's own statements and 37 belong to 10 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
settings.getUpscaleValidationIssues (cognitive 68) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1026— settings.getUpscaleValidationIssues has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (34 pts), ternaries 9 (18 pts), boolean chains 11, loops 3 (5 pts) (nesting depth added 22). Of this number, 66 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PreviewFrame.PreviewVideo (cognitive 68) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:416— PreviewFrame.PreviewVideo has cognitive complexity 68 (threshold 15). Drivers by points: if/else 31 (32 pts), ternaries 16 (18 pts), boolean chains 15, error handling 3 (nesting depth added 3). Most of this is not in the body itself: 12 of the 68 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 520, 622, 775, …). 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.
executeImageRecall.executeImageRecall (cognitive 68) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:340— executeImageRecall.executeImageRecall has cognitive complexity 68 (threshold 15). Drivers by points: if/else 24 (31 pts), boolean chains 22, ternaries 13, error handling 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DownloadQueueService._do_download (cognitive 67) invokeai/app/services/download/download_default.py:425— DownloadQueueService._do_download has cognitive complexity 67 (threshold 15). Drivers by points: if/else 28 (41 pts), boolean chains 19, ternaries 3 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeminiProvider.generate (cognitive 67) invokeai/app/services/external_generation/providers/gemini.py:29— GeminiProvider.generate has cognitive complexity 67 (threshold 15). Drivers by points: if/else 27 (52 pts), boolean chains 8, loops 3 (4 pts), ternaries 1 (3 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.
CanvasTextOverlay.TextEditor (cognitive 67) invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:95— CanvasTextOverlay.TextEditor has cognitive complexity 67 (threshold 15). Drivers by points: if/else 36 (38 pts), ternaries 14 (15 pts), boolean chains 14 (nesting depth added 3). Most of this is not in the body itself: 12 of the 67 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 307, 571, 230, …). 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.
usePreviewNavigation.usePreviewNavigation.navigate (cognitive 67) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:705— usePreviewNavigation.usePreviewNavigation.navigate has cognitive complexity 67 (threshold 15). Drivers by points: if/else 27 (43 pts), ternaries 5 (13 pts), boolean chains 7, error handling 2 (3 pts), loops 1 (nesting depth added 25). Most of this is not in the body itself: 8 of the 67 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 774, stepTo, updatePage, …). 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.
WanDenoiseInvocation._run_diffusion (cognitive 66) invokeai/app/invocations/wan/wan_denoise.py:426— WanDenoiseInvocation._run_diffusion has cognitive complexity 66 (threshold 15). Drivers by points: if/else 29 (45 pts), ternaries 8 (11 pts), boolean chains 9, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._rehydrate_generic_runtime_state (cognitive 66) invokeai/app/services/shared/graph.py:3771— GraphExecutionState._rehydrate_generic_runtime_state has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (48 pts), boolean chains 9, loops 7 (9 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise.denoise (cognitive 66) invokeai/backend/flux/denoise.py:26— denoise.denoise has cognitive complexity 66 (threshold 15). Drivers by points: if/else 25 (55 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
loaders.sdnq_sd_loader (cognitive 66) invokeai/backend/quantization/sdnq/loaders.py:195— loaders.sdnq_sd_loader has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (45 pts), ternaries 3 (10 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
setDefaultSettings.addSetDefaultSettingsListener (cognitive 66) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/setDefaultSettings.ts:34— setDefaultSettings.addSetDefaultSettingsListener has cognitive complexity 66 (threshold 15). Drivers by points: if/else 27 (65 pts), boolean chains 1 (nesting depth added 38). None of this is in the body itself: all 66 points belong to one function literal inside it that branches (line 37). 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.
useGalleryData.useGalleryData (cognitive 66) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:280— useGalleryData.useGalleryData has cognitive complexity 66 (threshold 15). Drivers by points: boolean chains 28, ternaries 27, if/else 8 (11 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.
utilityGraph.runUtilityGraph (cognitive 66) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:612— utilityGraph.runUtilityGraph has cognitive complexity 66 (threshold 15). Drivers by points: if/else 28 (32 pts), ternaries 10 (16 pts), error handling 8 (11 pts), boolean chains 6, loops 1 (nesting depth added 13). Most of this is not in the body itself: 5 of the 66 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 782, 638, 680, …). 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.
UpscaleWidgetView.UpscaleWidgetView (cognitive 66) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:483— UpscaleWidgetView.UpscaleWidgetView has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 27 (38 pts), boolean chains 19, if/else 9 (nesting depth added 11). Of this number, 39 points are the body's own statements and 27 belong to 15 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal (cognitive 66) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:784— indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 9 (31 pts), if/else 8 (23 pts), error handling 2 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 41). Of this number, 29 points are the body's own statements and 37 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RegionalGuidanceSettings.RegionalGuidanceSettings (cognitive 66) invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx:85— RegionalGuidanceSettings.RegionalGuidanceSettings has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 28 (34 pts), boolean chains 18, if/else 14 (nesting depth added 6). Of this number, 31 points are the body's own statements and 35 belong to 10 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler (cognitive 65) invokeai/app/services/shared/graph.py:1050— GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (47 pts), boolean chains 16, loops 2 (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.
FontsPage.FontLibrary (cognitive 65) invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:297— FontsPage.FontLibrary has cognitive complexity 65 (threshold 15). Drivers by points: ternaries 25 (40 pts), if/else 9 (12 pts), boolean chains 8, error handling 3 (4 pts), loops 1 (nesting depth added 19). Of this number, 26 points are the body's own statements and 39 belong to 14 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddNodeCmdk.NodeCommandList (cognitive 64) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:386— AddNodeCmdk.NodeCommandList has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (31 pts), ternaries 4 (15 pts), loops 5 (11 pts), boolean chains 7 (nesting depth added 32). Most of this is not in the body itself: 2 of the 64 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 426, 514, 486, …). 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.
baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cognitive 64) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2175— baseGenerationPolicies.getSettingsWithCompatibleModelSelections has cognitive complexity 64 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 21, ternaries 4 (9 pts), loops 1 (nesting depth added 16). Of this number, 49 points are the body's own statements and 15 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FloatingWidgetWindow.FloatingWidgetWindow (cognitive 64) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:339— FloatingWidgetWindow.FloatingWidgetWindow has cognitive complexity 64 (threshold 15). Drivers by points: ternaries 26, if/else 24 (25 pts), boolean chains 12, loops 1 (nesting depth added 1). Of this number, 24 points are the body's own statements and 40 belong to 16 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GalleryItemSearch.GalleryItemSearch (cognitive 63) invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:66— GalleryItemSearch.GalleryItemSearch has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 25 (37 pts), boolean chains 14, if/else 11, match/switch 1 (nesting depth added 12). Of this number, 30 points are the body's own statements and 33 belong to 13 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
video_smart_concat.encode_rgb_frames (cognitive 62) invokeai/app/util/video_smart_concat.py:340— video_smart_concat.encode_rgb_frames has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (32 pts), error handling 8 (16 pts), boolean chains 10, loops 3 (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.
previewMetadata.parsePreviewMetadata (cognitive 62) invokeai/frontend/webv2/src/workbench/widgets/preview/previewMetadata.ts:42— previewMetadata.parsePreviewMetadata has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 24 (57 pts), if/else 23 (43 pts), boolean chains 27, loops 4 (5 pts) (nesting depth added 54). 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 (previewMetadata.parsePreviewMetadata::visit) 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.
compositor.compositeDocument (cognitive 62) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:560— compositor.compositeDocument has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (34 pts), ternaries 7 (12 pts), boolean chains 8, loops 4 (8 pts) (nesting depth added 23). Of this number, 46 points are the body's own statements and 16 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
maskOutline.traceMaskOutlinePath (cognitive 62) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/maskOutline.ts:22— maskOutline.traceMaskOutlinePath has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (44 pts), loops 7 (13 pts), boolean chains 5 (nesting depth added 32). Of this number, 51 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute (cognitive 61) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/useCanvasWorkflowIntegrationExecute.tsx:40— useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 9, ternaries 3 (6 pts), loops 3 (5 pts), error handling 1 (nesting depth added 24). Of this number, 53 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ListItem.ListItem (cognitive 61) invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx:110— ListItem.ListItem has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 27, ternaries 22 (27 pts), if/else 7 (nesting depth added 5). Of this number, 46 points are the body's own statements and 15 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
canvasProjectMutations.patchLayerConfig (cognitive 61) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:630— canvasProjectMutations.patchLayerConfig has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 16 (26 pts), boolean chains 7 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CanvasWidgetView.CanvasWidgetView (cognitive 61) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:110— CanvasWidgetView.CanvasWidgetView has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 24 (28 pts), if/else 16 (18 pts), boolean chains 11, error handling 3, loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 43 belong to 18 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
StagingAreaApi.onItemsChangedEvent (cognitive 60) invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:460— StagingAreaApi.onItemsChangedEvent has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 7, loops 4 (6 pts), ternaries 2 (nesting depth added 26). Of this number, 58 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AspectRatioPicker.AspectRatioPicker (cognitive 60) invokeai/frontend/webv2/src/features/generation/ui/shared/AspectRatioPicker.tsx:437— AspectRatioPicker.AspectRatioPicker has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 30 (45 pts), if/else 9, boolean chains 6 (nesting depth added 15). Of this number, 32 points are the body's own statements and 28 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.createQueueRuntime.reconcile (cognitive 60) invokeai/frontend/webv2/src/features/queue/runtime.ts:2510— runtime.createQueueRuntime.reconcile has cognitive complexity 60 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 16, ternaries 2 (4 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 4 of the 60 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2602, 2555, 2710, …). 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.
groupSurfaceCache.createGroupSurfaceCache.resolve (cognitive 60) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:706— groupSurfaceCache.createGroupSurfaceCache.resolve has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (28 pts), ternaries 6 (16 pts), boolean chains 13, loops 2 (3 pts) (nesting depth added 21). Of this number, 58 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAIProvider.generate (cognitive 59) invokeai/app/services/external_generation/providers/openai.py:31— OpenAIProvider.generate has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (44 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChildExecutionCapability.create_dependency (cognitive 59) invokeai/app/services/shared/execution_engine/child.py:305— ChildExecutionCapability.create_dependency has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (33 pts), ternaries 3 (9 pts), loops 5 (8 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
promptAttention.groupTerminals (cognitive 59) invokeai/frontend/webv1/src/common/util/promptAttention.ts:463— promptAttention.groupTerminals has cognitive complexity 59 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 9 (21 pts), boolean chains 8, ternaries 2 (6 pts) (nesting depth added 30). Of this number, 55 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ModelInstallQueueItem.ModelInstallQueueItem (cognitive 59) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:109— ModelInstallQueueItem.ModelInstallQueueItem has cognitive complexity 59 (threshold 15). Drivers by points: boolean chains 23, if/else 15 (18 pts), ternaries 5 (11 pts), error handling 5, match/switch 2 (nesting depth added 9). Of this number, 26 points are the body's own statements and 33 belong to 14 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReferenceImageCropDialog.ReferenceImageCropDialog (cognitive 59) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCropDialog.tsx:212— ReferenceImageCropDialog.ReferenceImageCropDialog has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (27 pts), ternaries 11 (18 pts), boolean chains 12, error handling 2 (nesting depth added 10). Most of this is not in the body itself: 7 of the 59 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 459, 501, 317, …). 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.
executeRecallParameters.executeRecallParameters (cognitive 59) invokeai/frontend/webv2/src/workbench/image-actions/executeRecallParameters.ts:70— executeRecallParameters.executeRecallParameters has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 17, ternaries 5 (7 pts), loops 1 (2 pts), error handling 1 (nesting depth added 10). Of this number, 56 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
ModelSelect.ModelSelect (cognitive 58) invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx:99— ModelSelect.ModelSelect has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 32 (40 pts), boolean chains 12, if/else 5 (6 pts) (nesting depth added 9). Of this number, 49 points are the body's own statements and 9 belong to 8 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
QwenImageDenoiseInvocation._run_diffusion (cognitive 57) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:311— QwenImageDenoiseInvocation._run_diffusion has cognitive complexity 57 (threshold 15). Drivers by points: if/else 31 (43 pts), boolean chains 9, ternaries 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_if_runtime._get_if_iteration_paths_with_ancestry (cognitive 57) invokeai/app/services/shared/graph_if_runtime.py:393— graph_if_runtime._get_if_iteration_paths_with_ancestry has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 5 (11 pts), boolean chains 10, loops 3 (5 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.
useGalleryUploadAction.uploadGalleryFiles (cognitive 57) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts:80— useGalleryUploadAction.uploadGalleryFiles has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 21 (29 pts), if/else 12 (16 pts), boolean chains 8, error handling 2 (3 pts), loops 1 (nesting depth added 13). Of this number, 45 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildGraph.getProjectGraphReadiness (cognitive 57) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:130— buildGraph.getProjectGraphReadiness has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 6, loops 3 (4 pts), 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.
indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy (cognitive 57) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:991— indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (28 pts), ternaries 6 (18 pts), boolean chains 7, error handling 1 (3 pts), loops 1 (nesting depth added 29). Of this number, 30 points are the body's own statements and 27 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cognitive 57) invokeai/frontend/webv2/src/workbench/canvas-engine/rasterSnapshotCapture.ts:85— rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (37 pts), ternaries 5 (11 pts), loops 5, boolean chains 4 (nesting depth added 23). Of this number, 56 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService._install_path_with_info_claimed (cognitive 56) invokeai/app/services/model_install/model_install_default.py:1008— ModelInstallService._install_path_with_info_claimed has cognitive complexity 56 (threshold 15). Drivers by points: if/else 13 (31 pts), error handling 6 (14 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphPreviewDialog.GraphPreviewDialog (cognitive 56) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx:110— GraphPreviewDialog.GraphPreviewDialog has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 23 (32 pts), boolean chains 14, if/else 10 (nesting depth added 9). Of this number, 38 points are the body's own statements and 18 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
video_recall.resolve_video_recall_parameters (cognitive 55) invokeai/app/api/routers/video_recall.py:295— video_recall.resolve_video_recall_parameters has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (38 pts), loops 5 (11 pts), ternaries 1 (4 pts), boolean chains 2 (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.
WorkflowFieldRenderer.WorkflowFieldRenderer (cognitive 55) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:50— WorkflowFieldRenderer.WorkflowFieldRenderer has cognitive complexity 55 (threshold 15). Drivers by points: if/else 28 (29 pts), ternaries 11 (13 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 4). Of this number, 19 points are the body's own statements and 36 belong to 10 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
settings.normalizeGenerateSettings (cognitive 55) invokeai/frontend/webv2/src/features/generation/core/settings.ts:959— settings.normalizeGenerateSettings has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 42 (46 pts), boolean chains 7, if/else 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.
WildcardsPanel.WildcardsPanel (cognitive 55) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx:71— WildcardsPanel.WildcardsPanel has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 22 (35 pts), boolean chains 10, if/else 7, error handling 3 (nesting depth added 13). Of this number, 39 points are the body's own statements and 16 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InvocationFlowNode.ExpandedInvocationNode (cognitive 55) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1374— InvocationFlowNode.ExpandedInvocationNode has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 22 (41 pts), boolean chains 13, if/else 1 (nesting depth added 19). Of this number, 52 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MergeLayerController.mergeDown (cognitive 55) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186— MergeLayerController.mergeDown has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 14 (21 pts), if/else 16 (17 pts), boolean chains 16, error handling 1 (nesting depth added 8). Of this number, 42 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
measure-architecture-performance.runSample (cognitive 54) invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:317— measure-architecture-performance.runSample has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (36 pts), boolean chains 12, ternaries 4 (5 pts), error handling 1 (nesting depth added 14). Of this number, 40 points are the body's own statements and 14 belong to 10 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryBoardMenu.BoardDeleteDialog (cognitive 54) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:266— GalleryBoardMenu.BoardDeleteDialog has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 22 (29 pts), boolean chains 17, if/else 7 (8 pts) (nesting depth added 8). Of this number, 47 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WanModelLoaderInvocation.invoke (cognitive 53) invokeai/app/invocations/wan/wan_model_loader.py:125— WanModelLoaderInvocation.invoke has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (46 pts), boolean chains 6, ternaries 1 (nesting depth added 24). 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.
GraphExecutionState._record_effect_streams (cognitive 53) invokeai/app/services/shared/graph.py:1698— GraphExecutionState._record_effect_streams has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (28 pts), ternaries 9 (20 pts), boolean chains 4, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Qwen3EncoderCheckpointLoader._load_from_singlefile (cognitive 53) invokeai/backend/model_manager/load/model_loaders/z_image.py:1112— Qwen3EncoderCheckpointLoader._load_from_singlefile has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (35 pts), loops 5 (8 pts), boolean chains 6, error handling 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.
VideoReferenceListField.VideoReferenceListField (cognitive 53) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:363— VideoReferenceListField.VideoReferenceListField has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 16, ternaries 10 (13 pts), error handling 3 (nesting depth added 5). Most of this is not in the body itself: 11 of the 53 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 557, 539, 469, …). 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.
WorkflowDocumentGraph.GraphView (cognitive 53) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:1003— WorkflowDocumentGraph.GraphView has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 16 (20 pts), if/else 13 (17 pts), boolean chains 13, loops 3 (nesting depth added 8). Of this number, 21 points are the body's own statements and 32 belong to 11 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
List.List (cognitive 53) invokeai/frontend/webv2/src/platform/ui/list/List.tsx:190— List.List has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (21 pts), ternaries 14 (17 pts), boolean chains 13, loops 1, match/switch 1 (nesting depth added 6). Of this number, 24 points are the body's own statements and 29 belong to 14 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
ExtractMaskedAreaController.extract (cognitive 53) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122— ExtractMaskedAreaController.extract has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (30 pts), boolean chains 13, ternaries 4 (7 pts), loops 2, error handling 1 (nesting depth added 7). Of this number, 52 points are the body's own statements and 1 belongs to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
imageRecall.getFamilyTuning (cognitive 53) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:563— imageRecall.getFamilyTuning has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 21 (43 pts), if/else 6, boolean chains 4 (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.
CanvasEntityObjectRenderer.renderObject (cognitive 52) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityObjectRenderer.ts:348— CanvasEntityObjectRenderer.renderObject has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 21 (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.
ExternalModelSection.ExternalModelSection (cognitive 52) invokeai/frontend/webv2/src/features/models/ui/detail/ExternalModelSection.tsx:160— ExternalModelSection.ExternalModelSection has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 19 (31 pts), boolean chains 13, if/else 7 (8 pts) (nesting depth added 13). Of this number, 34 points are the body's own statements and 18 belong to 11 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.
buildGraph.compileProjectGraph (cognitive 52) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:327— buildGraph.compileProjectGraph has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 10, ternaries 2 (7 pts), loops 3 (4 pts) (nesting depth added 24). Of this number, 51 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkflowLibraryPreviewStage.WorkflowLibraryPreviewStage (cognitive 51) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryPreviewStage.tsx:89— WorkflowLibraryPreviewStage.WorkflowLibraryPreviewStage has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 17 (42 pts), if/else 5, boolean chains 4 (nesting depth added 25). Of this number, 40 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile (cognitive 51) invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.tsx:175— CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 10, ternaries 5 (10 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService._restore_incomplete_installs (cognitive 50) invokeai/app/services/model_install/model_install_default.py:337— ModelInstallService._restore_incomplete_installs has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (32 pts), error handling 5 (13 pts), boolean chains 4, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ExecutionNodeBuilder._create_nested_iterate_body_iteration (cognitive 50) invokeai/app/services/shared/graph_materializer.py:1017— _ExecutionNodeBuilder._create_nested_iterate_body_iteration has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 7 (9 pts), boolean chains 4 (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.
queueRunRestoration.normalizeRestoredQueueItem (cognitive 50) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:56— queueRunRestoration.normalizeRestoredQueueItem has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 24, ternaries 14, if/else 9 (11 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.
paintTool.resolveTarget (cognitive 50) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:133— paintTool.resolveTarget has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (26 pts), ternaries 8 (17 pts), boolean chains 7 (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.
imageRecall.getMetadataExternalProvider (cognitive 50) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:732— imageRecall.getMetadataExternalProvider has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 11, ternaries 4 (9 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 21). Of this number, 36 points are the body's own statements and 14 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StatusBar.CompactBottomWidget (cognitive 50) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:297— StatusBar.CompactBottomWidget has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 20 (24 pts), if/else 12 (14 pts), boolean chains 12 (nesting depth added 6). Of this number, 36 points are the body's own statements and 14 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Krea2DenoiseInvocation._run_diffusion (cognitive 49) invokeai/app/invocations/krea2/krea2_denoise.py:491— Krea2DenoiseInvocation._run_diffusion has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (33 pts), ternaries 10, boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_ExecutionNodeBuilder._create_nested_for_body_iteration (cognitive 49) invokeai/app/services/shared/graph_materializer.py:894— _ExecutionNodeBuilder._create_nested_for_body_iteration has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 7 (13 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryBoardsPanel.GalleryBoardsPanel (cognitive 49) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx:47— GalleryBoardsPanel.GalleryBoardsPanel has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 24 (28 pts), boolean chains 12, if/else 9 (nesting depth added 4). Of this number, 24 points are the body's own statements and 25 belong to 12 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ManagerLayout.ManagerLayout (cognitive 49) invokeai/frontend/webv2/src/platform/ui/ManagerLayout.tsx:153— ManagerLayout.ManagerLayout has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 22, if/else 18 (20 pts), ternaries 6 (7 pts) (nesting depth added 3). Most of this is not in the body itself: 3 of the 49 points are its own statements and the rest belongs to 11 function items inside it that branch (watchFocus::tick, a function literal at line 261, repairFocus, …). 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.
SeedreamProvider.generate (cognitive 48) invokeai/app/services/external_generation/providers/seedream.py:39— SeedreamProvider.generate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (28 pts), ternaries 5 (13 pts), boolean chains 5, loops 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.
GalleryMaintenanceService._archive_snapshot_files (cognitive 48) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:735— GalleryMaintenanceService._archive_snapshot_files has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (27 pts), ternaries 5 (13 pts), error handling 1 (3 pts), loops 2 (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.
GraphExecutionState._can_use_generic_serial_nested_for_scheduler (cognitive 48) invokeai/app/services/shared/graph.py:1158— GraphExecutionState._can_use_generic_serial_nested_for_scheduler has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 16, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._can_use_generic_nested_iterate_scheduler (cognitive 48) invokeai/app/services/shared/graph.py:1404— GraphExecutionState._can_use_generic_nested_iterate_scheduler has cognitive complexity 48 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 16 (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.
_ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches (cognitive 48) invokeai/app/services/shared/graph_materializer.py:1844— _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 6 (11 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCleanupDialog.useCleanupDialog.confirm (cognitive 48) invokeai/frontend/webv2/src/features/intermediates/ui/useCleanupDialog.ts:85— useCleanupDialog.useCleanupDialog.confirm has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 9 (27 pts), if/else 5 (11 pts), boolean chains 6, error handling 2 (4 pts) (nesting depth added 26). Of this number, 21 points are the body's own statements and 27 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
graphToDocument.previewGraphToDocument (cognitive 48) invokeai/frontend/webv2/src/features/workflow/core/graphToDocument.ts:37— graphToDocument.previewGraphToDocument has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (27 pts), ternaries 4 (9 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BooleanMergeController.merge (cognitive 48) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75— BooleanMergeController.merge has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 12, ternaries 6 (12 pts), loops 1 (nesting depth added 11). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._build_execution_tokens (cognitive 47) invokeai/app/services/shared/graph.py:3027— GraphExecutionState._build_execution_tokens has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 12 (27 pts), if/else 8 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelEditForm.ModelEditForm (cognitive 47) invokeai/frontend/webv2/src/features/models/ui/detail/ModelEditForm.tsx:73— ModelEditForm.ModelEditForm has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 20 (27 pts), if/else 8 (14 pts), boolean chains 5, error handling 1 (nesting depth added 13). Of this number, 18 points are the body's own statements and 29 belong to 9 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCompareLoupe.useCompareLoupe (cognitive 47) invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:64— useCompareLoupe.useCompareLoupe has cognitive complexity 47 (threshold 15). Drivers by points: if/else 27 (31 pts), boolean chains 11, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 1 of the 47 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 454, 243, 347, …). 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.
mediaUsageReport.buildReport (cognitive 47) invokeai/frontend/webv2/src/workbench/image-actions/mediaUsageReport.ts:351— mediaUsageReport.buildReport has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (24 pts), ternaries 10 (14 pts), boolean chains 6, loops 3 (nesting depth added 13). Of this number, 32 points are the body's own statements and 15 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useProjectActions.useProjectActions (cognitive 47) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts:56— useProjectActions.useProjectActions has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 5, error handling 4, ternaries 2 (3 pts), loops 2 (nesting depth added 10). None of this is in the body itself: all 47 points belong to 9 function literals inside it that branch (lines 190, 73, 239, …). 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.
GalleryMaintenance.GalleryMaintenance (cognitive 47) invokeai/frontend/webv2/src/workbench/settings/GalleryMaintenance.tsx:79— GalleryMaintenance.GalleryMaintenance has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 12, ternaries 7, error handling 4 (6 pts) (nesting depth added 7). Most of this is not in the body itself: 10 of the 47 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 154, 230, 105, …). 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.
InstallStagingLedger._sweep_stale_claims_locked (cognitive 46) invokeai/app/services/model_install/install_staging_ledger.py:689— InstallStagingLedger._sweep_stale_claims_locked has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 6 (14 pts), boolean chains 4, loops 2 (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.
ModelInstallService._enqueue_remote_download (cognitive 46) invokeai/app/services/model_install/model_install_default.py:2184— ModelInstallService._enqueue_remote_download has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 9, ternaries 2 (3 pts), error handling 2, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
execution_effects.normalize_persisted_execution_effects (cognitive 46) invokeai/app/services/shared/execution_effects.py:414— execution_effects.normalize_persisted_execution_effects has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (31 pts), error handling 2 (7 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.normalizeVideoSettings (cognitive 46) invokeai/frontend/webv2/src/features/video/core/settings.ts:347— settings.normalizeVideoSettings has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 35 (36 pts), boolean chains 9, if/else 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ControlLayerSettings.ControlLayerSettings (cognitive 46) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx:94— ControlLayerSettings.ControlLayerSettings has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 18, ternaries 15 (16 pts), if/else 12 (nesting depth added 1). Of this number, 17 points are the body's own statements and 29 belong to 16 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
graph_iterate_planner._get_direct_iterate_collect_nodes (cognitive 45) invokeai/app/services/shared/graph_iterate_planner.py:164— graph_iterate_planner._get_direct_iterate_collect_nodes has cognitive complexity 45 (threshold 15). Drivers by points: if/else 27 (35 pts), boolean chains 8, loops 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.
moss_image_lora_constants.read_moss_image_lora_keys (cognitive 45) invokeai/backend/patches/lora_conversions/moss_image_lora_constants.py:236— moss_image_lora_constants.read_moss_image_lora_keys has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 11, loops 5 (8 pts), ternaries 2 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hidiffusion_utils.hidiffusion_patch (cognitive 45) invokeai/backend/stable_diffusion/hidiffusion_utils.py:11— hidiffusion_utils.hidiffusion_patch has cognitive complexity 45 (threshold 15). Drivers by points: error handling 8 (19 pts), if/else 12 (19 pts), ternaries 4, 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.
runtime.createQueueRuntime.synchronizeRunPersistence (cognitive 45) invokeai/frontend/webv2/src/features/queue/runtime.ts:2291— runtime.createQueueRuntime.synchronizeRunPersistence has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 7, loops 5 (6 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.
templates.parseInvocationSchema (cognitive 45) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:331— templates.parseInvocationSchema has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 15, boolean chains 12, loops 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
layerTreeDrop.projectLayerDrop (cognitive 45) invokeai/frontend/webv2/src/workbench/widgets/layers/layerTreeDrop.ts:52— layerTreeDrop.projectLayerDrop has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 7 (11 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PreviewFrame.PreviewImageFrame (cognitive 45) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:121— PreviewFrame.PreviewImageFrame has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 22 (28 pts), boolean chains 12, if/else 5 (nesting depth added 6). Of this number, 34 points are the body's own statements and 11 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LayerMutationController.commitDuplicate (cognitive 45) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:206— LayerMutationController.commitDuplicate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 11, ternaries 6, loops 2 (nesting depth added 7). Of this number, 19 points are the body's own statements and 26 belong to 11 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Flux2DenoiseInvocation._run_diffusion (cognitive 44) invokeai/app/invocations/flux2/flux2_denoise.py:229— Flux2DenoiseInvocation._run_diffusion has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (24 pts), ternaries 11 (12 pts), boolean chains 8 (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.
graph_scheduler._prepare_deferred_nested_for_body (cognitive 44) invokeai/app/services/shared/graph_scheduler.py:28— graph_scheduler._prepare_deferred_nested_for_body has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 3 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CanvasEntityBufferObjectRenderer.renderBufferObject (cognitive 44) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityBufferObjectRenderer.ts:115— CanvasEntityBufferObjectRenderer.renderBufferObject has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 11 (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.
coordinator.createQueueCoordinator.reconcile (cognitive 44) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1093— coordinator.createQueueCoordinator.reconcile has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 9 (23 pts), boolean chains 8, if/else 5 (8 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 19). Of this number, 31 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HsvWheelPicker.HsvWheelPicker (cognitive 44) invokeai/frontend/webv2/src/platform/ui/HsvWheelPicker.tsx:38— HsvWheelPicker.HsvWheelPicker has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 13 (22 pts), if/else 9 (11 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 12). Most of this is not in the body itself: 6 of the 44 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 62, 189, 171, …). 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.
invocation.resolveInvocationRouteInput (cognitive 44) invokeai/frontend/webv2/src/workbench/invocation.ts:385— invocation.resolveInvocationRouteInput has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 7, ternaries 4 (6 pts), loops 1 (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.
layerPanelRows.navigateTree (cognitive 44) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:202— layerPanelRows.navigateTree has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 5 (12 pts), boolean chains 7, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
strokeSession.createStrokeSession.paint (cognitive 44) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/strokeSession.ts:323— strokeSession.createStrokeSession.paint has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (22 pts), ternaries 10 (11 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WanVideoDenoiseInvocation._run_diffusion (cognitive 43) invokeai/app/invocations/wan/wan_video_denoise.py:172— WanVideoDenoiseInvocation._run_diffusion has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 7 (11 pts), boolean chains 9, 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.
ImageIndexService._worker_loop (cognitive 43) invokeai/app/services/image_index/image_index_default.py:1195— ImageIndexService._worker_loop has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (29 pts), error handling 4 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._record_continuation_effects (cognitive 43) invokeai/app/services/shared/graph.py:1841— GraphExecutionState._record_continuation_effects has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (31 pts), ternaries 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph._validate_type_dependents_after_edge (cognitive 43) invokeai/app/services/shared/graph_validation.py:822— Graph._validate_type_dependents_after_edge has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
counted_dtypes.return_to_counted_dtypes (cognitive 43) invokeai/backend/model_manager/load/model_cache/counted_dtypes.py:21— counted_dtypes.return_to_counted_dtypes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (28 pts), loops 3 (6 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.getNextCropBoxByHandleWithAspectRatio (cognitive 43) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:746— Editor.getNextCropBoxByHandleWithAspectRatio has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 9, ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readiness.getReasonsWhyCannotEnqueueWorkflowsTab (cognitive 43) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:642— readiness.getReasonsWhyCannotEnqueueWorkflowsTab has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 4 (11 pts) (nesting depth added 26). Of this number, 35 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser-validation.waitForRenderedMedia (cognitive 43) invokeai/frontend/webv2/scripts/browser-validation.mjs:156— browser-validation.waitForRenderedMedia has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 12, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 16). Most of this is not in the body itself: 3 of the 43 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 189, 164, 230, …). 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.
deliveryClaims.createDeliveryConfirmations.recover (cognitive 43) invokeai/frontend/webv2/src/features/queue/runtime/deliveryClaims.ts:180— deliveryClaims.createDeliveryConfirmations.recover has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 6 (10 pts), boolean chains 4, error handling 1 (3 pts) (nesting depth added 20). Most of this is not in the body itself: 10 of the 43 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 204, 208, 260). 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.
templates.parseFieldType (cognitive 43) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:71— templates.parseFieldType has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (29 pts), ternaries 4 (9 pts), boolean chains 5 (nesting depth added 20). Of this number, 42 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cognitive 43) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryThumbnail.tsx:94— WorkflowLibraryThumbnail.WorkflowLibraryThumbnail has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 15 (22 pts), boolean chains 10, if/else 9 (10 pts), error handling 1 (nesting depth added 8). Of this number, 29 points are the body's own statements and 14 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResizeHandle.ResizeHandle (cognitive 43) invokeai/frontend/webv2/src/platform/ui/ResizeHandle.tsx:197— ResizeHandle.ResizeHandle has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 15 (25 pts), if/else 12 (13 pts), boolean chains 5 (nesting depth added 11). Most of this is not in the body itself: 2 of the 43 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 299, 224, 255, …). 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.
store.normalizeWorkbenchPreferences (cognitive 43) invokeai/frontend/webv2/src/workbench/settings/store.ts:435— store.normalizeWorkbenchPreferences has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 37 (39 pts), boolean chains 4 (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.
videoRecallRuntime.createVideoRecallRuntime::apply (cognitive 43) invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.ts:145— videoRecallRuntime.createVideoRecallRuntime::apply has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 7 (20 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.
FluxDenoiseInvocation._run_diffusion (cognitive 42) invokeai/app/invocations/flux/flux_denoise.py:220— FluxDenoiseInvocation._run_diffusion has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (31 pts), ternaries 6 (7 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GraphExecutionState._rehydrate_resolved_if_exec_branches (cognitive 42) invokeai/app/services/shared/graph.py:3667— GraphExecutionState._rehydrate_resolved_if_exec_branches has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 3 (5 pts), ternaries 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.
aac_splice._read_audio_track (cognitive 42) invokeai/app/util/aac_splice.py:145— aac_splice._read_audio_track has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 12, ternaries 4 (5 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Qwen3EncoderGGUFLoader._load_from_gguf (cognitive 42) invokeai/backend/model_manager/load/model_loaders/z_image.py:1419— Qwen3EncoderGGUFLoader._load_from_gguf has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 4, error handling 1 (4 pts), ternaries 4, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dynamicPromptSyntax.scanDynamicPromptSyntax (cognitive 42) invokeai/frontend/webv2/src/features/generation/core/prompt/dynamicPromptSyntax.ts:57— dynamicPromptSyntax.scanDynamicPromptSyntax has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 3 (9 pts), boolean chains 4, loops 3 (nesting depth added 19). Of this number, 40 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultSettingsSection.DefaultSettingsSection (cognitive 42) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:163— DefaultSettingsSection.DefaultSettingsSection has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 18 (27 pts), boolean chains 8, if/else 7 (nesting depth added 9). Most of this is not in the body itself: 7 of the 42 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 319, a function literal at line 191, retrySchedulerRules, …). 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.
WorkflowLibraryList.WorkflowLibraryListRow (cognitive 42) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryList.tsx:524— WorkflowLibraryList.WorkflowLibraryListRow has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 23 (27 pts), boolean chains 15 (nesting depth added 4). Of this number, 37 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
InvocationFlowNode.InputFieldRow (cognitive 42) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:807— InvocationFlowNode.InputFieldRow has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 20 (32 pts), boolean chains 9, if/else 1 (nesting depth added 12). Of this number, 39 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prepareCanvasInvocation.runCanvasInvocation (cognitive 42) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:325— prepareCanvasInvocation.runCanvasInvocation has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 11 (35 pts), if/else 4 (5 pts), boolean chains 1, error handling 1 (nesting depth added 25). Of this number, 40 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
controlPanelModel.deriveModel (cognitive 42) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:233— controlPanelModel.deriveModel has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 16 (34 pts), boolean chains 4, if/else 2 (3 pts), match/switch 1 (nesting depth added 19). Of this number, 41 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InvokeImageBlendInvocation.apply_blend (cognitive 41) invokeai/app/invocations/composition-nodes.py:679— InvokeImageBlendInvocation.apply_blend has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (30 pts), ternaries 4 (8 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph._is_for_connection_valid (cognitive 41) invokeai/app/services/shared/graph_validation.py:1414— Graph._is_for_connection_valid has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 7, loops 5 (7 pts), 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.
ControlNetModel.forward (cognitive 41) invokeai/backend/util/hotfixes.py:570— ControlNetModel.forward has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 3 (7 pts), boolean chains 2, 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.
UseDefaultSettingsButton.UseDefaultSettingsButton (cognitive 41) invokeai/frontend/webv1/src/features/parameters/components/MainModel/UseDefaultSettingsButton.tsx:24— UseDefaultSettingsButton.UseDefaultSettingsButton has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 14, ternaries 1 (nesting depth added 10). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 62, 133, 40, …). 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.
WorkflowWidgetChrome.WorkflowDialogHost (cognitive 41) invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx:839— WorkflowWidgetChrome.WorkflowDialogHost has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 10 (17 pts), if/else 14 (16 pts), boolean chains 8 (nesting depth added 9). Most of this is not in the body itself: 6 of the 41 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 925, 1023, 878, …). 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.
layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cognitive 41) invokeai/frontend/webv2/src/workbench/canvas-engine/layerRasterizer.ts:138— layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 5 (10 pts), boolean chains 9, error handling 2 (4 pts) (nesting depth added 13). Most of this is not in the body itself: 11 of the 41 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 216, 185). 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.
generationComposite.composeForGeneration (cognitive 41) invokeai/frontend/webv2/src/workbench/canvas-operations/generationComposite.ts:144— generationComposite.composeForGeneration has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 8 (10 pts), boolean chains 6, ternaries 2 (3 pts), error handling 1 (nesting depth added 11). Of this number, 37 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_manager.get_is_installed (cognitive 40) invokeai/app/api/routers/model_manager.py:1483— model_manager.get_is_installed has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (30 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GraphExecutionState.apply (cognitive 40) invokeai/app/services/shared/graph.py:3153— GraphExecutionState.apply has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 9, ternaries 3 (8 pts), error handling 1, 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.
graph_if_runtime._get_effective_iteration_paths_for_edge (cognitive 40) invokeai/app/services/shared/graph_if_runtime.py:300— graph_if_runtime._get_effective_iteration_paths_for_edge has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
working_memory_calibration_plan.build_plan (cognitive 40) invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py:570— working_memory_calibration_plan.build_plan has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 6 (10 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdvancedSettingsAccordion.AdvancedSettingsAccordion (cognitive 40) invokeai/frontend/webv1/src/features/settingsAccordions/components/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx:69— AdvancedSettingsAccordion.AdvancedSettingsAccordion has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 18 (nesting depth added 10). Of this number, 16 points are the body's own statements and 24 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mock-working-memory.createWorkingMemoryMock.calibrate (cognitive 40) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:710— mock-working-memory.createWorkingMemoryMock.calibrate has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 13, ternaries 4 (6 pts), loops 1 (2 pts) (nesting depth added 9). Of this number, 36 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryThumbnail.GalleryThumbnail (cognitive 40) invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx:84— GalleryThumbnail.GalleryThumbnail has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 17, if/else 11 (12 pts), boolean chains 11 (nesting depth added 1). Of this number, 18 points are the body's own statements and 22 belong to 15 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
baseGenerationPolicies.getReferenceImageValidationIssues (cognitive 40) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2687— baseGenerationPolicies.getReferenceImageValidationIssues has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 15, if/else 12 (14 pts), ternaries 5 (11 pts) (nesting depth added 8). Of this number, 23 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
indexedDbDraftStore.createIndexedDbProjectDraftStore.stage (cognitive 40) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1275— indexedDbDraftStore.createIndexedDbProjectDraftStore.stage has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 5 (10 pts), boolean chains 9, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cognitive 40) invokeai/frontend/webv2/src/workbench/widgets/canvas/ControlLayerCanvasOverlay.tsx:74— ControlLayerCanvasOverlay.SelectedControlLayerOverlay has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 19 (31 pts), boolean chains 8, if/else 1 (nesting depth added 12). Of this number, 33 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rasterComposite.renderRasterComposite (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterComposite.ts:457— rasterComposite.renderRasterComposite has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (27 pts), ternaries 4 (6 pts), loops 4, boolean chains 3 (nesting depth added 12). None of this is in the body itself: all 40 points belong to 6 function items inside it that branch (renderRange, drawLayer, drawSpatialScope, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
GeneratedResultController.commit (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:56— GeneratedResultController.commit has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (26 pts), ternaries 6 (9 pts), boolean chains 4, error handling 1 (nesting depth added 8). Of this number, 32 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
alphaFill.propagateNearestVisibleLabels (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/alphaFill.ts:28— alphaFill.propagateNearestVisibleLabels has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 6 (12 pts), boolean chains 6 (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.
CreateGradientMaskInvocation.invoke (cognitive 39) invokeai/app/invocations/sd/create_gradient_mask.py:80— CreateGradientMaskInvocation.invoke has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (14 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workflow_call_batch.build_batch_child_workflow_session_results (cognitive 39) invokeai/app/services/session_processor/workflow_call_batch.py:517— workflow_call_batch.build_batch_child_workflow_session_results has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ExecutionNodeBuilder._attach_pending_if_inputs (cognitive 39) invokeai/app/services/shared/graph_materializer.py:1934— _ExecutionNodeBuilder._attach_pending_if_inputs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MistralEncoderCheckpointLoader._load_text_encoder (cognitive 39) REDACTED:1149— MistralEncoderCheckpointLoader._load_text_encoder has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 6, loops 3 (5 pts), error handling 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.
Qwen3EncoderSDNQLoader._load_from_sdnq (cognitive 39) invokeai/backend/model_manager/load/model_loaders/z_image.py:1624— Qwen3EncoderSDNQLoader._load_from_sdnq has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (27 pts), error handling 1 (4 pts), ternaries 4, boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dnd-hooks.useBuilderDndMonitor (cognitive 39) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.ts:203— dnd-hooks.useBuilderDndMonitor has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 3 (9 pts), boolean chains 2 (nesting depth added 18). None of this is in the body itself: all 39 points belong to 2 function literals inside it that branch (lines 224, 223). 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.
buildSDXLGraph.buildSDXLGraph (cognitive 39) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:41— buildSDXLGraph.buildSDXLGraph has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (33 pts), ternaries 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy (cognitive 39) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1355— draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 4 (9 pts), boolean chains 8, error handling 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.
FilterResultController.commit (cognitive 39) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:66— FilterResultController.commit has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 7, ternaries 4 (7 pts), error handling 1 (nesting depth added 7). Of this number, 36 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cognitive 39) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:566— groupSurfaceCache.createGroupSurfaceCache.damagedRegion has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 4 (8 pts), boolean chains 4 (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.
Krea2LoRACollectionLoader.invoke (cognitive 38) invokeai/app/invocations/krea2/krea2_lora_loader.py:132— Krea2LoRACollectionLoader.invoke has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 4 (8 pts), boolean chains 5, 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.
h264_splice._read_video_stbl (cognitive 38) invokeai/app/util/h264_splice.py:344— h264_splice._read_video_stbl has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 7, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Flux2CheckpointModel._load_from_singlefile (cognitive 38) invokeai/backend/model_manager/load/model_loaders/flux.py:1283— Flux2CheckpointModel._load_from_singlefile has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 7, ternaries 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.
loaders._infer_quantization_type (cognitive 38) invokeai/backend/quantization/sdnq/loaders.py:70— loaders._infer_quantization_type has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
compileCanvasGraph.getCanvasValidationReasons (cognitive 38) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:123— compileCanvasGraph.getCanvasValidationReasons has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 13 (nesting depth added 7). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AspectRatioPicker.PresetForm (cognitive 38) invokeai/frontend/webv2/src/features/generation/ui/shared/AspectRatioPicker.tsx:172— AspectRatioPicker.PresetForm has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 15 (23 pts), boolean chains 14, if/else 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 14 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graphInputMedia.collectSubmissionInputMediaNames (cognitive 38) invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:19— graphInputMedia.collectSubmissionInputMediaNames has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 6 (14 pts), boolean chains 4, ternaries 1 (nesting depth added 17). Of this number, 30 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphPreviewMoreMenu.GraphPreviewMoreMenu (cognitive 38) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewMoreMenu.tsx:133— GraphPreviewMoreMenu.GraphPreviewMoreMenu has cognitive complexity 38 (threshold 15). Drivers by points: if/else 24 (27 pts), ternaries 6 (7 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 6 of the 38 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 183, 274, 238, …). 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.
LayerChildRow.LayerChildRowComponent (cognitive 38) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:92— LayerChildRow.LayerChildRowComponent has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 14 (17 pts), if/else 12, boolean chains 9 (nesting depth added 3). Of this number, 18 points are the body's own statements and 20 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PsdExportController.export (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:130— PsdExportController.export has cognitive complexity 38 (threshold 15). Drivers by points: if/else 25 (28 pts), ternaries 6 (7 pts), boolean chains 2, error handling 1 (nesting depth added 4). Of this number, 23 points are the body's own statements and 15 belong to 5 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
bitmapStore.createBitmapStore.flushLayer (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:397— bitmapStore.createBitmapStore.flushLayer has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 8, error handling 4 (5 pts), ternaries 2 (3 pts) (nesting depth added 6). Of this number, 36 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
createCanvasEngine.createCanvasEngine (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-operations/createCanvasEngine.ts:81— createCanvasEngine.createCanvasEngine has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 12 (15 pts), boolean chains 3, error handling 2, loops 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 38 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 161, resolveUploadProjectId, uploadImage, …). 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.
QwenImage21DenoiseInvocation._run_diffusion (cognitive 37) invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:321— QwenImage21DenoiseInvocation._run_diffusion has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 10 (12 pts), boolean chains 9, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch (cognitive 37) invokeai/app/services/shared/graph_materializer.py:2247— _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 6 (9 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.
color.restore_lightness (cognitive 37) invokeai/backend/image_util/color.py:70— color.restore_lightness has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 6, ternaries 2, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Krea2CheckpointModel._load_from_singlefile (cognitive 37) invokeai/backend/model_manager/load/model_loaders/krea2.py:542— Krea2CheckpointModel._load_from_singlefile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 5 (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.
WanCheckpointModel._load_from_singlefile (cognitive 37) invokeai/backend/model_manager/load/model_loaders/wan.py:569— WanCheckpointModel._load_from_singlefile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 5, loops 2 (3 pts), 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.
loaders.parse_gguf_convrot_markers (cognitive 37) invokeai/backend/quantization/gguf/loaders.py:165— loaders.parse_gguf_convrot_markers has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, ternaries 1 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loaders.gguf_sd_loader (cognitive 37) invokeai/backend/quantization/gguf/loaders.py:290— loaders.gguf_sd_loader has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 4 (11 pts), boolean chains 4, loops 2 (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.
CurrentVideoPreview.CurrentVideoPreview (cognitive 37) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:66— CurrentVideoPreview.CurrentVideoPreview has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16, boolean chains 15, error handling 4 (6 pts) (nesting depth added 2). Most of this is not in the body itself: 9 of the 37 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 263, 315, 367, …). 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.
buildQwenImageGraph.buildQwenImageGraph (cognitive 37) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:87— buildQwenImageGraph.buildQwenImageGraph has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (25 pts), ternaries 4 (6 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 9). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.dynamicBaseQuery (cognitive 37) invokeai/frontend/webv1/src/services/api/index.ts:99— index.dynamicBaseQuery has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (13 pts), ternaries 4 (nesting depth added 4). Of this number, 35 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SettingControl.SettingControl (cognitive 37) invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx:29— SettingControl.SettingControl has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 17 (28 pts), if/else 6, boolean chains 3 (nesting depth added 11). Of this number, 33 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StagingBar.StagingBar (cognitive 37) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:123— StagingBar.StagingBar has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 25 (44 pts), if/else 13 (16 pts), boolean chains 10 (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. This shape REPEATS in the file: one other method here (StagingBar.StagingBar::handleKeyDown) 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.
OverviewPane.ConnectedOverview (cognitive 37) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/OverviewPane.tsx:79— OverviewPane.ConnectedOverview has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 6 (12 pts), boolean chains 6, loops 1 (nesting depth added 8). None of this is in the body itself: all 37 points belong to 13 function literals inside it that branch (lines 268, 159, 148, …). 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.
importGalleryImages.commitCanvasRecall (cognitive 37) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:369— importGalleryImages.commitCanvasRecall has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 16). Of this number, 32 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
projectFile.importProjectFile (cognitive 37) invokeai/frontend/webv2/src/workbench/projects/projectFile.ts:283— projectFile.importProjectFile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 10 (12 pts), boolean chains 7, error handling 1 (nesting depth added 7). Of this number, 35 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
recall_parameters.update_recall_parameters (cognitive 36) invokeai/app/api/routers/recall_parameters.py:380— recall_parameters.update_recall_parameters has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (25 pts), error handling 4 (5 pts), boolean chains 3, ternaries 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.
session_queue.strip_missing_image_results (cognitive 36) invokeai/app/api/routers/session_queue.py:81— session_queue.strip_missing_image_results has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 6, ternaries 3 (6 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.
InvokeAdjustImageHuePlusInvocation.invoke (cognitive 36) invokeai/app/invocations/composition-nodes.py:85— InvokeAdjustImageHuePlusInvocation.invoke has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 8, ternaries 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InvokeImageCompositorInvocation.invoke (cognitive 36) invokeai/app/invocations/composition-nodes.py:1312— InvokeImageCompositorInvocation.invoke has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 10, 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.
MiniMaxH3ReferenceConditioningInvocation.invoke (cognitive 36) invokeai/app/invocations/minimax_h3/minimax_h3_reference.py:348— MiniMaxH3ReferenceConditioningInvocation.invoke has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (7 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.
graph_iterate_planner._get_body_iterate_collect_fan_in (cognitive 36) invokeai/app/services/shared/graph_iterate_planner.py:80— graph_iterate_planner._get_body_iterate_collect_fan_in has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 7, 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.
workflow_graph_builder._collect_exposed_inputs_from_form (cognitive 36) invokeai/app/services/shared/workflow_graph_builder.py:66— workflow_graph_builder._collect_exposed_inputs_from_form has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
sampling.build_ref2va_denoise_state (cognitive 36) invokeai/backend/minimax_h3/sampling.py:290— sampling.build_ref2va_denoise_state has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 4, 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.
StableDiffusionGeneratorPipeline.step (cognitive 36) invokeai/backend/stable_diffusion/diffusers_pipeline.py:438— StableDiffusionGeneratorPipeline.step has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (24 pts), loops 3 (8 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelSettingsIO.validateImportData (cognitive 36) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:100— modelSettingsIO.validateImportData has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 12 (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.
useEnqueueWorkflows.getBatchDataForWorkflowGeneration (cognitive 36) invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueWorkflows.ts:15— useEnqueueWorkflows.getBatchDataForWorkflowGeneration has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 4 (11 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 23). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.createQueueRuntime.submitQueueItem (cognitive 36) invokeai/frontend/webv2/src/features/queue/runtime.ts:2110— runtime.createQueueRuntime.submitQueueItem has cognitive complexity 36 (threshold 15). Drivers by points: if/else 22 (24 pts), boolean chains 9, ternaries 3 (nesting depth added 2). Of this number, 16 points are the body's own statements and 20 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
settings.normalizeUpscaleWidgetValues (cognitive 36) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:811— settings.normalizeUpscaleWidgetValues has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 30 (34 pts), boolean chains 1, if/else 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.
outputImages.visitOutputImageNames (cognitive 36) invokeai/frontend/webv2/src/platform/core/outputImages.ts:10— outputImages.visitOutputImageNames has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
layerPanelRows.flattenPanelRows (cognitive 36) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:111— layerPanelRows.flattenPanelRows has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 3 (12 pts), if/else 3 (10 pts), loops 3 (9 pts), boolean chains 5 (nesting depth added 22). Of this number, 33 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
adjustments.applyPixelRgbNoise (cognitive 36) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:860— adjustments.applyPixelRgbNoise has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 5 (13 pts), boolean chains 1, 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.
TextOptions.TextFontSettings (cognitive 36) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:566— TextOptions.TextFontSettings has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 12, if/else 9 (10 pts) (nesting depth added 6). Most of this is not in the body itself: 11 of the 36 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 637, 680, 705, …). 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.
LTX2DenoiseInvocation.invoke (cognitive 35) invokeai/app/invocations/ltx2/ltx2_denoise.py:398— LTX2DenoiseInvocation.invoke has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 11 (17 pts), if/else 11 (12 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
VideoConcatInvocation._build_audio_track (cognitive 35) invokeai/app/invocations/video_concat.py:699— VideoConcatInvocation._build_audio_track has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 4 (8 pts), boolean chains 3, loops 3 (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.
DefaultSessionProcessor._process (cognitive 35) invokeai/app/services/session_processor/session_processor_default.py:1386— DefaultSessionProcessor._process has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (28 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_if_runtime._validate_frame_axes (cognitive 35) invokeai/app/services/shared/graph_if_runtime.py:78— graph_if_runtime._validate_frame_axes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 2 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
quantized_loading.load_bnb4bit_state_dict (cognitive 35) invokeai/backend/ideogram4/quantized_loading.py:67— quantized_loading.load_bnb4bit_state_dict has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 3 (8 pts), loops 4, 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.
Flux2GGUFCheckpointModel._load_from_singlefile (cognitive 35) invokeai/backend/model_manager/load/model_loaders/flux.py:1837— Flux2GGUFCheckpointModel._load_from_singlefile has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 7 (18 pts), if/else 11 (15 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.
ZImageDiffusersModel._load_sdnq_text_encoder (cognitive 35) invokeai/backend/model_manager/load/model_loaders/z_image.py:297— ZImageDiffusersModel._load_sdnq_text_encoder has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 1 (4 pts), ternaries 4, boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RasterLayerCurvesAdjustmentsGraph.drawHistogram (cognitive 35) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:63— RasterLayerCurvesAdjustmentsGraph.drawHistogram has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 7 (14 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useConnection.useConnection (cognitive 35) invokeai/frontend/webv1/src/features/nodes/hooks/useConnection.ts:27— useConnection.useConnection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 7 (13 pts), boolean chains 5 (nesting depth added 11). None of this is in the body itself: all 35 points belong to 2 function literals inside it that branch (lines 108, 33). 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.
addOutpaint.addOutpaint (cognitive 35) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:39— addOutpaint.addOutpaint has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 3 (7 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useGalleryGridHotkeys.useGalleryGridHotkeys (cognitive 35) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridHotkeys.ts:73— useGalleryGridHotkeys.useGalleryGridHotkeys has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 7 (10 pts), boolean chains 5 (nesting depth added 7). None of this is in the body itself: all 35 points belong to 6 function items inside it that branch (a function literal at line 205, a function literal at line 137, getRangeAnchorKey, …). 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.
compileCanvasGraph.compileCanvasGraph (cognitive 35) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:1026— compileCanvasGraph.compileCanvasGraph has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 6, ternaries 3 (6 pts) (nesting depth added 11). Of this number, 31 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VideoReferenceListField.ReferenceCard (cognitive 35) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:82— VideoReferenceListField.ReferenceCard has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 16 (19 pts), boolean chains 8, if/else 8 (nesting depth added 3). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 216, 141, 158, …). 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.
validation.isValidLoopLinkageConnection (cognitive 35) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:370— validation.isValidLoopLinkageConnection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 11, 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.
libraryBrowseStore.loadWorkflowLibraryWindow (cognitive 35) invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:580— libraryBrowseStore.loadWorkflowLibraryWindow has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 17, if/else 14 (16 pts), error handling 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 631, 635, 660). 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.
Picker.Picker (cognitive 35) invokeai/frontend/webv2/src/platform/ui/Picker.tsx:125— Picker.Picker has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 9 (11 pts), boolean chains 6, loops 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 19 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
restoreProjectMedia.restoreProjectMedia (cognitive 35) invokeai/frontend/webv2/src/workbench/projects/invk/restoreProjectMedia.ts:204— restoreProjectMedia.restoreProjectMedia has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 7 (9 pts), ternaries 3, error handling 1 (nesting depth added 10). Of this number, 26 points are the body's own statements and 9 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RasterExportController.rasterize (cognitive 35) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts:167— RasterExportController.rasterize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 7, ternaries 4 (7 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
selectObjectSession.createSelectObjectSession.runRequest (cognitive 35) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:328— selectObjectSession.createSelectObjectSession.runRequest has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 10, ternaries 3 (5 pts), error handling 3 (nesting depth added 6). Most of this is not in the body itself: 13 of the 35 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 339, 401). 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.
unloadJournal.scenarios.testUnloadJournalScenarios (cognitive 35) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:189— unloadJournal.scenarios.testUnloadJournalScenarios has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 19, if/else 16. None of this is in the body itself: all 35 points belong to 19 function literals inside it that branch (lines 1239, 629, 1185, …). 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.
fields.InputField (cognitive 34) invokeai/app/invocations/fields.py:948— fields.InputField has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GalleryMaintenanceService._regenerate_thumbnails (cognitive 34) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:791— GalleryMaintenanceService._regenerate_thumbnails has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (22 pts), error handling 2 (8 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ExecutionNodeBuilder._get_known_iteration_path (cognitive 34) invokeai/app/services/shared/graph_materializer.py:118— _ExecutionNodeBuilder._get_known_iteration_path has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 4 (7 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.
_ExecutionNodeBuilder.create_nested_for_return (cognitive 34) invokeai/app/services/shared/graph_materializer.py:543— _ExecutionNodeBuilder.create_nested_for_return has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 5 (6 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.
_ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration (cognitive 34) invokeai/app/services/shared/graph_materializer.py:771— _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 4 (6 pts), boolean chains 2, 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.
Flux2DiffusersModel._load_model (cognitive 34) invokeai/backend/model_manager/load/model_loaders/flux.py:1170— Flux2DiffusersModel._load_model has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
z_image._convert_z_image_gguf_to_diffusers (cognitive 34) invokeai/backend/model_manager/load/model_loaders/z_image.py:145— z_image._convert_z_image_gguf_to_diffusers has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 2 (6 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anima_lora_conversion_utils.lora_model_from_anima_state_dict (cognitive 34) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:276— anima_lora_conversion_utils.lora_model_from_anima_state_dict has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (11 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.
InvokeAIDiffuserComponent.do_controlnet_step (cognitive 34) invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:58— InvokeAIDiffuserComponent.do_controlnet_step has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 4, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CanvasToolModule.onKeyDown (cognitive 34) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:796— CanvasToolModule.onKeyDown has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 8 (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.
ModelInstallQueue.ModelInstallQueue (cognitive 34) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueue.tsx:75— ModelInstallQueue.ModelInstallQueue has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 11, ternaries 3 (6 pts), error handling 1, loops 1 (nesting depth added 8). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 90, 127, 137, …). 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.
connectorTopology.getConnectorDeletionSpliceConnections (cognitive 34) invokeai/frontend/webv1/src/features/nodes/store/util/connectorTopology.ts:108— connectorTopology.getConnectorDeletionSpliceConnections has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 14). Of this number, 31 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildNodesGraph.buildNodesGraph (cognitive 34) invokeai/frontend/webv1/src/features/nodes/util/graph/buildNodesGraph.ts:48— buildNodesGraph.buildNodesGraph has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 12, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 34 points belong to 8 function literals inside it that branch (lines 68, 130, 55, …). 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.
ModelPicker.ModelPicker (cognitive 34) invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx:166— ModelPicker.ModelPicker has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 5, loops 3 (nesting depth added 12). None of this is in the body itself: all 34 points belong to 5 function literals inside it that branch (lines 202, 287, 211, …). 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.
HotkeyListItem.HotkeyItem (cognitive 34) invokeai/frontend/webv1/src/features/system/components/HotkeysModal/HotkeyListItem.tsx:92— HotkeyListItem.HotkeyItem has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 5 (11 pts), boolean chains 4, loops 1 (nesting depth added 8). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 8 function items inside it that branch (renderHotkeyKeys, a function literal at line 151, a function literal at line 116, …). 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.
GalleryBoardRow.GalleryBoardRow (cognitive 34) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx:42— GalleryBoardRow.GalleryBoardRow has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 18 (24 pts), if/else 6, boolean chains 4 (nesting depth added 6). Of this number, 18 points are the body's own statements and 16 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
GenerateReferenceImagesSection.GenerateReferenceImagesContent (cognitive 34) invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx:84— GenerateReferenceImagesSection.GenerateReferenceImagesContent has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 17 (19 pts), if/else 11, boolean chains 4 (nesting depth added 2). Of this number, 16 points are the body's own statements and 18 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WorkflowFieldInput.VideoFrameIndexInput (cognitive 34) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1257— WorkflowFieldInput.VideoFrameIndexInput has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 14 (25 pts), boolean chains 8, if/else 1 (nesting depth added 11). Of this number, 26 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CropLayerController.cropAll (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:282— CropLayerController.cropAll has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, error handling 3 (4 pts), loops 3 (nesting depth added 9). Of this number, 33 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
documentIndex.deriveIndexForValueEdit (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:292— documentIndex.deriveIndexForValueEdit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6 (8 pts), boolean chains 6, ternaries 5 (nesting depth added 9). Of this number, 27 points are the body's own statements and 7 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.
bitmapStore.createBitmapStore.flushPendingUploads (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:699— bitmapStore.createBitmapStore.flushPendingUploads has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (nesting depth added 16). Of this number, 31 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MetadataToSDXLLorasInvocation.invoke (cognitive 33) invokeai/app/invocations/metadata_linked.py:1077— MetadataToSDXLLorasInvocation.invoke has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 1, ternaries 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.
ModelInstallService._clear_pending_jobs (cognitive 33) invokeai/app/services/model_install/model_install_default.py:808— ModelInstallService._clear_pending_jobs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 7, loops 3 (5 pts), error handling 1 (2 pts), ternaries 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.
ExecutionPlan.from_snapshot (cognitive 33) invokeai/app/services/shared/execution_engine/scheduler.py:151— ExecutionPlan.from_snapshot has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._validate_for_continuation_output (cognitive 33) invokeai/app/services/shared/graph.py:2019— GraphExecutionState._validate_for_continuation_output has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), ternaries 2 (8 pts), boolean chains 3 (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.
graph_loop_topology._recognize_nested_iterate_sequence (cognitive 33) invokeai/app/services/shared/graph_loop_topology.py:370— graph_loop_topology._recognize_nested_iterate_sequence has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise.denoise (cognitive 33) invokeai/backend/ernie_image/denoise.py:27— denoise.denoise has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useImageUploadButton.useImageUploadButton (cognitive 33) invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx:68— useImageUploadButton.useImageUploadButton has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 4 (11 pts), boolean chains 2, error handling 1 (nesting depth added 14). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 89, 140, 210, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
UserManagement.UserFormModal (cognitive 33) invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:77— UserManagement.UserFormModal has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 15, ternaries 9 (10 pts), if/else 5 (6 pts), error handling 2 (nesting depth added 2). Of this number, 16 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
ToolWidthPicker.ToolWidthPicker (cognitive 33) invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:223— ToolWidthPicker.ToolWidthPicker has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (22 pts), boolean chains 7, ternaries 2 (3 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 388, 252, 411, …). 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.
mock-working-memory.createWorkingMemoryMock.linesOf (cognitive 33) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:470— mock-working-memory.createWorkingMemoryMock.linesOf has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 19 (28 pts), boolean chains 4, if/else 1 (nesting depth added 9). None of this is in the body itself: all 33 points belong to 5 function items inside it that branch (a function literal at line 483, a function literal at line 499, judged, …). 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.
semanticImageQuery.parseGallerySemanticReference (cognitive 33) invokeai/frontend/webv2/src/features/gallery/core/semanticImageQuery.ts:232— semanticImageQuery.parseGallerySemanticReference has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 9, ternaries 2 (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.
GeneratePresetsPopover.GeneratePresetsPopover (cognitive 33) invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx:174— GeneratePresetsPopover.GeneratePresetsPopover has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (20 pts), if/else 10, loops 1 (2 pts), boolean chains 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 16 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
installsStore.refreshInstalls (cognitive 33) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:146— installsStore.refreshInstalls has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 5 (7 pts), boolean chains 5, loops 4 (nesting depth added 8). None of this is in the body itself: all 33 points belong to 4 function literals inside it that branch (lines 152, 158, 231, …). 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.
widgetValues.syncVideoWidgetValuesWithModels (cognitive 33) invokeai/frontend/webv2/src/features/video/core/widgetValues.ts:43— widgetValues.syncVideoWidgetValuesWithModels has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (11 pts), ternaries 10 (11 pts) (nesting depth added 3). Of this number, 25 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
validation.validateConnection (cognitive 33) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:511— validation.validateConnection has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 7). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RunLayerWorkflowDialog.RunLayerWorkflowDialog (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx:198— RunLayerWorkflowDialog.RunLayerWorkflowDialog has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 9 (10 pts), boolean chains 6, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 354, 320, 255, …). 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.
overlayRenderer.traceBboxFrameBand (cognitive 33) invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts:749— overlayRenderer.traceBboxFrameBand has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 9 (27 pts), loops 2 (3 pts), if/else 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
controlPanelModel.deriveDetection (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:148— controlPanelModel.deriveDetection has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (28 pts), boolean chains 4, if/else 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.
board_images.remove_images_from_board (cognitive 32) invokeai/app/api/routers/board_images.py:304— board_images.remove_images_from_board has cognitive complexity 32 (threshold 15). Drivers by points: error handling 9 (18 pts), if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiniMaxH3DenoiseInvocation.invoke (cognitive 32) invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:319— MiniMaxH3DenoiseInvocation.invoke has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 7, error handling 2 (4 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.
ExtractVideoRangeInvocation.invoke (cognitive 32) invokeai/app/invocations/video_frame_extract_range.py:187— ExtractVideoRangeInvocation.invoke has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, ternaries 3, error handling 1 (2 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, 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.
image_index_common.blobs_to_embeddings (cognitive 32) invokeai/app/services/image_index/image_index_common.py:94— image_index_common.blobs_to_embeddings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrphanedModelsService.find_orphaned_models (cognitive 32) invokeai/app/services/orphaned_models/orphaned_models_service.py:73— OrphanedModelsService.find_orphaned_models has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 3 (8 pts), loops 6 (8 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.
ChildDependencyRecord._validate_relationship (cognitive 32) invokeai/app/services/shared/execution_engine/child.py:467— ChildDependencyRecord._validate_relationship has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_ExecutionScheduler.get_next_node (cognitive 32) invokeai/app/services/shared/graph_scheduler.py:254— _ExecutionScheduler.get_next_node has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlNetModel.__init__ (cognitive 32) invokeai/backend/util/hotfixes.py:109— ControlNetModel.__init__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
fit.fit_points (cognitive 32) invokeai/backend/working_memory/fit.py:544— fit.fit_points has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 4, loops 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.
fit._lowest_rounded (cognitive 32) invokeai/backend/working_memory/fit.py:843— fit._lowest_rounded has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addInpaint.addInpaint (cognitive 32) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:47— addInpaint.addInpaint has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildZImageGraph.buildZImageGraph (cognitive 32) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:49— buildZImageGraph.buildZImageGraph has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 7 (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.
GenerationSettingsAccordion.GenerationSettingsAccordion (cognitive 32) invokeai/frontend/webv1/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx:62— GenerationSettingsAccordion.GenerationSettingsAccordion has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 27, ternaries 5. Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
selection.getGalleryNavigationStep (cognitive 32) invokeai/frontend/webv2/src/features/gallery/core/selection.ts:311— selection.getGalleryNavigationStep has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (11 pts), boolean chains 9, if/else 4 (9 pts), ternaries 2 (3 pts) (nesting depth added 11). Of this number, 27 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
galleryBoardGroups.getGalleryBoardGroups (cognitive 32) invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts:61— galleryBoardGroups.getGalleryBoardGroups has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 16, if/else 4 (9 pts), loops 2 (4 pts), ternaries 3 (nesting depth added 7). Of this number, 20 points are the body's own statements and 12 belong to 9 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.
runtime.createQueueRuntime.routeRunResults (cognitive 32) invokeai/frontend/webv2/src/features/queue/runtime.ts:1238— runtime.createQueueRuntime.routeRunResults has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 3 (7 pts), boolean chains 3, error handling 2, loops 1 (2 pts) (nesting depth added 12). Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.createQueueRuntime.initialize::initializeProjects (cognitive 32) invokeai/frontend/webv2/src/features/queue/runtime.ts:2813— runtime.createQueueRuntime.initialize::initializeProjects has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 4 (9 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.
QueueItemRow.QueueItemRow (cognitive 32) invokeai/frontend/webv2/src/features/queue/ui/QueueItemRow.tsx:32— QueueItemRow.QueueItemRow has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 19 (22 pts), boolean chains 7, if/else 3 (nesting depth added 3). Of this number, 28 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
buildGraph.planWorkflowSeeds (cognitive 32) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:509— buildGraph.planWorkflowSeeds has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 5 (17 pts), if/else 4 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workflowJson.parseWorkflowJson (cognitive 32) invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:283— workflowJson.parseWorkflowJson has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 5 (11 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 12). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolStripFlyout.ToolFamilyButton (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:49— ToolStripFlyout.ToolFamilyButton has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 5, boolean chains 4, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 118, 148, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ImageMapWidgetView.ImageMapWidgetView (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx:79— ImageMapWidgetView.ImageMapWidgetView has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 10, boolean chains 5 (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.
MergeLayerController.mergeSelectedInto (cognitive 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:628— MergeLayerController.mergeSelectedInto has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 6, loops 5, ternaries 3 (4 pts) (nesting depth added 2). Of this number, 28 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ControlDerivationController.commitControlMap (cognitive 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:198— ControlDerivationController.commitControlMap has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 7, ternaries 2 (4 pts), error handling 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
imageRecall.getRefinerRecall (cognitive 32) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1024— imageRecall.getRefinerRecall has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 10 (17 pts), if/else 7 (8 pts), boolean chains 7 (nesting depth added 8). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueueRecoveryNotice.QueueRecoveryNotice (cognitive 32) invokeai/frontend/webv2/src/workbench/queue-integration/QueueRecoveryNotice.tsx:34— QueueRecoveryNotice.QueueRecoveryNotice has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 9, error handling 3, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 71, 118, 97, …). 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.
WorkbenchShell.WorkbenchShell (cognitive 32) invokeai/frontend/webv2/src/workbench/shell/WorkbenchShell.tsx:66— WorkbenchShell.WorkbenchShell has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 9, if/else 9, loops 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 222, 148, 247, …). 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.
widgetDnd.resolveWidgetDragEnd (cognitive 32) invokeai/frontend/webv2/src/workbench/widgetDnd.ts:224— widgetDnd.resolveWidgetDragEnd has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 8 (13 pts), boolean chains 5 (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.
LayerFilterControls.FilterParamField (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterControls.tsx:143— LayerFilterControls.FilterParamField has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 8, boolean chains 7 (nesting depth added 4). Of this number, 25 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ControlDetectionRow.ControlDetectionRow (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlDetectionRow.tsx:40— ControlDetectionRow.ControlDetectionRow has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 19 (27 pts), boolean chains 4, if/else 1 (nesting depth added 8). Of this number, 21 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VideoConcatInvocation.invoke (cognitive 31) invokeai/app/invocations/video_concat.py:205— VideoConcatInvocation.invoke has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 2 (6 pts), boolean chains 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.
user_management._modify_user_interactive (cognitive 31) invokeai/app/util/user_management.py:449— user_management._modify_user_interactive has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 6 (7 pts), boolean chains 5, error handling 2, 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.
ModelConfigFactory._validate_path_looks_like_model (cognitive 31) invokeai/backend/model_manager/configs/factory.py:901— ModelConfigFactory._validate_path_looks_like_model has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserProfile.UserProfile (cognitive 31) invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:38— UserProfile.UserProfile has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 12, if/else 3, error handling 2 (nesting depth added 1). Of this number, 23 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CanvasTextToolModule.commitSession (cognitive 31) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:361— CanvasTextToolModule.commitSession has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 7 (11 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenerateDimensionFields.GenerateDimensionFields (cognitive 31) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:367— GenerateDimensionFields.GenerateDimensionFields has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 40 (50 pts), boolean chains 12, if/else 8 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (GenerateDimensionFields.GenerateDimensionFields::renderSection) 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.
graph.buildMiniMaxH3VideoGraph (cognitive 31) invokeai/frontend/webv2/src/features/video/core/graph.ts:438— graph.buildMiniMaxH3VideoGraph has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (15 pts), if/else 10, boolean chains 6 (nesting depth added 2). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
LayerGroupContextMenu.LayerGroupContextMenu (cognitive 31) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:73— LayerGroupContextMenu.LayerGroupContextMenu has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 11 (15 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 4). Of this number, 18 points are the body's own statements and 13 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CropLayerController.crop (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:175— CropLayerController.crop has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15, ternaries 6 (9 pts), boolean chains 6, 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.
MergeLayerController.mergeVisible (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394— MergeLayerController.mergeVisible has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23 (32 pts), ternaries 6 (13 pts), boolean chains 5, loops 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (MergeLayerController.mergeVisible::drawMerged) 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.
workbenchState.compileInvocationSnapshot (cognitive 31) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3376— workbenchState.compileInvocationSnapshot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 7 (11 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
documentMirror.diffValueEdit (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:168— documentMirror.diffValueEdit has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 5 (7 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
executeQueueItemRecall.executeQueueItemRecall (cognitive 31) invokeai/frontend/webv2/src/workbench/queue-integration/executeQueueItemRecall.ts:37— executeQueueItemRecall.executeQueueItemRecall has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 8, error handling 2 (4 pts), ternaries 2 (nesting depth added 6). Of this number, 30 points are the body's own statements and 1 belongs to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
QueueCluster.QueueCluster (cognitive 31) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:62— QueueCluster.QueueCluster has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 12 (20 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 9). Of this number, 26 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recall_parameters.resolve_control_models (cognitive 30) invokeai/app/api/routers/recall_parameters.py:214— recall_parameters.resolve_control_models has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExtractVideoRangeInvocation._write_spliced_range (cognitive 30) invokeai/app/invocations/video_frame_extract_range.py:373— ExtractVideoRangeInvocation._write_spliced_range has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 3, error handling 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.
config_default.migrate_v3_config_dict (cognitive 30) invokeai/app/services/config/config_default.py:584— config_default.migrate_v3_config_dict has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService._install_next_item (cognitive 30) invokeai/app/services/model_install/model_install_default.py:1716— ModelInstallService._install_next_item has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 3 (8 pts), boolean chains 2, 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.
graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect (cognitive 30) invokeai/app/services/shared/graph_if_dependencies.py:30— graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 9, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
aac_splice._set_audio_edit (cognitive 30) invokeai/app/util/aac_splice.py:280— aac_splice._set_audio_edit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 6 (11 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise.denoise (cognitive 30) invokeai/backend/ltx2/denoise.py:621— denoise.denoise has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 5 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoRALoader._load_model (cognitive 30) invokeai/backend/model_manager/load/model_loaders/lora.py:133— LoRALoader._load_model has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (29 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.
nvfp4.find_nvfp4_layers (cognitive 30) invokeai/backend/quantization/nvfp4.py:215— nvfp4.find_nvfp4_layers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 9, error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CanvasSegmentAnythingModule.onStagePointerUp (cognitive 30) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:752— CanvasSegmentAnythingModule.onStagePointerUp has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 2 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
run-graph._runGraph (cognitive 30) invokeai/frontend/webv1/src/services/api/run-graph.ts:152— run-graph._runGraph has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (17 pts), error handling 4 (9 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 327, a function literal at line 216, cleanup, …). 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.
PromptTextarea.PromptTextarea (cognitive 30) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTextarea.tsx:64— PromptTextarea.PromptTextarea has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 15 (21 pts), boolean chains 8, if/else 1 (nesting depth added 6). Most of this is not in the body itself: 13 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 157, 225, 99, …). 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.
PromptParser.parseNodes (cognitive 30) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:606— PromptParser.parseNodes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (4 pts), boolean chains 2, match/switch 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.
runtime.createQueueRuntime.handleItemsRetried (cognitive 30) invokeai/frontend/webv2/src/features/queue/runtime.ts:1882— runtime.createQueueRuntime.handleItemsRetried has cognitive complexity 30 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 6 (11 pts), boolean chains 5, 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.
graph.buildWanVideoGraph (cognitive 30) invokeai/frontend/webv2/src/features/video/core/graph.ts:280— graph.buildWanVideoGraph has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 6 (9 pts), boolean chains 6 (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.
videoGraphCoverage.testing.candidatesForSlot (cognitive 30) invokeai/frontend/webv2/src/features/video/core/videoGraphCoverage.testing.ts:61— videoGraphCoverage.testing.candidatesForSlot has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 4 (20 pts), loops 4 (10 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.
WorkflowFieldInput.SavedWorkflowInput (cognitive 30) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1718— WorkflowFieldInput.SavedWorkflowInput has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 14 (18 pts), boolean chains 7, if/else 5 (nesting depth added 4). Of this number, 21 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, split the body: 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.
FileFieldInput.FileFieldInput (cognitive 30) invokeai/frontend/webv2/src/features/workflow/ui/fields/FileFieldInput.tsx:35— FileFieldInput.FileFieldInput has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 7 (10 pts), boolean chains 7, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 60, 152, 166, …). 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.
HsvBoxPicker.HsvBoxPicker (cognitive 30) invokeai/frontend/webv2/src/platform/ui/HsvBoxPicker.tsx:27— HsvBoxPicker.HsvBoxPicker has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (20 pts), boolean chains 6, if/else 4 (nesting depth added 7). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 106, 127, 48, …). 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.
documentIndex.updateNodeValues (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:435— documentIndex.updateNodeValues has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 13). Of this number, 16 points are the body's own statements and 14 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
adjustments.streamNoiseRows (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:660— adjustments.streamNoiseRows has cognitive complexity 30 (threshold 15). Drivers by points: loops 10 (27 pts), if/else 2 (3 pts) (nesting depth added 18). 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.
VideoConcatInvocation._iter_joined_frames (cognitive 29) invokeai/app/invocations/video_concat.py:805— VideoConcatInvocation._iter_joined_frames has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExecutionRef._accept_token_fields (cognitive 29) invokeai/app/services/shared/execution_effects.py:146— ExecutionRef._accept_token_fields has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (6 pts), boolean chains 4 (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.
Config_Base.get_model_discriminator_value (cognitive 29) invokeai/backend/model_manager/configs/base.py:159— Config_Base.get_model_discriminator_value has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (28 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.
main._detect_wan_expert (cognitive 29) invokeai/backend/model_manager/configs/main.py:3153— main._detect_wan_expert has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 3 (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.
minimax_h3_state_dict_utils.convert_minimax_h3_checkpoint_to_diffusers (cognitive 29) invokeai/backend/model_manager/load/model_loaders/minimax_h3_state_dict_utils.py:76— minimax_h3_state_dict_utils.convert_minimax_h3_checkpoint_to_diffusers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (8 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.
PidDistillModel.generate_samples_from_batch (cognitive 29) invokeai/backend/pid/_src/models/pid_distill_model.py:168— PidDistillModel.generate_samples_from_batch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 5, ternaries 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.
TextLLMPipeline.run (cognitive 29) invokeai/backend/text_llm_pipeline.py:156— TextLLMPipeline.run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProtectedRoute.ProtectedRoute (cognitive 29) invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:21— ProtectedRoute.ProtectedRoute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 13 (nesting depth added 2). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 114, 100, 42, …). 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.
ModelView.ModelView (cognitive 29) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx:64— ModelView.ModelView has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 24, if/else 5. Of this number, 21 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
tsSourceAnalysis.collectPublicExports (cognitive 29) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:164— tsSourceAnalysis.collectPublicExports has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (9 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
baseGenerationPolicies.getBaseComponentSectionPolicy (cognitive 29) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1201— baseGenerationPolicies.getBaseComponentSectionPolicy has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (22 pts), boolean chains 5, if/else 1, match/switch 1 (nesting depth added 12). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserFormDialog.UserForm (cognitive 29) invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:76— UserFormDialog.UserForm has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 6 (10 pts), boolean chains 2, error handling 2 (nesting depth added 7). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 123, 108). 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.
holdLease.startIntermediatesHoldLease (cognitive 29) invokeai/frontend/webv2/src/features/intermediates/holdLease.ts:32— holdLease.startIntermediatesHoldLease has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, error handling 2 (4 pts), ternaries 2, loops 1 (nesting depth added 3). None of this is in the body itself: all 29 points belong to 9 function items inside it that branch (sendOnce, bodyFor, send, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runtime.createQueueRuntime.handleUnadoptedRerunSettled (cognitive 29) invokeai/frontend/webv2/src/features/queue/runtime.ts:2002— runtime.createQueueRuntime.handleUnadoptedRerunSettled has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 9, ternaries 4 (6 pts) (nesting depth added 4). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 6 function items inside it that branch (stage, recordError, a function literal at line 2037, …). 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.
WorkflowFieldInput.useMediaUpload.onFileChange (cognitive 29) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:692— WorkflowFieldInput.useMediaUpload.onFileChange has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (8 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 717). 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.
useLayerStackActions.useLayerStackActions (cognitive 29) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerStackActions.ts:48— useLayerStackActions.useLayerStackActions has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 10, boolean chains 7 (nesting depth added 4). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 81, 130, 168, …). 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.
usePreviewNavigation.usePreviewNavigation (cognitive 29) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:205— usePreviewNavigation.usePreviewNavigation has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, ternaries 11 (12 pts), if/else 3 (nesting depth added 1). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SelectionPixelController.edit (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:199— SelectionPixelController.edit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 8 (10 pts), boolean chains 6 (nesting depth added 3). Of this number, 25 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
documentMirror.diffForests (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:99— documentMirror.diffForests has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3, 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.
mediaReferences.collectMediaNames (cognitive 29) invokeai/frontend/webv2/src/workbench/mediaReferences.ts:21— mediaReferences.collectMediaNames has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
trusted_routes._copy_config (cognitive 28) invokeai/app/api/trusted_routes.py:46— trusted_routes._copy_config has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 4 (9 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.
baseinvocation.validate_fields (cognitive 28) invokeai/app/invocations/baseinvocation.py:604— baseinvocation.validate_fields has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 6, 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.
Flux2KleinLoRACollectionLoader.invoke (cognitive 28) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:163— Flux2KleinLoRACollectionLoader.invoke has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, 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.
ZImageLoRACollectionLoader.invoke (cognitive 28) invokeai/app/invocations/z_image/z_image_lora_loader.py:135— ZImageLoRACollectionLoader.invoke has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, 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.
ExternalGenerationService._validate_request (cognitive 28) invokeai/app/services/external_generation/external_generation_default.py:96— ExternalGenerationService._validate_request has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 8 (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.
DiskImageFileStorage.__recover_pending_deletes (cognitive 28) invokeai/app/services/image_files/image_files_disk.py:711— DiskImageFileStorage.__recover_pending_deletes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (7 pts), error handling 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.
ModelInstallService._migrate_yaml (cognitive 28) invokeai/app/services/model_install/model_install_default.py:1451— ModelInstallService._migrate_yaml has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), error handling 1 (4 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
graph_if_runtime.validate_if_iteration_axes (cognitive 28) invokeai/app/services/shared/graph_if_runtime.py:28— graph_if_runtime.validate_if_iteration_axes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (6 pts), boolean chains 5 (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.
h264_splice._sample_locations (cognitive 28) invokeai/app/util/h264_splice.py:273— h264_splice._sample_locations has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 3 (6 pts), ternaries 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main._get_flux2_variant (cognitive 28) invokeai/backend/model_manager/configs/main.py:530— main._get_flux2_variant has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelCache.put (cognitive 28) invokeai/backend/model_manager/load/model_cache/model_cache.py:902— ModelCache.put has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 12, loops 2 (3 pts), ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile (cognitive 28) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:492— QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 2 (4 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.
fp8_scaled.find_torchao_fp8_problem (cognitive 28) invokeai/backend/quantization/fp8_scaled.py:520— fp8_scaled.find_torchao_fp8_problem has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TorchDevice.get_generation_devices (cognitive 28) invokeai/backend/util/devices.py:363— TorchDevice.get_generation_devices has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextToolOptions.FontSelect (cognitive 28) invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:97— TextToolOptions.FontSelect has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 2). None of this is in the body itself: all 28 points belong to 14 function literals inside it that branch (lines 123, 216, 265, …). 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.
DeleteBoardModal.DeleteBoardModal (cognitive 28) invokeai/frontend/webv1/src/features/gallery/components/Boards/DeleteBoardModal.tsx:43— DeleteBoardModal.DeleteBoardModal has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 9, if/else 6 (nesting depth added 4). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 105, 123, 97, …). 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.
GalleryImageGrid.useKeyboardNavigation (cognitive 28) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:135— GalleryImageGrid.useKeyboardNavigation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 3, match/switch 1, ternaries 1 (nesting depth added 7). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 144). 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.
attention.groupWeightedLeaves (cognitive 28) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:209— attention.groupWeightedLeaves has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (13 pts), ternaries 4 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelSettingsIO.validateImportData (cognitive 28) invokeai/frontend/webv2/src/features/models/core/modelSettingsIO.ts:78— modelSettingsIO.validateImportData has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 10 (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.
workingMemory.deriveCalibrationProgress (cognitive 28) invokeai/frontend/webv2/src/features/models/core/workingMemory.ts:300— workingMemory.deriveCalibrationProgress has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, ternaries 5 (9 pts), if/else 6 (nesting depth added 4). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrphanedModelsDialog.OrphanedModelsDialog (cognitive 28) invokeai/frontend/webv2/src/features/models/ui/library/OrphanedModelsDialog.tsx:25— OrphanedModelsDialog.OrphanedModelsDialog has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (19 pts), if/else 6 (7 pts), boolean chains 1, error handling 1 (nesting depth added 14). Of this number, 16 points are the body's own statements and 12 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
shortcutHints.getCanvasShortcutHints (cognitive 28) invokeai/frontend/webv2/src/workbench/widgets/canvas/shortcutHints.ts:23— shortcutHints.getCanvasShortcutHints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, boolean chains 7, ternaries 4 (7 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.
MissingFontsDialog.RecoveryRow (cognitive 28) invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx:139— MissingFontsDialog.RecoveryRow has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 9, if/else 6 (7 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 166, 193). 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.
documentMirror.createDocumentMirror.refresh (cognitive 28) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:244— documentMirror.createDocumentMirror.refresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 1 (4 pts), boolean chains 2 (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.
imageRecall.readMetadataReferenceImages (cognitive 28) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1286— imageRecall.readMetadataReferenceImages has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (9 pts), ternaries 5 (7 pts) (nesting depth added 4). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 1298). 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.
canvasRecall.readCanvasSettings (cognitive 28) invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:68— canvasRecall.readCanvasSettings has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
revealGalleryItem.revealGalleryItem (cognitive 28) invokeai/frontend/webv2/src/workbench/image-actions/revealGalleryItem.ts:54— revealGalleryItem.revealGalleryItem has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 11, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 70, isCurrent). 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.
PreferencesPage.PreferencesPage (cognitive 28) invokeai/frontend/webv2/src/workbench/settings/PreferencesPage.tsx:30— PreferencesPage.PreferencesPage has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Flux3DenoiseInvocation._run_diffusion (cognitive 27) invokeai/app/invocations/flux3/flux3_denoise.py:113— Flux3DenoiseInvocation._run_diffusion has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 7, boolean chains 4 (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.
VideoConcatInvocation._execute_smart_render (cognitive 27) invokeai/app/invocations/video_concat.py:378— VideoConcatInvocation._execute_smart_render has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 6 (8 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fonts_parsing.parse_font_bytes (cognitive 27) invokeai/app/services/fonts/fonts_parsing.py:91— fonts_parsing.parse_font_bytes has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts), loops 2 (4 pts), ternaries 3, error handling 2 (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.
ModelInstallService._register_or_install (cognitive 27) invokeai/app/services/model_install/model_install_default.py:1780— ModelInstallService._register_or_install has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), error handling 4 (9 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
graph_if_dependencies._can_use_fresh_literal_if_iterate_collect (cognitive 27) invokeai/app/services/shared/graph_if_dependencies.py:107— graph_if_dependencies._can_use_fresh_literal_if_iterate_collect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, 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.
working_memory_calibration_fits._sizes (cognitive 27) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:423— working_memory_calibration_fits._sizes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (8 pts), boolean chains 2, 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.
video_thumbnails._iter_video_frames_unbounded (cognitive 27) invokeai/app/util/video_thumbnails.py:211— video_thumbnails._iter_video_frames_unbounded has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3 (7 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
checkpoint_quantization.reject_unloadable_quantization (cognitive 27) invokeai/backend/flux3/checkpoint_quantization.py:61— checkpoint_quantization.reject_unloadable_quantization has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
mistral_encoder._load_tokenizer_for_model (cognitive 27) REDACTED:984— mistral_encoder._load_tokenizer_for_model has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_util.calc_model_size_by_fs (cognitive 27) invokeai/backend/model_manager/load/model_util.py:118— model_util.calc_model_size_by_fs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ModelSettingsImportButton.ModelSettingsImportButton (cognitive 27) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelSettingsImportButton.tsx:16— ModelSettingsImportButton.ModelSettingsImportButton has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), error handling 2 (5 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 7). None of this is in the body itself: all 27 points belong to 3 function literals inside it that branch (lines 23, 122, 129). 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.
buildFLUXGraph.buildFLUXGraph::addFlux2Features (cognitive 27) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:388— buildFLUXGraph.buildFLUXGraph::addFlux2Features has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (buildFLUXGraph.buildFLUXGraph) 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.
ast.tokenizePrompt (cognitive 27) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:162— ast.tokenizePrompt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemPromptsField.SystemPromptsField (cognitive 27) invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx:101— SystemPromptsField.SystemPromptsField has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 7, boolean chains 3, error handling 3 (nesting depth added 5). Of this number, 15 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
InstallJobRow.InstallJobRow (cognitive 27) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallJobRow.tsx:61— InstallJobRow.InstallJobRow has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 20 (22 pts), boolean chains 5 (nesting depth added 2). Of this number, 22 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
runtime.createQueueItemBackendSubmission (cognitive 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:276— runtime.createQueueItemBackendSubmission has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 10, if/else 9 (10 pts), ternaries 4 (7 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.
QueueHeaderActions.InvocationCacheSection (cognitive 27) invokeai/frontend/webv2/src/features/queue/ui/QueueHeaderActions.tsx:178— QueueHeaderActions.InvocationCacheSection has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 12 (22 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 10). Of this number, 24 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.sanitizeVideoReferences (cognitive 27) invokeai/frontend/webv2/src/features/video/core/settings.ts:190— settings.sanitizeVideoReferences has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, loops 4 (5 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.
RasterizeLayerController.rasterize (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterizeLayerController.ts:72— RasterizeLayerController.rasterize has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6, ternaries 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.
adjustments.buildCurveLut (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:33— adjustments.buildCurveLut has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 8 (11 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pointerPipeline.createPointerPipeline.onKeyDown (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:425— pointerPipeline.createPointerPipeline.onKeyDown has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 6 (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.
firstPartyCommands.useRegisterFirstPartyCommands (cognitive 27) invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts:115— firstPartyCommands.useRegisterFirstPartyCommands has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 5, loops 3, error handling 1 (nesting depth added 2). None of this is in the body itself: all 27 points belong to 12 function items inside it that branch (recallSelectedImage, a function literal at line 311, loadSelectedItemWorkflow, …). 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.
mediaUsageReport.resolveMediaUsage (cognitive 27) invokeai/frontend/webv2/src/workbench/image-actions/mediaUsageReport.ts:236— mediaUsageReport.resolveMediaUsage has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (9 pts), boolean chains 4, error handling 2, loops 2 (nesting depth added 7). Of this number, 22 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
executeImageRecall.executeLoadMediaWorkflow (cognitive 27) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:99— executeImageRecall.executeLoadMediaWorkflow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 4, ternaries 2, 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.
ReferenceImageSettings.ReferenceImageEditor (cognitive 27) invokeai/frontend/webv2/src/workbench/widgets/layers/ReferenceImageSettings.tsx:225— ReferenceImageSettings.ReferenceImageEditor has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 14 (17 pts), if/else 6, boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 328, 278, 291, …). 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.
recall_parameters.resolve_ip_adapter_models (cognitive 26) invokeai/app/api/routers/recall_parameters.py:270— recall_parameters.resolve_ip_adapter_models has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnimaLoRACollectionLoader.invoke (cognitive 26) invokeai/app/invocations/anima/anima_lora_loader.py:124— AnimaLoRACollectionLoader.invoke has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SD3DenoiseInvocation._raise_unless_loras_fit (cognitive 26) invokeai/app/invocations/sd3/sd3_denoise.py:459— SD3DenoiseInvocation._raise_unless_loras_fit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (8 pts), boolean chains 3, 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.
ModelInstallService._staged_remote_files (cognitive 26) invokeai/app/services/model_install/model_install_default.py:2386— ModelInstallService._staged_remote_files has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (9 pts), error handling 1 (4 pts), ternaries 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.
DefaultSessionRunner._run_session_loop (cognitive 26) invokeai/app/services/session_processor/session_processor_default.py:214— DefaultSessionRunner._run_session_loop has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StreamBuffer._coerce_event (cognitive 26) invokeai/app/services/shared/execution_engine/primitives.py:322— StreamBuffer._coerce_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 3, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._record_iterate_stream (cognitive 26) invokeai/app/services/shared/graph.py:1625— GraphExecutionState._record_iterate_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 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.
Graph._resolve_collection_input_types (cognitive 26) invokeai/app/services/shared/graph_validation.py:1792— Graph._resolve_collection_input_types has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (7 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.
WorkingMemoryCalibrationService.refresh_user_fits (cognitive 26) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1520— WorkingMemoryCalibrationService.refresh_user_fits has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkingMemoryCalibrationService._canceled_runs (cognitive 26) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1637— WorkingMemoryCalibrationService._canceled_runs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sd3_lora_constants.resolve_sd3_transformer_module (cognitive 26) invokeai/backend/patches/lora_conversions/sd3_lora_constants.py:138— sd3_lora_constants.resolve_sd3_transformer_module has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (8 pts), ternaries 1 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LQProjection2D.init_weights (cognitive 26) invokeai/backend/pid/_src/networks/lq_projection_2d.py:271— LQProjection2D.init_weights has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 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.
MultiDiffusionPipeline.multi_diffusion_denoise (cognitive 26) invokeai/backend/stable_diffusion/multi_diffusion_pipeline.py:39— MultiDiffusionPipeline.multi_diffusion_denoise has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), 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.
fit.two_phase_envelope (cognitive 26) invokeai/backend/working_memory/fit.py:415— fit.two_phase_envelope has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (4 pts), error handling 1 (3 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Picker.PickerSyncer (cognitive 26) invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:669— Picker.PickerSyncer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 13). None of this is in the body itself: all 26 points belong to 2 function literals inside it that branch (lines 687, 689). 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.
ChangeBoardModal.ChangeBoardModal (cognitive 26) invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:40— ChangeBoardModal.ChangeBoardModal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 4 (5 pts), loops 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 87, 59, 182, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pressure.appendPressureStrokeRenderOpsToCanvas (cognitive 26) invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:491— pressure.appendPressureStrokeRenderOpsToCanvas has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 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.
buildAnimaGraph.buildAnimaGraph (cognitive 26) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildAnimaGraph.ts:32— buildAnimaGraph.buildAnimaGraph has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 6, ternaries 1 (2 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.
validateWorkflow.refreshCallSavedWorkflowDynamicInputs (cognitive 26) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:57— validateWorkflow.refreshCallSavedWorkflowDynamicInputs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (5 pts), boolean chains 4, error handling 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.
mock-backend.filterGalleryItems (cognitive 26) invokeai/frontend/webv2/scripts/mock-backend.mjs:954— mock-backend.filterGalleryItems has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 10, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 26 points belong to 2 function literals inside it that branch (lines 966, 1009). 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.
tsSourceAnalysis.collectModuleReferences::visit (cognitive 26) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:224— tsSourceAnalysis.collectModuleReferences::visit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (9 pts), boolean chains 8 (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.
dependencyPolicy.checkDependency (cognitive 26) invokeai/frontend/webv2/src/architecture/dependencyPolicy.ts:227— dependencyPolicy.checkDependency has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 11 (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.
react.createDeferredFontRuntime (cognitive 26) invokeai/frontend/webv2/src/features/fonts/react.tsx:32— react.createDeferredFontRuntime has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (18 pts), loops 4, boolean chains 2, ternaries 2 (nesting depth added 1). None of this is in the body itself: all 26 points belong to 13 function items inside it that branch (a function literal at line 107, a function literal at line 132, a function literal at line 156, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
galleryGridLayout.buildSparseGalleryNavigationEntries (cognitive 26) invokeai/frontend/webv2/src/features/gallery/ui/galleryGridLayout.ts:204— galleryGridLayout.buildSparseGalleryNavigationEntries has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (14 pts), boolean chains 4, if/else 3 (4 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryBoardMenu.GalleryBoardMenu (cognitive 26) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:47— GalleryBoardMenu.GalleryBoardMenu has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 16, if/else 8, ternaries 2. Of this number, 16 points are the body's own statements and 10 belong to 9 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.
PromptParser.parseQuotedPromptFunction (cognitive 26) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:410— PromptParser.parseQuotedPromptFunction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 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.
GenerateResetMenuItems.GenerateResetMenuItems (cognitive 26) invokeai/frontend/webv2/src/features/generation/ui/GenerateResetMenuItems.tsx:34— GenerateResetMenuItems.GenerateResetMenuItems has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 5, if/else 2 (nesting depth added 7). None of this is in the body itself: all 26 points belong to 4 function items inside it that branch (a function literal at line 49, a function literal at line 71, 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.
GenerateProviderOptionsSection.GenerateProviderOptionsSection (cognitive 26) invokeai/frontend/webv2/src/features/generation/ui/GenerateProviderOptionsSection.tsx:51— GenerateProviderOptionsSection.GenerateProviderOptionsSection has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 10 (12 pts) (nesting depth added 8). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 162, 211, 126, …). 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.
PromptTemplatesPanel.PromptTemplatesPanel (cognitive 26) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx:65— PromptTemplatesPanel.PromptTemplatesPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (18 pts), boolean chains 5, if/else 2, error handling 1 (nesting depth added 9). Of this number, 23 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.isVideoSettings (cognitive 26) invokeai/frontend/webv2/src/features/video/core/settings.ts:470— settings.isVideoSettings has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 25, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkflowLibraryCard.WorkflowLibraryCard (cognitive 26) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx:153— WorkflowLibraryCard.WorkflowLibraryCard has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 19 (20 pts), boolean chains 6 (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.
NodeFieldControl.NodeFieldControl (cognitive 26) invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx:62— NodeFieldControl.NodeFieldControl has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 9, if/else 2 (nesting depth added 4). Of this number, 23 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LayerMutationController.convertToControl (cognitive 26) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:484— LayerMutationController.convertToControl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, boolean chains 7, ternaries 3 (5 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.
fontLoader.createFontLoader.ensureSource (cognitive 26) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:350— fontLoader.createFontLoader.ensureSource has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 4 (9 pts), boolean chains 4 (nesting depth added 11). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiagnosticsPanel.DiagnosticsPanel (cognitive 26) invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx:128— DiagnosticsPanel.DiagnosticsPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (20 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 12 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageRecall.getMetadataConcepts (cognitive 26) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1117— imageRecall.getMetadataConcepts has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 8 (10 pts), boolean chains 4, 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.
ImageContextMenu.SingleItemMenuItems (cognitive 26) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:286— ImageContextMenu.SingleItemMenuItems has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 6, if/else 2 (3 pts), error handling 1 (nesting depth added 5). Of this number, 20 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
exportProject.executeInvkExport (cognitive 26) invokeai/frontend/webv2/src/workbench/projects/invk/exportProject.ts:148— exportProject.executeInvkExport has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, ternaries 4, loops 1 (2 pts), error handling 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 12 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenerationDevicesSettings.GenerationDevicesSettings (cognitive 26) invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx:24— GenerationDevicesSettings.GenerationDevicesSettings has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 5, boolean chains 3, error handling 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ControlModelRow.ControlModelRow (cognitive 26) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlModelRow.tsx:65— ControlModelRow.ControlModelRow has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 5, if/else 4 (nesting depth added 5). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 105, 133, 144, …). 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.
FLUXLoRACollectionLoader.invoke (cognitive 25) invokeai/app/invocations/flux/flux_lora_loader.py:146— FLUXLoRACollectionLoader.invoke has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiskImageFileStorage.__iter_supported_paths (cognitive 25) invokeai/app/services/image_files/image_files_disk.py:132— DiskImageFileStorage.__iter_supported_paths has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_IfActivationController._branch_sources (cognitive 25) invokeai/app/services/shared/graph_if_activation.py:26— _IfActivationController._branch_sources has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 pts), boolean chains 6 (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.
graph_loop_topology._recognize_nested_iterate_body (cognitive 25) invokeai/app/services/shared/graph_loop_topology.py:187— graph_loop_topology._recognize_nested_iterate_body has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
graph_loop_topology._recognize_nested_iterate_chain (cognitive 25) invokeai/app/services/shared/graph_loop_topology.py:263— graph_loop_topology._recognize_nested_iterate_chain has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, 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.
graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer (cognitive 25) invokeai/app/services/shared/graph_nested_iterate_planner.py:207— graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Main_Diffusers_LTX2_Config.from_model_on_disk (cognitive 25) invokeai/backend/model_manager/configs/main.py:2123— Main_Diffusers_LTX2_Config.from_model_on_disk has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, loops 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.
flux2_state_dict_utils.convert_flux2_vae_bfl_to_diffusers (cognitive 25) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:252— flux2_state_dict_utils.convert_flux2_vae_bfl_to_diffusers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 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.
GenericDiffusersLoader.get_hf_load_class (cognitive 25) invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py:52— GenericDiffusersLoader.get_hf_load_class has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6 (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.
ggml_tensor.dequantize_and_run (cognitive 25) invokeai/backend/quantization/gguf/ggml_tensor.py:15— ggml_tensor.dequantize_and_run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkflowFormPreview.WorkflowFormPreview (cognitive 25) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:81— WorkflowFormPreview.WorkflowFormPreview has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 112, 93, 102). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GalleryImageGridPaged.GalleryImageGridPaged (cognitive 25) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGridPaged.tsx:13— GalleryImageGridPaged.GalleryImageGridPaged has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 6 (nesting depth added 1). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 36, 84, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RelatedModels.RelatedModels (cognitive 25) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx:108— RelatedModels.RelatedModels has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, loops 3 (4 pts), ternaries 2 (nesting depth added 4). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 220, 246, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
fieldValidators.validateNumberFieldCollectionValue (cognitive 25) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:116— fieldValidators.validateNumberFieldCollectionValue has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 8, 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.
run-project-file-journey.executeProjectFileJourney (cognitive 25) REDACTED:1170— run-project-file-journey.executeProjectFileJourney has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 4, boolean chains 3, ternaries 2 (3 pts) (nesting depth added 3). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 9 function items inside it that branch (stopPreview, a function literal at line 1238, fail, …). 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.
backend.moveGalleryVideoItemsToBoard (cognitive 25) REDACTED:1478— backend.moveGalleryVideoItemsToBoard has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, error handling 1 (2 pts), loops 2, ternaries 1 (nesting depth added 9). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 2 function items inside it that branch (worker, claimNextVideo). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
controlValidation.getControlValidationReason (cognitive 25) invokeai/frontend/webv2/src/features/generation/core/canvas/controlValidation.ts:113— controlValidation.getControlValidationReason has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, boolean chains 9, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
attention.adjustNodes (cognitive 25) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:263— attention.adjustNodes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 11). Of this number, 19 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelDefaultsReset.getApplyModelDefaultsPlan (cognitive 25) invokeai/frontend/webv2/src/features/generation/ui/shared/modelDefaultsReset.ts:129— modelDefaultsReset.getApplyModelDefaultsPlan has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 4 (9 pts), boolean chains 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utilityGraph.watchUtilityItems.readItems (cognitive 25) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:332— utilityGraph.watchUtilityItems.readItems has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
videoPolicies.getVideoComponentSectionPolicy (cognitive 25) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1510— videoPolicies.getVideoComponentSectionPolicy has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, ternaries 5 (9 pts), if/else 5 (6 pts) (nesting depth added 5). Of this number, 18 points are the body's own statements and 7 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
connectors.resolveLoopLinkagePath (cognitive 25) invokeai/frontend/webv2/src/features/workflow/core/connectors.ts:56— connectors.resolveLoopLinkagePath has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
batch.readProperty (cognitive 25) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:301— batch.readProperty has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (18 pts), boolean chains 5, if/else 1, match/switch 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.
templates.buildInputTemplate (cognitive 25) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:237— templates.buildInputTemplate has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 8 (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.
libraryBrowseStore.pumpEnrichment (cognitive 25) invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:453— libraryBrowseStore.pumpEnrichment has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 501, publish, a function literal at line 493). 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.
ProjectWorkflowsView.ProjectWorkflowsView (cognitive 25) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:116— ProjectWorkflowsView.ProjectWorkflowsView has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14 (16 pts), if/else 5 (6 pts), boolean chains 3 (nesting depth added 3). Of this number, 13 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
GeneratorFieldInput.GeneratorFieldInput (cognitive 25) invokeai/frontend/webv2/src/features/workflow/ui/fields/GeneratorFieldInput.tsx:396— GeneratorFieldInput.GeneratorFieldInput has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9, boolean chains 8, if/else 7 (8 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Select.Select (cognitive 25) invokeai/frontend/webv2/src/platform/ui/Select.tsx:102— Select.Select has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 15 (21 pts), boolean chains 4 (nesting depth added 6). Of this number, 14 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layerPanelState.reconcileLayerPanelState (cognitive 25) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:204— layerPanelState.reconcileLayerPanelState has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 8, if/else 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useCanvasGallerySave.useCanvasGallerySave.save (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasGallerySave.ts:52— useCanvasGallerySave.useCanvasGallerySave.save has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 3 (6 pts), boolean chains 3, error handling 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 59, 90). 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.
layerRowSummary.layerRowSummary (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowSummary.ts:6— layerRowSummary.layerRowSummary has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 4 (9 pts), boolean chains 1, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PreviewActionStrip.PreviewActionStrip (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewActionStrip.tsx:43— PreviewActionStrip.PreviewActionStrip has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14 (19 pts), if/else 4, boolean chains 2 (nesting depth added 5). Of this number, 20 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PreviewDetailsPanel.PreviewDetailsPanel (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewDetailsPanel.tsx:88— PreviewDetailsPanel.PreviewDetailsPanel has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (13 pts), if/else 7, boolean chains 5 (nesting depth added 4). Of this number, 15 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
workbenchState.assembleWorkbenchProject (cognitive 25) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2324— workbenchState.assembleWorkbenchProject has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, ternaries 4 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
shapeTool.createShapeTool.commitPixels (cognitive 25) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:259— shapeTool.createShapeTool.commitPixels has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13, boolean chains 7, ternaries 4, error handling 1. Of this number, 21 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
imageMapStore.refreshImageIndexStatus (cognitive 25) invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts:436— imageMapStore.refreshImageIndexStatus has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (10 pts), ternaries 2 (5 pts) (nesting depth added 6). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 449, 508). 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.
useCommandPaletteController.useCommandPaletteController (cognitive 25) invokeai/frontend/webv2/src/workbench/palette/useCommandPaletteController.ts:61— useCommandPaletteController.useCommandPaletteController has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (19 pts), boolean chains 6 (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.
WidgetInstanceContextMenu.WidgetInstanceContextMenu (cognitive 25) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetInstanceContextMenu.tsx:34— WidgetInstanceContextMenu.WidgetInstanceContextMenu has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 4, boolean chains 3 (nesting depth added 8). Of this number, 17 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SocketIO._handle_connect (cognitive 24) invokeai/app/api/sockets.py:266— SocketIO._handle_connect has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 1 (4 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.
MetadataToLorasInvocation.invoke (cognitive 24) invokeai/app/invocations/metadata_linked.py:1000— MetadataToLorasInvocation.invoke has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 1, 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.
WanLatentsToVideoInvocation.invoke (cognitive 24) invokeai/app/invocations/vae/wan_latents_to_video.py:98— WanLatentsToVideoInvocation.invoke has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 4, loops 1 (2 pts), ternaries 2, error handling 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.
_ExpertSwapper.get (cognitive 24) invokeai/app/invocations/wan/wan_denoise.py:211— _ExpertSwapper.get has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3, 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.
run_app.run_app (cognitive 24) invokeai/app/run_app.py:111— run_app.run_app has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (6 pts), ternaries 1 (3 pts), boolean chains 1, error handling 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.
FontService._rescan_directory (cognitive 24) REDACTED:292— FontService._rescan_directory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, error handling 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.
GraphExecutionState._coerce_execution_ref (cognitive 24) invokeai/app/services/shared/graph.py:2310— GraphExecutionState._coerce_execution_ref has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (18 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.
GraphExecutionState.complete (cognitive 24) invokeai/app/services/shared/graph.py:3990— GraphExecutionState.complete has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (7 pts), boolean chains 3, 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.
_ExecutionRuntime._build_collect_collection (cognitive 24) invokeai/app/services/shared/graph_execution_runtime.py:134— _ExecutionRuntime._build_collect_collection has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (7 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_iterate_planner._get_direct_iterate_collect_fan_in (cognitive 24) invokeai/app/services/shared/graph_iterate_planner.py:26— graph_iterate_planner._get_direct_iterate_collect_fan_in has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 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.
_ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch (cognitive 24) invokeai/app/services/shared/graph_materializer.py:2170— _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, 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.
VideoService.create (cognitive 24) invokeai/app/services/videos/videos_default.py:51— VideoService.create has cognitive complexity 24 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 7 (10 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkingMemoryCalibrationService._prepare_run (cognitive 24) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:826— WorkingMemoryCalibrationService._prepare_run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, 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.
CachedModelWithPartialLoad.partial_load_to_vram_chunk (cognitive 24) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:402— CachedModelWithPartialLoad.partial_load_to_vram_chunk has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4, 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.
flux3.flux3_transformer_from_single_file (cognitive 24) invokeai/backend/model_manager/load/model_loaders/flux3.py:111— flux3.flux3_transformer_from_single_file has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_util.read_checkpoint_meta (cognitive 24) invokeai/backend/model_manager/util/model_util.py:52— model_util.read_checkpoint_meta has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
flux_bfl_peft_lora_conversion_utils._split_qkv_lokr_layer (cognitive 24) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:496— flux_bfl_peft_lora_conversion_utils._split_qkv_lokr_layer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (7 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
attention._chunked_sdpa (cognitive 24) invokeai/backend/util/attention.py:285— attention._chunked_sdpa has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (7 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coefficients.resolve_coefficients (cognitive 24) invokeai/backend/working_memory/coefficients.py:221— coefficients.resolve_coefficients has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 7 (9 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
typegen.generateTypes (cognitive 24) invokeai/frontend/api/scripts/typegen.js:10— typegen.generateTypes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 11). Of this number, 17 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AdministratorSetup.AdministratorSetup (cognitive 24) invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26— AdministratorSetup.AdministratorSetup has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, ternaries 4 (6 pts), if/else 5, error handling 1 (nesting depth added 2). Of this number, 18 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SyncModelsDialog.SyncModelsDialog (cognitive 24) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/SyncModelsDialog.tsx:36— SyncModelsDialog.SyncModelsDialog has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, boolean chains 4, ternaries 3, error handling 1. Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 80, 111, 142, …). 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.
parseSchema.parseSchema.invocations (cognitive 24) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:108— parseSchema.parseSchema.invocations has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, ternaries 4 (6 pts), boolean chains 2, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 120, 200). 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.
UpscaleTabAdvancedSettingsAccordion.UpscaleTabAdvancedSettingsAccordion (cognitive 24) invokeai/frontend/webv1/src/features/settingsAccordions/components/AdvancedSettingsAccordion/UpscaleTabAdvancedSettingsAccordion.tsx:18— UpscaleTabAdvancedSettingsAccordion.UpscaleTabAdvancedSettingsAccordion has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 2, ternaries 1 (nesting depth added 10). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 26). 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.
GalleryPickerGrid.GalleryPickerGrid (cognitive 24) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerGrid.tsx:198— GalleryPickerGrid.GalleryPickerGrid has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 6. Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 392, 287, 338, …). 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.
PositivePromptActions.ExpandPromptButton (cognitive 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:658— PositivePromptActions.ExpandPromptButton has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 8, if/else 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph.buildQwenImageGraph (cognitive 24) invokeai/frontend/webv2/src/features/generation/core/graph.ts:1050— graph.buildQwenImageGraph has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 6, boolean chains 3, 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.
GenerateModelCard.GenerateModelCard (cognitive 24) invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx:51— GenerateModelCard.GenerateModelCard has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 5, if/else 5 (nesting depth added 6). Of this number, 16 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WildcardTransferActions.WildcardTransferActions (cognitive 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardTransferActions.tsx:39— WildcardTransferActions.WildcardTransferActions has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 6 (9 pts), error handling 3, boolean chains 2 (nesting depth added 6). 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 literals inside it that branch (lines 62, 102, 140, …). 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.
ClearDialog.ClearDialog (cognitive 24) invokeai/frontend/webv2/src/features/intermediates/ui/ClearDialog.tsx:151— ClearDialog.ClearDialog has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 10, if/else 1 (nesting depth added 2). Of this number, 21 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ExternalProviderKeyCards.ExternalProviderKeyCard (cognitive 24) invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx:103— ExternalProviderKeyCards.ExternalProviderKeyCard has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, ternaries 6 (nesting depth added 1). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (handleSave, a function literal at line 127, a function literal at line 186, …). 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.
utilityGraph.reconcileUtilityCompletedOutput (cognitive 24) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:177— utilityGraph.reconcileUtilityCompletedOutput has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 4, loops 2 (3 pts), 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.
utilityGraph.submitUtilityGraph (cognitive 24) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:508— utilityGraph.submitUtilityGraph has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (7 pts), error handling 4 (5 pts), loops 1 (nesting depth added 8). Of this number, 15 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
callSavedWorkflow.syncCallSavedWorkflowFields (cognitive 24) invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts:220— callSavedWorkflow.syncCallSavedWorkflowFields has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, ternaries 4 (7 pts), if/else 2 (3 pts), loops 2 (nesting depth added 4). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
workflowJson.parseForm (cognitive 24) invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:212— workflowJson.parseForm has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 pts), ternaries 1 (2 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.
WorkflowFieldInput.MediaInput (cognitive 24) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1051— WorkflowFieldInput.MediaInput has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 16 (20 pts), boolean chains 3, if/else 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: 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.
CanvasHeaderActions.CanvasHeaderActionsInner (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx:105— CanvasHeaderActions.CanvasHeaderActionsInner has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14, boolean chains 7, if/else 3. Of this number, 16 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
canvasToolCommands.executeCanvasToolCommand (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasToolCommands.ts:232— canvasToolCommands.executeCanvasToolCommand has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CanvasColorFeed.ColorSampleRouting (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/CanvasColorFeed.tsx:110— CanvasColorFeed.ColorSampleRouting has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 9). None of this is in the body itself: all 24 points belong to 4 function items inside it that branch (a function literal at line 143, a function literal at line 122, commitSourceColor, …). 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.
ColorPane.ColorPane (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx:44— ColorPane.ColorPane has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 8, boolean chains 2 (nesting depth added 2). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 127, 54, 111, …). 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.
previewMetadata.parsePreviewMetadata::visit (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/preview/previewMetadata.ts:306— previewMetadata.parsePreviewMetadata::visit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (10 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (previewMetadata.parsePreviewMetadata) 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.
CopyLayerController.copy (cognitive 24) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/copyLayerController.ts:85— CopyLayerController.copy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 4 (6 pts), boolean chains 4 (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.
workbenchStore.createCommands (cognitive 24) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:89— workbenchStore.createCommands has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11, ternaries 11, boolean chains 2. None of this is in the body itself: all 24 points belong to 15 function literals inside it that branch (lines 444, 390, 476, …). 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.
CommandPaletteDialog.CommandPaletteContent (cognitive 24) invokeai/frontend/webv2/src/workbench/palette/CommandPaletteDialog.tsx:98— CommandPaletteDialog.CommandPaletteContent has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (13 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
queueRecallCache.createIndexedDbQueueRecallCache.put (cognitive 24) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts:213— queueRecallCache.createIndexedDbQueueRecallCache.put has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, error handling 3, loops 2 (nesting depth added 6). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useInvocationState.useInvocationState (cognitive 24) invokeai/frontend/webv2/src/workbench/shell/topbar/useInvocationState.ts:142— useInvocationState.useInvocationState has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 3 (nesting depth added 7). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
image_map.search_image_map (cognitive 23) invokeai/app/api/routers/image_map.py:617— image_map.search_image_map has cognitive complexity 23 (threshold 15). Drivers by points: error handling 4 (11 pts), if/else 8 (10 pts), boolean chains 1, ternaries 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InvokeImageBlendInvocation.prepare_tensors_from_images (cognitive 23) invokeai/app/invocations/composition-nodes.py:515— InvokeImageBlendInvocation.prepare_tensors_from_images has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, ternaries 4 (8 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DefaultSessionRunner.run_node (cognitive 23) invokeai/app/services/session_processor/session_processor_default.py:451— DefaultSessionRunner.run_node has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 4 (5 pts), boolean chains 4, 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.
GraphExecutionState._validate_persisted_activation_tokens (cognitive 23) invokeai/app/services/shared/graph.py:3636— GraphExecutionState._validate_persisted_activation_tokens has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 1, 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.
graph_if_runtime._get_edge_frame_axes (cognitive 23) invokeai/app/services/shared/graph_if_runtime.py:246— graph_if_runtime._get_edge_frame_axes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workflow_graph_builder._resolve_for_connector_loop_linkage_path (cognitive 23) invokeai/app/services/shared/workflow_graph_builder.py:313— workflow_graph_builder._resolve_for_connector_loop_linkage_path has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnimaControlNetLLLite.from_state_dict (cognitive 23) invokeai/backend/anima/control_net_lllite.py:414— AnimaControlNetLLLite.from_state_dict has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, loops 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.
checkpoint_layout.classify_roles (cognitive 23) invokeai/backend/ltx2/checkpoint_layout.py:96— checkpoint_layout.classify_roles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 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, 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.
pid_decoder._int8_sidecar_keys (cognitive 23) invokeai/backend/model_manager/configs/pid_decoder.py:253— pid_decoder._int8_sidecar_keys has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, error handling 2 (3 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.
Ideogram4CheckpointModel._load_model (cognitive 23) invokeai/backend/model_manager/load/model_loaders/ideogram4.py:357— Ideogram4CheckpointModel._load_model has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, 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.
loaders._get_original_shape (cognitive 23) invokeai/backend/quantization/sdnq/loaders.py:145— loaders._get_original_shape has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MediaImportProcessor.import_image (cognitive 23) invokeai/frontend/install/import_images.py:569— MediaImportProcessor.import_image has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 2, ternaries 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.
Picker.useKeyboardNavigation (cognitive 23) invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:386— Picker.useKeyboardNavigation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 20 (23 pts) (nesting depth added 3). None of this is in the body itself: all 23 points belong to 4 function literals inside it that branch (lines 407, 438, 470, …). 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.
CanvasToolModule.syncCursorStyle (cognitive 23) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:299— CanvasToolModule.syncCursorStyle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 22 (23 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
worker.getImageDataBboxArrayBufferLike (cognitive 23) invokeai/frontend/webv1/src/features/controlLayers/konva/worker.ts:18— worker.getImageDataBboxArrayBufferLike has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 2 (3 pts), ternaries 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.
validators.getGlobalReferenceImageWarnings (cognitive 23) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:176— validators.getGlobalReferenceImageWarnings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 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.
Flow.Flow (cognitive 23) invokeai/frontend/webv1/src/features/nodes/components/flow/Flow.tsx:89— Flow.Flow has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 5, ternaries 3. Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 284, 342, 111, …). 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.
useNodeCopyPaste._pasteSelection (cognitive 23) invokeai/frontend/webv1/src/features/nodes/hooks/useNodeCopyPaste.ts:37— useNodeCopyPaste._pasteSelection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 122, 59, 87, …). 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.
PromptTriggerSelect.PromptTriggerSelect (cognitive 23) invokeai/frontend/webv1/src/features/prompt/PromptTriggerSelect.tsx:23— PromptTriggerSelect.PromptTriggerSelect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5, loops 1 (nesting depth added 5). None of this is in the body itself: all 23 points belong to 8 function literals inside it that branch (lines 67, 100, 35, …). 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.
onModelInstallError.buildOnModelInstallError.<returned closure> (cognitive 23) invokeai/frontend/webv1/src/services/events/onModelInstallError.tsx:55— onModelInstallError.buildOnModelInstallError.<returned closure> has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (23 pts) (nesting depth added 8). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenerateRenderSection.GenerateRenderSection (cognitive 23) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:628— GenerateRenderSection.GenerateRenderSection has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 32 (38 pts), boolean chains 8, if/else 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (GenerateRenderSection.GenerateRenderSection::renderFields) 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.
ModelSettingsMenuItems.ModelSettingsMenuItems (cognitive 23) invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:21— ModelSettingsMenuItems.ModelSettingsMenuItems has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (16 pts), error handling 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 4). None of this is in the body itself: all 23 points belong to 3 function items inside it that branch (a function literal at line 59, handleExport, handleFileChange). 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.
queries.applyQueueItemStatusChange (cognitive 23) invokeai/frontend/webv2/src/features/queue/data/queries.ts:185— queries.applyQueueItemStatusChange has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 8, if/else 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.
submissionApi.enqueueUtility (cognitive 23) invokeai/frontend/webv2/src/features/queue/data/submissionApi.ts:123— submissionApi.enqueueUtility has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (7 pts), boolean chains 3, loops 2 (nesting depth added 11). Of this number, 14 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelRequirements.visitNodeModelNeeds (cognitive 23) invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts:200— modelRequirements.visitNodeModelNeeds has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 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.
WorkflowLibraryFacts.getWorkflowLibraryEntryFacts (cognitive 23) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryFacts.tsx:52— WorkflowLibraryFacts.getWorkflowLibraryEntryFacts has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (22 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime (cognitive 23) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowSelectionRequestRuntime.tsx:95— WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 5 (6 pts) (nesting depth added 2). None of this is in the body itself: all 23 points belong to 6 function items inside it that branch (a function literal at line 169, a function literal at line 147, 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.
draftStore.isProjectDraftCandidate (cognitive 23) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:452— draftStore.isProjectDraftCandidate has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 20, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
draftStore.createMemoryProjectDraftStore.reconcileUnloadJournal (cognitive 23) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1244— draftStore.createMemoryProjectDraftStore.reconcileUnloadJournal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (10 pts), boolean chains 2, loops 1 (nesting depth added 11). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
canvasProjectMutations.applyMoves (cognitive 23) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:395— canvasProjectMutations.applyMoves has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, ternaries 3, loops 1 (nesting depth added 1). Most of this is not in the body itself: 10 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 436, a function literal at line 461, namesMoving, …). 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.
controlModelResolution.resolveControlModel (cognitive 23) invokeai/frontend/webv2/src/workbench/controlModelResolution.ts:100— controlModelResolution.resolveControlModel has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 7, boolean chains 5 (nesting depth added 3). Of this number, 17 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
layerExportActions.saveLayerToBoard (cognitive 23) invokeai/frontend/webv2/src/workbench/widgets/layers/layerExportActions.ts:76— layerExportActions.saveLayerToBoard has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, ternaries 1 (3 pts), error handling 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.
PixelEditController.beginMaterialized (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:351— PixelEditController.beginMaterialized has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 5 (6 pts), error handling 3 (4 pts), boolean chains 3 (nesting depth added 3). Of this number, 13 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
compositeFrame.createCompositeFrame.draw (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositeFrame.ts:233— compositeFrame.createCompositeFrame.draw has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 12, boolean chains 8, if/else 2, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:323— SelectObjectCoordinator.createSelectObjectOperationCoordinator.save has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageStorageSettings.ImageStorageEditor (cognitive 23) invokeai/frontend/webv2/src/workbench/settings/ImageStorageSettings.tsx:106— ImageStorageSettings.ImageStorageEditor has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13, boolean chains 7, if/else 3. Of this number, 12 points are the body's own statements and 11 belong to 7 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
QueueCluster.QueueTooltip (cognitive 23) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:335— QueueCluster.QueueTooltip has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 5, boolean chains 4 (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.
video_recall.apply_media_precedence (cognitive 22) invokeai/app/api/routers/video_recall.py:374— video_recall.apply_media_precedence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 pts), boolean chains 1, 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.
execution_state_migration._compact_effects (cognitive 22) invokeai/app/services/shared/execution_state_migration.py:42— execution_state_migration._compact_effects has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ExecutionNodeBuilder.create_for_body_iteration (cognitive 22) invokeai/app/services/shared/graph_materializer.py:460— _ExecutionNodeBuilder.create_for_body_iteration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph._get_upstream_collector_ids (cognitive 22) invokeai/app/services/shared/graph_validation.py:767— Graph._get_upstream_collector_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, 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.
media_references.extract_media_references (cognitive 22) invokeai/app/services/shared/media_references.py:45— media_references.extract_media_references has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkingMemoryCalibrationService.get_status (cognitive 22) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1370— WorkingMemoryCalibrationService.get_status has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 4 (7 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelConfigFactory.from_model_on_disk (cognitive 22) invokeai/backend/model_manager/configs/factory.py:1005— ModelConfigFactory.from_model_on_disk has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 4 (8 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_cache._run_deferred_work (cognitive 22) invokeai/backend/model_manager/load/model_cache/model_cache.py:181— model_cache._run_deferred_work has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 2 (5 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.
ModelOnDisk.load_state_dict (cognitive 22) invokeai/backend/model_manager/model_on_disk.py:212— ModelOnDisk.load_state_dict has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 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.
ModelSearch._walk_directory (cognitive 22) invokeai/backend/model_manager/search.py:107— ModelSearch._walk_directory has cognitive complexity 22 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 7 (8 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
checkpoint_layout.split_fused_qkv (cognitive 22) invokeai/backend/moss_image/checkpoint_layout.py:26— checkpoint_layout.split_fused_qkv has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LQProjection2D.__init__ (cognitive 22) invokeai/backend/pid/_src/networks/lq_projection_2d.py:145— LQProjection2D.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sage_attention._ineligible (cognitive 22) invokeai/backend/util/sage_attention.py:187— sage_attention._ineligible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
fit.entry_fit (cognitive 22) invokeai/backend/working_memory/fit.py:647— fit.entry_fit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 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.
route-data.onRequest (cognitive 22) docs/src/route-data.ts:38— route-data.onRequest has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 5 (6 pts) (nesting depth added 2). Of this number, 19 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
promptAttention.adjustPromptAttention (cognitive 22) invokeai/frontend/webv1/src/common/util/promptAttention.ts:113— promptAttention.adjustPromptAttention has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryImage.buildOnClick.<returned closure> (cognitive 22) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx:42— GalleryImage.buildOnClick.<returned closure> has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 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.
buildSD1Graph.buildSD1Graph (cognitive 22) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:30— buildSD1Graph.buildSD1Graph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
buildSD3Graph.buildSD3Graph (cognitive 22) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD3Graph.ts:32— buildSD3Graph.buildSD3Graph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 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.
galleryStateView.getGallerySelectedImageQuery (cognitive 22) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:370— galleryStateView.getGallerySelectedImageQuery has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 11 (12 pts), boolean chains 10 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
graph.buildFlux2Graph (cognitive 22) invokeai/frontend/webv2/src/features/generation/core/graph.ts:798— graph.buildFlux2Graph has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 5, if/else 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.
highlight.forEachTokenAnnotation (cognitive 22) invokeai/frontend/webv2/src/features/generation/core/prompt/highlight.ts:115— highlight.forEachTokenAnnotation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 11). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExternalSizeSelect.ExternalSizeSelect (cognitive 22) invokeai/frontend/webv2/src/features/generation/ui/shared/ExternalSizeSelect.tsx:44— ExternalSizeSelect.ExternalSizeSelect has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 3). Of this number, 16 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PromptTemplateEditor.PromptTemplateEditor (cognitive 22) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplateEditor.tsx:58— PromptTemplateEditor.PromptTemplateEditor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9, ternaries 8 (9 pts), boolean chains 3, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 103, 216, 81, …). 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.
DefaultSettingsSection.FieldControl (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:64— DefaultSettingsSection.FieldControl has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 6 (8 pts), boolean chains 3 (nesting depth added 7). Of this number, 14 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InstallProgressCell.useInstallProgressCaption (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallProgressCell.tsx:38— InstallProgressCell.useInstallProgressCaption has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
InstallQueueBar.InstallQueueBar (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallQueueBar.tsx:59— InstallQueueBar.InstallQueueBar has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 6 (7 pts), boolean chains 3 (nesting depth added 5). Of this number, 14 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.createQueueRuntime.claimRerunDelivery (cognitive 22) invokeai/frontend/webv2/src/features/queue/runtime.ts:1609— runtime.createQueueRuntime.claimRerunDelivery has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
formFieldSettings.applyNodeFieldFormSettings (cognitive 22) invokeai/frontend/webv2/src/features/workflow/core/formFieldSettings.ts:224— formFieldSettings.applyNodeFieldFormSettings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 6 (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.
layerWorkflow.buildLayerWorkflowGraph (cognitive 22) invokeai/frontend/webv2/src/features/workflow/core/layerWorkflow.ts:204— layerWorkflow.buildLayerWorkflowGraph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, loops 2, ternaries 2 (nesting depth added 2). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WorkflowDocumentGraph.PreviewChip (cognitive 22) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:368— WorkflowDocumentGraph.PreviewChip has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 14 (20 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.
normalize.serializeErrorAtDepth (cognitive 22) invokeai/frontend/webv2/src/platform/logging/normalize.ts:296— normalize.serializeErrorAtDepth has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 4 (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.
ColorPicker.ColorPicker (cognitive 22) invokeai/frontend/webv2/src/platform/ui/ColorPicker.tsx:151— ColorPicker.ColorPicker has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 8 (10 pts), boolean chains 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PreviewFilmstrip.FilmstripLiveThumb (cognitive 22) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx:124— PreviewFilmstrip.FilmstripLiveThumb has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 11 (14 pts), if/else 5, boolean chains 3 (nesting depth added 3). Of this number, 17 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
MergeLayerController.mergeVisible::drawMerged (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:502— MergeLayerController.mergeVisible::drawMerged has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (7 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (MergeLayerController.mergeVisible) 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.
exportRasterComposite.exportRasterComposite (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.ts:47— exportRasterComposite.exportRasterComposite has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, 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.
prepareCanvasInvocation.resolveRegionalReferenceImages (cognitive 22) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:203— prepareCanvasInvocation.resolveRegionalReferenceImages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (6 pts), boolean chains 4, 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.
groupSurfaceCache.createGroupSurfaceCache.drawRange (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:453— groupSurfaceCache.createGroupSurfaceCache.drawRange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paletteQueryModel.derivePaletteQueryModel (cognitive 22) invokeai/frontend/webv2/src/workbench/palette/paletteQueryModel.ts:31— paletteQueryModel.derivePaletteQueryModel has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 8 (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.
OpenProjectDialog.OpenProjectDialog (cognitive 22) invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx:56— OpenProjectDialog.OpenProjectDialog has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (13 pts), if/else 7 (8 pts), error handling 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 92, renderItem, a function literal at line 136, …). 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.
queueRecall.buildQueueRecallValues (cognitive 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:193— queueRecall.buildQueueRecallValues has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 7 (8 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.
queueRunJournal.createIndexedDbQueueRunJournal.record (cognitive 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:384— queueRunJournal.createIndexedDbQueueRunJournal.record has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 4 (5 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
videos.ingest_uploaded_video (cognitive 21) invokeai/app/api/routers/videos.py:430— videos.ingest_uploaded_video has cognitive complexity 21 (threshold 15). Drivers by points: error handling 7 (10 pts), if/else 6 (7 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.
videos._parse_range_header (cognitive 21) invokeai/app/api/routers/videos.py:785— videos._parse_range_header has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 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.
Flux2DevLoRACollectionLoader.invoke (cognitive 21) invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:145— Flux2DevLoRACollectionLoader.invoke has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Ideogram4DenoiseInvocation._load_branches (cognitive 21) invokeai/app/invocations/ideogram4/ideogram4_denoise.py:266— Ideogram4DenoiseInvocation._load_branches has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 3 (4 pts), ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MossImageDenoiseInvocation._run_diffusion (cognitive 21) invokeai/app/invocations/moss_image/moss_image_denoise.py:102— MossImageDenoiseInvocation._run_diffusion has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 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.
sd3_denoise._delta_fits (cognitive 21) invokeai/app/invocations/sd3/sd3_denoise.py:68— sd3_denoise._delta_fits has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 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.
gemini._iter_response_parts (cognitive 21) invokeai/app/services/external_generation/providers/gemini.py:181— gemini._iter_response_parts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), 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.
GalleryMaintenanceService._scan_archive_untracked (cognitive 21) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:330— GalleryMaintenanceService._scan_archive_untracked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (6 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.
DiskImageFileStorage.save (cognitive 21) invokeai/app/services/image_files/image_files_disk.py:239— DiskImageFileStorage.save has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageMoveService.preflight_moves (cognitive 21) invokeai/app/services/image_moves/image_moves_default.py:402— ImageMoveService.preflight_moves has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 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.
IntermediatesService._resolve_scope (cognitive 21) invokeai/app/services/intermediates/intermediates_default.py:334— IntermediatesService._resolve_scope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService._move_with_retries (cognitive 21) invokeai/app/services/model_install/model_install_default.py:899— ModelInstallService._move_with_retries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (7 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService.resume_and_wait_for_job (cognitive 21) invokeai/app/services/model_install/model_install_default.py:1217— ModelInstallService.resume_and_wait_for_job has cognitive complexity 21 (threshold 15). Drivers by points: error handling 3 (9 pts), if/else 4 (9 pts), boolean chains 1, loops 1, 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.
ModelInstallService._staging_has_recoverable_data (cognitive 21) invokeai/app/services/model_install/model_install_default.py:2533— ModelInstallService._staging_has_recoverable_data has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MediaReferenceQueries.document_names (cognitive 21) invokeai/app/services/shared/database/queries/media_references.py:117— MediaReferenceQueries.document_names has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 5 (9 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._value_from_object (cognitive 21) invokeai/app/services/shared/graph.py:2374— GraphExecutionState._value_from_object has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_if_dependencies._get_fresh_if_branch_sources (cognitive 21) invokeai/app/services/shared/graph_if_dependencies.py:316— graph_if_dependencies._get_fresh_if_branch_sources has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (6 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.
graph_if_runtime._get_reopened_source_axes (cognitive 21) invokeai/app/services/shared/graph_if_runtime.py:149— graph_if_runtime._get_reopened_source_axes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph._validate_special_nodes (cognitive 21) invokeai/app/services/shared/graph_validation.py:975— Graph._validate_special_nodes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (20 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.
workflow_call_compatibility._get_placeholder_for_annotation (cognitive 21) invokeai/app/services/shared/workflow_call_compatibility.py:56— workflow_call_compatibility._get_placeholder_for_annotation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (20 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.
DiskVideoFileStorage.__recover_staged_deletes (cognitive 21) invokeai/app/services/video_files/video_files_disk.py:406— DiskVideoFileStorage.__recover_staged_deletes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkingMemoryCalibrationService._attempt_blocks (cognitive 21) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:962— WorkingMemoryCalibrationService._attempt_blocks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
aac_splice.splice_soundtrack (cognitive 21) invokeai/app/util/aac_splice.py:364— aac_splice.splice_soundtrack has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
h264_splice.read_h264_layout (cognitive 21) invokeai/app/util/h264_splice.py:124— h264_splice.read_h264_layout has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
video_thumbnails.extract_representative_video_frame (cognitive 21) invokeai/app/util/video_thumbnails.py:548— video_thumbnails.extract_representative_video_frame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, error handling 1, loops 1, ternaries 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.
LLLiteModuleDiT.forward (cognitive 21) invokeai/backend/anima/control_net_lllite.py:287— LLLiteModuleDiT.forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), boolean chains 4 (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.
conversion.convert_flux3_native_to_diffusers (cognitive 21) invokeai/backend/flux3/conversion.py:196— conversion.convert_flux3_native_to_diffusers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (8 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.
Krea2MemoryEfficientAttnProcessor.__call__ (cognitive 21) invokeai/backend/krea2/attention.py:127— Krea2MemoryEfficientAttnProcessor.__call__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (4 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.
ModelLoader._load_and_cache (cognitive 21) invokeai/backend/model_manager/load/load_default.py:364— ModelLoader._load_and_cache has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (5 pts), boolean chains 3, error handling 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.
ModelCache._log_cache_state (cognitive 21) invokeai/backend/model_manager/load/model_cache/model_cache.py:2694— ModelCache._log_cache_state has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 4, boolean chains 3, 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.
ModelCache._reconcile_budget_if_pending (cognitive 21) invokeai/backend/model_manager/load/model_cache/model_cache.py:2954— ModelCache._reconcile_budget_if_pending has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FluxSDNQDiffusersModel._convert_diffusers_sd_to_bfl (cognitive 21) invokeai/backend/model_manager/load/model_loaders/flux.py:2156— FluxSDNQDiffusersModel._convert_diffusers_sd_to_bfl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 6 (8 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.
flux2_state_dict_utils._convert_flux2_weight_keys (cognitive 21) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:158— flux2_state_dict_utils._convert_flux2_weight_keys has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZImageCheckpointModel._load_from_singlefile (cognitive 21) invokeai/backend/model_manager/load/model_loaders/z_image.py:482— ZImageCheckpointModel._load_from_singlefile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
int8_convrot.reject_unmarked_int8_weights (cognitive 21) invokeai/backend/quantization/int8_convrot.py:738— int8_convrot.reject_unmarked_int8_weights has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), ternaries 4 (6 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.
translation-checks.comparePage (cognitive 21) docs/src/lib/translation-checks.mjs:145— translation-checks.comparePage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 8, error handling 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.
wanComponentSync.getWanComponentUpdates (cognitive 21) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/wanComponentSync.ts:59— wanComponentSync.getWanComponentUpdates has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workflowHasImageField.workflowHasImageField (cognitive 21) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/workflowHasImageField.tsx:20— workflowHasImageField.workflowHasImageField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 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.
RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph (cognitive 21) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:240— RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, error handling 3 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 21 points belong to 9 function literals inside it that branch (lines 260, 306, 335, …). 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.
Editor.exportImage (cognitive 21) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1138— Editor.exportImage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 3 (5 pts) (nesting depth added 6). None of this is in the body itself: all 21 points belong to 2 function literals inside it that branch (lines 1143, 1215). 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.
getFirstValidConnection.getSourceCandidateFields (cognitive 21) invokeai/frontend/webv1/src/features/nodes/store/util/getFirstValidConnection.ts:156— getFirstValidConnection.getSourceCandidateFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueueItemDetail.QueueItemComponent (cognitive 21) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemDetail.tsx:24— QueueItemDetail.QueueItemComponent has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, ternaries 4 (7 pts), if/else 3 (nesting depth added 3). Of this number, 11 points are the body's own statements and 10 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.
QueueItemComponent.QueueItemComponent (cognitive 21) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemComponent.tsx:34— QueueItemComponent.QueueItemComponent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 8, ternaries 4. Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 53, 109, 40, …). 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.
run-accessibility-journeys.runNativeWidgetRecoveryJourney (cognitive 21) REDACTED:1669— run-accessibility-journeys.runNativeWidgetRecoveryJourney has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 8 (10 pts) (nesting depth added 4). Of this number, 13 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cognitive 21) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridSelection.ts:101— useGalleryGridSelection.useGalleryGridSelection.selectItemRange has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 5, error handling 1 (nesting depth added 1). Of this number, 13 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
promptFocus.getActiveTriggerQuery (cognitive 21) invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptFocus.ts:189— promptFocus.getActiveTriggerQuery has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 pts), boolean chains 5, 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.
referenceImage.resolveRatioDrag (cognitive 21) invokeai/frontend/webv2/src/features/generation/core/referenceImage.ts:361— referenceImage.resolveRatioDrag has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 4, if/else 4 (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.
graph.buildSDGraph (cognitive 21) invokeai/frontend/webv2/src/features/generation/core/graph.ts:341— graph.buildSDGraph has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 6, boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
attention.unifyEqualWeights (cognitive 21) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:169— attention.unifyEqualWeights 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.
GenerateRenderSection.GenerateRenderSection::renderFields (cognitive 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:694— GenerateRenderSection.GenerateRenderSection::renderFields has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 17 (18 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (GenerateRenderSection.GenerateRenderSection) 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.
fields.isWorkflowFieldValueValid (cognitive 21) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:385— fields.isWorkflowFieldValueValid has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 4 (6 pts), match/switch 1 (nesting depth added 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.
WorkflowFieldInput.WorkflowFieldSnapshot (cognitive 21) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:2071— WorkflowFieldInput.WorkflowFieldSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalize.normalizeValue (cognitive 21) invokeai/frontend/webv2/src/platform/logging/normalize.ts:123— normalize.normalizeValue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 3 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 4). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
http.getApiErrorMessage (cognitive 21) invokeai/frontend/webv2/src/platform/transport/http.ts:265— http.getApiErrorMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, error handling 1 (2 pts), 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.
Combobox.Combobox (cognitive 21) invokeai/frontend/webv2/src/platform/ui/Combobox.tsx:93— Combobox.Combobox has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8, if/else 7, boolean chains 6. Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 168, 177, 205, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ManagerQueue.ManagerQueueFooter (cognitive 21) invokeai/frontend/webv2/src/platform/ui/ManagerQueue.tsx:92— ManagerQueue.ManagerQueueFooter has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
persistenceRuntime.createWorkbenchPersistenceRuntime.load (cognitive 21) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:526— persistenceRuntime.createWorkbenchPersistenceRuntime.load has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, 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.
canvasProjectMutations.applyLayerStackMutation (cognitive 21) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:484— canvasProjectMutations.applyLayerStackMutation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2 (3 pts), ternaries 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.
invocationSubmit.submitResolvedInvocation (cognitive 21) invokeai/frontend/webv2/src/workbench/invocationSubmit.ts:210— invocationSubmit.submitResolvedInvocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (7 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.
SelectionImageController.replace (cognitive 21) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionImageController.ts:30— SelectionImageController.replace has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 2 (4 pts), 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.
bitmapStore.createBitmapStore.uploadWithRetry (cognitive 21) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:285— bitmapStore.createBitmapStore.uploadWithRetry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (18 pts), 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.
alphaBounds.alphaBounds (cognitive 21) invokeai/frontend/webv2/src/workbench/canvas-engine/render/alphaBounds.ts:47— alphaBounds.alphaBounds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (5 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.
imageRecall.getMetadataReferenceEntries (cognitive 21) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1202— imageRecall.getMetadataReferenceEntries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 3 (5 pts) (nesting depth added 3). Of this number, 13 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
queueRecall.getQueueRecallAvailability (cognitive 21) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:125— queueRecall.getQueueRecallAvailability has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 4 (7 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.
HotkeysSettingsSection.HotkeyListRow (cognitive 21) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:301— HotkeysSettingsSection.HotkeyListRow has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 4, if/else 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageMapVocabularySettings.ImageMapVocabularySettings (cognitive 21) invokeai/frontend/webv2/src/workbench/settings/ImageMapVocabularySettings.tsx:46— ImageMapVocabularySettings.ImageMapVocabularySettings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (8 pts), boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (addTerms, a function literal at line 52, a function literal at line 62, …). 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.
ProjectSwitcher.ProjectSwitcher (cognitive 21) invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx:69— ProjectSwitcher.ProjectSwitcher has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11 (14 pts), if/else 6, error handling 1 (nesting depth added 3). Of this number, 11 points are the body's own statements and 10 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ClusterStrengthField.ClusterStrengthField (cognitive 21) invokeai/frontend/webv2/src/workbench/widgets/image-map/ClusterStrengthField.tsx:40— ClusterStrengthField.ClusterStrengthField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, ternaries 9, boolean chains 2. Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 144, 72, 115, …). 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.
SocketIO._handle_user_access_changed (cognitive 20) invokeai/app/api/sockets.py:720— SocketIO._handle_user_access_changed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
trusted_routes._clone_route (cognitive 20) invokeai/app/api/trusted_routes.py:191— trusted_routes._clone_route has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (7 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.
InvokeImageBlendInvocation.image_convert_with_xform (cognitive 20) invokeai/app/invocations/composition-nodes.py:449— InvokeImageBlendInvocation.image_convert_with_xform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 9 (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.
SDXLLoRACollectionLoader.invoke (cognitive 20) invokeai/app/invocations/model.py:695— SDXLLoRACollectionLoader.invoke has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, 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.
SD3DenoiseInvocation._run_diffusion (cognitive 20) invokeai/app/invocations/sd3/sd3_denoise.py:274— SD3DenoiseInvocation._run_diffusion has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 2 (3 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.
ImageIndexService._process_batch (cognitive 20) invokeai/app/services/image_index/image_index_default.py:1422— ImageIndexService._process_batch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 3 (4 pts), loops 2, 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.
workflow_call_compatibility._build_compatibility_workflow_inputs (cognitive 20) invokeai/app/services/shared/workflow_call_compatibility.py:89— workflow_call_compatibility._build_compatibility_workflow_inputs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
working_memory_calibration_store._os_lock (cognitive 20) invokeai/app/services/working_memory_calibration/working_memory_calibration_store.py:79— working_memory_calibration_store._os_lock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise_working_memory._sidecar_residual_bytes (cognitive 20) invokeai/backend/krea2/denoise_working_memory.py:302— denoise_working_memory._sidecar_residual_bytes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
style_reference.parse_block_spec (cognitive 20) invokeai/backend/krea2/style_reference.py:123— style_reference.parse_block_spec has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise.build_denoise_state (cognitive 20) invokeai/backend/ltx2/denoise.py:278— denoise.build_denoise_state has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
reference_conditioning.normalize_reference_video_frames_streaming (cognitive 20) invokeai/backend/minimax_h3/reference_conditioning.py:164— reference_conditioning.normalize_reference_video_frames_streaming has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 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.
qwen3_vl_encoder._has_complete_pretrained_weights (cognitive 20) invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:57— qwen3_vl_encoder._has_complete_pretrained_weights has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, 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.
ModelCache._make_room_internal (cognitive 20) invokeai/backend/model_manager/load/model_cache/model_cache.py:2779— ModelCache._make_room_internal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flux2_state_dict_utils._convert_flux2_double_block_key (cognitive 20) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:61— flux2_state_dict_utils._convert_flux2_double_block_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (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.
HuggingFaceMetadataFetch.from_id (cognitive 20) invokeai/backend/model_manager/metadata/fetch/huggingface.py:121— HuggingFaceMetadataFetch.from_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 3 (5 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LayerPatcher.apply_smart_model_patch (cognitive 20) invokeai/backend/patches/layer_patcher.py:126— LayerPatcher.apply_smart_model_patch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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.
krea2_lora_conversion_utils.lora_model_from_krea2_state_dict (cognitive 20) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:181— krea2_lora_conversion_utils.lora_model_from_krea2_state_dict has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sdxl_lora_conversion_utils._make_sdxl_unet_conversion_map (cognitive 20) invokeai/backend/patches/lora_conversions/sdxl_lora_conversion_utils.py:67— sdxl_lora_conversion_utils._make_sdxl_unet_conversion_map has cognitive complexity 20 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 4 (8 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
fp8_scaled.extract_fp8_scaled_layers (cognitive 20) invokeai/backend/quantization/fp8_scaled.py:692— fp8_scaled.extract_fp8_scaled_layers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 3, 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.
attention._report_unpinned_call (cognitive 20) invokeai/backend/util/attention.py:764— attention._report_unpinned_call has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 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.
bounds.line_bounds (cognitive 20) invokeai/backend/working_memory/bounds.py:332— bounds.line_bounds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, 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.
TranslationCleaner._search_codebase (cognitive 20) invokeai/frontend/webv1/scripts/clean_translations.py:36— TranslationCleaner._search_codebase has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
remark-localize-assets.remarkLocalizeAssets.<returned closure> (cognitive 20) docs/plugins/remark-localize-assets.mjs:21— remark-localize-assets.remarkLocalizeAssets.<returned closure> has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (2 pts), ternaries 2 (nesting depth added 5). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 40, toSource). 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.
translation-checks.inventory (cognitive 20) docs/src/lib/translation-checks.mjs:197— translation-checks.inventory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 8). None of this is in the body itself: all 20 points belong to 2 function literals inside it that branch (lines 213, 216). 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.
CanvasEntityGroupList.CanvasEntityGroupList (cognitive 20) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:31— CanvasEntityGroupList.CanvasEntityGroupList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, ternaries 5 (7 pts), boolean chains 3 (nesting depth added 2). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 37). 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.
CanvasCompositorModule.getGrayscaleMaskCompositeImageDTO (cognitive 20) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:501— CanvasCompositorModule.getGrayscaleMaskCompositeImageDTO has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), ternaries 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.
CanvasBrushToolModule.onStagePointerDown (cognitive 20) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:259— CanvasBrushToolModule.onStagePointerDown has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoRASelect.LoRASelect (cognitive 20) invokeai/frontend/webv1/src/features/lora/components/LoRASelect.tsx:19— LoRASelect.LoRASelect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, ternaries 4 (8 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 33, 88, 29, …). 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.
validateConnectionTypes.validateConnectionTypes (cognitive 20) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnectionTypes.ts:10— validateConnectionTypes.validateConnectionTypes has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 18, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
buildExternalGraph.buildExternalGraph (cognitive 20) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildExternalGraph.ts:33— buildExternalGraph.buildExternalGraph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildKrea2Graph.buildKrea2Graph (cognitive 20) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildKrea2Graph.ts:29— buildKrea2Graph.buildKrea2Graph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 4. Of this number, 16 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
readiness.getReasonsWhyCannotEnqueueUpscaleTab (cognitive 20) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:726— readiness.getReasonsWhyCannotEnqueueUpscaleTab has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SettingsGenerationDevices.SettingsGenerationDevices (cognitive 20) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:39— SettingsGenerationDevices.SettingsGenerationDevices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (6 pts), boolean chains 3, loops 3, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 79, 114, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SettingsImageStorageMaintenance.SettingsImageStorageMaintenance (cognitive 20) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsImageStorageMaintenance.tsx:48— SettingsImageStorageMaintenance.SettingsImageStorageMaintenance has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7, error handling 2, ternaries 2. Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 92, 70, 66, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
images.bulkDownloadQueryFn (cognitive 20) invokeai/frontend/webv1/src/services/api/endpoints/images.ts:502— images.bulkDownloadQueryFn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 1, ternaries 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.
mock-backend.collectReferencedMedia (cognitive 20) invokeai/frontend/webv2/scripts/mock-backend.mjs:659— mock-backend.collectReferencedMedia has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addControlLayers.addControlLayers (cognitive 20) invokeai/frontend/webv2/src/features/generation/core/canvas/addControlLayers.ts:160— addControlLayers.addControlLayers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (7 pts), boolean chains 1, loops 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConceptRow.ConceptRowContent (cognitive 20) invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.tsx:170— ConceptRow.ConceptRowContent has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 3, if/else 1 (nesting depth added 3). Of this number, 17 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
graph.buildKrea2Graph (cognitive 20) invokeai/frontend/webv2/src/features/generation/core/graph.ts:1467— graph.buildKrea2Graph has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (12 pts), boolean chains 4, if/else 4 (nesting depth added 1). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cognitive 20) invokeai/frontend/webv2/src/features/generation/ui/GenerateConditioningRebalanceField.tsx:61— GenerateConditioningRebalanceField.GenerateConditioningRebalanceField has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 4, if/else 3 (nesting depth added 3). Of this number, 14 points are the body's own statements and 6 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RelatedModelsSection.RelatedModelsForModel (cognitive 20) invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx:35— RelatedModelsSection.RelatedModelsForModel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 5 (8 pts), boolean chains 2, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 4 function items inside it that branch (handleAdd, handleRemove, a function literal at line 45, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
modelDraftsStore.syncWithLibrary (cognitive 20) invokeai/frontend/webv2/src/features/models/ui/modelDraftsStore.ts:202— modelDraftsStore.syncWithLibrary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.createQueueRuntime.processQueueItems (cognitive 20) invokeai/frontend/webv2/src/features/queue/runtime.ts:2471— runtime.createQueueRuntime.processQueueItems has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VideoModelField.VideoModelField (cognitive 20) invokeai/frontend/webv2/src/features/video/ui/VideoModelField.tsx:68— VideoModelField.VideoModelField has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (12 pts), if/else 6, boolean chains 2 (nesting depth added 3). Of this number, 12 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
workflowPreview.describeValue (cognitive 20) invokeai/frontend/webv2/src/features/workflow/core/workflowPreview.ts:260— workflowPreview.describeValue has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (9 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flowAdapters.toFlowNodes (cognitive 20) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:205— flowAdapters.toFlowNodes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 6). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 220). 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.
api.settleProjectCreate (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/api.ts:521— api.settleProjectCreate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 4 (5 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 5). Of this number, 10 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
assetTransport.createAssetResponseReader.<returned closure> (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:144— assetTransport.createAssetResponseReader.<returned closure> has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
projectHalves.findRepeatedWorkflowItem (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:135— projectHalves.findRepeatedWorkflowItem has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 9). Of this number, 15 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runLayerWorkflow.runLayerWorkflow (cognitive 20) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:119— runLayerWorkflow.runLayerWorkflow has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), 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.
TransformPane.ConnectedTransform (cognitive 20) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx:56— TransformPane.ConnectedTransform has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11, boolean chains 6, if/else 3. Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
workbenchState.removeGalleryItemsFromAllProjects (cognitive 20) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3680— workbenchState.removeGalleryItemsFromAllProjects has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, boolean chains 7, if/else 3. Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3707, 3751, 3691, …). 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.
workbenchStore.recordDiagnosticForAction (cognitive 20) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:805— workbenchStore.recordDiagnosticForAction has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 4 (8 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PixelEditController.begin (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:130— PixelEditController.begin has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 4 (5 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TransformEditingController.apply (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/transformEditingController.ts:267— TransformEditingController.apply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MaskLayerController.invert (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:98— MaskLayerController.invert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, ternaries 5 (6 pts), boolean chains 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StructuralLayerController.beginPreview (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/structuralLayerController.ts:191— StructuralLayerController.beginPreview has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 3. Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 225, a function literal at line 257, flushPending, …). 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.
StagedResultController.commit (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:78— StagedResultController.commit has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 5, error handling 1. Of this number, 13 points are the body's own statements and 7 belong to 6 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
engine.createCanvasEngine::getDuplicateRasterPlan (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2376— engine.createCanvasEngine::getDuplicateRasterPlan has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8, 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.
psdExport.executePsdExport (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:531— psdExport.executePsdExport has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (5 pts), loops 4, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (drawPreview, a function literal at line 578). 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.
selectObjectSession.createSelectObjectSession.update (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:587— selectObjectSession.createSelectObjectSession.update has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 5, ternaries 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
resolve.getScopePriority (cognitive 20) invokeai/frontend/webv2/src/workbench/hotkeys/resolve.ts:18— resolve.getScopePriority has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (6 pts), boolean chains 5 (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.
canvasRecall.sourceNames (cognitive 20) invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:124— canvasRecall.sourceNames has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, 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.
ProjectsBrowser.ProjectsBrowser (cognitive 20) invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsBrowser.tsx:71— ProjectsBrowser.ProjectsBrowser has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 2 (5 pts), boolean chains 3 (nesting depth added 7). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
entries.buildProviderSectionRows (cognitive 20) invokeai/frontend/webv2/src/workbench/palette/entries.ts:701— entries.buildProviderSectionRows has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (6 pts), boolean chains 4, 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.
importProject.readInvkArchive (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/invk/importProject.ts:104— importProject.readInvkArchive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4, loops 2 (3 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.
unloadJournal.scenarios.createUnloadJournalServer (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:26— unloadJournal.scenarios.createUnloadJournalServer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 6, boolean chains 2 (nesting depth added 1). None of this is in the body itself: all 20 points belong to 6 function items inside it that branch (a function literal at line 125, a function literal at line 51, a function literal at line 98, …). 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.
SettingsEntryView.SettingsEntryView (cognitive 20) invokeai/frontend/webv2/src/workbench/settings/SettingsEntryView.tsx:96— SettingsEntryView.SettingsEntryView has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
invokeIssueActions.useInvokeIssueActions (cognitive 20) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueActions.ts:44— invokeIssueActions.useInvokeIssueActions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 10). None of this is in the body itself: all 20 points belong to 5 function literals inside it that branch (lines 54, 78, 99, …). 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.
custom_nodes._import_workflows_from_pack (cognitive 19) invokeai/app/api/routers/custom_nodes.py:460— custom_nodes._import_workflows_from_pack has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recall_parameters._assert_recall_image_access (cognitive 19) invokeai/app/api/routers/recall_parameters.py:349— recall_parameters._assert_recall_image_access has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 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.
utilities.list_user_fonts (cognitive 19) invokeai/app/api/routers/utilities.py:281— utilities.list_user_fonts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (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.
workflows.list_workflows (cognitive 19) invokeai/app/api/routers/workflows.py:245— workflows.list_workflows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlidingWindowTokenMiddleware.dispatch (cognitive 19) invokeai/app/api_app.py:164— SlidingWindowTokenMiddleware.dispatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WanLoRACollectionLoader.invoke (cognitive 19) invokeai/app/invocations/wan/wan_lora_loader.py:245— WanLoRACollectionLoader.invoke has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, 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.
AlibabaCloudProvider._parse_sync_response (cognitive 19) invokeai/app/services/external_generation/providers/alibabacloud.py:213— AlibabaCloudProvider._parse_sync_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageIndexService._process_projection (cognitive 19) invokeai/app/services/image_index/image_index_default.py:1651— ImageIndexService._process_projection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6, error handling 5, ternaries 3 (5 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ModelManagerService.reidentify_model (cognitive 19) invokeai/app/services/model_manager/model_manager_default.py:73— ModelManagerService.reidentify_model has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, 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.
WorkflowCallQueueLifecycle.apply_execution_effects (cognitive 19) invokeai/app/services/session_processor/workflow_call_runtime.py:150— WorkflowCallQueueLifecycle.apply_execution_effects has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ContinuationRecord.transition (cognitive 19) invokeai/app/services/shared/execution_engine/primitives.py:470— ContinuationRecord.transition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphExecutionState._update_prepared_for_index (cognitive 19) invokeai/app/services/shared/graph.py:3331— GraphExecutionState._update_prepared_for_index has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
users_common.validate_email_with_special_domains (cognitive 19) invokeai/app/services/users/users_common.py:12— users_common.validate_email_with_special_domains has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, error handling 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.
Main_SDNQ_Diffusers_Flux2_Config._get_submodels (cognitive 19) invokeai/backend/model_manager/configs/main.py:4182— Main_SDNQ_Diffusers_Flux2_Config._get_submodels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Main_SDNQ_Diffusers_ZImage_Config._get_submodels) 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.
Main_SDNQ_Diffusers_ZImage_Config._get_submodels (cognitive 19) invokeai/backend/model_manager/configs/main.py:4336— Main_SDNQ_Diffusers_ZImage_Config._get_submodels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Main_SDNQ_Diffusers_Flux2_Config._get_submodels) 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.
qwen3_encoder._has_qwen3_keys (cognitive 19) invokeai/backend/model_manager/configs/qwen3_encoder.py:28— qwen3_encoder._has_qwen3_keys has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layout._compile_draft_item (cognitive 19) invokeai/backend/moss_image/layout.py:233— layout._compile_draft_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
flux_onetrainer_bfl_lora_conversion_utils.lora_model_from_flux_onetrainer_bfl_state_dict (cognitive 19) invokeai/backend/patches/lora_conversions/flux_onetrainer_bfl_lora_conversion_utils.py:95— flux_onetrainer_bfl_lora_conversion_utils.lora_model_from_flux_onetrainer_bfl_state_dict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (6 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.
z_image_lora_conversion_utils.lora_model_from_z_image_state_dict (cognitive 19) invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:78— z_image_lora_conversion_utils.lora_model_from_z_image_state_dict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sidecar_working_memory.lora_sidecar_bytes (cognitive 19) invokeai/backend/patches/sidecar_working_memory.py:67— sidecar_working_memory.lora_sidecar_bytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UNetAttentionPatcher._prepare_attention_processors (cognitive 19) invokeai/backend/stable_diffusion/diffusion/unet_attention_patcher.py:25— UNetAttentionPatcher._prepare_attention_processors has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sage_attention.install_sage_attention (cognitive 19) invokeai/backend/util/sage_attention.py:281— sage_attention.install_sage_attention has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, error handling 3, 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.
LoginPage.LoginPage (cognitive 19) invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25— LoginPage.LoginPage has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 4, ternaries 2 (3 pts), error handling 1 (nesting depth added 1). Of this number, 11 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RefImageImage.RefImageImage (cognitive 19) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:35— RefImageImage.RefImageImage has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 1. Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 82, 59, 106, …). 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.
shared.getOutputImageNames (cognitive 19) invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/shared.ts:19— shared.getOutputImageNames has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts), 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.
dnd.canMoveFromSourceBoard (cognitive 19) invokeai/frontend/webv1/src/features/dnd/dnd.ts:513— dnd.canMoveFromSourceBoard has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (2 pts), boolean chains 1 (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.
GalleryVideoItem.buildOnClick.<returned closure> (cognitive 19) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryVideoItem.tsx:44— GalleryVideoItem.buildOnClick.<returned closure> has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CurrentImagePreview.CurrentImagePreview (cognitive 19) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentImagePreview.tsx:30— CurrentImagePreview.CurrentImagePreview has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 7. Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 68, 143, 80). 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.
MainModelDefaultSettings.MainModelDefaultSettings (cognitive 19) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx:50— MainModelDefaultSettings.MainModelDefaultSettings has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10, boolean chains 7, if/else 2. Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 115). 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-collapsible-gridview-panel.useCollapsibleGridviewPanel (cognitive 19) invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts:19— use-collapsible-gridview-panel.useCollapsibleGridviewPanel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 6. None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 49, 29, 72, …). 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.
workflowExecutionState.transitionWorkflowExecutionState (cognitive 19) invokeai/frontend/webv1/src/services/events/workflowExecutionState.ts:47— workflowExecutionState.transitionWorkflowExecutionState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, 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.
mock-backend.galleryMediaUsage (cognitive 19) invokeai/frontend/webv2/scripts/mock-backend.mjs:712— mock-backend.galleryMediaUsage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 3, loops 2 (nesting depth added 3). Of this number, 15 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GalleryUiAdapter.GalleryUiAdapterProvider (cognitive 19) invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:66— GalleryUiAdapter.GalleryUiAdapterProvider has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 5, boolean chains 2 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 8 function literals inside it that branch (lines 175, 113, 143, …). 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.
GenerationUiAdapter.getQueueInsights (cognitive 19) invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:93— GenerationUiAdapter.getQueueInsights has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 3 (5 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 6). Of this number, 15 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tsSourceAnalysis.collectTypographyLiterals::collectValue (cognitive 19) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:329— tsSourceAnalysis.collectTypographyLiterals::collectValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 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.
GalleryProgressSection.GalleryProgressTile (cognitive 19) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:205— GalleryProgressSection.GalleryProgressTile has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 3, if/else 3 (nesting depth added 3). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
GenerateCollapsibleSection.GenerateCollapsibleSection::handleKeyDown (cognitive 19) invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateCollapsibleSection.tsx:209— GenerateCollapsibleSection.GenerateCollapsibleSection::handleKeyDown has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (6 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.
settings.cloneGenerateWidgetValues (cognitive 19) invokeai/frontend/webv2/src/features/generation/core/settings.ts:715— settings.cloneGenerateWidgetValues has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 19. 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.
baseGenerationPolicies.getGenerationValidationIssues (cognitive 19) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:3058— baseGenerationPolicies.getGenerationValidationIssues has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 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.
modelDefaultSettings.getSettingDefaultSource (cognitive 19) invokeai/frontend/webv2/src/features/generation/ui/shared/modelDefaultSettings.ts:31— modelDefaultSettings.getSettingDefaultSource has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (15 pts), boolean chains 3, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
settings.syncUpscaleWidgetValuesWithModels (cognitive 19) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:887— settings.syncUpscaleWidgetValuesWithModels has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 13 (15 pts), boolean chains 3, if/else 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
validation.validateConnectionTypes (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:40— validation.validateConnectionTypes has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 17, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
fields.getWorkflowFieldIssue (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:483— fields.getWorkflowFieldIssue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 3 (5 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.
WorkflowDocumentGraph.NodeCard (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:658— WorkflowDocumentGraph.NodeCard has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 2, if/else 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 781, 699). 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.
WorkflowLibraryBrowsePanes.WorkflowLibraryBrowsePanes (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryBrowsePanes.tsx:184— WorkflowLibraryBrowsePanes.WorkflowLibraryBrowsePanes has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9, boolean chains 6, if/else 4. Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 252, 289, 269, …). 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.
useWorkflowPublication.useWorkflowPublication.settle (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/library/useWorkflowPublication.ts:144— useWorkflowPublication.useWorkflowPublication.settle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (8 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.
NodeContextMenu.NodeContextMenu (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/editor/NodeContextMenu.tsx:44— NodeContextMenu.NodeContextMenu has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (18 pts), if/else 1 (nesting depth added 11). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WorkflowEdge.WorkflowEdgeComponent (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEdge.tsx:16— WorkflowEdge.WorkflowEdgeComponent has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 12 (19 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.
NumericInput.NumericInput (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx:79— NumericInput.NumericInput has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 5, if/else 5 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
WorkflowFieldInput.BoardInput (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:524— WorkflowFieldInput.BoardInput has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 5, if/else 1 (nesting depth added 3). Of this number, 10 points are the body's own statements and 9 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
http.getValidationIssueMessage (cognitive 19) invokeai/frontend/webv2/src/platform/transport/http.ts:125— http.getValidationIssueMessage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 5, if/else 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VideoPlayer.Scrubber (cognitive 19) invokeai/frontend/webv2/src/platform/ui/video-player/VideoPlayer.tsx:300— VideoPlayer.Scrubber has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 5, boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 385, 408, 338, …). 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.
WorkbenchUnavailableScreen.WorkbenchUnavailableScreen (cognitive 19) invokeai/frontend/webv2/src/workbench/components/WorkbenchUnavailableScreen.tsx:18— WorkbenchUnavailableScreen.WorkbenchUnavailableScreen has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 5 (6 pts), boolean chains 1, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 57, 40, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
layerPanelState.selectLayerInPanel (cognitive 19) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:269— layerPanelState.selectLayerInPanel has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy (cognitive 19) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:196— indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, ternaries 4 (7 pts), boolean chains 5 (nesting depth added 3). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 200). 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.
indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt (cognitive 19) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:557— indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, ternaries 6, if/else 1. None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 559). 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.
projectHalves.joinProjectDocument (cognitive 19) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:157— projectHalves.joinProjectDocument has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 12, boolean chains 5, if/else 2. Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, 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.
canvasStagingView.getCanvasStagingSlotsForQueueItem (cognitive 19) invokeai/frontend/webv2/src/workbench/canvasStagingView.ts:184— canvasStagingView.getCanvasStagingSlotsForQueueItem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (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.
useCanvasRecovery.useStagingRecovery (cognitive 19) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasRecovery.ts:142— useCanvasRecovery.useStagingRecovery has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 3, loops 2, boolean chains 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 5 function literals inside it that branch (lines 208, 163, 186, …). 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.
StagingBar.StagingBar::handleKeyDown (cognitive 19) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:228— StagingBar.StagingBar::handleKeyDown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 3 (5 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. This shape REPEATS in the file: one other method here (StagingBar.StagingBar) 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.
layerTreeRows.buildLayerStackRows (cognitive 19) invokeai/frontend/webv2/src/workbench/widgets/layers/layerTreeRows.ts:69— layerTreeRows.buildLayerStackRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compositor.drawCachedLayer (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:388— compositor.drawCachedLayer has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5, boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
focusRegions.createWorkbenchFocusController.focusAdjacentRegion (cognitive 19) invokeai/frontend/webv2/src/workbench/focusRegions.tsx:246— focusRegions.createWorkbenchFocusController.focusAdjacentRegion has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 4 (5 pts) (nesting depth added 1). Of this number, 14 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
groupSurfaceCache.createGroupSurfaceCache.drawnEntries (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:415— groupSurfaceCache.createGroupSurfaceCache.drawnEntries has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
groupSurfaceCache.createGroupSurfaceCache.showSpatial (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:642— groupSurfaceCache.createGroupSurfaceCache.showSpatial has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 4 (5 pts) (nesting depth added 4). Of this number, 15 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
guidedFilter.boxMean (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/guidedFilter.ts:69— guidedFilter.boxMean has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 3 (5 pts) (nesting depth added 9). 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.
importGalleryImages.importGalleryImagesToCanvas (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:256— importGalleryImages.importGalleryImagesToCanvas has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
videoRecall.parseVideoRecallRecord (cognitive 19) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:357— videoRecall.parseVideoRecallRecord has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 5, if/else 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.
canvasRecall.prepareCanvasRecall::lookupImages (cognitive 19) invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:187— canvasRecall.prepareCanvasRecall::lookupImages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (canvasRecall.prepareCanvasRecall) 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.
executeVideoRecall.placeVideoImage (cognitive 19) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:736— executeVideoRecall.placeVideoImage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 3 (4 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.
MaxQueueHistorySettings.MaxQueueHistorySettings (cognitive 19) invokeai/frontend/webv2/src/workbench/settings/MaxQueueHistorySettings.tsx:31— MaxQueueHistorySettings.MaxQueueHistorySettings has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (7 pts), boolean chains 6, if/else 5, error handling 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
notificationToasts.startNotificationToasts (cognitive 19) invokeai/frontend/webv2/src/workbench/shell/notifications/notificationToasts.ts:58— notificationToasts.startNotificationToasts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 5 (6 pts), boolean chains 2, loops 2 (nesting depth added 5). None of this is in the body itself: all 19 points belong to 5 function items inside it that branch (show, a function literal at line 111, a function literal at line 93, …). 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.
LayoutPresetStrip.LayoutPresetStrip (cognitive 19) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:121— LayoutPresetStrip.LayoutPresetStrip has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 7, boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 261, 144, 152, …). 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.
LayoutPresetStrip.PresetTab (cognitive 19) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:407— LayoutPresetStrip.PresetTab has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10, if/else 5, boolean chains 4. Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 490, 433, 452, …). 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.
board_images.add_images_to_board (cognitive 18) invokeai/app/api/routers/board_images.py:206— board_images.add_images_to_board has cognitive complexity 18 (threshold 15). Drivers by points: error handling 7 (11 pts), if/else 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_manager.get_starter_models (cognitive 18) invokeai/app/api/routers/model_manager.py:1534— model_manager.get_starter_models has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 2 (7 pts), boolean chains 2 (nesting depth added 9). 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.
Krea2LoRALoaderInvocation.invoke (cognitive 18) invokeai/app/invocations/krea2/krea2_lora_loader.py:57— Krea2LoRALoaderInvocation.invoke has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
load_custom_nodes.load_custom_nodes (cognitive 18) invokeai/app/invocations/load_custom_nodes.py:9— load_custom_nodes.load_custom_nodes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, 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.
IntermediatesService._summary_rows (cognitive 18) invokeai/app/services/intermediates/intermediates_default.py:225— IntermediatesService._summary_rows has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (6 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.
IntermediatesService._run (cognitive 18) invokeai/app/services/intermediates/intermediates_default.py:556— IntermediatesService._run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IntermediatesSizeMeasurer.measure_once (cognitive 18) invokeai/app/services/intermediates/intermediates_measurement.py:49— IntermediatesSizeMeasurer.measure_once has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), loops 2 (3 pts), ternaries 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.
ModelInstallService._restart_remote_download (cognitive 18) invokeai/app/services/model_install/model_install_default.py:1364— ModelInstallService._restart_remote_download has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ExecutionScheduler.complete (cognitive 18) invokeai/app/services/shared/execution_engine/scheduler.py:401— ExecutionScheduler.complete has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2, 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.
ExecutionScheduler.rebuild_ready (cognitive 18) invokeai/app/services/shared/execution_engine/scheduler.py:435— ExecutionScheduler.rebuild_ready has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2, 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.
GraphExecutionState._register_generic_child_dependency (cognitive 18) invokeai/app/services/shared/graph.py:2126— GraphExecutionState._register_generic_child_dependency has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph_iterate_planner._prepare_body_iterate_collect_fan_in_unchecked (cognitive 18) invokeai/app/services/shared/graph_iterate_planner.py:387— graph_iterate_planner._prepare_body_iterate_collect_fan_in_unchecked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (8 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.
_ExecutionNodeBuilder._matches_sibling_if_collect_context (cognitive 18) invokeai/app/services/shared/graph_materializer.py:1516— _ExecutionNodeBuilder._matches_sibling_if_collect_context has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (4 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.
_ExecutionNodeBuilder._has_admitted_source_mapping (cognitive 18) invokeai/app/services/shared/graph_materializer.py:1676— _ExecutionNodeBuilder._has_admitted_source_mapping has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ExecutionNodeBuilder._get_if_condition_iteration_mappings (cognitive 18) invokeai/app/services/shared/graph_materializer.py:1740— _ExecutionNodeBuilder._get_if_condition_iteration_mappings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Migration26Callback.__call__ (cognitive 18) invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py:44— Migration26Callback.__call__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workflow_graph_builder.apply_workflow_inputs_to_workflow (cognitive 18) invokeai/app/services/shared/workflow_graph_builder.py:127— workflow_graph_builder.apply_workflow_inputs_to_workflow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 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.
DiskVideoFileStorage.save (cognitive 18) invokeai/app/services/video_files/video_files_disk.py:65— DiskVideoFileStorage.save has cognitive complexity 18 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 7, 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.
WorkingMemoryCalibrationService._identify (cognitive 18) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:633— WorkingMemoryCalibrationService._identify has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 pts), loops 3, 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.
KontextExtension._prepare_kontext (cognitive 18) invokeai/backend/flux/extensions/kontext_extension.py:105— KontextExtension._prepare_kontext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main._is_flux2_model (cognitive 18) invokeai/backend/model_manager/configs/main.py:445— main._is_flux2_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 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.
mistral_encoder._count_mistral_layers (cognitive 18) invokeai/backend/model_manager/configs/mistral_encoder.py:151— mistral_encoder._count_mistral_layers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 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.
qwen3_encoder._get_qwen3_variant_from_state_dict (cognitive 18) invokeai/backend/model_manager/configs/qwen3_encoder.py:212— qwen3_encoder._get_qwen3_variant_from_state_dict has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 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.
ModelCache._load_locked_model (cognitive 18) invokeai/backend/model_manager/load/model_cache/model_cache.py:2118— ModelCache._load_locked_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 4 (5 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, 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.
ModelCache._offload_unlocked_models (cognitive 18) invokeai/backend/model_manager/load/model_cache/model_cache.py:2629— ModelCache._offload_unlocked_models has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flux2_state_dict_utils.convert_flux2_bfl_to_diffusers (cognitive 18) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:402— flux2_state_dict_utils.convert_flux2_bfl_to_diffusers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gemma2_encoder.load_gemma2_model_from_gguf (cognitive 18) invokeai/backend/model_manager/load/model_loaders/gemma2_encoder.py:150— gemma2_encoder.load_gemma2_model_from_gguf has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), ternaries 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.
QwenImageCheckpointModel._load_from_singlefile (cognitive 18) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:283— QwenImageCheckpointModel._load_from_singlefile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4 (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.
QwenImage21CheckpointModel._load_model (cognitive 18) invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py:209— QwenImage21CheckpointModel._load_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, ternaries 1 (2 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.
wan._read_converted (cognitive 18) invokeai/backend/model_manager/load/model_loaders/wan.py:484— wan._read_converted has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
select_hf_files.filter_files (cognitive 18) invokeai/backend/model_manager/util/select_hf_files.py:22— select_hf_files.filter_files has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, 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.
flux3_lora_constants.read_flux3_lora_keys (cognitive 18) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:272— flux3_lora_constants.read_flux3_lora_keys has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
flux_diffusers_lora_conversion_utils.is_state_dict_likely_in_flux_diffusers_format (cognitive 18) invokeai/backend/patches/lora_conversions/flux_diffusers_lora_conversion_utils.py:17— flux_diffusers_lora_conversion_utils.is_state_dict_likely_in_flux_diffusers_format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 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.
_Window._close (cognitive 18) invokeai/backend/working_memory/probe.py:444— _Window._close has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (2 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.
addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener (cognitive 18) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts:19— addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. None of this is in the body itself: all 18 points belong to 4 function literals inside it that branch (lines 64, 26, 103, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GalleryImageGrid.useStarImageHotkey (cognitive 18) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:337— GalleryImageGrid.useStarImageHotkey has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4, boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 351). 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.
fieldValidators.getFieldErrors (cognitive 18) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:214— fieldValidators.getFieldErrors has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8 (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.
SettingsGenerationDevices.DeviceTag (cognitive 18) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:208— SettingsGenerationDevices.DeviceTag has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 7, boolean chains 4 (nesting depth added 1). Of this number, 11 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
workflowExecutionCoordinator.createWorkflowExecutionCoordinator.onQueueItemStatusChanged (cognitive 18) invokeai/frontend/webv1/src/services/events/workflowExecutionCoordinator.ts:256— workflowExecutionCoordinator.createWorkflowExecutionCoordinator.onQueueItemStatusChanged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, 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.
performance-budgets.checkBrowserRouteBudget (cognitive 18) invokeai/frontend/webv2/scripts/performance-budgets.mjs:902— performance-budgets.checkBrowserRouteBudget has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 5). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkflowUiAdapter.selectProjectPersistence (cognitive 18) invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx:53— WorkflowUiAdapter.selectProjectPersistence has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (16 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
galleryStateView.getGalleryStateView (cognitive 18) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:512— galleryStateView.getGalleryStateView has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, ternaries 8 (9 pts) (nesting depth added 1). Of this number, 16 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.
queries.ensureLifecycle (cognitive 18) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:424— queries.ensureLifecycle has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 pts), loops 2 (nesting depth added 1). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 446, seedExistingPages, pruneListing, …). 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.
addRegionalGuidance.addRegionalGuidance (cognitive 18) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:393— addRegionalGuidance.addRegionalGuidance has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installsStore.handleModelInstallSocketEvent (cognitive 18) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:455— installsStore.handleModelInstallSocketEvent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 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.
runtime.createQueueRuntime (cognitive 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:537— runtime.createQueueRuntime has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 1. None of this is in the body itself: all 18 points belong to 6 function literals inside it that branch (lines 567, 1508, 1539, …). 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.
outputFields.formatOutputValue (cognitive 18) invokeai/frontend/webv2/src/features/workflow/core/outputFields.ts:71— outputFields.formatOutputValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), boolean chains 2, 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.
clipboard.getBridgingConnectorIds (cognitive 18) invokeai/frontend/webv2/src/features/workflow/ui/editor/clipboard.ts:57— clipboard.getBridgingConnectorIds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (reachesCopiedNode, startsAtCopiedNode, isConnectorId). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Picker.PickerListbox (cognitive 18) invokeai/frontend/webv2/src/platform/ui/Picker.tsx:374— Picker.PickerListbox has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 3, loops 1 (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 5 function items inside it that branch (a function literal at line 512, a function literal at line 408, a function literal at line 413, …). 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.
ResizableTextarea.ResizableTextarea (cognitive 18) invokeai/frontend/webv2/src/platform/ui/ResizableTextarea.tsx:104— ResizableTextarea.ResizableTextarea has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 1 (nesting depth added 9). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 160). 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.
draftStore.decideUnloadJournalEntry (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:802— draftStore.decideUnloadJournalEntry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, ternaries 5 (7 pts), boolean chains 4 (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: 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.
draftStore.createMemoryProjectDraftStore.stage (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1554— draftStore.createMemoryProjectDraftStore.stage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1125— indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 2). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 1135). 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.
projectAssets.createOpenProjectsHeldMediaReader::collectParts (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:188— projectAssets.createOpenProjectsHeldMediaReader::collectParts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, 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.
projectDocument.applyAuthoritativeProjectBoard (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/projectDocument.ts:302— projectDocument.applyAuthoritativeProjectBoard has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 3 (5 pts), boolean chains 2, 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.
useStagedResultGallerySave.useStagedResultGallerySave.save::run (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/useStagedResultGallerySave.ts:51— useStagedResultGallerySave.useStagedResultGallerySave.save::run has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 6 (7 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layerChildRows.projectLayerChildRows (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:233— layerChildRows.projectLayerChildRows has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5, ternaries 2 (4 pts) (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
layerChildRows.getLayerChildItem (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:308— layerChildRows.getLayerChildItem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 2 (4 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.
LayerSection.resolveChildEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx:84— LayerSection.resolveChildEditor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 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.
LayerEditorPanes.LayerPaneBlock (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.tsx:50— LayerEditorPanes.LayerPaneBlock has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LayerMutationController.duplicate (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:147— LayerMutationController.duplicate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layerStacks.moveSelectedIds (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/document/layerStacks.ts:91— layerStacks.moveSelectedIds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 3, 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.
workbenchStore.createWorkbenchStore.setSnapshotState (cognitive 18) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:981— workbenchStore.createWorkbenchStore.setSnapshotState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 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.
ThumbnailController.draw (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:74— ThumbnailController.draw has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 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.
selectionState.createSelectionState.commit (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/selectionState.ts:264— selectionState.createSelectionState.commit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 3, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
layerImageResult.processSelectObjectSource (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-operations/layerImageResult.ts:128— layerImageResult.processSelectObjectSource has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 6 (7 pts), boolean chains 1, 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.
legacyCanvasPressure.buildOpacityStampRenderOps (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasPressure.ts:196— legacyCanvasPressure.buildOpacityStampRenderOps has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (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.
legacyCanvasPressure.drawLegacyOpacityStroke (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasPressure.ts:337— legacyCanvasPressure.drawLegacyOpacityStroke has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveCanvasToGallery.recordCanvasMetadata::visit (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-operations/saveCanvasToGallery.ts:64— saveCanvasToGallery.recordCanvasMetadata::visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
videoRecall.getReferences (cognitive 18) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:326— videoRecall.getReferences has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 5, if/else 3 (nesting depth added 5). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 329). 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.
queueRecall.buildVideoQueueRecallPatch (cognitive 18) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:262— queueRecall.buildVideoQueueRecallPatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InvokePopoverBody.InvokePopoverBody (cognitive 18) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokePopoverBody.tsx:20— InvokePopoverBody.InvokePopoverBody has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 11 (17 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.
widgetDnd.widgetCollisionDetection (cognitive 18) invokeai/frontend/webv2/src/workbench/widgetDnd.ts:347— widgetDnd.widgetCollisionDetection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, ternaries 2 (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WidgetFailureBoundary.WidgetFailureFallback (cognitive 18) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFailureBoundary.tsx:287— WidgetFailureBoundary.WidgetFailureFallback has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (6 pts), if/else 5 (nesting depth added 1). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AdjustmentSettings.CurvesEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx:710— AdjustmentSettings.CurvesEditor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 2, loops 1. None of this is in the body itself: all 18 points belong to 8 function literals inside it that branch (lines 810, 784, 840, …). 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.
ControlAdapterRows.ControlAdapterRows (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlAdapterRows.tsx:36— ControlAdapterRows.ControlAdapterRows has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 6 (7 pts), boolean chains 1 (nesting depth added 2). Of this number, 9 points are the body's own statements and 9 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
image_map.get_image_map_points (cognitive 17) invokeai/app/api/routers/image_map.py:418— image_map.get_image_map_points has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SocketIO._handle_queue_event (cognitive 17) invokeai/app/api/sockets.py:972— SocketIO._handle_queue_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, 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.
QwenImageLoRACollectionLoader.invoke (cognitive 17) invokeai/app/invocations/qwen_image/qwen_image_lora_loader.py:142— QwenImageLoRACollectionLoader.invoke has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, 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.
DownloadQueueService._download_next_item (cognitive 17) invokeai/app/services/download/download_default.py:389— DownloadQueueService._download_next_item has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 3 (6 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.
DownloadQueueService._mfd_error (cognitive 17) invokeai/app/services/download/download_default.py:858— DownloadQueueService._mfd_error has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (2 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.
ImageMoveService._complete_partial_filesystem_move (cognitive 17) invokeai/app/services/image_moves/image_moves_default.py:463— ImageMoveService._complete_partial_filesystem_move has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WorkflowCallQueueLifecycle._resume_parent_from_completed_child (cognitive 17) invokeai/app/services/session_processor/workflow_call_runtime.py:295— WorkflowCallQueueLifecycle._resume_parent_from_completed_child has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Batch.validate_types (cognitive 17) invokeai/app/services/session_queue/session_queue_common.py:147— Batch.validate_types has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
copy.find_oversized (cognitive 17) invokeai/app/services/shared/database/copy.py:147— copy.find_oversized has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
images._conditions (cognitive 17) invokeai/app/services/shared/database/queries/images.py:196— images._conditions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 3 (5 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.
ExecutionScheduler.discard (cognitive 17) invokeai/app/services/shared/execution_engine/scheduler.py:358— ExecutionScheduler.discard has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2, 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.
GraphExecutionState._validate_output_owner (cognitive 17) invokeai/app/services/shared/graph.py:2531— GraphExecutionState._validate_output_owner 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.
_ExecutionNodeBuilder._get_parent_iteration_mappings_without_iterators (cognitive 17) invokeai/app/services/shared/graph_materializer.py:1408— _ExecutionNodeBuilder._get_parent_iteration_mappings_without_iterators has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 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.
_ExecutionNodeBuilder._get_parent_iteration_mappings (cognitive 17) invokeai/app/services/shared/graph_materializer.py:1551— _ExecutionNodeBuilder._get_parent_iteration_mappings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, 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.
_ExecutionNodeBuilder._get_unexecuted_root_collect_if_descendants (cognitive 17) invokeai/app/services/shared/graph_materializer.py:2348— _ExecutionNodeBuilder._get_unexecuted_root_collect_if_descendants 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.
graph_nested_iterate_planner._get_exact_nested_iterate_body (cognitive 17) invokeai/app/services/shared/graph_nested_iterate_planner.py:21— graph_nested_iterate_planner._get_exact_nested_iterate_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 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.
_GenericGraphSchedulerAdapter.complete (cognitive 17) invokeai/app/services/shared/graph_scheduler.py:605— _GenericGraphSchedulerAdapter.complete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 4, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StoreEmbeddingsFp16Callback._convert_table (cognitive 17) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_30_store_embeddings_fp16.py:69— StoreEmbeddingsFp16Callback._convert_table has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Migration24Callback._normalize_model_storage (cognitive 17) invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:79— Migration24Callback._normalize_model_storage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (3 pts), ternaries 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.
WorkingMemoryCalibrationService.get_model_summary (cognitive 17) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1806— WorkingMemoryCalibrationService.get_model_summary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5, boolean chains 3, loops 2 (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.
ssrf._parse_ipv4_literal (cognitive 17) invokeai/app/util/ssrf.py:136— ssrf._parse_ipv4_literal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
video_audio._probe_audio_sample_rate (cognitive 17) invokeai/app/util/video_audio.py:213— video_audio._probe_audio_sample_rate has cognitive complexity 17 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 2 (6 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.
mediapipe_face_common.draw_pupils (cognitive 17) invokeai/backend/image_util/mediapipe_face/mediapipe_face_common.py:50— mediapipe_face_common.draw_pupils has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PiDiNet.__init__ (cognitive 17) invokeai/backend/image_util/pidi/model.py:497— PiDiNet.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SegmentAnything2Pipeline.segment (cognitive 17) invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:37— SegmentAnything2Pipeline.segment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), ternaries 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.
SegmentAnythingPipeline.segment (cognitive 17) invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:31— SegmentAnythingPipeline.segment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), ternaries 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.
AutoencoderKLMiniMaxH3._decode (cognitive 17) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:795— AutoencoderKLMiniMaxH3._decode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
main._sdnq_component_declared_classes (cognitive 17) invokeai/backend/model_manager/configs/main.py:3978— main._sdnq_component_declared_classes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 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.
AnimaCheckpointModel._load_from_singlefile (cognitive 17) invokeai/backend/model_manager/load/model_loaders/anima.py:95— AnimaCheckpointModel._load_from_singlefile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Flux2CheckpointModel._dequantize_fp8_weights (cognitive 17) invokeai/backend/model_manager/load/model_loaders/flux.py:1573— Flux2CheckpointModel._dequantize_fp8_weights has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 5, 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.
qwen3_5_encoder.load_qwen3_5_text_encoder (cognitive 17) invokeai/backend/model_manager/load/model_loaders/qwen3_5_encoder.py:66— qwen3_5_encoder.load_qwen3_5_text_encoder has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (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.
QwenImage21DiffusersModel._load_model (cognitive 17) invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py:92— QwenImage21DiffusersModel._load_model has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2, boolean chains 1, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
model_util.lora_token_vector_length (cognitive 17) invokeai/backend/model_manager/util/model_util.py:87— model_util.lora_token_vector_length has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, 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.
ModelPatcher.apply_ti (cognitive 17) REDACTED:44— ModelPatcher.apply_ti has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 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.
MOSSImageTransformer.forward (cognitive 17) invokeai/backend/moss_image/pipeline_moss_image.py:218— MOSSImageTransformer.forward has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
minimax_h3_lora_conversion_utils.lora_model_from_minimax_h3_state_dict (cognitive 17) invokeai/backend/patches/lora_conversions/minimax_h3_lora_conversion_utils.py:86— minimax_h3_lora_conversion_utils.lora_model_from_minimax_h3_state_dict 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.
sd3_lora_constants.sd3_text_encoder_target (cognitive 17) invokeai/backend/patches/lora_conversions/sd3_lora_constants.py:259— sd3_lora_constants.sd3_text_encoder_target has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 2 (7 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PidDistillModel.load_state_dict (cognitive 17) invokeai/backend/pid/_src/models/pid_distill_model.py:293— PidDistillModel.load_state_dict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProbeScope.open_window (cognitive 17) invokeai/backend/working_memory/probe.py:514— ProbeScope.open_window has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, error handling 2, 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.
CanvasEntityAdapterInpaintMask.sync (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterInpaintMask.ts:31— CanvasEntityAdapterInpaintMask.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CanvasEntityAdapterRasterLayer.sync (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRasterLayer.ts:56— CanvasEntityAdapterRasterLayer.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CanvasEntityAdapterRegionalGuidance.sync (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRegionalGuidance.ts:31— CanvasEntityAdapterRegionalGuidance.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
needsPixelBbox.objectStateNeedsPixelBbox (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasObject/needsPixelBbox.ts:3— needsPixelBbox.objectStateNeedsPixelBbox has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6 (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.
CanvasEraserToolModule.onStagePointerDown (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.ts:222— CanvasEraserToolModule.onStagePointerDown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 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.
CanvasToolModule.getCanDraw (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:458— CanvasToolModule.getCanDraw has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (17 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
pressure.buildPressureStrokeRenderOps (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:594— pressure.buildPressureStrokeRenderOps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paramsSlice.applyParamsVersionMigrations (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1080— paramsSlice.applyParamsVersionMigrations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
validators.getControlLayerWarnings (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:266— validators.getControlLayerWarnings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.createKonvaCropInteractionHandle (cognitive 17) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:418— Editor.createKonvaCropInteractionHandle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 4 function literals inside it that branch (lines 446, 434, 466, …). 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.
selectedItemReveal.createSelectedItemRevealMachine.sync (cognitive 17) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/selectedItemReveal.ts:131— selectedItemReveal.createSelectedItemRevealMachine.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AddNodeCmdk.useAddNode.addNode (cognitive 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:68— AddNodeCmdk.useAddNode.addNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddNodeCmdk.filter (cognitive 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:304— AddNodeCmdk.filter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
getCollectItemType.getCollectItemType (cognitive 17) invokeai/frontend/webv1/src/features/nodes/store/util/getCollectItemType.ts:25— getCollectItemType.getCollectItemType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function items inside it that branch (getCollectItemTypeInternal, a function literal at line 37, a function literal at line 55). 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.
workflow.validateFormStructure (cognitive 17) invokeai/frontend/webv1/src/features/nodes/types/workflow.ts:310— workflow.validateFormStructure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (nesting depth added 5). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (findChildren). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ParamPositivePrompt.ParamPositivePrompt (cognitive 17) invokeai/frontend/webv1/src/features/parameters/components/Core/ParamPositivePrompt.tsx:147— ParamPositivePrompt.ParamPositivePrompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, loops 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 199, 291, 163, …). 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.
readiness.pushWanReasons (cognitive 17) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:308— readiness.pushWanReasons has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.getGallerySettings (cognitive 17) invokeai/frontend/webv2/src/features/gallery/core/settings.ts:205— settings.getGallerySettings has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 15, boolean chains 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.
settings.normalizeReferenceImageConfig (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/settings.ts:434— settings.normalizeReferenceImageConfig has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 4, if/else 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph.buildZImageGraph (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/graph.ts:1192— graph.buildZImageGraph has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7, boolean chains 6, if/else 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ast.serializeInto (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:776— ast.serializeInto has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 10). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConditioningRebalanceBars.ConditioningRebalanceBars (cognitive 17) invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.tsx:100— ConditioningRebalanceBars.ConditioningRebalanceBars has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7, boolean chains 5, if/else 5. None of this is in the body itself: all 17 points belong to 4 function literals inside it that branch (lines 219, 162, 115, …). 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.
GenerateSettingsForm.GenerateSettingsForm (cognitive 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx:53— GenerateSettingsForm.GenerateSettingsForm has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 3 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 10 function items inside it that branch (a function literal at line 101, a function literal at line 264, a function literal at line 205, …). 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.
WorkingMemorySection.WorkingMemorySection (cognitive 17) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:70— WorkingMemorySection.WorkingMemorySection has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6, boolean chains 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NodeInstallQueue.NodeInstallRow (cognitive 17) invokeai/frontend/webv2/src/features/nodes/ui/install-queue/NodeInstallQueue.tsx:185— NodeInstallQueue.NodeInstallRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (14 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.
runtime.createQueueRuntime.deliverResultVideos (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:1117— runtime.createQueueRuntime.deliverResultVideos has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, error handling 4, boolean chains 3, ternaries 2 (3 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: 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.
runtime.createQueueRuntime.routeBackendItemResults (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:1354— runtime.createQueueRuntime.routeBackendItemResults has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, ternaries 3, 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.
runtime.createQueueRuntime.loadProjectJournal (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:2739— runtime.createQueueRuntime.loadProjectJournal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 4). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 2747, 2766). 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.
coordinator.createQueueCoordinator.handleStatusChanged (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:816— coordinator.createQueueCoordinator.handleStatusChanged has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 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.
queueMenuActions.useQueueActions (cognitive 17) invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx:302— queueMenuActions.useQueueActions has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 11 (12 pts), boolean chains 4, match/switch 1 (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 10 function literals inside it that branch (lines 379, 505, 464, …). 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.
libraryBrowseStore.revalidateSelected (cognitive 17) invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:969— libraryBrowseStore.revalidateSelected has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2, error handling 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
flowAdapters.getCollapsedEdgeLayout (cognitive 17) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:470— flowAdapters.getCollapsedEdgeLayout has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), boolean chains 1, 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.
QueueStatusWidgetView.QueueStatusWidgetView (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/queue-status/QueueStatusWidgetView.tsx:31— QueueStatusWidgetView.QueueStatusWidgetView has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 1, if/else 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.
rect.mergeDirtyRects (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/math/rect.ts:101— rect.mergeDirtyRects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 5). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (findMergeablePair, a function literal at line 135). 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.
MaskLayerController.clear (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:41— MaskLayerController.clear has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, boolean chains 5, ternaries 5. Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
psdExport.planPsdExport::buildTree (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:276— psdExport.planPsdExport::buildTree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 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.
paintTool.createPaintTool.onPointerDown (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:330— paintTool.createPaintTool.onPointerDown has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 4, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
imageRecall.getHiDiffusionPatch (cognitive 17) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:270— imageRecall.getHiDiffusionPatch has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 6, if/else 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.
executeVideoRecall.resolveVideoRecallMedia (cognitive 17) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:87— executeVideoRecall.resolveVideoRecallMedia has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 4 (5 pts), loops 3, boolean chains 2, error handling 1 (nesting depth added 4). Of this number, 10 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
entries.buildSettingsEntries (cognitive 17) invokeai/frontend/webv2/src/workbench/palette/entries.ts:413— entries.buildSettingsEntries has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 3, if/else 2 (nesting depth added 2). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 421, 513, 512). 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.
fonts.readEmbeddedFonts (cognitive 17) invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:109— fonts.readEmbeddedFonts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HotkeysSettingsSection.canScopesOverlap (cognitive 17) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:101— HotkeysSettingsSection.canScopesOverlap has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CenterArea.CenterArea (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:86— CenterArea.CenterArea has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 6, if/else 1 (nesting depth added 2). 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, 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.
invokeIssueTargets.getInvocationIssueTarget (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueTargets.ts:31— invokeIssueTargets.getInvocationIssueTarget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GenerateCanvasRenderSize.GenerateCanvasRenderSize (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasRenderSize.tsx:70— GenerateCanvasRenderSize.GenerateCanvasRenderSize has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, boolean chains 4, if/else 4. 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 literals inside it that branch (lines 139, 113, 87, …). 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.
custom_nodes._install_pack (cognitive 16) invokeai/app/api/routers/custom_nodes.py:211— custom_nodes._install_pack has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2, ternaries 2, 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.
images.delete_images_from_list (cognitive 16) invokeai/app/api/routers/images.py:583— images.delete_images_from_list has cognitive complexity 16 (threshold 15). Drivers by points: error handling 6 (9 pts), if/else 1 (3 pts), loops 2 (3 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.
SocketIO._revalidate_socket_users (cognitive 16) invokeai/app/api/sockets.py:464— SocketIO._revalidate_socket_users has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4, boolean chains 2, 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.
FluxDenoiseInvocation._prep_controlnet_extensions (cognitive 16) invokeai/app/invocations/flux/flux_denoise.py:737— FluxDenoiseInvocation._prep_controlnet_extensions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MetadataToLorasCollectionInvocation.invoke (cognitive 16) invokeai/app/invocations/metadata_linked.py:940— MetadataToLorasCollectionInvocation.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, ternaries 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.
metadata_linked.extract_model_key (cognitive 16) invokeai/app/invocations/metadata_linked.py:192— metadata_linked.extract_model_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (16 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.
MiniMaxH3DenoiseInvocation._split_pruned_adaln_patches (cognitive 16) invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:663— MiniMaxH3DenoiseInvocation._split_pruned_adaln_patches has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoRACollectionLoader.invoke (cognitive 16) invokeai/app/invocations/model.py:535— LoRACollectionLoader.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 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.
DenoiseLatentsInvocation._concat_regional_text_embeddings (cognitive 16) invokeai/app/invocations/sd/denoise_latents.py:339— DenoiseLatentsInvocation._concat_regional_text_embeddings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IPAdapterInvocation.invoke (cognitive 16) invokeai/app/invocations/sd/ip_adapter.py:123— IPAdapterInvocation.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (16 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.
QwenImageTextEncoderInvocation._load_quantized_encoder (cognitive 16) invokeai/app/invocations/text_encoder/qwen_image_text_encoder.py:475— QwenImageTextEncoderInvocation._load_quantized_encoder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
WanRefImageEncoderInvocation.invoke (cognitive 16) invokeai/app/invocations/wan/wan_ref_image_encoder.py:108— WanRefImageEncoderInvocation.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 4 (5 pts), boolean chains 4 (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.
GalleryService._usage (cognitive 16) invokeai/app/services/gallery/gallery_default.py:304— GalleryService._usage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (5 pts), ternaries 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryMaintenanceService._archive_file (cognitive 16) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:838— GalleryMaintenanceService._archive_file has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 4 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
IntermediatesService._worker_loop (cognitive 16) invokeai/app/services/intermediates/intermediates_default.py:532— IntermediatesService._worker_loop has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InstallStagingLedger.recoverable_installs (cognitive 16) invokeai/app/services/model_install/install_staging_ledger.py:822— InstallStagingLedger.recoverable_installs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService._download_complete_callback (cognitive 16) invokeai/app/services/model_install/model_install_default.py:2504— ModelInstallService._download_complete_callback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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.
workflow_call_batch._resolve_float_generator (cognitive 16) invokeai/app/services/session_processor/workflow_call_batch.py:235— workflow_call_batch._resolve_float_generator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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.
copy.copy_rows (cognitive 16) invokeai/app/services/shared/database/copy.py:38— copy.copy_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (4 pts), loops 2 (3 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.
gallery._conditions (cognitive 16) invokeai/app/services/shared/database/queries/gallery.py:163— gallery._conditions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 1 (2 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.
GraphExecutionState._get_for_parent (cognitive 16) invokeai/app/services/shared/graph.py:890— GraphExecutionState._get_for_parent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_IteratorAncestry.get_frame_iterators (cognitive 16) invokeai/app/services/shared/graph_iterator_ancestry.py:113— _IteratorAncestry.get_frame_iterators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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.
_ExecutionNodeBuilder._get_iteration_axes (cognitive 16) invokeai/app/services/shared/graph_materializer.py:66— _ExecutionNodeBuilder._get_iteration_axes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
graph_nested_iterate_planner._prepare_nested_iterate_sequence (cognitive 16) invokeai/app/services/shared/graph_nested_iterate_planner.py:394— graph_nested_iterate_planner._prepare_nested_iterate_sequence has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 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.
Graph._validate_for_loop_linkages (cognitive 16) invokeai/app/services/shared/graph_validation.py:1011— Graph._validate_for_loop_linkages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 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.
migration_2026_10_10_board_roles._board_roles (cognitive 16) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_10_board_roles.py:78— migration_2026_10_10_board_roles._board_roles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WorkingMemoryCalibrationService._held_back (cognitive 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1568— WorkingMemoryCalibrationService._held_back has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (4 pts), boolean chains 3, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
working_memory_calibration_fits.exclusions (cognitive 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:74— working_memory_calibration_fits.exclusions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (4 pts), loops 3, 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.
controlnet_utils.heuristic_resize (cognitive 16) invokeai/app/util/controlnet_utils.py:150— controlnet_utils.heuristic_resize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PromptFormatter.normalize_prompt (cognitive 16) invokeai/backend/image_util/pngwriter.py:87— PromptFormatter.normalize_prompt has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Qwen3VLEncoderCheckpointLoader._load_text_encoder (cognitive 16) invokeai/backend/model_manager/load/model_loaders/krea2.py:1083— Qwen3VLEncoderCheckpointLoader._load_text_encoder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5 (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.
MiniMaxH3CheckpointModel._load_transformer_from_singlefile (cognitive 16) invokeai/backend/model_manager/load/model_loaders/minimax_h3.py:203— MiniMaxH3CheckpointModel._load_transformer_from_singlefile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 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.
qwen_image._build_qwen_image_transformer_config (cognitive 16) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:105— qwen_image._build_qwen_image_transformer_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 1 (4 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.
PixelDiTModel.load_state_dict (cognitive 16) invokeai/backend/pid/_src/models/pixeldit_model.py:249— PixelDiTModel.load_state_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PixDiT_T2I.__init__ (cognitive 16) invokeai/backend/pid/_src/networks/pixeldit_official.py:1168— PixDiT_T2I.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 3 (4 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ggml_tensor.peak_ggml_linear_dequant_transient_bytes (cognitive 16) invokeai/backend/quantization/gguf/ggml_tensor.py:262— ggml_tensor.peak_ggml_linear_dequant_transient_bytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
int8_convrot.swap_in_int8_linears (cognitive 16) invokeai/backend/quantization/int8_convrot.py:1066— int8_convrot.swap_in_int8_linears has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention (cognitive 16) invokeai/backend/stable_diffusion/diffusers_pipeline.py:170— StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
StableDiffusionGeneratorPipeline.latents_from_embeddings (cognitive 16) invokeai/backend/stable_diffusion/diffusers_pipeline.py:274— StableDiffusionGeneratorPipeline.latents_from_embeddings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 1 (2 pts), 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.
IPAdapterExt.run_adapters (cognitive 16) invokeai/backend/stable_diffusion/extensions/ip_adapter.py:223— IPAdapterExt.run_adapters has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
counters.fdinfo_vram_bytes (cognitive 16) invokeai/backend/working_memory/counters.py:138— counters.fdinfo_vram_bytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (3 pts), ternaries 1 (3 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.
fit.upper_envelope (cognitive 16) invokeai/backend/working_memory/fit.py:353— fit.upper_envelope has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), boolean chains 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.
MediaImportProcessor.select_board_option (cognitive 16) invokeai/frontend/install/import_images.py:514— MediaImportProcessor.select_board_option has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
promptAST.serializeCore (cognitive 16) invokeai/frontend/webv1/src/common/util/promptAST.ts:801— promptAST.serializeCore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
useMediaCookieRefresh.useMediaCookieRefresh (cognitive 16) invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:68— useMediaCookieRefresh.useMediaCookieRefresh has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, loops 1. None of this is in the body itself: all 16 points belong to 7 function literals inside it that branch (lines 99, 136, 151, …). 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.
RefImagePreview.RefImagePreview (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx:79— RefImagePreview.RefImagePreview has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 4 (5 pts), if/else 3 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CanvasToolbarSnapshotMenuButton.CanvasToolbarSnapshotMenuButton (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/components/Toolbar/CanvasToolbarSnapshotMenuButton.tsx:80— CanvasToolbarSnapshotMenuButton.CanvasToolbarSnapshotMenuButton has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3 (nesting depth added 1). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 139, 93, 105, …). 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.
useCanvasProjectLoad.useCanvasProjectLoad.loadCanvasProject (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectLoad.ts:31— useCanvasProjectLoad.useCanvasProjectLoad.loadCanvasProject has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 3). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CanvasEntityTransformer.syncInteractionState (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:664— CanvasEntityTransformer.syncInteractionState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
filters.AdjustmentsSimpleFilter (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/konva/filters.ts:33— filters.AdjustmentsSimpleFilter has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), ternaries 3, if/else 2, boolean chains 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
state.handleDeletions (cognitive 16) invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.ts:78— state.handleDeletions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 4 (5 pts), boolean chains 2, 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.
actions.newCanvasFromImage (cognitive 16) invokeai/frontend/webv1/src/features/imageActions/actions.ts:178— actions.newCanvasFromImage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelList.ModelList (cognitive 16) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelList.tsx:40— ModelList.ModelList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 3, error handling 2, ternaries 2, loops 1. Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 99, 153, 63, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkflowListItem.WorkflowListItem (cognitive 16) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowListItem.tsx:36— WorkflowListItem.WorkflowListItem has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 2, ternaries 1. Of this number, 12 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, 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.
fieldValidators.validateStringFieldCollectionValue (cognitive 16) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:83— fieldValidators.validateStringFieldCollectionValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, 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.
fieldValidators.syncNodeErrors (cognitive 16) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:305— fieldValidators.syncNodeErrors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resolveBatchValue.resolveBatchValue (cognitive 16) invokeai/frontend/webv1/src/features/nodes/util/node/resolveBatchValue.ts:46— resolveBatchValue.resolveBatchValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (nesting depth added 4). Of this number, 12 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SettingsModal.SettingsModal (cognitive 16) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsModal.tsx:79— SettingsModal.SettingsModal has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 5, ternaries 5, error handling 1. Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 133, 126, 273). 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.
queries.fetchVerifiedGalleryItemPage (cognitive 16) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:899— queries.fetchVerifiedGalleryItemPage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GalleryWidgetContext.createSelectionStarStore.reconcilePatch (cognitive 16) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:145— GalleryWidgetContext.createSelectionStarStore.reconcilePatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
baseGenerationPolicies.getDimensionValidationIssues (cognitive 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2565— baseGenerationPolicies.getDimensionValidationIssues has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PromptParser.parseUnquotedPromptFunction (cognitive 16) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:502— PromptParser.parseUnquotedPromptFunction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenerateDimensionFields.GenerateDimensionFields::renderSection (cognitive 16) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:643— GenerateDimensionFields.GenerateDimensionFields::renderSection has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 14, boolean chains 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. This shape REPEATS in the file: one other method here (GenerateDimensionFields.GenerateDimensionFields) 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.
OperationPanel.OperationPanel (cognitive 16) invokeai/frontend/webv2/src/features/intermediates/ui/OperationPanel.tsx:73— OperationPanel.OperationPanel has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 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.
WorkingMemoryParts.LineStateBadge (cognitive 16) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemoryParts.tsx:29— WorkingMemoryParts.LineStateBadge has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (16 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.
deliveryClaims.createDeliveryConfirmations.drain (cognitive 16) invokeai/frontend/webv2/src/features/queue/runtime/deliveryClaims.ts:44— deliveryClaims.createDeliveryConfirmations.drain has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 64, 58). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
UpscaleFormFields.UpscalePromptFields (cognitive 16) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleFormFields.tsx:41— UpscaleFormFields.UpscalePromptFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 1. Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 112, 89, 144, …). 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.
videoPolicies.getVideoDimensions (cognitive 16) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:580— videoPolicies.getVideoDimensions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 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.
batch.resolveWorkflowGeneratorValue (cognitive 16) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:556— batch.resolveWorkflowGeneratorValue has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 2, boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
document.updateInvocationNodeToTemplate (cognitive 16) invokeai/frontend/webv2/src/features/workflow/core/document.ts:503— document.updateInvocationNodeToTemplate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 2 (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.
document.updateWorkflowNodes (cognitive 16) invokeai/frontend/webv2/src/features/workflow/core/document.ts:587— document.updateWorkflowNodes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, boolean chains 1, ternaries 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent 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.toWorkflowLibraryWriteRefusal (cognitive 16) invokeai/frontend/webv2/src/features/workflow/data/api.ts:167— api.toWorkflowLibraryWriteRefusal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 4 (7 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PendingLibraryWorkflowLoader.PendingWorkflowLoader (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/PendingLibraryWorkflowLoader.tsx:28— PendingLibraryWorkflowLoader.PendingWorkflowLoader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (5 pts), error handling 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 36). 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.
useEraser.getIntersectingEdgeIds (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/editor/useEraser.tsx:50— useEraser.getIntersectingEdgeIds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), error handling 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.
WorkflowFieldInput.ScalarCollectionInput (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1557— WorkflowFieldInput.ScalarCollectionInput has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 2, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1585, 1599, 1569, …). 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.
DropZone.DropZone (cognitive 16) invokeai/frontend/webv2/src/platform/ui/DropZone.tsx:25— DropZone.DropZone has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 4 (nesting depth added 2). Of this number, 11 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
api.requestProjectWrite (cognitive 16) invokeai/frontend/webv2/src/workbench/projects/api.ts:224— api.requestProjectWrite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (4 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt (cognitive 16) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:364— indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 2 (4 pts) (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 one function literal inside it that branches (line 370). 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.
projectWorkflows.normalizeProjectWorkflowCollection (cognitive 16) invokeai/frontend/webv2/src/workbench/projectWorkflows.ts:144— projectWorkflows.normalizeProjectWorkflowCollection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 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.
layerContextActions.enabledToggleLabel (cognitive 16) invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:379— layerContextActions.enabledToggleLabel has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (15 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.
mutationContext.createCanvasMutationContext.begin.publish (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mutationContext.ts:363— mutationContext.createCanvasMutationContext.begin.publish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 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.
shapeRasterizer.buildParametricShapePath (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterizers/shapeRasterizer.ts:19— shapeRasterizer.buildParametricShapePath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 6). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
floatingWindows.commitChangedAxes (cognitive 16) invokeai/frontend/webv2/src/workbench/floatingWindows.ts:79— floatingWindows.commitChangedAxes has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 7 (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.
FloatingSelectionController.lift (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/floatingSelectionController.ts:116— FloatingSelectionController.lift has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, 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.
ThumbnailController.request (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:142— ThumbnailController.request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 3 (4 pts), error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
fontLoader.createFontLoader.setActiveSources (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:231— fontLoader.createFontLoader.setActiveSources has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5, 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.
ControlDetectionCoordinator.createControlDetectionCoordinator.reconcileWithDocument (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/ControlDetectionCoordinator.ts:555— ControlDetectionCoordinator.createControlDetectionCoordinator.reconcileWithDocument has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:279— SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
OpenProjectsControl.OpenProjectsNavSection (cognitive 16) invokeai/frontend/webv2/src/workbench/launchpad/OpenProjectsControl.tsx:64— OpenProjectsControl.OpenProjectsNavSection has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 3, if/else 2 (nesting depth added 4). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usePaletteNavigation.usePaletteNavigation.onSearchKeyDown (cognitive 16) invokeai/frontend/webv2/src/workbench/palette/usePaletteNavigation.ts:157— usePaletteNavigation.usePaletteNavigation.onSearchKeyDown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SettingsDialog.SettingsDialog (cognitive 16) invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx:74— SettingsDialog.SettingsDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 4, boolean chains 2 (nesting depth added 1). Of this number, 9 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
QueueCluster.QueueProgressAnnouncement (cognitive 16) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:299— QueueCluster.QueueProgressAnnouncement has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (16 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.
TextOptions.FontAxisSettings (cognitive 16) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:381— TextOptions.FontAxisSettings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 5, boolean chains 4. Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 422, 408, 394, …). 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.
Change coupling clique: flux_vae_decode.py, latents_to_image.py, sd3_latents_to_image.py invokeai/app/invocations/flux_vae_decode.py— 3 files — `invokeai/app/invocations/flux_vae_decode.py`, `invokeai/app/invocations/latents_to_image.py`, `invokeai/app/invocations/sd3_latents_to_image.py` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
D4 · Code Duplication· Near-duplicate member family (7 members, 55 shared lines) · ×1
Near-duplicate member family (7 members, 55 shared lines) invokeai/app/invocations/pid/flux2_pid_decode.py:103— invokeai/app/invocations/pid/flux2_pid_decode.py:103-201 | invokeai/app/invocations/pid/flux_pid_decode.py:85-170 | invokeai/app/invocations/pid/pid_upscale.py:106-209 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:101-199 | invokeai/app/invocations/pid/sd3_pid_decode.py:83-164 | invokeai/app/invocations/pid/sdxl_pid_decode.py:96-182 | invokeai/app/invocations/pid/z_image_pid_decode.py:97-192 — 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 (3 members, 9 shared lines) · ×1
Near-duplicate member family (3 members, 9 shared lines) invokeai/backend/flux/custom_block_processor.py:24— invokeai/backend/flux/custom_block_processor.py:24-59 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:41-93 | invokeai/backend/flux/modules/layers.py:156-188 — These 3 members are variants of one another: a block of 9 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (98 shared lines) invokeai/app/invocations/wan/wan_denoise.py:427— invokeai/app/invocations/wan/wan_denoise.py:427-728 | invokeai/app/invocations/wan/wan_video_denoise.py:173-406 — These two members are variants of one another: 98 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 (87 shared lines) invokeai/backend/pid/_src/networks/pid_net.py:290— invokeai/backend/pid/_src/networks/pid_net.py:290-495 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1413-1532 — These two members are variants of one another: 87 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 (59 shared lines) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14— invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14-76 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:27-93 — These two members are variants of one another: 59 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 (22 shared lines) invokeai/app/invocations/model.py:536— invokeai/app/invocations/model.py:536-564 | invokeai/app/invocations/model.py:696-731 — These two members are variants of one another: 22 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (9 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py:259— invokeai/app/invocations/anima/anima_denoise.py:259-280 | invokeai/app/invocations/cogview4/cogview4_denoise.py:81-113 | invokeai/app/invocations/flux/flux_denoise.py:697-735 | invokeai/app/invocations/flux2/flux2_denoise.py:588-604 | invokeai/app/invocations/krea2/krea2_denoise.py:229-241 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:160-174 | invokeai/app/invocations/sd3/sd3_denoise.py:161-193 | invokeai/app/invocations/wan/wan_denoise.py:783-799 | invokeai/app/invocations/z_image/z_image_denoise.py:157-174 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication· Edited copy of a member (71 corresponding lines) · ×1
Edited copy of a member (71 corresponding lines) invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:229— invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:229-300 | invokeai/app/invocations/ltx2/ltx2_video_conditioning.py:102-172 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding lines) invokeai/backend/model_manager/load/model_loaders/flux.py:1751— invokeai/backend/model_manager/load/model_loaders/flux.py:1751-1814 | invokeai/backend/model_manager/load/model_loaders/flux.py:1841-1951 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 45+ corresponding lines) · ×1
Edited copies of one member (4 members, 45+ corresponding lines) invokeai/app/invocations/flux3/flux3_model_loader.py:86— invokeai/app/invocations/flux3/flux3_model_loader.py:86-132 | invokeai/app/invocations/krea2/krea2_model_loader.py:97-146 | invokeai/app/invocations/moss_image/moss_image_model_loader.py:83-136 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py:85-129 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 45 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 43+ corresponding lines) · ×1
Edited copies of one member (3 members, 43+ corresponding lines) invokeai/app/invocations/flux2/flux2_dev_model_loader.py:119— invokeai/app/invocations/flux2/flux2_dev_model_loader.py:119-171 | invokeai/app/invocations/flux2/flux2_klein_model_loader.py:136-197 | invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:97-139 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:42— invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:42-106 | invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:36-97 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) invokeai/backend/image_util/hed.py:101— invokeai/backend/image_util/hed.py:101-146 | invokeai/backend/image_util/hed.py:176-217 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) invokeai/app/invocations/composition-nodes.py:1424— invokeai/app/invocations/composition-nodes.py:1424-1456 | invokeai/app/invocations/composition-nodes.py:1509-1546 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (70 corresponding lines) · ×1
Edited copy of a member (70 corresponding lines) invokeai/app/invocations/vae/flux2_vae_decode.py:60— invokeai/app/invocations/vae/flux2_vae_decode.py:60-129 | invokeai/app/invocations/vae/flux_vae_decode.py:66-147 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:100— invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:100-137 | invokeai/backend/patches/lora_conversions/flux_onetrainer_lora_conversion_utils.py:104-144 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) invokeai/app/invocations/metadata_linked.py:1165— invokeai/app/invocations/metadata_linked.py:1165-1196 | invokeai/app/invocations/metadata_linked.py:1226-1255 | invokeai/app/invocations/metadata_linked.py:1285-1315 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 22+ corresponding lines) · ×1
Edited copies of one member (3 members, 22+ corresponding lines) invokeai/app/invocations/flux/flux_denoise.py:581— invokeai/app/invocations/flux/flux_denoise.py:581-607 | invokeai/app/invocations/flux2/flux2_denoise.py:696-717 | invokeai/app/invocations/z_image/z_image_denoise.py:185-222 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 20+ corresponding lines) · ×1
Edited copies of one member (4 members, 20+ corresponding lines) invokeai/app/api/routers/images.py:773— invokeai/app/api/routers/images.py:773-821 | invokeai/app/api/routers/images.py:831-867 | invokeai/app/api/routers/videos.py:1126-1145 | invokeai/app/api/routers/videos.py:1154-1173 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) invokeai/backend/flux/extensions/kontext_extension.py:27— invokeai/backend/flux/extensions/kontext_extension.py:27-78 | invokeai/backend/flux2/ref_image_extension.py:179-225 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 21+ corresponding lines) · ×1
Edited copies of one member (4 members, 21+ corresponding lines) invokeai/app/api/routers/gallery.py:108— invokeai/app/api/routers/gallery.py:108-128 | invokeai/app/api/routers/gallery.py:161-183 | invokeai/app/api/routers/gallery.py:219-245 | invokeai/app/api/routers/gallery.py:278-304 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) invokeai/app/invocations/hed.py:24— invokeai/app/invocations/hed.py:24-33 | invokeai/app/invocations/mlsd.py:30-39 | invokeai/app/invocations/normal_bae.py:22-31 | invokeai/app/invocations/pidi.py:24-33 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 10+ corresponding lines) · ×1
Edited copies of one member (5 members, 10+ corresponding lines) invokeai/app/api/routers/model_manager.py:1209— invokeai/app/api/routers/model_manager.py:1209-1218 | invokeai/app/api/routers/model_manager.py:1234-1244 | invokeai/app/api/routers/model_manager.py:1260-1270 | invokeai/app/api/routers/model_manager.py:1286-1296 | invokeai/app/api/routers/model_manager.py:1314-1324 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 12+ corresponding lines) · ×1
Edited copies of one member (5 members, 12+ corresponding lines) invokeai/app/services/images/images_default.py:349— invokeai/app/services/images/images_default.py:349-360 | invokeai/app/services/images/images_default.py:402-413 | invokeai/app/services/images/images_default.py:416-427 | invokeai/app/services/images/images_default.py:430-443 | invokeai/app/services/images/images_default.py:446-458 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 21+ corresponding lines) · ×1
Edited copies of one member (6 members, 21+ corresponding lines) invokeai/backend/model_manager/configs/main.py:982— invokeai/backend/model_manager/configs/main.py:982-1008 | invokeai/backend/model_manager/configs/main.py:1131-1166 | invokeai/backend/model_manager/configs/main.py:1267-1290 | invokeai/backend/model_manager/configs/main.py:1435-1463 | invokeai/backend/model_manager/configs/main.py:1859-1879 | invokeai/backend/model_manager/configs/main.py:2555-2576 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×1
Edited copies of one member (3 members, 6+ corresponding lines) invokeai/app/services/session_queue/session_queue_default.py:694— invokeai/app/services/session_queue/session_queue_default.py:694-702 | invokeai/app/services/session_queue/session_queue_default.py:707-712 | invokeai/app/services/session_queue/session_queue_default.py:749-754 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 6+ corresponding lines) · ×1
Edited copies of one member (6 members, 6+ corresponding lines) invokeai/app/invocations/anima/anima_denoise.py:1090— invokeai/app/invocations/anima/anima_denoise.py:1090-1095 | invokeai/app/invocations/cogview4/cogview4_denoise.py:358-371 | invokeai/app/invocations/flux/flux_denoise.py:558-570 | invokeai/app/invocations/flux2/flux2_denoise.py:573-585 | invokeai/app/invocations/sd3/sd3_denoise.py:504-517 | invokeai/app/invocations/z_image/z_image_denoise.py:752-765 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) invokeai/app/services/shared/database/queries/boards.py:250— invokeai/app/services/shared/database/queries/boards.py:250-254 | invokeai/app/services/shared/database/queries/boards.py:310-317 | invokeai/app/services/shared/database/queries/workflows.py:287-291 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) invokeai/backend/model_manager/configs/main.py:1835— invokeai/backend/model_manager/configs/main.py:1835-1848 | invokeai/backend/model_manager/configs/main.py:2532-2544 | invokeai/backend/model_manager/configs/main.py:2707-2721 | invokeai/backend/model_manager/configs/main.py:2823-2835 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) invokeai/app/services/shared/database/queries/base.py:96— invokeai/app/services/shared/database/queries/base.py:96-102 | invokeai/app/services/shared/database/queries/base.py:106-112 | invokeai/app/services/shared/database/queries/base.py:116-126 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×1
Edited copies of one member (3 members, 12+ corresponding lines) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:478— invokeai/backend/model_manager/load/model_loaders/qwen_image.py:478-490 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:671-683 | invokeai/backend/model_manager/load/model_loaders/wan.py:864-875 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 25+ corresponding lines) · ×1
Edited copies of one member (3 members, 25+ corresponding lines) invokeai/backend/model_manager/configs/lora.py:1676— invokeai/backend/model_manager/configs/lora.py:1676-1715 | invokeai/backend/model_manager/configs/lora.py:1768-1792 | invokeai/backend/model_manager/configs/lora.py:1913-1937 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×1
Edited copies of one member (3 members, 10+ corresponding lines) invokeai/app/invocations/anima/anima_denoise.py:423— invokeai/app/invocations/anima/anima_denoise.py:423-434 | invokeai/app/invocations/krea2/krea2_denoise.py:302-311 | invokeai/app/invocations/z_image/z_image_denoise.py:234-248 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 6+ corresponding lines) · ×1
Edited copies of one member (5 members, 6+ corresponding lines) invokeai/app/invocations/flux2/flux2_dev_model_loader.py:176— invokeai/app/invocations/flux2/flux2_dev_model_loader.py:176-195 | invokeai/app/invocations/flux2/flux2_klein_model_loader.py:202-219 | invokeai/app/invocations/krea2/krea2_model_loader.py:166-173 | invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:143-148 | invokeai/app/invocations/z_image/z_image_model_loader.py:190-202 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 6+ corresponding lines) · ×1
Edited copies of one member (4 members, 6+ corresponding lines) invokeai/app/services/shared/database/queries/images.py:124— invokeai/app/services/shared/database/queries/images.py:124-129 | invokeai/app/services/shared/database/queries/style_presets.py:44-49 | invokeai/app/services/shared/database/queries/videos.py:117-122 | invokeai/app/services/shared/database/queries/wildcards.py:37-42 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (67–70 lines × 2) invokeai/backend/flux/denoise.py:212— invokeai/backend/flux/denoise.py:212-281 | invokeai/backend/flux2/denoise.py:184-250 — 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 (39–51 lines × 2) invokeai/app/services/shared/invocation_context.py:323— invokeai/app/services/shared/invocation_context.py:323-373 | invokeai/app/services/shared/invocation_context.py:499-537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (46–47 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:153— invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:153-199 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:152-197 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (43 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:239— invokeai/app/invocations/cogview4/cogview4_denoise.py:239-281 | invokeai/app/invocations/sd3/sd3_denoise.py:309-351 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.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 7 separate duplicated blocks between them, totalling at least 126 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/cogview4/cogview4_denoise.py:238` calls `_convert_timesteps_to_sigmas`, `tensor` and `invokeai/app/invocations/sd3/sd3_denoise.py:308` 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 (42–46 lines × 7) invokeai/app/invocations/pid/flux2_pid_decode.py:126— invokeai/app/invocations/pid/flux2_pid_decode.py:126-169 | invokeai/app/invocations/pid/flux_pid_decode.py:96-138 | invokeai/app/invocations/pid/pid_upscale.py:136-177 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:126-167 | invokeai/app/invocations/pid/sd3_pid_decode.py:91-132 | invokeai/app/invocations/pid/sdxl_pid_decode.py:109-150 | invokeai/app/invocations/pid/z_image_pid_decode.py:106-151 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/pid/flux2_pid_decode.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/pid/sd3_pid_decode.py:89` calls `load` and `invokeai/app/invocations/pid/flux_pid_decode.py:93` 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 (31–42 lines × 2) invokeai/backend/anima/regional_prompting.py:76— invokeai/backend/anima/regional_prompting.py:76-106 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:75-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 (42 lines × 2) invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:42— invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:42-83 | invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:36-77 — 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 (38 lines × 2) invokeai/backend/tiles/tiles.py:233— invokeai/backend/tiles/tiles.py:233-270 | invokeai/backend/tiles/tiles.py:344-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/tiles/tiles.py:233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/tiles/tiles.py:273` calls `linspace`, `expand_dims` and `invokeai/backend/tiles/tiles.py:383` 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–35 lines × 2) invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:320— invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:320-332 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:223-257 — 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 `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:320` it begins part-way through the construct above it, so those 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 (31–33 lines × 2) invokeai/backend/minimax_h3/sampling.py:234— invokeai/backend/minimax_h3/sampling.py:234-264 | invokeai/backend/minimax_h3/sampling.py:394-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/sampling.py:394` it begins part-way through the construct above it, so those 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 (27–33 lines × 2) invokeai/backend/model_manager/load/model_loaders/krea2.py:689— invokeai/backend/model_manager/load/model_loaders/krea2.py:689-721 | invokeai/backend/model_manager/load/model_loaders/z_image.py:663-689 — 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 `invokeai/backend/model_manager/load/model_loaders/krea2.py:689` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–32 lines × 2) invokeai/backend/model_manager/load/model_loaders/anima.py:193— invokeai/backend/model_manager/load/model_loaders/anima.py:193-224 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:438-463 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/anima.py:193` it begins part-way through the construct above it, so those 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, `invokeai/backend/model_manager/load/model_loaders/anima.py:190` calls `info` and `invokeai/backend/model_manager/load/model_loaders/ideogram4.py:437` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (30–32 lines × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:188— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:188-217 | invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:230-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–31 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:361— invokeai/backend/model_manager/load/model_loaders/z_image.py:361-389 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1708-1738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:1739` calls `info` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:390` 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 (27–30 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:708— invokeai/app/invocations/anima/anima_denoise.py:708-737 | invokeai/app/invocations/z_image/z_image_denoise.py:356-382 — 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 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, `invokeai/app/invocations/anima/anima_denoise.py:704` calls `unsqueeze` and `invokeai/app/invocations/z_image/z_image_denoise.py:352` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–30 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:611— invokeai/app/invocations/wan/wan_denoise.py:611-640 | invokeai/app/invocations/wan/wan_video_denoise.py:291-309 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/wan/wan_denoise.py:611` it does not close everything it opens, so those 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 (24–30 lines × 2) invokeai/backend/minimax_h3/packing.py:188— invokeai/backend/minimax_h3/packing.py:188-211 | invokeai/backend/minimax_h3/presets.py:43-72 — 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 (28–30 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:861— invokeai/backend/model_manager/load/model_loaders/flux.py:861-888 | invokeai/backend/model_manager/load/model_loaders/flux.py:1252-1281 — both copies are in the same file, so extract the 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 (26–29 lines × 2) invokeai/app/invocations/vae/flux_vae_decode.py:121— invokeai/app/invocations/vae/flux_vae_decode.py:121-146 | invokeai/app/invocations/vae/z_image_latents_to_image.py:130-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (24–29 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:614— invokeai/backend/minimax_h3/transformer_minimax_h3.py:614-642 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:216-239 — 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 (22–28 lines × 3) invokeai/backend/model_manager/configs/main.py:987— invokeai/backend/model_manager/configs/main.py:987-1008 | invokeai/backend/model_manager/configs/main.py:1059-1086 | invokeai/backend/model_manager/configs/main.py:1440-1463 — 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 `invokeai/backend/model_manager/configs/main.py:1059` it begins part-way through the construct above it, so those 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–27 lines × 2) invokeai/app/invocations/vae/flux2_vae_decode.py:102— invokeai/app/invocations/vae/flux2_vae_decode.py:102-120 | invokeai/app/invocations/vae/z_image_latents_to_image.py:127-153 — 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, `invokeai/app/invocations/vae/z_image_latents_to_image.py:126` calls `inference_mode` and `invokeai/app/invocations/vae/flux2_vae_decode.py:99` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22–27 lines × 2) invokeai/backend/flux/extensions/kontext_extension.py:192— invokeai/backend/flux/extensions/kontext_extension.py:192-218 | invokeai/backend/flux2/ref_image_extension.py:313-334 — 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–26 lines × 3) invokeai/app/invocations/vae/flux2_vae_decode.py:104— invokeai/app/invocations/vae/flux2_vae_decode.py:104-121 | invokeai/app/invocations/vae/flux_vae_decode.py:120-142 | invokeai/app/invocations/vae/z_image_latents_to_image.py:129-154 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/z_image_latents_to_image.py:126` calls `inference_mode` and `invokeai/app/invocations/vae/flux2_vae_decode.py:99` 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–26 lines × 2) invokeai/backend/flux/extensions/regional_prompting_extension.py:178— invokeai/backend/flux/extensions/regional_prompting_extension.py:178-203 | invokeai/backend/flux2/extensions/regional_prompting_extension.py:104-118 — 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 `invokeai/backend/flux/extensions/regional_prompting_extension.py:178` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24–25 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:436— invokeai/backend/model_manager/load/model_loaders/z_image.py:436-459 | invokeai/backend/model_manager/load/model_loaders/z_image.py:781-805 | invokeai/backend/model_manager/load/model_loaders/z_image.py:904-927 — 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 `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 `config` to `AnyModelConfig` in one and `Main_SDNQ_ZImage_Config` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:899` calls `detect`, `strip` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:431` 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 (3–25 lines × 3) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:64— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:64-88 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:44-46 | invokeai/backend/flux/model.py:62-86 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.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.
Duplicated block (13–25 lines × 2) invokeai/backend/flux/extensions/regional_prompting_extension.py:271— invokeai/backend/flux/extensions/regional_prompting_extension.py:271-295 | invokeai/backend/flux2/extensions/regional_prompting_extension.py:162-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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (24–25 lines × 2) invokeai/backend/minimax_h3/sampling.py:208— invokeai/backend/minimax_h3/sampling.py:208-232 | invokeai/backend/minimax_h3/sampling.py:365-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/sampling.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/minimax_h3/sampling.py:364` calls `cat`, `MiniMaxH3Scheduler` and `invokeai/backend/minimax_h3/sampling.py:208` 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 (21–24 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:441— invokeai/app/invocations/wan/wan_denoise.py:441-461 | invokeai/app/invocations/wan/wan_video_denoise.py:198-221 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (23–24 lines × 2) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:349— invokeai/backend/model_manager/load/model_loaders/qwen_image.py:349-372 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:542-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. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/qwen_image.py:349` it does not close everything it opens, so those exact lines 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–23 lines × 3) invokeai/backend/model_manager/load/model_loaders/krea2.py:686— invokeai/backend/model_manager/load/model_loaders/krea2.py:686-708 | invokeai/backend/model_manager/load/model_loaders/krea2.py:1219-1239 | invokeai/backend/model_manager/load/model_loaders/z_image.py:660-679 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:640` calls `extract_comfy_quant_hints`, `extract_fp8_scaled_layers`, `_keep_fp8_weights` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:677` 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–23 lines × 2) invokeai/app/api/routers/images.py:773— invokeai/app/api/routers/images.py:773-795 | invokeai/app/api/routers/images.py:831-847 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/images.py:773` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–23 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:331— invokeai/backend/model_manager/load/model_loaders/z_image.py:331-353 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1676-1697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:331` it does not close everything it opens, so those exact lines 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–22 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:664— invokeai/app/invocations/wan/wan_denoise.py:664-685 | invokeai/app/invocations/wan/wan_video_denoise.py:330-345 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21–22 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1779— invokeai/backend/model_manager/load/model_loaders/flux.py:1779-1799 | invokeai/backend/model_manager/load/model_loaders/flux.py:1897-1918 — both copies are in the same file, so extract the 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, `invokeai/backend/model_manager/load/model_loaders/flux.py:1776` calls `get` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1892` 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–22 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1356— invokeai/backend/model_manager/load/model_loaders/z_image.py:1356-1377 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1562-1580 — both copies are in the same file, so extract the block into 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–21 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:335— invokeai/backend/model_manager/load/model_loaders/z_image.py:335-346 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1487-1507 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1680-1691 — 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 (16–21 lines × 2) invokeai/app/services/external_generation/providers/alibabacloud.py:101— invokeai/app/services/external_generation/providers/alibabacloud.py:101-121 | invokeai/app/services/external_generation/providers/alibabacloud.py:147-162 — both copies are in the same file, so extract the block into 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–21 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1545— invokeai/backend/model_manager/load/model_loaders/z_image.py:1545-1565 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1732-1748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (3–21 lines × 3) invokeai/backend/wan/extensions/wan_ref_image_extension.py:49— invokeai/backend/wan/extensions/wan_ref_image_extension.py:49-69 | invokeai/backend/wan/extensions/wan_ref_image_extension.py:86-101 | invokeai/backend/wan/extensions/wan_ref_image_extension.py:190-192 — 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 `invokeai/backend/wan/extensions/wan_ref_image_extension.py:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–20 lines × 3) invokeai/app/invocations/anima/anima_denoise.py:716— invokeai/app/invocations/anima/anima_denoise.py:716-735 | invokeai/app/invocations/flux2/flux2_denoise.py:330-343 | invokeai/app/invocations/z_image/z_image_denoise.py:364-378 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (19–20 lines × 3) invokeai/app/invocations/z_image/z_image_denoise.py:589— invokeai/app/invocations/z_image/z_image_denoise.py:589-608 | invokeai/backend/flux/denoise.py:226-244 | invokeai/backend/flux2/denoise.py:199-217 — 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 `invokeai/app/invocations/z_image/z_image_denoise.py:589` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–20 lines × 2) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:137— invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:137-156 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:109-127 — before extracting anything, compare `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py` and `invokeai/app/invocations/text_encoder/z_image_text_encoder.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.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.
Duplicated block (19 lines × 4) invokeai/app/invocations/metadata_linked.py:640— invokeai/app/invocations/metadata_linked.py:640-658 | invokeai/app/invocations/metadata_linked.py:704-722 | invokeai/app/invocations/metadata_linked.py:758-776 | invokeai/app/invocations/metadata_linked.py:828-846 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/metadata_linked.py:700` calls `FluxDenoiseLatentsMetaInvocation` and `invokeai/app/invocations/metadata_linked.py:825` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18–19 lines × 2) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:118— invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:118-135 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:89-107 — before extracting anything, compare `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py` and `invokeai/app/invocations/text_encoder/z_image_text_encoder.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:117` calls `load`, `enter_context`, `model_on_device` and `invokeai/app/invocations/text_encoder/z_image_text_encoder.py:89` 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–18 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:391— invokeai/backend/model_manager/load/model_loaders/z_image.py:391-404 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1351-1368 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1558-1571 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1741-1754 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:1555` calls `info` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:389` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:439— invokeai/backend/model_manager/load/model_loaders/z_image.py:439-456 | invokeai/backend/model_manager/load/model_loaders/z_image.py:536-553 | invokeai/backend/model_manager/load/model_loaders/z_image.py:785-802 | invokeai/backend/model_manager/load/model_loaders/z_image.py:907-924 — 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 (18 lines × 3) invokeai/app/invocations/anima/anima_lora_loader.py:72— invokeai/app/invocations/anima/anima_lora_loader.py:72-89 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:111-128 | invokeai/app/invocations/z_image/z_image_lora_loader.py:84-101 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 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 (17–18 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:1459— invokeai/backend/model_manager/load/model_loaders/flux.py:1459-1476 | invokeai/backend/model_manager/load/model_loaders/flux.py:1784-1801 | invokeai/backend/model_manager/load/model_loaders/flux.py:1904-1920 — 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, `invokeai/backend/model_manager/load/model_loaders/flux.py:1456` calls `reject_unmarked_int8_weights` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1782` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–18 lines × 2) invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:156— invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:156-173 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:175-189 — 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 (11–17 lines × 9) invokeai/app/invocations/anima/anima_denoise.py:264— invokeai/app/invocations/anima/anima_denoise.py:264-277 | invokeai/app/invocations/cogview4/cogview4_denoise.py:95-110 | invokeai/app/invocations/flux/flux_denoise.py:713-729 | invokeai/app/invocations/flux2/flux2_denoise.py:589-601 | invokeai/app/invocations/krea2/krea2_denoise.py:229-239 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:160-171 | invokeai/app/invocations/sd3/sd3_denoise.py:175-190 | invokeai/app/invocations/wan/wan_denoise.py:788-798 | invokeai/app/invocations/z_image/z_image_denoise.py:158-171 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times. 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) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744-758 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:583-599 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744` it does not close everything it opens, so those 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–16 lines × 3) invokeai/backend/flux2/denoise.py:304— invokeai/backend/flux2/denoise.py:304-319 | invokeai/backend/flux3/denoise.py:80-93 | invokeai/backend/moss_image/denoise.py:68-82 — 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 `invokeai/backend/flux2/denoise.py:304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–16 lines × 2) invokeai/app/services/external_generation/providers/openai.py:48— invokeai/app/services/external_generation/providers/openai.py:48-63 | invokeai/app/services/external_generation/providers/openai.py:94-108 — both copies are in the same file, so extract the 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, `invokeai/app/services/external_generation/providers/openai.py:109` calls `get` and `invokeai/app/services/external_generation/providers/openai.py:64` 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–17 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:580— invokeai/backend/minimax_h3/transformer_minimax_h3.py:580-596 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:190-203 — 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–16 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1455— invokeai/backend/model_manager/load/model_loaders/z_image.py:1455-1470 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1662-1674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:1455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15 lines × 5) invokeai/app/invocations/pid/flux2_pid_decode.py:185— invokeai/app/invocations/pid/flux2_pid_decode.py:185-199 | invokeai/app/invocations/pid/flux_pid_decode.py:154-168 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:183-197 | invokeai/app/invocations/pid/sd3_pid_decode.py:148-162 | invokeai/app/invocations/pid/sdxl_pid_decode.py:166-180 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:314— invokeai/backend/model_manager/load/model_loaders/z_image.py:314-328 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1178-1192 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1450-1464 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1657-1671 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:1675` calls `ValueError` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:331` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–15 lines × 3) invokeai/app/invocations/text_encoder/cogview4_text_encoder.py:75— invokeai/app/invocations/text_encoder/cogview4_text_encoder.py:75-88 | invokeai/app/invocations/text_encoder/sd3_text_encoder.py:126-139 | invokeai/app/invocations/text_encoder/sd3_text_encoder.py:193-207 — 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 `invokeai/app/invocations/text_encoder/cogview4_text_encoder.py:75` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–15 lines × 2) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:236— invokeai/backend/model_manager/load/model_loaders/qwen_image.py:236-243 | invokeai/backend/model_manager/load/model_loaders/z_image.py:764-778 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–14 lines × 5) invokeai/app/invocations/ernie_image/ernie_image_denoise.py:232— invokeai/app/invocations/ernie_image/ernie_image_denoise.py:232-241 | invokeai/app/invocations/ideogram4/ideogram4_denoise.py:429-442 | invokeai/app/invocations/ltx2/ltx2_denoise.py:222-231 | invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:651-660 | invokeai/app/invocations/sd3/sd3_denoise.py:448-457 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. 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 × 3) invokeai/app/api/routers/gallery.py:115— invokeai/app/api/routers/gallery.py:115-128 | invokeai/app/api/routers/gallery.py:167-180 | invokeai/app/api/routers/gallery.py:289-302 — 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 `invokeai/app/api/routers/gallery.py:115` it begins part-way through the construct above it, so those 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, `invokeai/app/api/routers/gallery.py:182` calls `HTTPException` and `invokeai/app/api/routers/gallery.py:131` 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–14 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:1416— invokeai/backend/model_manager/load/model_loaders/flux.py:1416-1429 | invokeai/backend/model_manager/load/model_loaders/flux.py:1761-1769 | invokeai/backend/model_manager/load/model_loaders/flux.py:1859-1872 — 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 `invokeai/backend/model_manager/load/model_loaders/flux.py:1416` it begins part-way through the construct above it, so those 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, `invokeai/backend/model_manager/load/model_loaders/flux.py:1873` calls `hasattr` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1430` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–14 lines × 2) invokeai/app/invocations/vae/wan_latents_to_image.py:53— invokeai/app/invocations/vae/wan_latents_to_image.py:53-66 | invokeai/app/invocations/wan/wan_denoise.py:519-529 — 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 `invokeai/app/invocations/vae/wan_latents_to_image.py:53` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–14 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:442— invokeai/backend/pid/_src/networks/pid_net.py:442-455 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1510-1517 — 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, `invokeai/backend/pid/_src/networks/pid_net.py:437` calls `_unpatchify_features` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:1507` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 7) invokeai/app/invocations/pid/flux2_pid_decode.py:171— invokeai/app/invocations/pid/flux2_pid_decode.py:171-183 | invokeai/app/invocations/pid/flux_pid_decode.py:140-152 | invokeai/app/invocations/pid/pid_upscale.py:179-191 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:169-181 | invokeai/app/invocations/pid/sd3_pid_decode.py:134-146 | invokeai/app/invocations/pid/sdxl_pid_decode.py:152-164 | invokeai/app/invocations/pid/z_image_pid_decode.py:153-165 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `invokeai/app/invocations/pid/flux2_pid_decode.py:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 4) invokeai/app/services/events/events_common.py:143— invokeai/app/services/events/events_common.py:143-155 | invokeai/app/services/events/events_common.py:212-224 | invokeai/app/services/events/events_common.py:245-257 | invokeai/app/services/events/events_common.py:281-293 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/events/events_common.py:143` it does not close everything it opens, so those 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–13 lines × 3) invokeai/app/invocations/composition-nodes.py:93— invokeai/app/invocations/composition-nodes.py:93-105 | invokeai/app/invocations/composition-nodes.py:1429-1440 | invokeai/app/invocations/composition-nodes.py:1513-1524 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–13 lines × 2) invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:244— invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:244-256 | invokeai/app/invocations/ltx2/ltx2_video_conditioning.py:117-126 — 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 `invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:244` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 3) invokeai/app/invocations/anima/anima_lora_loader.py:155— invokeai/app/invocations/anima/anima_lora_loader.py:155-166 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:202-212 | invokeai/app/invocations/z_image/z_image_lora_loader.py:171-181 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/anima/anima_lora_loader.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. 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 × 3) invokeai/backend/util/attention.py:391— invokeai/backend/util/attention.py:391-402 | invokeai/backend/util/attention.py:697-708 | invokeai/backend/util/sage_attention.py:344-355 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9–12 lines × 2) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:767— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:767-775 | invokeai/app/invocations/z_image/z_image_denoise.py:719-730 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8–12 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1112— invokeai/backend/hidiffusion/hidiffusion.py:1112-1123 | invokeai/backend/util/hotfixes.py:635-642 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–13 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:393— invokeai/backend/pid/_src/networks/pid_net.py:393-405 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1479-1490 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9–11 lines × 4) invokeai/backend/model_manager/configs/main.py:1295— invokeai/backend/model_manager/configs/main.py:1295-1305 | invokeai/backend/model_manager/configs/main.py:4183-4191 | invokeai/backend/model_manager/configs/main.py:4337-4345 | invokeai/backend/model_manager/configs/main.py:4503-4512 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The 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) invokeai/backend/model_manager/load/model_loaders/cogview4.py:28— invokeai/backend/model_manager/load/model_loaders/cogview4.py:28-38 | invokeai/backend/model_manager/load/model_loaders/flux.py:1133-1143 | invokeai/backend/model_manager/load/model_loaders/flux.py:1175-1185 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:171-181 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/flux.py:1194` calls `SilenceWarnings` and `invokeai/backend/model_manager/load/model_loaders/cogview4.py:43` 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–10 lines × 5) invokeai/backend/model_manager/load/model_loaders/flux.py:1019— invokeai/backend/model_manager/load/model_loaders/flux.py:1019-1025 | invokeai/backend/model_manager/load/model_loaders/flux.py:1555-1561 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:488-494 | invokeai/backend/model_manager/load/model_loaders/krea2.py:741-750 | invokeai/backend/model_manager/load/model_loaders/z_image.py:708-714 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:700` calls `load_state_dict_ignoring_extras`, `clear` and `invokeai/backend/model_manager/load/model_loaders/ideogram4.py:486` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) invokeai/app/api/routers/style_presets.py:132— invokeai/app/api/routers/style_presets.py:132-141 | invokeai/app/api/routers/style_presets.py:222-231 | invokeai/app/api/routers/workflows.py:366-375 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8–10 lines × 2) invokeai/app/services/shared/graph.py:1457— invokeai/app/services/shared/graph.py:1457-1464 | invokeai/app/services/shared/graph.py:1472-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 `invokeai/app/services/shared/graph.py:1472` it begins part-way through the construct above it, so those 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–9 lines × 3) invokeai/app/invocations/cogview4/cogview4_denoise.py:165— invokeai/app/invocations/cogview4/cogview4_denoise.py:165-173 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:214-221 | invokeai/app/invocations/sd3/sd3_denoise.py:264-272 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.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 7 separate duplicated blocks between them, totalling at least 126 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 (2–17 lines × 6) invokeai/app/invocations/vae/anima_image_to_latents.py:104— invokeai/app/invocations/vae/anima_image_to_latents.py:104-120 | invokeai/app/invocations/vae/anima_latents_to_image.py:141-142 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:106-107 | invokeai/app/invocations/vae/wan_image_to_latents.py:73-89 | invokeai/app/invocations/vae/wan_latents_to_image.py:102-106 | invokeai/app/invocations/vae/wan_latents_to_video.py:205-206 — 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 `invokeai/app/invocations/vae/wan_latents_to_image.py:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/anima_latents_to_image.py:137` calls `unsqueeze`, `tensor`, `view` and `invokeai/app/invocations/vae/wan_image_to_latents.py:73` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–9 lines × 2) invokeai/backend/anima/anima_transformer.py:248— invokeai/backend/anima/anima_transformer.py:248-256 | invokeai/backend/anima/anima_transformer.py:856-862 — both copies are in the same file, so extract the block into 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–8 lines × 7) invokeai/app/invocations/vae/anima_latents_to_image.py:191— invokeai/app/invocations/vae/anima_latents_to_image.py:191-197 | invokeai/app/invocations/vae/cogview4_latents_to_image.py:75-82 | invokeai/app/invocations/vae/ideogram4_latents_to_image.py:91-96 | invokeai/app/invocations/vae/qwen_image_latents_to_image.py:142-149 | invokeai/app/invocations/vae/sd3_latents_to_image.py:77-84 | invokeai/app/invocations/vae/wan_latents_to_image.py:115-121 | invokeai/app/invocations/vae/z_image_latents_to_image.py:157-164 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 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 (3–8 lines × 5) invokeai/app/invocations/anima/anima_lora_loader.py:60— invokeai/app/invocations/anima/anima_lora_loader.py:60-66 | invokeai/app/invocations/flux/flux_lora_loader.py:65-72 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:103-105 | invokeai/app/invocations/qwen_image/qwen_image_lora_loader.py:76-82 | invokeai/app/invocations/z_image/z_image_lora_loader.py:58-65 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 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. 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, `invokeai/app/invocations/anima/anima_lora_loader.py:66` calls `ValueError` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:105` 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–8 lines × 4) invokeai/app/services/shared/graph_materializer.py:655— invokeai/app/services/shared/graph_materializer.py:655-662 | invokeai/app/services/shared/graph_materializer.py:733-738 | invokeai/app/services/shared/graph_materializer.py:761-768 | invokeai/app/services/shared/graph_materializer.py:1189-1194 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_materializer.py:1188` calls `_discard_source_executed`, `_create_execution_node_copy` and `invokeai/app/services/shared/graph_materializer.py:655` 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 (4–8 lines × 4) invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:91— invokeai/app/invocations/ernie_image/ernie_image_lora_loader.py:91-94 | invokeai/app/invocations/ideogram4/ideogram4_lora_loader.py:91-94 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:100-107 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:93-100 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.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 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/ltx2/ltx2_lora_loader.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 (6 lines × 5) invokeai/app/invocations/text_encoder/anima_text_encoder.py:288— invokeai/app/invocations/text_encoder/anima_text_encoder.py:288-293 | invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:258-263 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:215-220 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:215-220 | invokeai/app/invocations/z_image/z_image_denoise.py:776-781 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
Duplicated block (6 lines × 7) invokeai/app/util/user_management.py:124— invokeai/app/util/user_management.py:124-129 | invokeai/app/util/user_management.py:164-169 | invokeai/app/util/user_management.py:241-246 | invokeai/app/util/user_management.py:289-294 | invokeai/app/util/user_management.py:474-479 | invokeai/app/util/user_management.py:524-529 | invokeai/app/util/user_management.py:581-586 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–5 lines × 3) invokeai/backend/flux/custom_block_processor.py:50— invokeai/backend/flux/custom_block_processor.py:50-53 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:64-70 | invokeai/backend/flux/modules/layers.py:178-182 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (138 lines × 2) invokeai/app/services/image_files/image_files_base.py:14— invokeai/app/services/image_files/image_files_base.py:14-151 | invokeai/app/services/image_records/image_records_base.py:25-190 — 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 (44 lines × 2) invokeai/app/services/item_storage/item_storage_base.py:16— invokeai/app/services/item_storage/item_storage_base.py:16-59 | invokeai/app/services/videos/videos_base.py:26-202 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (126 lines × 3) invokeai/app/services/image_files/image_files_base.py:14— invokeai/app/services/image_files/image_files_base.py:14-151 | invokeai/app/services/image_records/image_records_base.py:25-190 | invokeai/app/services/video_records/video_records_base.py:21-146 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (11 lines × 3) invokeai/app/services/external_generation/external_generation_default.py:355— invokeai/app/services/external_generation/external_generation_default.py:355-365 | invokeai/app/services/external_generation/providers/atlascloud.py:358-368 | invokeai/app/services/external_generation/providers/gemini.py:223-233 — 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. 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 × 10) invokeai/backend/model_manager/configs/controlnet.py:104— invokeai/backend/model_manager/configs/controlnet.py:104-108 | invokeai/backend/model_manager/configs/controlnet.py:169-173 | invokeai/backend/model_manager/configs/ip_adapter.py:58-62 | invokeai/backend/model_manager/configs/ip_adapter.py:138-142 | invokeai/backend/model_manager/configs/lora.py:776-780 | invokeai/backend/model_manager/configs/lora.py:841-845 | invokeai/backend/model_manager/configs/lora.py:2126-2130 | invokeai/backend/model_manager/configs/main.py:360-364 | invokeai/backend/model_manager/configs/main.py:1170-1174 | invokeai/backend/model_manager/configs/t2i_adapter.py:53-57 — there are 10 copies across 5 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 10 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:38— invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:38-43 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_flux_rms_norm.py:31-36 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:62-67 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:89-94 — 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 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 × 6) invokeai/backend/model_manager/load/model_loaders/anima.py:84— invokeai/backend/model_manager/load/model_loaders/anima.py:84-93 | invokeai/backend/model_manager/load/model_loaders/flux.py:1047-1056 | invokeai/backend/model_manager/load/model_loaders/flux.py:1093-1102 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:221-230 | invokeai/backend/model_manager/load/model_loaders/z_image.py:471-480 | invokeai/backend/model_manager/load/model_loaders/z_image.py:746-755 — 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. 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 × 12) invokeai/app/services/shared/sqlite_migrator/migrations/migration_10.py:22— invokeai/app/services/shared/sqlite_migrator/migrations/migration_10.py:22-37 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_13.py:19-33 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_14.py:49-63 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_15.py:21-36 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_16.py:19-33 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_17.py:22-37 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_18.py:31-49 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_4.py:72-85 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_5.py:21-36 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_6.py:48-64 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_7.py:74-90 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_9.py:17-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 12 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 (9 lines × 3) invokeai/app/invocations/flux3/flux3_lora_loader.py:101— invokeai/app/invocations/flux3/flux3_lora_loader.py:101-109 | invokeai/app/invocations/moss_image/moss_image_lora_loader.py:102-110 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:102-110 — 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. 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.
Near-duplicate member pair (24 shared lines) scripts/calibrate_flux2_denoise_working_memory.py:425— scripts/calibrate_flux2_denoise_working_memory.py:425-461 | scripts/calibrate_flux3_denoise_working_memory.py:600-647 — These two members are variants of one another: 24 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.
Duplicated block (21 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:615— scripts/calibrate_flux2_denoise_working_memory.py:615-635 | scripts/calibrate_flux3_denoise_working_memory.py:869-889 | scripts/calibrate_z_image_working_memory.py:546-566 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:615` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/calibrate_flux2_denoise_working_memory.py:637` calls `_summarize_large` and `scripts/calibrate_z_image_working_memory.py:567` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18–19 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:615— scripts/calibrate_flux2_denoise_working_memory.py:615-633 | scripts/calibrate_flux3_denoise_working_memory.py:869-887 | scripts/calibrate_vae_tiling_working_memory.py:696-713 | scripts/calibrate_z_image_working_memory.py:546-564 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:615` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7–10 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:588— scripts/calibrate_flux2_denoise_working_memory.py:588-594 | scripts/calibrate_flux3_denoise_working_memory.py:827-833 | scripts/calibrate_krea2_working_memory.py:714-723 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_krea2_working_memory.py:714` it begins part-way through the construct above it, so those 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, `scripts/calibrate_flux3_denoise_working_memory.py:826` calls `add_argument` and `scripts/calibrate_flux2_denoise_working_memory.py:587` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5–6 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:576— scripts/calibrate_flux2_denoise_working_memory.py:576-581 | scripts/calibrate_krea2_working_memory.py:698-703 | scripts/calibrate_z_image_working_memory.py:511-515 — 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 `scripts/calibrate_flux2_denoise_working_memory.py:576` it does not close everything it opens, so those 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.
Low cohesion: PixelDiTModel (LCOM4 4) invokeai/backend/pid/_src/models/pixeldit_model.py:119— PixelDiTModel'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.
P12 · CI test-gate honesty· Runner config excludes tests no gate runs · ×1
Runner config excludes tests no gate runs invokeai/frontend/webv2/vitest.config.mts:11— `src/**/*.browser.test.{ts,tsx}` removes 4699 test(s) in 485 file(s) (e.g. `invokeai/frontend/webv2/src/app/AccountLifecycleCoordinator.browser.test.tsx`, `invokeai/frontend/webv2/src/app/AccountModelsUiProvider.browser.test.tsx`) from what vitest collects, and no other runner or CI command runs them — they are dead tests. Run them (another runner, project or job), or delete them.
Sync-over-async blocking REDACTED:173— `unzipSync` in `readArchiveEntries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Duplication concentrated across 24 sibling directories (220 clone groups) invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx:12— 220 duplicated blocks under invokeai/frontend/webv1/src/features/ have copies in at least two of the sibling directories auth, changeBoardModal, controlLayers, cropper, customNodes, deleteImageModal (+18 more sibling(s) not listed) — 107 of them are reported below, and 113 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 220 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 220 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 220 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 (187 clone groups) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:224— 187 duplicated blocks under invokeai/frontend/webv2/src/ have copies in at least two of the sibling directories app, features, platform, workbench — 58 of them are reported below, and 129 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 187 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 187 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 187 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 11 sibling directories (101 clone groups) invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts:107— 101 duplicated blocks under invokeai/frontend/webv2/src/features/ have copies in at least two of the sibling directories fonts, gallery, generation, identity, intermediates, models (+5 more sibling(s) not listed) — 51 of them are reported below, and 50 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 101 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 101 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 101 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 13 sibling directories (77 clone groups) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:165— 77 duplicated blocks under invokeai/frontend/webv2/src/workbench/ have copies in at least two of the sibling directories canvas-engine, canvas-operations, diagnostics, hotkeys, image-actions, launchpad (+7 more sibling(s) not listed) — 34 of them are reported below, and 43 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 77 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 77 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 77 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 (59 clone groups) invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170— 59 duplicated blocks under invokeai/frontend/ have copies in at least two of the sibling directories webv1, webv2 — 31 of them are reported below, and 28 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 59 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 59 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 59 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 14 sibling directories (59 clone groups) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:11— 59 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/components/ have copies in at least two of the sibling directories CanvasContextMenu, CanvasEntityList, ControlLayer, Filters, InpaintMask, RasterLayer (+8 more sibling(s) not listed) — 40 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 59 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 59 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 59 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 13 sibling directories (22 clone groups) invokeai/frontend/webv1/src/features/parameters/components/Bbox/BboxPreview.tsx:1— 22 duplicated blocks under invokeai/frontend/webv1/src/features/parameters/components/ have copies in at least two of the sibling directories Advanced, Bbox, Canvas, Core, Dimensions, Krea2Enhancers (+7 more sibling(s) not listed) — 18 of them are reported below, and 4 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 22 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 22 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 22 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 12 sibling directories (18 clone groups) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx:72— 18 duplicated blocks under invokeai/frontend/webv2/src/workbench/widgets/ have copies in at least two of the sibling directories autosave-status, canvas, diagnostics, gallery, image-map, layers (+6 more sibling(s) not listed) — 8 of them are reported below, and 10 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 18 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 18 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 18 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 (14 clone groups) invokeai/frontend/webv1/src/common/hooks/useCopyImageToClipboard.ts:14— 14 duplicated blocks under invokeai/frontend/webv1/src/ have copies in at least two of the sibling directories app, common, features, services — 9 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 14 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 14 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 14 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 (11 clone groups) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1186— 11 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/konva/ have copies in at least two of the sibling directories CanvasEntity, CanvasObject, CanvasTool — 6 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 11 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 11 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 11 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 6 sibling directories (10 clone groups) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/ControlAdapterModelDefaultSettings.tsx:31— 10 duplicated blocks under invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ have copies in at least two of the sibling directories ControlAdapterModelDefaultSettings, CpuOnlyModelSettings, EncoderModelSettings, LoRAModelDefaultSettings, MainModelDefaultSettings, VAEModelSettings — 8 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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 7 sibling directories (10 clone groups) invokeai/frontend/webv2/src/features/models/ui/detail/UpdatePathDialog.tsx:60— 10 duplicated blocks under invokeai/frontend/webv2/src/features/models/ui/ have copies in at least two of the sibling directories add-models, credentials, detail, install-queue, launchpad, library (+1 more sibling(s) not listed) — 5 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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 5 sibling directories (10 clone groups) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewMoreMenu.tsx:404— 10 duplicated blocks under invokeai/frontend/webv2/src/features/workflow/ui/ have copies in at least two of the sibling directories editor, fields, graph-preview, library, linear — 7 of them are reported below, and 3 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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 (10 clone groups) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:456— 10 duplicated blocks under invokeai/frontend/webv2/src/workbench/canvas-engine/ have copies in at least two of the sibling directories controllers, document, document-model, editing, export, math (+3 more sibling(s) not listed) — 7 of them are reported below, and 3 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 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 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 10 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 (6 clone groups) invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts:667— 6 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/ have copies in at least two of the sibling directories components, hooks, store, util — 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.
Duplication concentrated across 5 sibling directories (5 clone groups) invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsSettingsPopover.tsx:23— 5 duplicated blocks under invokeai/frontend/webv1/src/features/gallery/components/ have copies in at least two of the sibling directories Boards, ContextMenu, GallerySettingsPopover, ImageGrid, ImageViewer — 4 of them are reported below, and 1 is 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 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 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 5 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 (5 clone groups) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/FloatField/useFloatField.ts:45— 5 of the duplicated blocks reported below have copies in at least two of the sibling directories FloatField, IntegerField under invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/. That concentration is one structural fact, not 5 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 5 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 (221 matched lines × 2 locations) · ×1
Duplicated block with local edits (221 matched lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170— invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170 · invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts:174 — the two spans are one implementation copied and then locally edited — 1760 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 (198 matched lines × 2 locations) · ×1
Duplicated block with local edits (198 matched lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22— invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:24 — the two spans are one implementation copied and then locally edited — 1330 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 (174 matched lines × 2 locations) · ×1
Duplicated block with local edits (174 matched lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117— invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:128 — the two spans are one implementation copied and then locally edited — 1036 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 (172 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1— invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 172 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 (171 matched lines × 2 locations) · ×1
Duplicated block with local edits (171 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:152— invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:152 · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:138 — the two spans are one implementation copied and then locally edited — 878 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 (169 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1— invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 169 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 (167 matched lines × 2 locations) · ×1
Duplicated block with local edits (167 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:221— invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:221 · invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:570 — the two spans are one implementation copied and then locally edited — 996 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (144 lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250— invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:251 — 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.
Wholesale file copy (143 identical lines × 2 files) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1— invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IntegerFieldCollectionInputComponent.tsx:1 — these 2 files are line-for-line copies of one another — 143 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 (138 matched lines × 2 locations) · ×1
Duplicated block with local edits (138 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47— invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:42 — the two spans are one implementation copied and then locally edited — 973 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (132 matched lines × 2 locations) · ×1
Duplicated block with local edits (132 matched lines × 2 locations) invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112— invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112 · invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:93 — the two spans are one implementation copied and then locally edited — 739 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 (123 lines × 2 locations) invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:60— invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:60 · invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasPressure.ts:49 — 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 (123 matched lines × 2 locations) · ×1
Duplicated block with local edits (123 matched lines × 2 locations) invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:63— invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:63 · invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:66 — the two spans are one implementation copied and then locally edited — 793 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 (108 identical lines × 2 files) invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1— invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1 · invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueGenerate.ts:1 — these 2 files are line-for-line copies of one another — 108 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 (105 matched lines × 2 locations) · ×1
Duplicated block with local edits (105 matched lines × 2 locations) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:692— invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:692 · invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:937 — the two spans are one implementation copied and then locally edited — 569 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (100 identical lines × 2 files) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1— invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/OutputFieldHandle.tsx:1 — these 2 files are line-for-line copies of one another — 100 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 (99 matched lines × 2 locations) · ×1
Duplicated block with local edits (99 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306— invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:492 — the two spans are one implementation copied and then locally edited — 717 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function (anonymous) (cyclomatic 722, cognitive 1199) invokeai/frontend/webv2/scripts/mock-backend.mjs:1332— (anonymous) has cyclomatic complexity 722 and cognitive complexity 1199; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 266, cognitive 206) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4742— (anonymous) has cyclomatic complexity 266 and cognitive complexity 206; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 effect (cyclomatic 209, cognitive 574) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:100— effect has cyclomatic complexity 209 and cognitive complexity 574; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 getReasonsWhyCannotEnqueueCanvasTab (cyclomatic 145, cognitive 294) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773— getReasonsWhyCannotEnqueueCanvasTab has cyclomatic complexity 145 and cognitive complexity 294; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 101, cognitive 131) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:690— (anonymous) has cyclomatic complexity 101 and cognitive complexity 131; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 100, cognitive 123) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2424— (anonymous) has cyclomatic complexity 100 and cognitive complexity 123; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 98, cognitive 67) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:56— (anonymous) has cyclomatic complexity 98 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 96, cognitive 163) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:201— (anonymous) has cyclomatic complexity 96 and cognitive complexity 163; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 96, cognitive 84) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:321— (anonymous) has cyclomatic complexity 96 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 GalleryImageGrid (cyclomatic 95, cognitive 87) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:445— GalleryImageGrid has cyclomatic complexity 95 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 getReasonsWhyCannotEnqueueGenerateTab (cyclomatic 89, cognitive 148) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357— getReasonsWhyCannotEnqueueGenerateTab has cyclomatic complexity 89 and cognitive complexity 148; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 86, cognitive 85) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:796— (anonymous) has cyclomatic complexity 86 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 82, cognitive 75) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4248— (anonymous) has cyclomatic complexity 82 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 78, cognitive 75) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:352— (anonymous) has cyclomatic complexity 78 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 VideoWidgetView (cyclomatic 78, cognitive 70) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:147— VideoWidgetView has cyclomatic complexity 78 and cognitive complexity 70; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 74, cognitive 85) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:179— (anonymous) has cyclomatic complexity 74 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 GenerateAdvancedFields (cyclomatic 74, cognitive 62) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:93— GenerateAdvancedFields has cyclomatic complexity 74 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 73, cognitive 57) invokeai/frontend/webv2/src/features/workflow/core/document.ts:915— (anonymous) has cyclomatic complexity 73 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 72, cognitive 122) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55— (anonymous) has cyclomatic complexity 72 and cognitive complexity 122; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 71, cognitive 134) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:205— (anonymous) has cyclomatic complexity 71 and cognitive complexity 134; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 70, cognitive 89) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1974— (anonymous) has cyclomatic complexity 70 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 69, cognitive 129) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140— (anonymous) has cyclomatic complexity 69 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 69, cognitive 73) invokeai/frontend/webv2/src/features/video/core/graph.ts:654— (anonymous) has cyclomatic complexity 69 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 68, cognitive 164) invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts:490— (anonymous) has cyclomatic complexity 68 and cognitive complexity 164; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 68, cognitive 98) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1526— (anonymous) has cyclomatic complexity 68 and cognitive complexity 98; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 67, cognitive 55) invokeai/frontend/webv2/src/features/video/core/settings.ts:470— (anonymous) has cyclomatic complexity 67 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 66, cognitive 144) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addRegions.ts:97— (anonymous) has cyclomatic complexity 66 and cognitive complexity 144; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 WorkflowLibraryDetailPanel (cyclomatic 65, cognitive 62) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:110— WorkflowLibraryDetailPanel has cyclomatic complexity 65 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 64, cognitive 101) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx:93— (anonymous) has cyclomatic complexity 64 and cognitive complexity 101; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 IntermediatesManager (cyclomatic 64, cognitive 58) invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.tsx:63— IntermediatesManager has cyclomatic complexity 64 and cognitive complexity 58; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 GalleryPickerView (cyclomatic 62, cognitive 60) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67— GalleryPickerView has cyclomatic complexity 62 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 ProjectWorkflowDetailPanel (cyclomatic 62, cognitive 57) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:432— ProjectWorkflowDetailPanel has cyclomatic complexity 62 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 59, cognitive 134) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnection.ts:209— (anonymous) has cyclomatic complexity 59 and cognitive complexity 134; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 59, cognitive 129) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:330— (anonymous) has cyclomatic complexity 59 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 58, cognitive 56) invokeai/frontend/webv2/src/features/generation/core/settings.ts:959— (anonymous) has cyclomatic complexity 58 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 58, cognitive 31) invokeai/frontend/webv1/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx:62— (anonymous) has cyclomatic complexity 58 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 extract (cyclomatic 55, cognitive 57) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122— extract has cyclomatic complexity 55 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function LayerRowComponent (cyclomatic 55, cognitive 54) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:77— LayerRowComponent has cyclomatic complexity 55 and cognitive complexity 54; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 54, cognitive 69) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1029— (anonymous) has cyclomatic complexity 54 and cognitive complexity 69; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 53, cognitive 104) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:686— (anonymous) has cyclomatic complexity 53 and cognitive complexity 104; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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· invokeai/frontend/webv2/src/workbench/workbenchState.ts · ×1
invokeai/frontend/webv2/src/workbench/workbenchState.ts: 6229 lines of code invokeai/frontend/webv2/src/workbench/workbenchState.ts:1— invokeai/frontend/webv2/src/workbench/workbenchState.ts has 6229 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· invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts · ×1
invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts: 3955 lines of code invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1— invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts has 3955 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· invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts · ×1
invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts: 3089 lines of code invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:1— invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts has 3089 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· invokeai/frontend/webv1/src/features/metadata/parsing.tsx · ×1
invokeai/frontend/webv1/src/features/metadata/parsing.tsx: 2950 lines of code invokeai/frontend/webv1/src/features/metadata/parsing.tsx:1— invokeai/frontend/webv1/src/features/metadata/parsing.tsx has 2950 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· invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts · ×1
invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts: 2860 lines of code invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1— invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts has 2860 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· invokeai/frontend/webv2/src/features/queue/runtime.ts · ×1
invokeai/frontend/webv2/src/features/queue/runtime.ts: 2825 lines of code invokeai/frontend/webv2/src/features/queue/runtime.ts:1— invokeai/frontend/webv2/src/features/queue/runtime.ts has 2825 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· invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts · ×1
invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts: 2479 lines of code invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1— invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts has 2479 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· invokeai/frontend/webv2/src/features/generation/core/graph.ts · ×1
invokeai/frontend/webv2/src/features/generation/core/graph.ts: 2108 lines of code invokeai/frontend/webv2/src/features/generation/core/graph.ts:1— invokeai/frontend/webv2/src/features/generation/core/graph.ts has 2108 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· invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx · ×1
invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx: 2013 lines of code invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1— invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx has 2013 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· invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts · ×1
invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts: 2001 lines of code invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts:1— invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts has 2001 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· invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx · ×1
invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx: 1975 lines of code invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1— invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx has 1975 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· invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts · ×1
invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts: 1841 lines of code invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts:1— invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts has 1841 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· invokeai/frontend/webv1/src/features/nodes/types/field.ts · ×1
invokeai/frontend/webv1/src/features/nodes/types/field.ts: 1629 lines of code invokeai/frontend/webv1/src/features/nodes/types/field.ts:1— invokeai/frontend/webv1/src/features/nodes/types/field.ts has 1629 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· invokeai/frontend/webv2/src/workbench/projects/draftStore.ts · ×1
invokeai/frontend/webv2/src/workbench/projects/draftStore.ts: 1583 lines of code invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1— invokeai/frontend/webv2/src/workbench/projects/draftStore.ts has 1583 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· invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts · ×1
invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts: 1550 lines of code invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1— invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts has 1550 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· invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts · ×1
invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts: 1543 lines of code invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:1— invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts has 1543 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· invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts · ×1
invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts: 1542 lines of code invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1— invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts has 1542 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· invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts · ×1
invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts: 1531 lines of code invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts:1— invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts has 1531 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· invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts · ×1
invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts: 1471 lines of code invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1— invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts has 1471 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1448 lines of code REDACTED:1— REDACTED has 1448 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· invokeai/frontend/webv1/src/features/queue/store/readiness.ts · ×1
invokeai/frontend/webv1/src/features/queue/store/readiness.ts: 1446 lines of code invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1— invokeai/frontend/webv1/src/features/queue/store/readiness.ts has 1446 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· invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx · ×1
invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx: 1446 lines of code invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1— invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx has 1446 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· invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts · ×1
invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts: 1444 lines of code invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1— invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts has 1444 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· invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts · ×1
invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts: 1424 lines of code invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:1— invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts has 1424 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· invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx · ×1
invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx: 1409 lines of code invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:1— invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx has 1409 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· invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx · ×1
invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx: 1403 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:1— invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx has 1403 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· invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts · ×1
invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts: 1383 lines of code invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1— invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts has 1383 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· invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx · ×1
invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx: 1370 lines of code invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx:1— invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/WorkflowDocumentGraph.tsx has 1370 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· invokeai/frontend/webv1/src/features/cropper/lib/editor.ts · ×1
invokeai/frontend/webv1/src/features/cropper/lib/editor.ts: 1336 lines of code invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1— invokeai/frontend/webv1/src/features/cropper/lib/editor.ts has 1336 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· invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx · ×1
invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx: 1294 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1— invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx has 1294 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· invokeai/frontend/webv2/src/features/upscale/core/settings.ts · ×1
invokeai/frontend/webv2/src/features/upscale/core/settings.ts: 1229 lines of code invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1— invokeai/frontend/webv2/src/features/upscale/core/settings.ts has 1229 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· invokeai/frontend/webv1/src/features/controlLayers/store/types.ts · ×1
invokeai/frontend/webv1/src/features/controlLayers/store/types.ts: 1203 lines of code invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:1— invokeai/frontend/webv1/src/features/controlLayers/store/types.ts has 1203 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· invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts · ×1
invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts: 1200 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:1— invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts has 1200 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· invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx · ×1
invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx: 1169 lines of code invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:1— invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx has 1169 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· invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts · ×1
invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts: 1166 lines of code invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:1— invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts has 1166 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· invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts · ×1
invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts: 1160 lines of code invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1— invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts has 1160 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· invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts · ×1
invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts: 1142 lines of code invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts:1— invokeai/frontend/webv2/src/features/workflow/data/libraryBrowseStore.ts has 1142 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· invokeai/frontend/webv2/src/features/upscale/core/graph.ts · ×1
invokeai/frontend/webv2/src/features/upscale/core/graph.ts: 1128 lines of code invokeai/frontend/webv2/src/features/upscale/core/graph.ts:1— invokeai/frontend/webv2/src/features/upscale/core/graph.ts has 1128 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· invokeai/frontend/webv2/src/features/gallery/data/queries.ts · ×1
invokeai/frontend/webv2/src/features/gallery/data/queries.ts: 1123 lines of code invokeai/frontend/webv2/src/features/gallery/data/queries.ts:1— invokeai/frontend/webv2/src/features/gallery/data/queries.ts has 1123 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· invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx · ×1
invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx: 1117 lines of code invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:1— invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx has 1117 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling· This package's lint script runs in no CI job · ×1
This package's lint script runs in no CI job invokeai/frontend/webv1/package.json:28— The package in `invokeai/frontend/webv1` declares the lint script `lint:eslint` (`eslint --max-warnings=0 .`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint:eslint` in `invokeai/frontend/webv1` (or the workspace's task runner).
Dead file (~66 LoC) invokeai/frontend/webv1/src/features/nodes/types/common.test-d.ts— no import path from any entry point (529 application, 18 tooling, 1428 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 (~28 LoC) invokeai/frontend/webv1/knip.ts— no import path from any entry point (529 application, 18 tooling, 1428 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 (~19 LoC) invokeai/frontend/webv2/src/workbench/workbenchAggregateInterface.type-test.ts— no import path from any entry point (529 application, 18 tooling, 1428 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~18 LoC) invokeai/frontend/webv1/src/features/nodes/types/workflow.test-d.ts— no import path from any entry point (529 application, 18 tooling, 1428 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 (~15 LoC) invokeai/frontend/webv2/src/platform/ui/Button.type-test.tsx— no import path from any entry point (529 application, 18 tooling, 1428 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~12 LoC) invokeai/frontend/webv2/src/workbench/widgetRegionItems.ts— no import path from any entry point (529 application, 18 tooling, 1428 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) invokeai/frontend/webv2/src/workbench/settings/index.ts— no import path from any entry point (529 application, 18 tooling, 1428 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) invokeai/frontend/webv2/src/workbench/palette/index.ts— no import path from any entry point (529 application, 18 tooling, 1428 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
X18 · Disposal-pattern correctness· Disposes a dependency it does not own · ×1
Disposes a dependency it does not own invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/persistenceController.ts:49— `store` is never created by `PersistenceController` — it is the constructor parameter `store` (line 17), and its declared type `BitmapStore` is an interface — yet this class disposes it here (line 49). The instance came from whoever resolved it, and that owner decides when it ends. Disposing it from here reaches outside this object's lifetime: a dependency shared with the rest of the program is torn down when THIS instance goes away, and the real owner's later `dispose()` runs a second time on an object already disposed. Drop the call — a class disposes what it constructed, and only that. If this dependency genuinely is exclusive to this instance, construct it here (or take an owned factory) so the ownership is stated in the code rather than assumed.
X25 · Inert configuration knob· Option is kept and never read · ×1
Option is kept and never read invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterController.ts:111— `RasterController` accepts `options.getDocument` from the caller and keeps it in `this.getDocument` on line 111, where only it can read the value — but nothing ever reads `this.getDocument`. Setting `options.getDocument` therefore changes nothing: every caller gets the same behaviour whatever they pass, and nothing reports that the option was ignored. Read `this.getDocument` where the behaviour it configures is decided — or, if the behaviour genuinely is fixed, remove `options.getDocument` from the accepted options so callers stop setting a knob that does nothing.
X29 · Per-element action decided by a fixed element· Per-element action decided by a fixed element · ×1
Per-element action decided by a fixed element invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.ts:148— This loop runs once per element of `groups`, and the statement it guards acts on the element it is on — `group`. The test deciding whether that statement runs does not: `showHeadings` reads `groups[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 145, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out.
Orphaned file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.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 invokeai/frontend/webv1/src/services/api/endpoints/queue.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 invokeai/app/util/controlnet_utils.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 invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.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 invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.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 invokeai/frontend/webv1/src/features/imageActions/actions.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 invokeai/app/services/shared/sqlite_migrator/migrations/migration_1.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 invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/mobilenetv3.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 invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_common.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.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 invokeai/backend/flux/extensions/regional_prompting_extension.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 invokeai/frontend/webv1/src/features/deleteImageModal/store/state.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 invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.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 invokeai/frontend/webv1/src/features/controlLayers/store/selectors.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 invokeai/frontend/webv1/src/features/nodes/types/v2/field.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 invokeai/backend/util/level_zero.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 invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.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 invokeai/app/invocations/wan/wan_lora_loader.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 invokeai/backend/flux/controlnet/state_dict_utils.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 invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/conv2d_layers.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 invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.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 invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.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 invokeai/backend/image_util/dw_openpose/onnxpose.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.
Mock-dominated test: reads the board listing alongside generator resolution and dispatches only once both have answered invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:226— This test sets up 4 test doubles (for example `vi.spyOn`) against 3 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: carries the captured project and workflow through generator resolution to the dispatch invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:312— 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: queues nothing for a workflow the captured project no longer owns invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:341— 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: keeps Invoke Front on a Workflow dispatch invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:550— 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: leaves drafts alone when the page is hidden before loading or after its account lifetime ended invokeai/frontend/webv2/src/workbench/persistenceRuntime.test.ts:1269— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: cycles all modes through the M command and keeps swap and exit separate invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.browser.test.tsx:270— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: offers 100% at a fit just past it, though both read as 100%, and not at an exact 100% fit invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.browser.test.tsx:404— This test sets up 3 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: refreshes a loaded map when the socket reconnects, and detaches cleanly invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts:255— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: %s runs the bar’s %s action for the candidate invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingItemContextMenu.browser.test.tsx:233— This test sets up 4 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: anchors the zoom at the viewport centre invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:55— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: re-reads the viewport size on every call invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:61— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: commits one undoable setCanvasBbox whose inverse restores the current bbox invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:69— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: is inert with a null rect (nothing to fit to) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:89— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: is inert while editing is locked, even with a valid rect invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:96— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: fitBboxToLayers commits the layers rect and re-fits invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:105— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: fitBboxToMasks commits the masks rect and does NOT re-fit invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:116— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: newSession opens the confirm dialog instead of replacing directly invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:127— This test sets up 4 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: fit commands are inert with no rect to fit to invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:135— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: %s zooms to %d× about the viewport centre invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:154— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: ignores an unknown command id invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:166— This test sets up 4 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: quick switch prefers the bookmark, falls back to the previous selection, and skips missing layers invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:279— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: reports when whole-layer duplication throws invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:445— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: explains a %s whole-layer duplication refusal invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:455— This test sets up 3 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: resetSelected explains a refused clear and stays silent when there is nothing to clear invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:654— This test sets up 3 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: reports a merge the engine refused invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:748— This test sets up 3 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.
redundant comment invokeai/frontend/api/scripts/typegen.js:18— "`Record<string, unknown>` type" repeats the code it sits on: 4 of its 4 words (record, string, unknown, type) are already in `const RECORD_STRING_UNKNOWN = ts.factory.createTypeReferenceNode(ts.factory.createIdentifier('Record'), [`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.test.ts:160— "Mock i18next" repeats the code it sits on: 3 of its 3 words (mock, 18, next) are already in `vi.mock('i18next', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.test.ts:339— "Find the dispatched actions for Anima encoders" repeats the code it sits on: 4 of its 5 words (find, dispatched, anima, encoders) are already in `const qwen3Dispatch = dispatched.find((a) => a.type === animaQwen3EncoderModelSelected.type);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/common/util/promptAST.ts:397— "consume method close paren" repeats the code it sits on: 4 of its 4 words (consume, method, close, paren) are already in `const methodCloseParen = consume()!;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.test.ts:92— "Cross-Boundary Selection" repeats the code it sits on: 3 of its 3 words (cross, boundary, selection) are already in `describe('cross-boundary selection', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.test.ts:144— "Numeric Attention Weights" repeats the code it sits on: 3 of its 3 words (numeric, attention, weights) are already in `describe('numeric attention weights', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.test.ts:473— "Selection Preservation with Prompt Functions" repeats the code it sits on: 4 of its 4 words (selection, preservation, prompt, functions) are already in `describe('selection preservation with prompt functions', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.ts:82— "Check if the added direction cancels the current one" repeats the code it sits on: 4 of its 5 words (check, added, cancels, current) are already in `const isCancel = (current.startsWith('+') && added === '-') || (current.startsWith('-') && added === '+');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:424— "For other field types, show a read-only message" repeats the code it sits on: 5 of its 6 words (field, types, show, read, only) are already in `log.warn(`Unsupported field type "${fieldType}" for field "${label}" - showing as read-only`);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useAutoFitBBoxToMasks.ts:12— "Get the rect of all visible inpaint masks" repeats the code it sits on: 5 of its 5 words (get, rect, visible, inpaint, masks) are already in `const visibleRect = canvasManager.compositor.getVisibleRectOfType('inpaint_mask');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectLoad.ts:68— "Collect all image names referenced in the state" repeats the code it sits on: 4 of its 5 words (collect, image, names, state) are already in `const imageNames = collectImageNames(canvasState, refImages);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectLoad.ts:106— "Remap image names in state objects" repeats the code it sits on: 4 of its 5 words (remap, image, names, state) are already in `const remappedCanvasState = remapCanvasState(canvasState, imageNameMapping);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectSave.ts:56— "Collect all image names referenced in the state" repeats the code it sits on: 4 of its 5 words (collect, image, names, state) are already in `const imageNames = collectImageNames(projectState, refImagesState.entities);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:544— "Get the canvas from the adapter" repeats the code it sits on: 3 of its 3 words (get, canvas, adapter) are already in `const adapterCanvas = adapter.getCanvas(rect);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:555— "Draw the original adapter canvas to the temp canvas" repeats the code it sits on: 4 of its 5 words (draw, adapter, canvas, temp) are already in `tempCtx.drawImage(adapterCanvas, 0, 0);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts:183— "Add the group to the parent layer" repeats the code it sits on: 4 of its 4 words (add, group, parent, layer) are already in `this.parent.konva.layer.add(this.konva.group);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:388— "Add bbox rect and transformer to bbox group" repeats the code it sits on: 4 of its 5 words (add, bbox, rect, group) are already in `this.konva.bboxGroup.add(this.konva.bboxRect);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1170— "Run the graph and get the segmented image output" repeats the code it sits on: 5 of its 6 words (run, graph, segmented, image, output) are already in `const segmentResult = await withResultAsync(() =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts:361— 7 comments in this file only repeat the code they sit on (lines 361, 529, 569, 640, 642, 832, 1166), for example "Convert the raster layer to inpaint mask". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:138— 5 comments in this file only repeat the code they sit on (lines 138, 146, 185, 208, 279), for example "No model selected". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1272— "Update handle scaling" repeats the code it sits on: 3 of its 3 words (update, handle, scaling) are already in `this.updateKonvaCropInteractionHandleScales();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1328— "Update handle scaling" repeats the code it sits on: 3 of its 3 words (update, handle, scaling) are already in `this.updateKonvaCropInteractionHandleScales();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1366— "Update handle scaling" repeats the code it sits on: 3 of its 3 words (update, handle, scaling) are already in `this.updateKonvaCropInteractionHandleScales();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/dnd/dnd.ts:176— 10 comments in this file only repeat the code they sit on (lines 176, 204, 232, 260, 285, 311, 337, 388, 420, 479), for example "#region Set Global Reference Image". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment invokeai/frontend/webv1/src/features/gallery/components/ContextMenu/ImageContextMenu.tsx:226— "Context menu events" repeats the code it sits on: 3 of its 3 words (context, menu, events) are already in `window.addEventListener('contextmenu', onContextMenu, { signal: controller.signal });`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
Duplicated predicate invokeai/frontend/webv2/src/workbench/canvas-engine/document/insertionAnchors.ts:122— `!!entry && entry.stack === stack && isGroupNode(entry.node)` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/canvas-engine/document/insertionAnchors.ts, invokeai/frontend/webv2/src/workbench/canvasProjectMutations.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 invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx:88— `!!mainModelConfig && isExternalApiModelConfig(mainModelConfig)` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx, invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.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 invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx:218— `!!referenceImage && referenceImage.config.image !== null` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx, invokeai/frontend/webv1/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.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 invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts:226— `!(error instanceof ApiError) && !networkFailure` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/image-actions/canvasRecall.ts, invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.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 invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:156— `!Number.isFinite(pathBounds.x) || !Number.isFinite(pathBounds.y) || !Number.isFinite(pathBounds.width) || !Number.isFinite(pathBounds.height…` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts, invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.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 invokeai/frontend/webv2/src/features/queue/ui/formatDuration.ts:9— `!Number.isFinite(seconds) || seconds < 0` appears character-identically in 2 files — invokeai/frontend/webv2/src/features/queue/ui/formatDuration.ts, invokeai/frontend/webv2/src/workbench/image-map/indexProgress.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 invokeai/frontend/webv2/src/features/generation/core/promptTemplateOwnership.ts:31— `!account.multiuserEnabled || record.userId === account.currentUserId` appears character-identically in 2 files — invokeai/frontend/webv2/src/features/generation/core/promptTemplateOwnership.ts, invokeai/frontend/webv2/src/features/generation/core/systemPrompts.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 invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:60— `!currentUser || currentUser.is_admin || board.user_id === currentUser.user_id` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx, invokeai/frontend/webv1/src/services/api/hooks/useBoardAccess.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:201— `!cursorPos || !isPrimaryPointerDown || !selectedEntity` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:264— `!cursorPos || !selectedEntity || !isPrimaryPointerDown` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.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 invokeai/frontend/webv2/src/workbench/projects/invk/duplicateProject.ts:232— `!didAttemptProjectCreate && isAccountScopeCurrent(owner)` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/projects/invk/duplicateProject.ts, invokeai/frontend/webv2/src/workbench/projects/projectFile.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 invokeai/frontend/webv1/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx:20— `!doesWorkflowHaveUnsavedChanges || !isCurrentWorkflowOwner` appears character-identically in 3 files — invokeai/frontend/webv1/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx, invokeai/frontend/webv1/src/features/nodes/components/sidePanel/WorkflowListMenu/SaveWorkflowButton.tsx, invokeai/frontend/webv1/src/features/workflowLibrary/components/WorkflowLibraryMenu/SaveWorkflowMenuItem.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 invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:600— `!durable && isAccountScopeCurrent(owner) && canvasTarget.getProject()` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts, invokeai/frontend/webv2/src/workbench/image-actions/executeRecallParameters.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 invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/callSavedWorkflowFormUtils.ts:114— `!element || element.type !== 'node-field'` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/callSavedWorkflowFormUtils.ts, invokeai/frontend/webv2/src/features/workflow/core/document.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 invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:83— `!imageDTO || (tab === 'canvas' && isStaging)` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx, invokeai/frontend/webv1/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceRefImageImage.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 invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:448— `!instance || !widget || widget.status !== 'enabled'` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx, invokeai/frontend/webv2/src/workbench/shell/Panels.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 invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:107— `!isClosed && !isUnavailable && isWorkbenchDatabaseAvailable(database)` appears character-identically in 3 files — invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts, invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts, invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.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 invokeai/frontend/webv1/src/features/queue/hooks/useCancelAllExceptCurrentQueueItem.ts:39— `!isConnected || !queueStatus?.queue.pending` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/queue/hooks/useCancelAllExceptCurrentQueueItem.ts, invokeai/frontend/webv1/src/features/queue/hooks/useDeleteAllExceptCurrentQueueItem.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 invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx:62— `!isDisposed && isAccountScopeCurrent(owner)` appears character-identically in 3 files — invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx, invokeai/frontend/webv2/src/features/queue/runtime.ts, invokeai/frontend/webv2/src/features/queue/runtime/coordinator.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 invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:107— `!isFit && actualZoom >= PIXELATED_ACTUAL_ZOOM` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts, invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewLoupe.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 invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:38— `!isLoadingSetup && setupStatus && !setupStatus.multiuser_enabled` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx, invokeai/frontend/webv1/src/features/auth/components/LoginPage.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 invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:427— `!lastPoint || !isDistanceMoreThanMin(cursorPos.relative, lastPoint, minDistance)` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.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 invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/textEditingController.ts:79— `!next.fontVariations || Object.keys(next.fontVariations).length === 0` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/textEditingController.ts, invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.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 invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:105— `!o.ctx.isPermitCurrent(permit) || o.ctx.isGestureActive()` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.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 invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:429— `!pinch.pointerIds.includes(event.pointerId) || !first || !second` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts, invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewLoupe.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.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:127— `trace` at line 127 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:534— `trace` at line 534 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:562— `error` at line 562 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:633— `warn` at line 633 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:659— `debug` at line 659 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:663— `trace` at line 663 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:761— `trace` at line 761 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onQueueItemStatusChanged.tsx:48— `debug` at line 48 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:98— `debug` at line 98 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:226— `trace` at line 226 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:230— `debug` at line 230 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:236— `trace` at line 236 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:240— `trace` at line 240 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:262— `trace` at line 262 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:266— `error` at line 266 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:638— `debug` at line 638 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:640— `warn` at line 640 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:644— `error` at line 644 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:650— `info` at line 650 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:655— `debug` at line 655 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:680— `debug` at line 680 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:682— `warn` at line 682 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:686— `error` at line 686 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:690— `info` at line 690 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:695— `debug` at line 695 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
Fat interface: GalleryCommandsPort (19 required operations) invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx:76— `GalleryCommandsPort` declares 19 required operations: `clearSelection`, `reconcileDeletedBoardOutcome`, `selectBoard`, `selectItem`, `selectImage`, `setCompareItem`, `setCompareImage`, `setItemMultiSelection`, `setPage`, `setPageInfo`, `setSearchTerm`, `setStarredOnly`, `setSemanticSearchMode`, `setSemanticSearchText`, `commitSemanticSearch`, `clearSearch`, `setView`, `toggleItemSelection`, `updateSettings`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: GalleryActions (28 required operations) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:23— `GalleryActions` declares 28 required operations: `archiveBoard`, `clearSelection`, `createBoard`, `deleteBoard`, `downloadBoard`, `getBoardMediaUsage`, `exportProject`, `loadMore`, `moveBoard`, `refresh`, `renameBoard`, `setBoardGeneralAccess`, `selectBoard`, `selectItem`, `selectItemRange`, `setCompareItem`, `setSearchTerm`, `setSearchScope`, `setStarredOnly`, `clearSearch`, `commitSemanticSearch`, `setSemanticImageQuery`, `setSemanticSearchMode`, `setSemanticSearchText`, `setView`, `toggleItemInSelection`, `updateSettings`, `uploadFiles`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: QueueBackendPort (20 required operations) invokeai/frontend/webv2/src/features/queue/core/types.ts:339— `QueueBackendPort` declares 20 required operations: `claimItemDelivery`, `cancelQueueItems`, `cancelQueueItemsByBatchIds`, `enqueueGenerate`, `enqueueWorkflow`, `getItem`, `getResultImages`, `getResultVideoNames`, `getResultVideos`, `listItems`, `readCurrent`, `readItemIds`, `readItemsById`, `readNext`, `readStatus`, `readItemDetail`, `retryItems`, `emit`, `on`, `onConnectionChange`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: QueueHistoryCommands (16 required operations) invokeai/frontend/webv2/src/features/queue/runtime.ts:96— `QueueHistoryCommands` declares 16 required operations: `markBackendCancelled`, `markBackendSubmitted`, `noteFirstProgressFrame`, `recordSubmissionRetry`, `setCancellationPending`, `setLocalRecoveryState`, `recordError`, `refreshBackendData`, `refreshBoardDestinations`, `reopenForRetry`, `restoreFromJournal`, `routePartialResults`, `routeResults`, `setConnectionStatus`, `stageRetriedCanvasResults`, `setStatus`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ProjectDraftStore (24 required operations) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:270— `ProjectDraftStore` declares 24 required operations: `adopt`, `acknowledgeRetarget`, `claimWriter`, `close`, `delete`, `deleteCorrupt`, `discardUnloadJournal`, `get`, `journalBeforeUnload`, `list`, `listForProject`, `listRetargets`, `peekUnloadJournalProjectIds`, `reconcileUnloadJournal`, `reserveCopyIdentity`, `resumeDraft`, `rebaseDraft`, `retargetAcknowledgedCopy`, `settleAcknowledgement`, `settleConflict`, `settleSchemaRefusal`, `settleUnloadJournal`, `stage`, `startFreshWriter`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: DurableSyncedWorkbenchPersistence (30 required operations) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:510— `DurableSyncedWorkbenchPersistence` declares 30 required operations: `acknowledgeProjectResolution`, `abortProjectResolution`, `adoptProjectRecord`, `clearWorkbench`, `close`, `deleteRecoverableDraft`, `deleteProjectOnServer`, `ensureProjectOnServer`, `flushProjectToServer`, `getProjectDraftDocument`, `getRecoverableDraftDocument`, `hasClosedSession`, `journalBeforeUnload`, `hasChangesUnloadWouldLose`, `hasPendingChanges`, `hydrateProjectFromServer`, `loadWorkbench`, `listRecoverableDrafts`, `markProjectDeleted`, `persistEmptySession`, `releaseMutationLocks`, `reopenSession`, `subscribeSessionReopened`, `resolveConflictDiscard`, `resolveConflictSaveAsNew`, `resolveConflictUseServer`, `releaseProjectSync`, `retain`, `saveWorkbench`, `unmarkProjectDeleted`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: PersistenceAggregatePort (17 required operations) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:11— `PersistenceAggregatePort` declares 17 required operations: `assignProjectBoard`, `getPersistedRevision`, `getState`, `hydrate`, `notifyProjectNotFound`, `reportLoadAvailable`, `reportLoadError`, `reportLoadUnavailable`, `reportRefusedProjects`, `saveFailed`, `saveNeedsAttention`, `savePending`, `saveScheduled`, `saveStarted`, `saveSucceeded`, `setHasHydrated`, `subscribe`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: LayerRowCommands (22 required operations) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts:19— `LayerRowCommands` declares 22 required operations: `select`, `focus`, `toggleExpanded`, `setEnabled`, `setHidden`, `setLocked`, `startRename`, `rename`, `endRename`, `openMenu`, `openStackMenu`, `toggleCollapse`, `toggleChildren`, `selectChild`, `setChildEnabled`, `removeChild`, `renameChild`, `moveChild`, `moveChildToLayer`, `duplicateChild`, `openChildMenu`, `keyDown`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: LayerContextActionEffects (33 required operations) invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:161— `LayerContextActionEffects` declares 33 required operations: `reorder`, `duplicate`, `mergeSelected`, `mergeMasks`, `group`, `removeFromGroup`, `openRename`, `openRunWorkflow`, `startSelectObject`, `startFilter`, `transform`, `fitToBbox`, `openProperties`, `saveToBoard`, `copyToClipboard`, `cropToBbox`, `extractMaskedArea`, `booleanMerge`, `copyTo`, `rasterize`, `convertTo`, `patchConfig`, `addReferenceImage`, `addMaskModifier`, `addAdjustment`, `addLayerRegion`, `setColorLabel`, `mergeDown`, `toggleVisibility`, `toggleHidden`, `toggleLock`, `toggleQuickSwitchBookmark`, `delete`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: LayerCacheStore (21 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerCache.ts:82— `LayerCacheStore` declares 21 required operations: `peek`, `layerIds`, `get`, `getOrCreate`, `getOrCreateRect`, `growToRect`, `shrinkToRect`, `prepareReplacement`, `installReplacement`, `publishRasterized`, `captureState`, `restoreState`, `publishPixels`, `damageSince`, `invalidate`, `delete`, `version`, `revision`, `byteSize`, `evict`, `dispose`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: CanvasEngineLayerCapability (29 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts:786— `CanvasEngineLayerCapability` declares 29 required operations: `applyTransform`, `beginTransform`, `booleanMergeRasterLayers`, `cancelTextEdit`, `cancelTransform`, `clearMask`, `commitLayerConversion`, `commitLayerCopy`, `commitMaskImageResult`, `commitOpenTextSession`, `commitRasterFilterResult`, `commitTextEdit`, `convertLayerToControl`, `copyLayerToControl`, `copyLayerToRaster`, `cropAllLayersToBbox`, `cropLayerToBbox`, `duplicateLayers`, `mergeInpaintMasks`, `mergeLayerDown`, `mergeSelectedRasterLayers`, `mergeVisibleRasterLayers`, `nudgeSelectedLayer`, `openTextCreate`, `openTextEdit`, `rasterizeLayer`, `setTextEditContentReader`, `updateTextEditStyle`, `updateTransformSession`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: CanvasApplicationHost (27 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:42— `CanvasApplicationHost` declares 27 required operations: `captureGuard`, `clearFilterPreview`, `clearSamPreview`, `commitFilter`, `commitGenerated`, `commitMask`, `decodeSelectObjectPreview`, `encodeSurface`, `exportBakedLayerBlob`, `flushLayerUploads`, `exportLayerPixels`, `getCompositeExecutorDeps`, `getDocument`, `isGuardCurrent`, `isSamToolActive`, `prepareSelectObjectStart`, `publishFilterPreview`, `publishSamPreview`, `replaceSelection`, `replaceTemporaryRestoreTool`, `selectLayer`, `setSamInputHandler`, `setEscapeHandler`, `setSamInteraction`, `setSamTool`, `setViewTool`, `subscribeToolChanges`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: PixelEditControllerOptions (17 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:43— `PixelEditControllerOptions` declares 17 required operations: `canEdit`, `deleteDerived`, `getActiveProjectId`, `getAdjustedSurface`, `peekAdjustedSurface`, `getAdjustmentStatus`, `getDocument`, `getTransformSession`, `installPrepared`, `invalidate`, `isCacheReady`, `isOperationIdle`, `notifyPainted`, `preparePixels`, `publishStroke`, `reportRefusal`, `setTransformOverride`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: PointerPipeline (16 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:71— `PointerPipeline` declares 16 required operations: `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel`, `onPointerEnter`, `onPointerLeave`, `onKeyDown`, `onKeyUp`, `onFocusIn`, `isGestureActive`, `hoverPoint`, `cancelActiveGesture`, `endForToolSwitch`, `replaceTemporaryRestoreTool`, `heldRestoreToolId`, `reset`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: CanvasOperationCapability (26 required operations) invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:65— `CanvasOperationCapability` declares 26 required operations: `composeForGeneration`, `uploadIntermediate`, `getOperationState`, `subscribeOperation`, `getFilterSessionState`, `subscribeFilterSession`, `getSamSessionState`, `subscribeSamSession`, `startSelectObject`, `startFilterOperation`, `updateFilterOperation`, `setFilterOperationAutoProcess`, `processFilterOperation`, `resetFilterOperation`, `commitFilterOperation`, `cancelFilterOperation`, `updateSelectObjectSession`, `processSelectObjectSession`, `applySelectObjectSession`, `saveSelectObjectSession`, `resetSelectObjectSession`, `cancelSelectObjectSession`, `applyControlLayerIntent`, `retryControlDetection`, `getControlDetectionStatus`, `subscribeControlDetectionStatus`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: CanvasSelectObjectCoordinatorDeps (19 required operations) invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:204— `CanvasSelectObjectCoordinatorDeps` declares 19 required operations: `prepareStart`, `selectLayer`, `clearOtherOperation`, `setSamTool`, `setViewTool`, `replaceTemporaryRestoreTool`, `isSamToolActive`, `captureGuard`, `isGuardCurrent`, `exportSource`, `uploadIntermediate`, `runGraph`, `decodePreview`, `publishPreview`, `clearPreview`, `invalidateOverlay`, `commitGenerated`, `commitMask`, `replaceSelection`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ImageActions (22 required operations) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:115— `ImageActions` declares 22 required operations: `copyImage`, `createCanvasFromImages`, `deleteImages`, `deriveImageRecallCapabilities`, `downloadImage`, `downloadImages`, `generatePbrMaps`, `loadImageWorkflow`, `loadVideoWorkflow`, `moveImagesToBoard`, `openImageInPreview`, `recallImageData`, `recallVideoData`, `sendToInitialVideo`, `savePromptAsTemplate`, `selectForCompare`, `sendToCanvas`, `sendImageAsControl`, `setImagesStarred`, `useAsReferenceImage`, `useAsReferenceVideo`, `useAsConditioningClip`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ImageFileStorageBase (21 abstract methods) invokeai/app/services/image_files/image_files_base.py:9— `ImageFileStorageBase` declares 21 abstract methods: `get`, `get_path`, `iter_image_paths`, `iter_thumbnail_paths`, `image_root`, `thumbnail_root`, `evict_cache_paths`, `validate_path`, `save`, `generate_thumbnail_if_missing`, `copy`, `get_file_size_bytes`, `delete`, `stage_delete`, `begin_delete`, `commit_delete`, `abandon_delete`, `rollback_delete`, `get_workflow`, `get_graph`, `get_resolved_inputs`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ImageRecordStorageBase (17 abstract methods) invokeai/app/services/image_records/image_records_base.py:18— `ImageRecordStorageBase` declares 17 abstract methods: `get`, `exists`, `get_metadata`, `update`, `get_many`, `delete`, `delete_many`, `get_subfolders`, `iter_all_image_locations`, `delete_intermediates_by_names`, `save`, `set_file_size_bytes`, `set_file_sizes_bytes`, `get_user_id`, `get_most_recent_image_for_board`, `get_image_names`, `get_image_names_by_date`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ImageServiceABC (19 abstract methods) invokeai/app/services/images/images_base.py:19— `ImageServiceABC` declares 19 abstract methods: `create`, `copy`, `update`, `get_pil_image`, `get_record`, `get_dto`, `get_metadata`, `get_workflow`, `get_graph`, `get_resolved_inputs`, `get_path`, `validate_path`, `get_url`, `get_many`, `delete`, `delete_intermediates_by_names`, `delete_images_by_names`, `delete_images_on_board`, `get_image_names`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ModelInstallServiceBase (25 abstract methods) invokeai/app/services/model_install/model_install_base.py:19— `ModelInstallServiceBase` declares 25 abstract methods: `start`, `stop`, `app_config`, `record_store`, `event_bus`, `register_path`, `unregister`, `delete`, `unconditionally_delete`, `install_path`, `heuristic_import`, `import_model`, `get_job_by_source`, `get_job_by_id`, `list_jobs`, `prune_jobs`, `cancel_job`, `pause_job`, `resume_job`, `restart_failed`, `restart_file`, `wait_for_job`, `resume_and_wait_for_job`, `wait_for_installs`, `download_and_cache_model`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: SessionQueueBase (49 abstract methods) invokeai/app/services/session_queue/session_queue_base.py:43— `SessionQueueBase` declares 49 abstract methods: `dequeue`, `enqueue_batch`, `acknowledge_enqueue`, `get_enqueue_receipt`, `replay_enqueue`, `get_current`, `get_current_for_api`, `get_next`, `get_next_for_api`, `clear`, `prune`, `is_empty`, `is_full`, `get_queue_status`, `has_active_queue_work`, `get_counts_by_destination`, `get_batch_status`, `complete_queue_item`, `suspend_queue_item`, `resume_queue_item`, `cancel_queue_item`, `delete_queue_item`, `delete_queue_items_by_id`, `fail_queue_item`, `cancel_by_batch_ids`, `cancel_by_destination`, `delete_by_destination`, `cancel_by_queue_id`, `cancel_all_except_current`, `delete_all_except_current`, `list_queue_items`, `list_all_queue_items`, `get_queue_item_ids`, `get_queue_item_lineage`, `get_unfinished_origins`, `get_queue_item_summaries_by_ids`, `get_queue_item`, `get_queue_item_owner`, `claim_queue_item_delivery`, `confirm_queue_item_delivery`, and 9 more. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: VideoServiceABC (16 abstract methods) invokeai/app/services/videos/videos_base.py:19— `VideoServiceABC` declares 16 abstract methods: `create`, `copy`, `update`, `get_record`, `get_dto`, `get_metadata`, `get_workflow`, `get_graph`, `get_path`, `get_url`, `get_many`, `delete`, `delete_intermediates_by_names`, `delete_videos_by_names`, `delete_videos_on_board`, `get_video_names`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Silent fallback default in catch invokeai/app/api/sockets.py:444— `_running_queue_item_owners` 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 invokeai/app/services/session_queue/session_queue_default.py:460— `_get_device_resident_model_keys` 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 invokeai/backend/model_manager/load/model_cache/model_cache.py:2443— `_get_reclaimable_allocator_bytes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/backend/quantization/fp8_scaled.py:1017— `_probe_fp8_matmul` swallows every exception into `return False` — 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 invokeai/backend/quantization/int8_convrot.py:213— `parse_comfy_quant_bytes` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/backend/quantization/int8_convrot.py:222— `parse_comfy_quant_marker` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/backend/util/wddm.py:391— `_counter_values` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/backend/working_memory/counters.py:278— `_sample` swallows every exception into `return ()` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch docs/src/lib/components/memory/page-lang.mjs:11— `pageLang` swallows every exception into `return 'en'` — 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 docs/src/lib/components/search.mjs:162— `parseRecent` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:59— `getSemanticReferenceName` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/frontend/webv2/src/features/queue/runtime/receiptAcknowledgements.ts:59— `createQueueReceiptAcknowledgements.drain` swallows every exception into `return false` — 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 invokeai/frontend/webv2/src/features/workflow/core/layerWorkflow.ts:349— `getRunnableLayerWorkflowInputs` swallows every exception into `return false` — 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 invokeai/frontend/webv2/src/platform/ui/colorPickerStore.ts:72— `parseRecents` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/frontend/webv2/src/workbench/projects/covers.ts:69— `parseProjectCovers` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch invokeai/frontend/webv2/src/workbench/widgets/canvas/toolFamilyStore.ts:18— `readStored` swallows every exception into `return 'marquee'` — 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 invokeai/frontend/webv2/src/workbench/palette/recents.ts:51— `parseRecords` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X7 · Silent fallback defaults· Pending state with no failure state · ×14
Pending state with no failure state invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx:401— The view draws `<Spinner boxSize="3.5"/>` under `isSaving`, but `isSaving` 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 invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx:176— The view draws `<Spinner color="fg.muted"/>` under `busyProjectId === summary . id`, but `busyProjectId` 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 invokeai/frontend/webv1/src/features/systemPrompts/components/SystemPromptsModal.tsx:63— The view draws `<Spinner alignSelf="center"/>` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state invokeai/frontend/webv1/src/features/stylePresets/components/StylePresetExportButton.tsx:60— The view draws `<PiSpinner/>` 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 invokeai/frontend/webv1/src/features/stylePresets/components/StylePresetImportButton.tsx:56— The view draws `<PiSpinner/>` 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 invokeai/frontend/webv1/src/features/stylePresets/components/StylePresetForm/StylePresetModal.tsx:99— The view draws `<Spinner/>` under `! stylePresetModalState . prefilledFormData || formData`, but `formData` 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 invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueList.tsx:113— The view draws `<IAINoContentFallbackWithSpinner/>` 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 invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx:99— The view draws `<Flex alignItems="center" justifyContent="center" w="full" h="full">` 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 invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/Model.tsx:37— The view draws `<IAINoContentFallbackWithSpinner label= />` 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 invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/StarterModels/StarterModelsForm.tsx:15— The view draws `<FetchingModelsLoader loadingMessage= />` 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 invokeai/frontend/webv1/src/features/gallery/components/ImageMetadataViewer/ImageMetadataViewer.tsx:136— The view draws `<IAINoContentFallbackWithSpinner label= />` 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 invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GallerySearch.tsx:45— The view draws `<InputRightElement h="full" pe= >` under `isFetching`, but `isFetching` 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 invokeai/frontend/webv1/src/features/customNodes/CustomNodesList.tsx:90— The view draws `<Flex justifyContent="center" py= >` 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 invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/CanvasWorkflowIntegrationWorkflowSelector.tsx:53— The view draws `<Flex alignItems="center" gap= >` under `isLoading || isFiltering`, 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.
P2 · Observability· Console output used as the logging channel · ×13
Console output used as the logging channel invokeai/frontend/webv1/src/services/events/useSocketIO.ts:154— `invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 154 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/services/events/useSocketIO.ts:169— `invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 169 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:311— `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 311 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:313— `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 313 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:397— `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 397 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:399— `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 399 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:444— `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 444 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:446— `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 446 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:328— `invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts` reports through `console.*` at line 328 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:19— `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 19 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:23— `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 23 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:26— `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 26 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2781— `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` reports through `console.*` at line 2781 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Silent fallback default on parse failure invokeai/app/services/image_index/projection.py:88— `stored_projection_method` returns `'umap'` when `(ValueError, AttributeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure invokeai/app/services/shared/database/queries/base.py:154— `day_after` returns `''` when `(ValueError, OverflowError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure invokeai/app/services/shared/database/startup.py:102— `redacted_database_url` returns `'***'` when `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.
Silent fallback default on parse failure invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_08_06_add_project_boards.py:356— `_collect_board_candidates` returns `set()` when `(TypeError, 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.
Silent fallback default on parse failure invokeai/app/util/dynamicprompts.py:62— `find_missing_wildcards` returns `[]` when `ParseException` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure invokeai/backend/ltx2/checkpoint_layout.py:75— `header_config` returns `{}` when `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.
Silent fallback default on parse failure scripts/family_e2e/bundle.py:237— `_strip_url` returns `'<url>'` when `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.
Silent fallback default on parse failure scripts/family_e2e/report.py:314— `_node_types` returns `{}` when `(OSError, 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.
Silent fallback default on parse failure scripts/family_e2e/runner.py:422— `read_heartbeat` returns `{}` when `(OSError, 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 625 significant file(s) lose their only recent owner: invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts, invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx, invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts, invokeai/frontend/webv2/src/workbench/projects/draftStore.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts, invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts, invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx (+617 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 121 significant file(s) lose their only recent owner: invokeai/backend/model_manager/load/model_loaders/z_image.py, REDACTED, invokeai/backend/quantization/fp8_scaled.py, invokeai/backend/quantization/int8_convrot.py, invokeai/app/invocations/wan/wan_denoise.py, invokeai/backend/model_manager/configs/qwen3_encoder.py, invokeai/app/invocations/ideogram4/ideogram4_denoise.py, invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py (+113 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 81 significant file(s) lose their only recent owner: invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts, invokeai/frontend/webv2/src/features/video/core/graph.ts, invokeai/frontend/webv2/src/features/video/core/settings.ts, invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts, invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx, invokeai/backend/ltx2/denoise.py, invokeai/app/api/routers/video_recall.py, invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts (+73 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 27 significant file(s) lose their only recent owner: invokeai/app/services/shared/graph.py, invokeai/app/services/shared/graph_scheduler.py, invokeai/app/services/shared/execution_engine/child.py, invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts, invokeai/app/services/shared/execution_effects.py, invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts, invokeai/app/services/shared/graph_iterate_planner.py, invokeai/app/services/shared/graph_nested_iterate_planner.py (+19 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 9 significant file(s) lose their only recent owner: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasGradientToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItemsExtractMaskedArea.tsx, invokeai/frontend/webv1/src/features/ui/layouts/canvasToolModifierHints.ts, invokeai/backend/stable_diffusion/hidiffusion_utils.py, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/toolHotkeys.ts, invokeai/frontend/webv1/src/features/ui/layouts/DockviewCanvasHeaderActions.tsx, invokeai/frontend/webv1/src/features/parameters/components/Prompts/PromptResizeHandle.tsx (+1 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 3 significant file(s) lose their only recent owner: invokeai/backend/stable_diffusion/extensions/ip_adapter.py, invokeai/backend/stable_diffusion/diffusion_backend.py, invokeai/backend/stable_diffusion/denoise_context.py. Pair on, review, or document these before any departure.
IC1 · Incompleteness & stubs· Empty method body · ×5
Empty method body invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryList.tsx:516— `ignoreContextMenu` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body invokeai/frontend/webv2/src/platform/ui/video-player/mediaElementStore.ts:108— `ignoreRefusal` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:413— `focusAdjacentRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:414— `focusFloating` has an empty body — confirm it's an intentional no-op and not an unfinished method.
Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:415— `focusRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×3
Projects may be oversized for their cohesion invokeai/frontend/webv2/package.json:1— `invokeai/frontend/webv2` (353815 LoC, 4261 module-visible types across 148 directories) overshoots its size bounds. 3 of 7 build unit(s) (Python, npm) overshoot their size bounds, lowering Project Cohesion to 1.4/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Projects may be oversized for their cohesion REDACTED:1— `(repository root)` (261085 LoC, 3534 module-visible types across 192 directories) overshoots its size bounds. 3 of 7 build unit(s) (Python, npm) overshoot their size bounds, lowering Project Cohesion to 1.4/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Projects may be oversized for their cohesion invokeai/frontend/webv1/package.json:1— `invokeai/frontend/webv1` (158480 LoC, 1596 module-visible types across 217 directories) overshoots its size bounds. 3 of 7 build unit(s) (Python, npm) overshoot their size bounds, lowering Project Cohesion to 1.4/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D21 · Naming Consistency· `selectAspectRatioID` spells `ID` where 1981 names in the project spell it `Id` · ×2
`selectAspectRatioID` spells `ID` where 1981 names in the project spell it `Id` invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1542— 1981 of 1986 names in project repository spell the token `Id` (1981 of 1986; unit: names in project repository containing `Id`). Peers: docs-page.isDocsPage(entryId) (docs/src/lib/docs-page.ts:10); docs-page.isLocalizablePage(entryId) (docs/src/lib/docs-page.ts:18); boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20). Rename to `selectAspectRatioId`. [rule N6]
`selectAspectRatioID` spells `ID` where 1981 names in the project spell it `Id` invokeai/frontend/webv1/src/features/controlLayers/store/selectors.ts:340— 1981 of 1986 names in project repository spell the token `Id` (1981 of 1986; unit: names in project repository containing `Id`). Peers: docs-page.isDocsPage(entryId) (docs/src/lib/docs-page.ts:10); docs-page.isLocalizablePage(entryId) (docs/src/lib/docs-page.ts:18); boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20). Rename to `selectAspectRatioId`. [rule N6]
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×2
Diagnostic log message is built whether or not it is wanted invokeai/frontend/webv1/src/features/controlLayers/hooks/useExportCanvasToPSD.ts:120— `debug` at line 120 is called with an argument built by `children?.map((l) => ({ name : l.name, bounds : { left : l.left, top : l.top, right : l.right, bottom : l.bottom }, }))` (line 125), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:98— `debug` at line 98 is called with an argument built by `Object.keys(els)` (line 98), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 1 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (867 single-owned of 2715 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; 2715 of the 4892 production source files in this repository met that bar). They are 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: invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsBooleanSubMenu.tsx.
No ADRs found REDACTED:575— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `REDACTED` makes this repository a deployable product (line 575).
D21 · Naming Consistency· `addGetOpenAPISchemaListener` spells `API` where 34 names in the project spell it `Api` · ×1
`addGetOpenAPISchemaListener` spells `API` where 34 names in the project spell it `Api` invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts:13— 34 of 36 names in project repository spell the token `Api` (34 of 36; unit: names in project repository containing `Api`). Peers: invokeai.frontend.webv1.src.features.controlLayers.components.StagingArea.state.StagingAreaApi (invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:93); CanvasManager.stateApi (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:56); invokeai.frontend.webv1.src.features.controlLayers.konva.CanvasStateApiModule.CanvasStateApiModule (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:68); state.useDeleteImageModalApi (invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts:173); state.useDeleteVideoModalApi (invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.ts:181). Rename to `addGetOpenApiSchemaListener`. [rule N6]
D21 · Naming Consistency· `getSAMPoints` spells `SAM` where 39 names in the project spell it `Sam` · ×1
`getSAMPoints` spells `SAM` where 39 names in the project spell it `Sam` invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:137— 39 of 41 names in project repository spell the token `Sam` (39 of 41; unit: names in project repository containing `Sam`). Peers: CanvasApplicationHost.clearSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:45); CanvasApplicationHost.isSamToolActive (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:66); CanvasApplicationHost.publishSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:75); CanvasApplicationHost.setSamInputHandler (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:89); CanvasApplicationHost.setSamInteraction (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:91). Rename to `getSamPoints`. [rule N6]
D21 · Naming Consistency· `getSAMPointColor` spells `SAM` where 39 names in the project spell it `Sam` · ×1
`getSAMPointColor` spells `SAM` where 39 names in the project spell it `Sam` invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1531— 39 of 41 names in project repository spell the token `Sam` (39 of 41; unit: names in project repository containing `Sam`). Peers: CanvasApplicationHost.clearSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:45); CanvasApplicationHost.isSamToolActive (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:66); CanvasApplicationHost.publishSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:75); CanvasApplicationHost.setSamInputHandler (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:89); CanvasApplicationHost.setSamInteraction (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:91). Rename to `getSamPointColor`. [rule N6]
D21 · Naming Consistency· `isAspectRatioID` spells `ID` where 1981 names in the project spell it `Id` · ×1
`isAspectRatioID` spells `ID` where 1981 names in the project spell it `Id` invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:774— 1981 of 1986 names in project repository spell the token `Id` (1981 of 1986; unit: names in project repository containing `Id`). Peers: docs-page.isDocsPage(entryId) (docs/src/lib/docs-page.ts:10); docs-page.isLocalizablePage(entryId) (docs/src/lib/docs-page.ts:18); boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20). Rename to `isAspectRatioId`. [rule N6]
D21 · Naming Consistency· `WorkflowJSONTab` spells `JSON` where 37 names in the project spell it `Json` · ×1
`WorkflowJSONTab` spells `JSON` where 37 names in the project spell it `Json` invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowJSONTab.tsx:8— 37 of 38 names in project repository spell the token `Json` (37 of 38; unit: names in project repository containing `Json`). Peers: promptTemplates.isJsonPrompt (invokeai/frontend/webv2/src/features/generation/core/promptTemplates.ts:16); workingMemory.isJsonObject (invokeai/frontend/webv2/src/features/models/core/workingMemory.ts:56); ModelsDataPort.requestJson (invokeai/frontend/webv2/src/features/models/data/transport.ts:6); NodesDataPort.requestJson (invokeai/frontend/webv2/src/features/nodes/data/transport.ts:6); workflowJson.parseWorkflowJson (invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:283). Rename to `WorkflowJsonTab`. [rule N6]
D21 · Naming Consistency· `prepareLinearUIBatch` spells `UI` where 51 names in the project spell it `Ui` · ×1
`prepareLinearUIBatch` spells `UI` where 51 names in the project spell it `Ui` invokeai/frontend/webv1/src/features/nodes/util/graph/buildLinearBatchConfig.ts:24— 51 of 53 names in project repository spell the token `Ui` (51 of 53; unit: names in project repository containing `Ui`). Peers: uiSlice.selectUiSlice (invokeai/frontend/webv1/src/features/ui/store/uiSlice.ts:92); GalleryUiAdapter.GalleryUiAdapterProvider (invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:66); GenerationUiAdapter.GenerationUiAdapterProvider (invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:208); ModelsUiAdapter.ModelsUiAdapterProvider (invokeai/frontend/webv2/src/app/ModelsUiAdapter.tsx:9); QueueUiAdapter.QueueUiAdapterProvider (invokeai/frontend/webv2/src/app/QueueUiAdapter.tsx:67). Rename to `prepareLinearUiBatch`. [rule N6]
D21 · Naming Consistency· `openAPI` spells `API` where 34 names in the project spell it `Api` · ×1
`openAPI` spells `API` where 34 names in the project spell it `Api` invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:97— 34 of 36 names in project repository spell the token `Api` (34 of 36; unit: names in project repository containing `Api`). Peers: invokeai.frontend.webv1.src.features.controlLayers.components.StagingArea.state.StagingAreaApi (invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:93); CanvasManager.stateApi (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:56); invokeai.frontend.webv1.src.features.controlLayers.konva.CanvasStateApiModule.CanvasStateApiModule (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:68); state.useDeleteImageModalApi (invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts:173); state.useDeleteVideoModalApi (invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.ts:181). Rename to `openApi`. [rule N6]
D21 · Naming Consistency· `getGroupIDFromModelConfig` spells `ID` where 1981 names in the project spell it `Id` · ×1
`getGroupIDFromModelConfig` spells `ID` where 1981 names in the project spell it `Id` invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx:129— 1981 of 1986 names in project repository spell the token `Id` (1981 of 1986; unit: names in project repository containing `Id`). Peers: docs-page.isDocsPage(entryId) (docs/src/lib/docs-page.ts:10); docs-page.isLocalizablePage(entryId) (docs/src/lib/docs-page.ts:18); boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20). Rename to `getGroupIdFromModelConfig`. [rule N6]
D21 · Naming Consistency· `aspectRatioID` spells `ID` where 1981 names in the project spell it `Id` · ×1
`aspectRatioID` spells `ID` where 1981 names in the project spell it `Id` invokeai/frontend/webv1/src/features/settingsAccordions/components/ImageSettingsAccordion/GenerateTabImageSettingsAccordion.tsx:29— 1981 of 1986 names in project repository spell the token `Id` (1981 of 1986; unit: names in project repository containing `Id`). Peers: docs-page.isDocsPage(entryId) (docs/src/lib/docs-page.ts:10); docs-page.isLocalizablePage(entryId) (docs/src/lib/docs-page.ts:18); boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20). Rename to `aspectRatioId`. [rule N6]
D21 · Naming Consistency· `getInitialUIState` spells `UI` where 51 names in the project spell it `Ui` · ×1
`getInitialUIState` spells `UI` where 51 names in the project spell it `Ui` invokeai/frontend/webv1/src/features/ui/store/uiTypes.ts:29— 51 of 53 names in project repository spell the token `Ui` (51 of 53; unit: names in project repository containing `Ui`). Peers: uiSlice.selectUiSlice (invokeai/frontend/webv1/src/features/ui/store/uiSlice.ts:92); GalleryUiAdapter.GalleryUiAdapterProvider (invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:66); GenerationUiAdapter.GenerationUiAdapterProvider (invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:208); ModelsUiAdapter.ModelsUiAdapterProvider (invokeai/frontend/webv2/src/app/ModelsUiAdapter.tsx:9); QueueUiAdapter.QueueUiAdapterProvider (invokeai/frontend/webv2/src/app/QueueUiAdapter.tsx:67). Rename to `getInitialUiState`. [rule N6]
D21 · Naming Consistency· `isSdxlTrainingSize` spells `Sdxl` where 14 names in the project spell it `SDXL` · ×1
`isSdxlTrainingSize` spells `Sdxl` where 14 names in the project spell it `SDXL` invokeai/frontend/webv2/src/features/generation/core/canvas/canvasProcessingSize.ts:49— 14 of 15 names in project repository spell the token `SDXL` (14 of 15; unit: names in project repository containing `SDXL`). Peers: useGroupedModelCombobox.selectBaseWithSDXLFallback (invokeai/frontend/webv1/src/common/hooks/useGroupedModelCombobox.ts:34); paramsSlice.selectIsSDXL (invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1269); addSDXLLoRAs.addSDXLLoRAs (invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addSDXLLoRAs.ts:7); addSDXLRefiner.addSDXLRefiner (invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addSDXLRefiner.ts:9); buildSDXLGraph.buildSDXLGraph (invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:41). Rename to `isSDXLTrainingSize`. [rule N6]
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 495 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts, invokeai/app/util/controlnet_utils.py, invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts, invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx, invokeai/frontend/webv1/src/features/imageActions/actions.ts, invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/mobilenetv3.py, invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_common.py, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.ts (and 487 more) (518 orphaned of 2748 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; 2748 of the 4892 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.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No SAST REDACTED:29— No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 18 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
No dependency-update automation docs/package.json:20— `docs/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety REDACTED:255— Deployment is orchestrated by compose, and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no compose service declares a `healthcheck:` that uses them and nothing pins a previous image to fall back to — so a release that starts but does not serve looks healthy, and reversing it is a manual step.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Unused export 'setLoading' invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:181— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'selectIsAuthLoading' · ×1
Unused export 'selectIsAuthLoading' invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:207— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'selectDefaultControlAdapter' · ×1
Unused export 'selectDefaultControlAdapter' invokeai/frontend/webv1/src/features/controlLayers/hooks/addLayerHooks.ts:65— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'ModelIdentifier' · ×1
Unused export 'ModelIdentifier' invokeai/frontend/webv1/src/features/nodes/types/v2/common.ts:53— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useListGalleryItemsQuery' · ×1
Unused export 'useListGalleryItemsQuery' invokeai/frontend/webv1/src/services/api/endpoints/gallery.ts:71— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useChangeVideoIsIntermediateMutation' · ×1
Unused export 'useChangeVideoIsIntermediateMutation' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useDeleteVideoMutation' · ×1
Unused export 'useDeleteVideoMutation' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useDeleteVideosMutation' · ×1
Unused export 'useDeleteVideosMutation' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useGetVideoNamesQuery' · ×1
Unused export 'useGetVideoNamesQuery' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useListVideosQuery' · ×1
Unused export 'useListVideosQuery' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360— Nothing imports this binding — it is safe to review for removal.
Unused export 'getVideoDTO' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:385— Nothing imports this binding — it is safe to review for removal.
Unused export 'uploadVideo' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:395— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'VideoRecordChanges' · ×1
Unused export 'VideoRecordChanges' invokeai/frontend/webv1/src/services/api/types.ts:948— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'GalleryItemNamesResult' · ×1
Unused export 'GalleryItemNamesResult' invokeai/frontend/webv1/src/services/api/types.ts:983— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'OffsetPaginatedResults_GalleryItem_' · ×1
Unused export 'OffsetPaginatedResults_GalleryItem_' invokeai/frontend/webv1/src/services/api/types.ts:985— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'WCAG_RELEASE_TAGS' · ×1
Unused export 'WCAG_RELEASE_TAGS' invokeai/frontend/webv2/scripts/accessibility/axe.mjs:6— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'MAX_WILDCARD_VALUES' · ×1
Unused export 'MAX_WILDCARD_VALUES' invokeai/frontend/webv2/src/features/generation/core/dynamicPrompts.ts:252— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'LLMTaskCompleteEvent' · ×1
Unused export 'LLMTaskCompleteEvent' invokeai/frontend/webv2/src/features/generation/data/llmTaskProgress.ts:24— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'LLMTaskErrorEvent' · ×1
Unused export 'LLMTaskErrorEvent' invokeai/frontend/webv2/src/features/generation/data/llmTaskProgress.ts:26— Nothing imports this binding — it is safe to review for removal.
Unused export 'getKindTotal' invokeai/frontend/webv2/src/features/intermediates/core/types.ts:170— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'MainDefaultSettingsFormValues' · ×1
Unused export 'MainDefaultSettingsFormValues' invokeai/frontend/webv2/src/features/models/core/schemas.ts:49— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'LoraDefaultSettingsFormValues' · ×1
Unused export 'LoraDefaultSettingsFormValues' invokeai/frontend/webv2/src/features/models/core/schemas.ts:81— Nothing imports this binding — it is safe to review for removal.
Unused export 'useNodesUi' invokeai/frontend/webv2/src/features/nodes/ui/nodesUiStore.ts:106— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'ensureQueueLoaded' · ×1
Unused export 'ensureQueueLoaded' invokeai/frontend/webv2/src/features/queue/ui/queueDataStore.ts:119— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'createQueueRowsSelector' · ×1
Unused export 'createQueueRowsSelector' invokeai/frontend/webv2/src/features/queue/ui/queueViewModel.ts:31— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'getPendingQueueCount' · ×1
Unused export 'getPendingQueueCount' invokeai/frontend/webv2/src/features/queue/ui/queueViewModel.ts:40— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'getQueueActionState' · ×1
Unused export 'getQueueActionState' invokeai/frontend/webv2/src/features/queue/ui/queueViewModel.ts:81— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'areWorkflowPanelStatesEqual' · ×1
Unused export 'areWorkflowPanelStatesEqual' invokeai/frontend/webv2/src/features/workflow/ui/linear/WorkflowLinearPanel.tsx:56— Nothing imports this binding — it is safe to review for removal.
Unused export 'MAX_DEPTH' invokeai/frontend/webv2/src/platform/logging/normalize.ts:4— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'MAX_STRING_LENGTH' · ×1
Unused export 'MAX_STRING_LENGTH' invokeai/frontend/webv2/src/platform/logging/normalize.ts:6— Nothing imports this binding — it is safe to review for removal.
R8 · Dependency Hygiene· Type-only dependency 'chakra-react-select' in production deps · ×1
Type-only dependency 'chakra-react-select' in production deps invokeai/frontend/webv1/src/common/hooks/useGroupedModelCombobox.ts:4— Every import is type-only — move it to devDependencies.
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 19/40 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 — 3/5 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 (`!`) override strict null checking — ~1.6 `!` null assertions per 1k TypeScript source lines — 889 assertion(s) across the 553393 source line(s) of the 3366 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: invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts (61), invokeai/frontend/webv2/src/workbench/canvas-operations/legacyCanvasMetadata.ts (54), docs/src/lib/components/tour/workflow-demo-client.ts (32). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Hand-rolled JSON/XML parsing via regex invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:170— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:243— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:248— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:265— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdSerialization.browser.test.ts:199— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
doc comments repeat the names invokeai/frontend/webv1/src/app/logging/logger.ts:53— 30 of 382 documented parameters and 14 of 1428 summaries in `@invoke-ai/invoke-ai-ui` only repeat the member or parameter name (e.g. "The log level" for `logLevel`). 3 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.
doc comments repeat the names invokeai/frontend/webv2/src/features/generation/core/canvas/addControlLayers.ts:79— 0 of 0 documented parameters and 13 of 12386 summaries in `@invoke-ai/invoke-ai-webv2` only repeat the member or parameter name (e.g. "Options for ." for `AddControlLayersOptions`). Delete the restating tags, or add what the name does not say.
Outdated: diffusers — `diffusers` is pinned to 0.42.1, but 0.43.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.42.1 until the declaration is edited.
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 147 file(s) — `docs/src/config/head.ts`, `invokeai/frontend/webv1/src/app/hooks/useSyncFaviconQueueStatus.ts`, `invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx`, `invokeai/frontend/webv1/src/common/hooks/useAsyncState.ts`, `invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx`, … (+142 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 01a1e5bf-6750-7b71-a8c2-d3bf8227c71c · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 70 · Warnings: 4832 · Recommendations: 991 · Info: 7 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 16-11-2026 @ 19:04 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.