Public report of invoke-ai/InvokeAI, published 20 October 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.10.5). Watchdog 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, 20 October 2026, 18:43 UTC · Survey ID cd_454f3ff790ea4797a6fb6332931d117d
invoke-ai/InvokeAI
Measured 20 October 2026, 18:16 UTC, at code version 64acb44
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
Down 8 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: 658,433 lines of product code in 7 projects, tests not counted · Estimated rebuild effort: about 7.4 person-years · Weakest lens: Production Readiness, 31
Findings by how serious they are
53 critical4064 serious825 minor
11 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
20 October 2026, 18:16 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 Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
The score is deterministic, which means the same code always gets the same score. Watchdog works 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 ▸
88of 91 dimensions measured by tools. The other 3 are advisory notes from an AI model, which explain the code but don't count towards the score.
4917of 4942 findings point to an exact file and line, so you can open each one in the code. The other 25 concern the repository as a whole, such as missing documentation.
91dimensions across 7 lenses, read from 658,433 lines of product code in 7 projects.
invoke-ai/InvokeAI scores 36 out of 100 and is rated Weak, while five of its seven lenses score higher still: Performance at 85, rated Strong, Security and Compliance at 71 and Code Health at 60, both rated Adequate, and Accessibility at 43 and Maturity at 39, both rated Weak.
The score is lower than those five because the weakest lens counts most, and here that is Production Readiness, which scores 31 and is rated Weak. Its REDACTED Scanning dimension scores 0 out of 10, and until that reaches 4, Production Readiness can't be rated higher than Adequate. The first actions are to resolve the 2 Leaked secret finding(s) in REDACTED Scanning and to resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion, and if Production Readiness rose to 70, the score would rise from 36 to about 41.
53 findings are critical: 28 in Static Analysis (SAST), 17 in Knowledge Freshness, two in Dependency Vulnerabilities, two in REDACTED Scanning, one in Circular Imports, one in Keyboard semantics, one in Secrets (history) and one in Text alternatives.
Watchdog couldn't measure 8 dimensions in this code, among them Code Coverage, Test Reliability and Internal API Consistency, so they are left out of the score. The product code is 658,433 lines, which would take an estimated 7.4 person-years, around €1,100,000, to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 31 to 70, the lowest score rated Strong, the score would rise from 36 to about 41.
Code composition: what the lines of code are
Product code 57%Tests 43%
New since the last survey: 700 findings
These 700 critical or serious findings weren't in the previous survey, on 4 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Watchdog compares 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: 5036 findings
These 5036 critical or serious findings were in the previous survey, on 4 October 2026, and are gone from this one. The first 100 are listed here.
God Classes · FunctionTooLong: durableSyncedPersistence.createDurableSyncedWorkbenchPersistence invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts
God Classes · FunctionTooLong: workbenchState.__workbenchReducerInternal invokeai/frontend/webv2/src/workbench/workbenchState.ts
God Classes · FunctionTooLong: runtime.createQueueRuntime invokeai/frontend/webv2/src/features/queue/runtime.ts
God Classes · FunctionTooLong: LayerContextMenu.LayerMenu invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx
God Classes · FunctionTooLong: workbenchStore.createCommands invokeai/frontend/webv2/src/workbench/workbenchStore.ts
God Classes · FunctionTooLong: durableSyncedPersistence.createDurableSyncedWorkbenchPersistence.loadWorkbench invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts
God Classes · TooManyMethods: SqliteSessionQueue invokeai/app/services/session_queue/session_queue_sqlite.py
God Classes · FunctionTooLong: durableSyncedPersistence.createDurableSyncedWorkbenchPersistence.resolveConflictSaveAsNew invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts
God Classes · FileTooLong: session_queue/session_queue_sqlite.py invokeai/app/services/session_queue/session_queue_sqlite.py
God Classes · FunctionTooLong: durableSyncedPersistence.createDurableSyncedWorkbenchPersistence.pushStagedProject invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts
God Classes · FunctionTooLong: GalleryBoardsPanel.GalleryBoardsPanel invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx
Rebuild cost: about €1,100,000 · Estimate
Cost to rebuild
€360,000 to €1,800,000, for 5,983 to 18,982 hours of work, about 7.4 person-years for 4 to 15 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 36. 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: 658,433 lines of product code
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED.
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion.
Raises the score by about 3 points · Low effort · Project Cohesion
3
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Raises the score by about 2 points · Low effort · ADR Quality
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €1,100,000 to build again, about 7.4 person-years of work. Its weakest lens is Production Readiness, at 31 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 2 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 1,234,107 lines over the last 90 days, which is about 5,004,990 lines a year. At that pace, the extra work comes to an estimated 586.4 to 3518.6 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 Watchdog's 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; 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.
2278 modules, with 3712 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; 2238 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.
22→26 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.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.generation.core.types, so a change to frontend.webv2.src.features.generation.core.types can break frontend.webv2.src.workbench, while a change to frontend.webv2.src.workbench can't break frontend.webv2.src.features.generation.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.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.
4 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.render.layerCache uses a type in frontend.webv2.src.workbench.canvas-engine.render.raster.
frontend.webv2.src.workbench.canvas-engine.render.layerCache 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.layerCache, while a change to frontend.webv2.src.workbench.canvas-engine.render.layerCache can't break frontend.webv2.src.workbench.canvas-engine.render.raster.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.render.layerCache uses a module listed above it, which is the healthy direction.
4 pairs of types, where a type in frontend.webv2.src.workbench.canvas-engine.render.layerCache uses a type in frontend.webv2.src.features.generation.core.canvas.types.
frontend.webv2.src.workbench.canvas-engine.render.layerCache 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.layerCache, while a change to frontend.webv2.src.workbench.canvas-engine.render.layerCache can't break frontend.webv2.src.features.generation.core.canvas.types.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.render.layerCache 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.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.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.
27 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.
53 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.
app.services.shared.graph uses app.invocations.baseinvocation, so a change to app.invocations.baseinvocation can break app.services.shared.graph, while a change to app.services.shared.graph can't break app.invocations.baseinvocation.
Position
Below the diagonal: app.services.shared.graph 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.
4 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.
17 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.
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.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.
7 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.
8 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.layerCache.
frontend.webv2.src.workbench.canvas-engine.render uses frontend.webv2.src.workbench.canvas-engine.render.layerCache, so a change to frontend.webv2.src.workbench.canvas-engine.render.layerCache 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.layerCache.
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.
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.layerCache.
frontend.webv2.src.workbench.canvas-engine.tools.tool uses frontend.webv2.src.workbench.canvas-engine.render.layerCache, so a change to frontend.webv2.src.workbench.canvas-engine.render.layerCache 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.layerCache.
Position
Below the diagonal: frontend.webv2.src.workbench.canvas-engine.tools.tool uses a module listed above it, which is the healthy direction.
4 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.
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.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.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.
4 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.platform.state.accountLifecycle, so a change to frontend.webv2.src.platform.state.accountLifecycle can break frontend.webv2.src.workbench.widgets.canvas, while a change to frontend.webv2.src.workbench.widgets.canvas can't break frontend.webv2.src.platform.state.accountLifecycle.
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.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.
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.
1 pair of types, where a type in frontend.webv2.src.workbench.canvas-engine uses a type in frontend.webv2.src.workbench.canvas-engine.render.layerCache.
frontend.webv2.src.workbench.canvas-engine uses frontend.webv2.src.workbench.canvas-engine.render.layerCache, so a change to frontend.webv2.src.workbench.canvas-engine.render.layerCache 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.layerCache.
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 · 60% · 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
40
High / Critical
A03:2025 — Software Supply Chain Failures
23
High / Critical
A07:2025 — Authentication Failures
4
High / Critical
A02:2025 — Security Misconfiguration
3
Medium
Roadmap
Immediately resolve the two leaked secrets in REDACTED and REDACTED to eliminate critical exposure risks. Strengthen the build pipeline by integrating a SAST step that fails the build on security regressions, ensuring code quality is enforced before merge. Address architectural debt by fixing oversized project cohesion, establishing initial Architecture Decision Records, and correcting import boundary violations to maintain a clean, layered codebase.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED.
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.
Fix the listed violations: respect the layer/slice order — import only through a slice's public index and never upward into a higher layer (2139 rows).
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 — 53
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 — 4064
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 — 825
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 11
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog 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. 88 of 91 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 3 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three 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; ◐ Advisory — an LLM prose judgement. 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; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 91 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, 4917 of 4942 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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 — Watchdog 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 97.8% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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 13,812 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 847 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 — Watchdog 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 included — the JavaScript/TypeScript suite (node:test via `pnpm install --frozen-lockfile --ignore-scripts` in docs/ (16 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/ (10864 tests)) did not finish re-running within its budget: too large to re-run within its budget.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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.
D22 Internal API Consistency — not measured this run — Watchdog 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.
D27 Navigability — not measured this run — Watchdog 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.
D31 IaC & Container Security — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog 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`, … (+121 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 — Watchdog measured this, but not all of it. What it 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. 93 further occurrence(s) are not listed individually; the score already reflects all 133.
AX1 Captive dependencies — not measured this run — Watchdog 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/app/services/shared/sqlite_migrator/sqlite_migrator_common.py, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX7 Slice cohesion — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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 — Watchdog 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-10-20T18:21:00Z" 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 — Watchdog 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.
M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 221 further occurrence(s) are not listed individually; the score already reflects all 261.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 1551 further occurrence(s) are not listed individually; the score already reflects all 1591.
R11 Import Boundaries — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 2100 further occurrence(s) are not listed individually; the score already reflects all 2140.
R3 Large Files — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 172 further occurrence(s) are not listed individually; the score already reflects all 212.
R4 Test Coverage — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 940 further occurrence(s) are not listed individually; the score already reflects all 980.
R7 Dead Code — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 53 further occurrence(s) are not listed individually; the score already reflects all 93.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 211 further occurrence(s) are not listed individually; the score already reflects all 251.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 231 further occurrence(s) are not listed individually; the score already reflects all 271.
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
Watchdog assesses the repository exactly as committed, and only the repository. By design it does 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.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
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 is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
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.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
C4 Data Retention: This control is scored from in-repo evidence only — its real-world effectiveness, exercised only at runtime, is outside a static scan.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
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.
The LLM boundary
LLM-set scores this run (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
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.
735 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was mock-backend.startMockBackend.server at 523. A further 18 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 40 — 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 40), 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/webv2/src/features/queue/data/submissionApi.ts (submissionApi.mapEnqueueResult at 21), invokeai/frontend/webv1/src/features/parameters/util/optimalDimension.ts (optimalDimension.getGridSize at 17). 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.
+ 722 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 523), workbenchState.__workbenchReducerInternal (cyclomatic 384), 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.9 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 982 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 21 bodies over 120 down to 120 or less in Cognitive Complexity — start with mock-backend.startMockBackend.server (cognitive 888), modelSelected.addModelSelectedListener (cognitive 565), workbenchState.__workbenchReducerInternal (cognitive 460). — 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 21 together lifts Cognitive Complexity from 2.0 to about 3.9/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes6.6 / 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 350 FunctionTooLong finding(s) in God Classes — start with graph.ts (5), runtime.ts (3), UserManagement.tsx (3). — One of this dimension's main actionable groups (350 warning-level).
Resolve the 157 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 (157 warning-level).
Resolve the 20 TooManyMethods finding(s) in God Classes — start with model_install_default.py, graph_materializer.py, session_queue_default.py. — One of this dimension's main actionable groups (20 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
464 duplicated block group(s) detected. A further 33 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 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.
+ 174 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), images.py (2), user_management.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), model.py (2), flux.py (2). — One of this dimension's main actionable groups (26 warning-level).
Resolve the 25 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with child.py (3), color_conversion.py (3), utilities.py (2). — One of this dimension's main actionable groups (25 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · 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).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
23299 test methods: 23299 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 13812 `it`/`test` case(s) across 1168 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 9487 test function(s) across 754 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality9.9 / 10Stronggated by 88 serious findings✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
3 skipped (3 with a documented reason), 86 zero-assertion, 2 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 13812 tests. Measured on the JavaScript/TypeScript suite only — at least 847 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: FilterType · ×86invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:35
Fixed-sleep synchronisation: waits for a held lock until its holder lets it go, and stops waiting once aborted · ×2invokeai/frontend/webv2/src/platform/browser/webLocks.browser.test.ts:43
Mock-dominated test: waits for media-cookie refreshes before logging out · ×176invokeai/frontend/webv1/src/features/auth/store/logoutAfterServerConfirmation.test.ts:23
Resolve the 176 Mock-dominated test finding(s) in Test Quality — start with runtime.test.ts (49), onInvocationComplete.test.ts (18), canvasHeaderCommands.test.ts (10). — One of this dimension's main actionable groups (176 recommendation-level).
Resolve the 86 No assertions finding(s) in Test Quality — start with PreferencesPage.browser.test.tsx (10), types.test.ts (8), compositeGolden.browser.test.ts (8). — One of this dimension's main actionable groups (86 warning-level).
Resolve the 2 Fixed-sleep synchronisation finding(s) in Test Quality — start with webLocks.browser.test.ts, engine.mask.test.ts. — One of this dimension's main actionable groups (2 warning-level).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
0 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.
What to do
Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Enforce REDACTED Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 63 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` (57 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 (118×384=45312); invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts (78×283=22074); invokeai/frontend/webv2/scripts/mock-backend.mjs (35×523=18305) Repeated repair below the complexity floor: invokeai/backend/util/vae_working_memory.py (15 of 29 changes were fixes); invokeai/backend/quantization/fp8_scaled.py (14 of 20 changes were fixes); invokeai/backend/model_manager/load/model_loaders/anima.py (10 of 18 changes were fixes)
Resolve the 362 Hotspot finding(s) in Churn × Complexity Hotspots — start with settings.ts (4), denoise.py (3), graph.ts (2). — One of this dimension's main actionable groups (362 warning-level).
Resolve the 66 Repeated repair finding(s) in Churn × Complexity Hotspots — start with rocm_causal_conv3d.py (2), promptTemplates.ts (2), api.ts (2). — One of this dimension's main actionable groups (66 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.3 / 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.
870 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 2366 of the 4522 production source files in this repository: 2119 are under the ~2,400-byte size floor this dimension measures over, and the remaining 37 have no attributable history left to measure.
Off-boarding risk: anonymized user #1 · ×7
Further sole-owners (lower concentration)
What to do
Resolve the 7 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (7 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.
309 deducted task-comment markers across 649459 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 269 TodoComment finding(s) in Explicit Debt — start with new_architecture.py (9), diffusers_pipeline.py (8), graph_validation.py (7). — One of this dimension's main actionable groups (269 warning-level).
Resolve the 30 HackComment finding(s) in Explicit Debt — start with flux.py (4), denoise_latents.py (2), ip_adapter.py (2). — One of this dimension's main actionable groups (30 warning-level).
Resolve the 10 FixmeComment finding(s) in Explicit Debt — start with onnx_runtime.py (4), denoise_latents.py (3), image_to_latents.py. — One of this dimension's main actionable groups (10 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The repository's README files are well organized with each directory's own focused README describing what it contains and how to use its contents. The architecture/design docs (12 markdown files) cover the project's internal structure, modules, and design rationale in depth, giving a clear architectural overview. All documents are clipped by the scanner; no section is missing from the outline despite visible truncation. This README documents the webv2 src/features/intermediates directory (a Settings-section metadata manager for temporary media transport mapping, account-fenced query keys, selection core, confirmation dialog, operation panel) and its policy-lease model with a browser hold lease, workbench projects scan, undo-state registration, and server-side cleanup decision making. It is an internal features README rather than the repository root, so it does not describe the project as a whole or provide installation/usage guidance for readers outside this directory; the outline lists Intermediates but no overview, installation, or contribution sections. (11 of 25 sampled documents could not be assessed: 1 of 3 evaluation groups failed.)
What to do
Improve Documentation Quality — currently 8.9/10. — The repository's README files are well organized with each directory's own focused README describing what it contains and how to use its contents. The architecture/design docs (12 markdown files) cover the project's internal structure, modules, and design rationale in depth, giving a clear architectural overview. All documents are clipped by the scanner; no section is missing from the outline despite visible truncation. This README documents the webv2 src/features/intermediates directory (a Settings-section metadata manager for temporary media transport mapping, account-fenced query keys, selection core, confirmation dialog, operation panel) and its policy-lease model with a browser hold lease, workbench projects scan, undo-state registration, and server-side cleanup decision making. It is an internal features README rather than the repository root, so it does not describe the project as a whole or provide installation/usage guidance for readers outside this directory; the outline lists Intermediates but no overview, installation, or contribution sections. (11 of 25 sampled documents could not be assessed: 1 of 3 evaluation groups failed.)
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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
3 of 7 build units (Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
42 finding(s): 0 critical, 29 high, 12 medium, 1 low. 20 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 166 file(s) — `REDACTED` (line 105, line 106), `docs/invoke-config.json`, `docs/src/config/head.ts` (line 74, line 76), `invokeai/frontend/webv1/src/app/hooks/useSyncFaviconQueueStatus.ts` (line 19), `invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx` (line 619, line 953, line 1072, …), … (+161 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 4 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 20 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 (22 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.
Resolve the 14 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (8), REDACTED (5), REDACTED. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 3 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (3). — One of this dimension's main actionable groups (3 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.
444 of 2403 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 2403 of the 4522 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 17 Orphaned knowledge finding(s) in Knowledge Freshness — start with gen_efficientnet.py, images.ts, CanvasSegmentAnythingModule.ts. — One of this dimension's main actionable groups (17 issue-level).
Resolve the 427 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 (427 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), GalleryViewTabs.tsx (2). — One of this dimension's main actionable groups (53 warning-level).
Resolve the 9 Change-coupling hub finding(s) in Change Coupling — start with canvas-tab-auto-layout.tsx, flux_denoise.py, engine.ts. — One of this dimension's main actionable groups (9 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. Scored 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. SCORED, not informational.
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 alternatives5.0 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×4) — invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421, invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:102, invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:103, …
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
Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:894
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.3 / 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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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. (×27) — invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:797, invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:387, invokeai/frontend/webv1/src/features/controlLayers/components/ControlLayer/ControlLayerControlAdapterControlMode.tsx:49, …
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. (×7) — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:224, invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/CanvasWorkflowIntegrationWorkflowSelector.tsx:77, invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:309, …
This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). 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. (×6) — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarCompositeOperation.tsx:63, invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:372, invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectModel.tsx:25, …
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
`.site-title` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/src/styles/custom.css:50
`.sl-link-button` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/src/styles/custom.css:309
`.splash-img::before` moves (`animation: splash-animate 6s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/src/styles/custom.css:401
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
Accessibility checks run in tests (Verified) but aren't gated in CI — run the suite that holds those checks in your pipeline so an accessibility regression blocks the merge (Prevented). What was searched, so you can tell an absence from a miss: the 1502 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Accessibility linting is already configured — run the suite that already asserts accessibility in CI so a regression blocks the merge.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`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:63
`GalleryActions` declares 25 required operations: `archiveBoard`, `createBoard`, `deleteBoard`, `downloadBoard`, `exportProject`, `loadMore`, `moveBoard`, `refresh`, `renameBoard`, `setBoardGeneralAccess`, `selectBoard`, `selectItem`, `selectItemRange`, `setCompareItem`, `setSearchTerm`, `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:22
`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:344
`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 29 required operations: `acknowledgeProjectResolution`, `abortProjectResolution`, `adoptProjectRecord`, `clearWorkbench`, `close`, `deleteRecoverableDraft`, `deleteProjectOnServer`, `ensureProjectOnServer`, `flushProjectToServer`, `getProjectDraftDocument`, `getRecoverableDraftDocument`, `hasClosedSession`, `journalBeforeUnload`, `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:508
`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 31 required operations: `reorder`, `duplicate`, `mergeSelected`, `group`, `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:141
`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 24 required operations: `applyTransform`, `booleanMergeRasterLayers`, `cancelTextEdit`, `cancelTransform`, `clearMask`, `commitLayerConversion`, `commitLayerCopy`, `commitMaskImageResult`, `commitOpenTextSession`, `commitRasterFilterResult`, `commitTextEdit`, `copyLayerToRaster`, `cropLayerToBbox`, `duplicateLayers`, `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:579
`CanvasApplicationHost` declares 27 required operations: `captureGuard`, `clearFilterPreview`, `clearSamPreview`, `commitFilter`, `commitGenerated`, `commitMask`, `decodeSelectObjectPreview`, `encodeSurface`, `exportBakedLayerBlob`, `exportLayerPixels`, `getCompositeExecutorDeps`, `getDocument`, `isGuardCurrent`, `isInteractionLocked`, `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:35
`CanvasOperationCapability` declares 22 required operations: `composeForGeneration`, `uploadIntermediate`, `getOperationState`, `subscribeOperation`, `getFilterSessionState`, `subscribeFilterSession`, `getSamSessionState`, `subscribeSamSession`, `startSelectObject`, `startFilterOperation`, `updateFilterOperation`, `setFilterOperationAutoProcess`, `processFilterOperation`, `resetFilterOperation`, `commitFilterOperation`, `cancelFilterOperation`, `updateSelectObjectSession`, `processSelectObjectSession`, `applySelectObjectSession`, `saveSelectObjectSession`, `resetSelectObjectSession`, `cancelSelectObjectSession`. 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:59
`CanvasSelectObjectCoordinatorDeps` declares 20 required operations: `isInteractionLocked`, `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:194
`ImageActions` declares 23 required operations: `copyImage`, `createCanvasFromImages`, `deleteImages`, `deriveImageRecallCapabilities`, `downloadImage`, `downloadImages`, `getImageRecallCapabilities`, `loadImageWorkflow`, `getVideoRecallCapabilities`, `hasVideoWorkflow`, `loadVideoWorkflow`, `moveImagesToBoard`, `openImageInPreview`, `recallImageData`, `recallVideoData`, `sendToInitialVideo`, `savePromptAsTemplate`, `selectForCompare`, `sendToCanvas`, `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:103
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 · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Do you agree with this assessment?
C4 · Data Retention5.0 / 10Adequate✓ Tool-verified
Other · Security — Whether data has a defined lifetime — retention periods, TTLs, cleanup jobs (storage limitation).
Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.
A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept, a scheduled purge / cleanup job (a Celery beat task, APScheduler job or management command that deletes rows past their retention — Session.objects.filter(created__lt=cutoff).delete(), purge_expired… / delete_old…).
What to do
Complete the data-lifecycle story: an expiry limit (a declared maximum age for the stored data — a retention-age setting, or a store-level TTL where your storage offers one), a scheduled purge/cleanup job that enforces it, and a documented retention period covering the personal data.
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
`focusAdjacentRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:358
`focusFloating` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:359
`focusRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:360
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 repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 2 of 5 project(s) that lack one — worth up to 0.8 pts.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
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 repo is organised deliberately — src/test separation and consistent project naming.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
What to do
Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
invokeai/backend/ip_adapter/README.md names `image_encoder.txt`, but no file or folder `image_encoder.txt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — invokeai/backend/ip_adapter/README.md:20
docs/src/content/docs/index.mdx links to `/start-here/installation/`, but `start-here/installation` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/index.mdx:86
docs/src/content/docs/index.mdx links to `/configuration/docker/`, but `configuration/docker` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/index.mdx:86
docs/src/content/docs/index.mdx links to `/start-here/manual/`, but `start-here/manual` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/index.mdx:86
docs/src/content/docs/index.mdx links to `/troubleshooting/faq/`, but `troubleshooting/faq` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/index.mdx:102
docs/src/content/docs/index.mdx links to `/contributing/contributors/`, but `contributing/contributors` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/index.mdx:108
docs/src/content/docs/index.mdx links to `/contributing/`, but `contributing` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/index.mdx:108
docs/src/content/docs/configuration/01.invokeai-yaml.mdx links to `/users-guide/gallery/image-storage-maintenance/`, but `users-guide/gallery/image-storage-maintenance` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/configuration/01.invokeai-yaml.mdx:215
docs/src/content/docs/configuration/01.invokeai-yaml.mdx links to `/configuration/external-database/`, but `configuration/external-database` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/configuration/01.invokeai-yaml.mdx:252
docs/src/content/docs/configuration/01.invokeai-yaml.mdx links to `/configuration/optimization/low-vram-mode/`, but `configuration/optimization/low-vram-mode` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/configuration/01.invokeai-yaml.mdx:362
docs/src/content/docs/configuration/02.docker.mdx links to `/configuration/invokeai-yaml/`, but `configuration/invokeai-yaml` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/configuration/02.docker.mdx:58
docs/src/content/docs/configuration/02.docker.mdx names `build.sh`, but no file or folder `build.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/configuration/02.docker.mdx:77
docs/src/content/docs/contributing/external-providers.md names `invokeai/backend/model_manager/starter_models.py`, but no file or folder `invokeai/backend/model_manager/starter_models.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/external-providers.md:13
docs/src/content/docs/contributing/index.md links to `/development/`, but `development` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:13
docs/src/content/docs/contributing/index.md links to `/contributing/new-contributor-guide/`, but `contributing/new-contributor-guide` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:15
docs/src/content/docs/contributing/index.md links to `/development/guides/creating-nodes/`, but `development/guides/creating-nodes` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:19
docs/src/content/docs/contributing/index.md links to `/contributing/`, but `contributing` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:29
docs/src/content/docs/contributing/index.md links to `/contributing/translations/`, but `contributing/translations` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:33
docs/src/content/docs/contributing/index.md links to `/contributing/contributors/`, but `contributing/contributors` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:41
docs/src/content/docs/contributing/index.md links to `/contributing/code-of-conduct/`, but `contributing/code-of-conduct` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/index.md:45
docs/src/content/docs/contributing/new-contributor-guide.mdx links to `/development/`, but `development` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-contributor-guide.mdx:15
docs/src/content/docs/contributing/new-contributor-guide.mdx links to `/development/setup/dev-environment/`, but `development/setup/dev-environment` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-contributor-guide.mdx:32
docs/src/content/docs/contributing/new-model-integration.mdx names `architectures/defs/new_model.py`, but no file or folder `architectures/defs/new_model.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:47
docs/src/content/docs/contributing/new-model-integration.mdx names `app/invocations/new_model/__init__.py`, but no file or folder `app/invocations/new_model/__init__.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:48
docs/src/content/docs/contributing/new-model-integration.mdx names `starter_models/new_model.py`, but no file or folder `starter_models/new_model.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:49
docs/src/content/docs/contributing/new-model-integration.mdx names `tests/backend/model_manager/load/test_diffusers_0XX_compatibility.py`, but no file or folder `tests/backend/model_manager/load/test_diffusers_0XX_compatibility.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:75
docs/src/content/docs/contributing/new-model-integration.mdx names `invokeai/backend/architectures/defs/new_model.py`, but no file or folder `invokeai/backend/architectures/defs/new_model.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:148
docs/src/content/docs/contributing/new-model-integration.mdx links to `/users-guide/models/model-format-support/`, but `users-guide/models/model-format-support` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:443
docs/src/content/docs/contributing/new-model-integration.mdx names `invokeai/app/invocations/new_model/`, but no file or folder `invokeai/app/invocations/new_model` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:491
docs/src/content/docs/contributing/new-model-integration.mdx names `new_model_denoise.py`, but no file or folder `new_model_denoise.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:499
docs/src/content/docs/contributing/new-model-integration.mdx names `text_encoder/new_model_text_encoder.py`, but no file or folder `text_encoder/new_model_text_encoder.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:542
docs/src/content/docs/contributing/new-model-integration.mdx names `vae/new_model_image_to_latents.py`, but no file or folder `vae/new_model_image_to_latents.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:606
docs/src/content/docs/contributing/new-model-integration.mdx names `vae/new_model_latents_to_image.py`, but no file or folder `vae/new_model_latents_to_image.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:606
docs/src/content/docs/contributing/new-model-integration.mdx links to `/development/architecture/model-manager/`, but `development/architecture/model-manager` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:608
docs/src/content/docs/contributing/new-model-integration.mdx names `invocations/new_model/`, but no file or folder `invocations/new_model` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:616
docs/src/content/docs/contributing/new-model-integration.mdx names `invokeai/backend/new_model/`, but no file or folder `invokeai/backend/new_model` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/contributing/new-model-integration.mdx:627
docs/src/content/docs/start-here/system-requirements.mdx links to `../manual`, but `docs/src/content/docs/manual` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/start-here/system-requirements.mdx:19
docs/src/content/docs/start-here/system-requirements.mdx links to `/users-guide/models/local-models/ideogram4/`, but `users-guide/models/local-models/ideogram4` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/start-here/system-requirements.mdx:36
docs/src/content/docs/start-here/system-requirements.mdx links to `/users-guide/models/local-models/qwen-image-2-1/`, but `users-guide/models/local-models/qwen-image-2-1` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/start-here/system-requirements.mdx:37
docs/src/content/docs/start-here/system-requirements.mdx links to `../installation`, but `docs/src/content/docs/installation` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/src/content/docs/start-here/system-requirements.mdx:49
What to do
Reconcile the README with reality: invokeai/backend/ip_adapter/README.md names `image_encoder.txt`, but no file or folder `image_encoder.txt` exists; docs/src/content/docs/index.mdx links to `/start-here/installation/`, but `start-here/installation` does not exist; docs/src/content/docs/index.mdx links to `/configuration/docker/`, but `configuration/docker` does not exist; docs/src/content/docs/index.mdx links to `/start-here/manual/`, but `start-here/manual` does not exist; docs/src/content/docs/index.mdx links to `/troubleshooting/faq/`, but `troubleshooting/faq` does not exist.
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 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/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/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/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/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/webv2/src/workbench/canvas-engine/engine.ts` reports through `console.*` at line 2504 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:2504
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.
Consider OpenTelemetry tracing/metrics (opentelemetry-sdk) and a health-check endpoint (a /health route) for operability.
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 73791 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.
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.
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.
`urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — scripts/check_classifiers.py:21
`requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — scripts/get_external_contributions.py:50, scripts/get_external_contributions.py:61
What to do
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
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/database/copy.py:213, invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_impl.py:526
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 the language 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. — invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:180
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.
What to do
Migrate the remaining .js/.jsx files to TypeScript.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
222 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 115 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 222 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 222 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 222 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
160 duplicated blocks under invokeai/frontend/webv2/src/ have copies in at least two of the sibling directories app, features, platform, workbench — 56 of them are reported below, and 104 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 160 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 160 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 160 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:202
89 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) — 44 of them are reported below, and 45 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 89 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 89 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 89 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/data/modelsStore.ts:51
64 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) — 29 of them are reported below, and 35 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 64 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 64 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 64 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/launchpad/HelpMenu.tsx:73
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
52 duplicated blocks under invokeai/frontend/ have copies in at least two of the sibling directories webv1, webv2 — 26 of them are reported below, and 26 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 52 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 52 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 52 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
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
16 duplicated blocks under invokeai/frontend/webv2/src/workbench/widgets/ have copies in at least two of the sibling directories autosave-status, canvas, gallery, generate, image-map, layers (+6 more sibling(s) not listed) — 5 of them are reported below, and 11 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 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 16 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:71
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
8 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, library, manager (+1 more sibling(s) not listed) — 4 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 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 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 8 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
8 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, math, render (+2 more sibling(s) not listed) — 6 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 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 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 8 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/render/layerDisplayEffect.ts:28
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
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
5 duplicated blocks under invokeai/frontend/webv2/ have copies in at least two of the sibling directories scripts, src — 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/webv2/scripts/write-workbench-ownership-inventory.mjs:62
5 duplicated blocks under invokeai/frontend/webv2/src/features/workflow/ have copies in at least two of the sibling directories core, data, ui — 3 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 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/webv2/src/features/workflow/core/buildGraph.ts:403
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/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/features/workflow/ui/library/ProjectWorkflowsView.tsx:256 · invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:329 — the two spans are one implementation copied and then locally edited — 834 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/workflow/ui/library/ProjectWorkflowsView.tsx:256
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:52 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:41 — the two spans are one implementation copied and then locally edited — 1011 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:52
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/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:134 · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:136 — the two spans are one implementation copied and then locally edited — 626 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:134
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/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/features/identity/ui/ProfileDialog.tsx:78 · invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:112 — the two spans are one implementation copied and then locally edited — 628 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:78
invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515 · invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1293 — the two spans are one implementation copied and then locally edited — 689 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/webv1/src/features/queue/store/readiness.ts:515
invokeai/frontend/webv1/src/features/prompt/ExpandPromptButton.tsx:126 · invokeai/frontend/webv1/src/features/prompt/ImageToPromptButton.tsx:96 — the two spans are one implementation copied and then locally edited — 429 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/prompt/ExpandPromptButton.tsx:126
invokeai/frontend/webv1/src/common/components/ColorPicker/RgbColorPicker.tsx:10 · invokeai/frontend/webv1/src/common/components/ColorPicker/RgbaColorPicker.tsx:10 — the two spans are one implementation copied and then locally edited — 536 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/common/components/ColorPicker/RgbColorPicker.tsx:10
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:16 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:16
invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:4 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:4
invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:38 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:38
invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:2
invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:6 imports invokeai/frontend/webv1/src/features/toast/toast.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:6
invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:22 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:22
invokeai/frontend/webv1/src/features/auth/hooks/useIsAdmin.ts:1 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/hooks/useIsAdmin.ts:1
invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:1 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:1
invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:4 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:4
invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:6 imports invokeai/frontend/webv1/src/features/auth/store/authSlice.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:6
invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:7 imports invokeai/frontend/webv1/src/features/auth/store/authTokenRefresh.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:7
invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:16 imports invokeai/frontend/webv1/src/features/gallery/store/gallerySelectors.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:16
invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:17 imports invokeai/frontend/webv1/src/features/toast/toast.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:17
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:3 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:3
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:5 imports invokeai/frontend/webv1/src/features/system/store/systemSlice.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:5
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsPreserveMask.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsPreserveMask.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSaveAllImagesToGallery.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSaveAllImagesToGallery.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSelectedEntityStatus.tsx:5 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSelectedEntityStatus.tsx:5
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAutoProcessSwitch.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAutoProcessSwitch.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasContextMenu/CanvasContextMenuSelectedEntityMenuItems.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasContextMenu/CanvasContextMenuSelectedEntityMenuItems.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:4 imports invokeai/frontend/webv1/src/features/dnd/dnd.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:4
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:5 imports invokeai/frontend/webv1/src/features/dnd/DndDropTarget.tsx against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:5
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:3 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:3
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:8 imports invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:8
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:5 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:5
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:18 imports invokeai/frontend/webv1/src/features/dnd/dnd.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:18
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:19 imports invokeai/frontend/webv1/src/features/dnd/util.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:19
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarCompositeOperation.tsx:3 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarCompositeOperation.tsx:3
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarDuplicateButton.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarDuplicateButton.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarFill.tsx:11 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarFill.tsx:11
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarFilterButton.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarFilterButton.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarInvertMaskButton.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarInvertMaskButton.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarOpacity.tsx:18 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarOpacity.tsx:18
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarSaveToAssetsButton.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarSaveToAssetsButton.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarSelectObjectButton.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarSelectObjectButton.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarTransformButton.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarTransformButton.tsx:2
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:5 imports invokeai/frontend/webv1/src/features/dnd/dnd.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:5
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:6 imports invokeai/frontend/webv1/src/features/dnd/types.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:6
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:7 imports invokeai/frontend/webv1/src/features/dnd/util.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:7
invokeai/frontend/webv1/src/features/controlLayers/components/CanvasLayersPanelContent.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasLayersPanelContent.tsx:2
What to do
Fix the listed violations: respect the layer/slice order — import only through a slice's public index and never upward into a higher layer (2139 rows).
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 586 and cognitive complexity 957; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:937
(anonymous) has cyclomatic complexity 241 and cognitive complexity 183; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:3894
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 111 and cognitive complexity 147; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:497
(anonymous) has cyclomatic complexity 102 and cognitive complexity 126; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:2291
GalleryImageGrid has cyclomatic complexity 97 and cognitive complexity 86; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:404
(anonymous) has cyclomatic complexity 95 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/widgets/canvas/canvasHotkeyCommands.ts:120
(anonymous) has cyclomatic complexity 94 and cognitive complexity 159; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:197
(anonymous) has cyclomatic complexity 94 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:17
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 89 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:295
VideoWidgetView has cyclomatic complexity 83 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/features/video/ui/VideoWidgetView.tsx:122
(anonymous) has cyclomatic complexity 81 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:3555
(anonymous) has cyclomatic complexity 73 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/image-actions/executeVideoRecall.ts:194
(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:907
(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 90; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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:1972
(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
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files7.3 / 10Strong✓ 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 5287 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 3700 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/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/workbench/canvas-engine/engine.ts has 2790 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/webv2/src/features/queue/runtime.ts has 2388 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 2277 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/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/workflow/ui/fields/WorkflowFieldInput.tsx has 1961 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/webv2/src/features/gallery/ui/GalleryImageGrid.tsx has 1927 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/features/generation/core/baseGenerationPolicies.ts has 1625 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/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/features/generation/core/graph.ts has 1554 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/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/workbench/canvas-engine/document-model/documentModel.ts has 1527 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/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
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
REDACTED has 1391 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/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/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/platform/ui/theme/recipes.ts has 1333 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/widgets/layers/LayerContextMenu.tsx has 1316 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/webv2/src/workbench/widgets/layers/LayersTree.tsx has 1278 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/workflow/ui/editor/WorkflowEditorView.tsx has 1234 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/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/image-actions/imageRecall.ts has 1162 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/image-actions/useImageActions.ts has 1113 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/webv1/src/services/api/endpoints/images.ts has 1108 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/services/api/endpoints/images.ts:1
invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts has 1105 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/workbench/image-actions/ImageContextMenu.tsx has 1086 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/ImageContextMenu.tsx:1
invokeai/frontend/webv2/src/features/workflow/core/document.ts has 1081 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/core/document.ts:1
invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts has 1067 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/CanvasEntity/CanvasEntityTransformer.ts:1
invokeai/frontend/webv2/src/features/video/core/graph.ts has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/video/core/graph.ts:1
invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx has 1041 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/webv1/src/common/components/Picker/Picker.tsx has 1033 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/common/components/Picker/Picker.tsx:1
invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts has 1019 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/nodesSlice.ts:1
invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:1
invokeai/frontend/webv2/src/features/upscale/core/settings.ts has 1004 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/webv2/src/features/video/core/settings.ts has 991 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/settings.ts: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 Coverage6.7 / 10Adequate✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×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.
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 370 application, 17 tooling and 1194 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 (370 application, 17 tooling, 1194 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 (×7) — invokeai/frontend/webv1/src/features/nodes/types/common.test-d.ts, invokeai/frontend/webv2/src/workbench/workbenchAggregateInterface.type-test.ts, invokeai/frontend/webv1/src/features/nodes/types/workflow.test-d.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, …
Nothing ultimately consumes this binding: its only referrer is the re-export in invokeai/frontend/webv2/src/features/queue/react.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in invokeai/frontend/webv2/src/features/queue/react.ts in the same commit, or the barrel will import a name that no longer exists. — invokeai/frontend/webv2/src/features/queue/data/activeProgressTargetStore.ts:103
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.
invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx → invokeai/frontend/webv2/src/workbench/workbenchStore.ts → invokeai/frontend/webv2/src/workbench/layoutPresetActivation.ts → invokeai/frontend/webv2/src/workbench/widgetRegistry.ts → invokeai/frontend/webv2/src/workbench/widgets/manifests.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/manifest.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/implementation.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/AutosaveStatusWidgetView.tsx → invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx (one verified cycle inside a mutually-dependent group of 155 files) — invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx:37
What to do
Break each cycle by extracting the shared piece into a module both sides can import.
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.
`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
`header_len` is read from the bytes being parsed at line 172 (`struct.unpack("<Q")`), then passed as the size of `read` at line 173 — 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:173
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.7 / 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.
`load_execution_state` is public, takes a document from its caller (line 172) and hands it to `_normalize_persisted_effects_in_snapshot`, which calls itself at line 168 (`_normalize_persisted_effects_in_snapshot`) with a piece of `payload` — and nowhere in `_normalize_persisted_effects_in_snapshot` 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_effects_in_snapshot` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/services/shared/execution_state_migration.py:168
`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
`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
`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
`collectGraphInputMediaNames` is exported, takes a document from its caller (line 12) and hands it to `visit`, which calls itself at line 19 (`visit`) with a piece of `value` (and at line 37) — 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:19
`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
`isWorkflowContentEquivalent` is exported, takes a document from its caller (line 100) and hands it to `canonicalize`, which calls itself at line 85 (`canonicalize`) with a piece of `value` (and at line 92) — 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:85
`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
`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
`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
`stripInstallationState` is exported, takes a document from its caller (line 264) and hands it to `mapDocument`, which calls itself at line 223 (`mapDocument`) with a piece of `node` (and at line 244) — 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:223
`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
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 7), and its declared type `BitmapStore` is an interface — yet this class disposes it here (line 20). 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:20
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 14/28 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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.
`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
`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/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:79, invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:167
`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
`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
`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/run-project-file-journey.mjs:51, REDACTED:20, invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:113
`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 })`. — invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:116
`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 })`. — invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:280
`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:70
`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:328
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 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
`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
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.0 / 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.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×25) — invokeai/app/api/dependencies.py:92, invokeai/app/api/routers/utilities.py:151, invokeai/app/api/routers/model_manager.py:1714, …
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. (×15) — invokeai/app/api/routers/videos.py:563, invokeai/app/api/routers/videos.py:567, invokeai/app/invocations/video_frame_extract_range.py:347, …
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`warning` at line 135 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api_app.py:135
`warning` at line 848 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api_app.py:848
`debug` at line 69 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/extract_metadata.py:69
`debug` at line 118 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/extract_metadata.py:118
`debug` at line 157 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/extract_metadata.py:157
`info` at line 121 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/dependencies.py:121
`info` at line 122 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/dependencies.py:122
`error` at line 546 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/routers/utilities.py:546
`error` at line 662 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/api/routers/utilities.py:662
`warning` at line 61 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/invocations/load_custom_nodes.py:61
`info` at line 64 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/invocations/load_custom_nodes.py:64
`error` at line 75 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/invocations/load_custom_nodes.py:75
`info` at line 81 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/invocations/load_custom_nodes.py:81
`error` at line 52 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/events/events_fastapievents.py:52
`warning` at line 597 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:597
`warning` at line 632 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:632
`warning` at line 821 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:821
`info` at line 924 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:924
`info` at line 1028 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1028
`info` at line 1324 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1324
`warning` at line 1345 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1345
`info` at line 1350 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1350
`warning` at line 1367 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1367
`exception` at line 1378 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1378
`error` at line 1383 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1383
`warning` at line 1400 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1400
`exception` at line 1432 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1432
`warning` at line 1511 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1511
`exception` at line 1593 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1593
`exception` at line 1634 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1634
`exception` at line 1657 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1657
`exception` at line 1684 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1684
`exception` at line 1714 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1714
`info` at line 1723 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1723
`warning` at line 1852 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/image_index/image_index_default.py:1852
`warning` at line 75 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/intermediates/intermediates_measurement.py:75
`warning` at line 99 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/intermediates/intermediates_measurement.py:99
`error` at line 485 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/intermediates/intermediates_default.py:485
`error` at line 549 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/intermediates/intermediates_default.py:549
`error` at line 602 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — invokeai/app/services/intermediates/intermediates_default.py:602
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.2 `!` null assertions per 1k TypeScript source lines — 584 assertion(s) across the 471189 source line(s) of the 3140 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/webv1/src/common/util/promptAST.ts (28), invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts (27), invokeai/frontend/webv2/src/platform/browser/sha256.ts (23). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). 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 — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 21 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 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.
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 — 35 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-10-20T18:21:00Z" 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.
D11 Test Reliability — Test reliability not included
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. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
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) — 126 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
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 (242 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 5 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 applicable: TypeScript/JavaScript and Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
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.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Orphaned knowledge 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/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/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/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/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.
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.
Hotspot: invokeai/frontend/webv2/src/workbench/workbenchState.ts invokeai/frontend/webv2/src/workbench/workbenchState.ts:3890— invokeai/frontend/webv2/src/workbench/workbenchState.ts changed 118 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 384 in workbenchState.__workbenchReducerInternal at line 3890. 51 of those changes were fix/bug commits, and the other 67 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/src/workbench/canvas-engine/engine.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:333— invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts changed 78 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 283 in engine.createCanvasEngine at line 333. 24 of those changes were fix/bug commits, and the other 54 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/frontend/webv2/scripts/mock-backend.mjs invokeai/frontend/webv2/scripts/mock-backend.mjs:937— invokeai/frontend/webv2/scripts/mock-backend.mjs changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 523 in mock-backend.startMockBackend.server at line 937. 4 of those changes were fix/bug commits, and the other 31 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/app/services/shared/graph.py invokeai/app/services/shared/graph.py:2565— invokeai/app/services/shared/graph.py changed 110 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 155 in GraphExecutionState._validate_effects at line 2565. 28 of those changes were fix/bug commits, and the other 82 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/features/gallery/ui/GalleryImageGrid.tsx invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:404— invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 322 in GalleryImageGrid.GalleryImageGrid at line 404. 22 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/projects/durableSyncedPersistence.ts invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:561— invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 568 in durableSyncedPersistence.createDurableSyncedWorkbenchPersistence at line 561. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/workbench/widgets/layers/LayersTree.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169— invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 227 in LayersTree.LayersTree at line 169. 1 of those changes was a fix/bug commit, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/features/video/ui/VideoWidgetView.tsx invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:122— invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 94 in VideoWidgetView.VideoWidgetView at line 122. 24 of those changes were fix/bug commits, and the other 24 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/video/core/videoPolicies.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2291— invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in videoPolicies.getVideoValidationReasons at line 2291. 19 of those changes were fix/bug commits, and the other 26 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/workbench/widgets/layers/LayerContextMenu.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:217— invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 107 in LayerContextMenu.LayerMenu at line 217. 8 of those changes were fix/bug commits, and the other 33 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/workbench/image-actions/useImageActions.ts invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:194— invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 129 in useImageActions.useImageActions at line 194. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/workbench/widgets/preview/PreviewWidgetView.tsx invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:188— invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 69 in PreviewWidgetView.PreviewWidgetView at line 188. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/features/video/core/settings.ts invokeai/frontend/webv2/src/features/video/core/settings.ts:446— invokeai/frontend/webv2/src/features/video/core/settings.ts changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in settings.isVideoSettings at line 446. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/workflow/ui/editor/WorkflowEditorView.tsx invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:305— invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 139 in WorkflowEditorView.WorkflowFlow at line 305. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/videoRecall.ts invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:474— invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in videoRecall.buildVideoRecallSettings at line 474. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/PreviewFrame.tsx invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:376— invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in PreviewFrame.PreviewVideo at line 376. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.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:669— 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 77 in canvasProjectMutations.applyCanvasProjectMutation at line 669. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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:907— invokeai/frontend/webv2/src/features/workflow/core/document.ts changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in document.applyProjectGraphAction at line 907. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/webv1/src/features/queue/store/readiness.ts invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773— invokeai/frontend/webv1/src/features/queue/store/readiness.ts changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 150 in readiness.getReasonsWhyCannotEnqueueCanvasTab at line 773. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv1/src/features/queue/store/readiness.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:352— invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in UpscaleWidgetView.UpscaleWidgetView at line 352. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/video/ui/VideoReferenceListField.tsx invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:363— invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in VideoReferenceListField.VideoReferenceListField at line 363. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.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/canvas/canvasHotkeyCommands.ts invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:120— invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 97 in canvasHotkeyCommands.executeCanvasHotkeyCommand at line 120. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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.
Hotspot: invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97— invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 205 in modelSelected.addModelSelectedListener at line 97. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.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/canvas-engine/document-model/documentModel.ts invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:463— invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 198 in documentModel.createDocumentModel at line 463. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/image-map/ImageMapPlot.tsx invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:113— invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in ImageMapPlot.ImageMapPlot at line 113. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.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.
FunctionTooLong: engine.createCanvasEngine invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:333— FunctionTooLong — createCanvasEngine runs 1852 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1752 over it, 18.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: GalleryImageGrid.GalleryImageGrid invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:404— FunctionTooLong — GalleryImageGrid runs 1266 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1166 over it, 12.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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: LayersTree.LayersTree invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169— FunctionTooLong — LayersTree runs 912 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 812 over it, 9.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: documentModel.createDocumentModel invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:463— 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: WorkflowEditorView.WorkflowFlow invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:305— FunctionTooLong — WorkflowFlow runs 745 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 645 over it, 7.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useImageActions.useImageActions invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:194— FunctionTooLong — useImageActions 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:222— FunctionTooLong — createQueueCoordinator runs 653 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 553 over it, 6.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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: VideoWidgetView.VideoWidgetView invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:122— FunctionTooLong — VideoWidgetView runs 576 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 476 over it, 5.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: 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: unloadJournal.scenarios.testUnloadJournalScenarios invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:188— FunctionTooLong — testUnloadJournalScenarios runs 511 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 411 over it, 5.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useGalleryData.useGalleryData invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:257— FunctionTooLong — useGalleryData runs 482 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 382 over it, 4.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: 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: GalleryPickerView.GalleryPickerView invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:65— FunctionTooLong — GalleryPickerView runs 456 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 356 over it, 4.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: persistenceRuntime.createWorkbenchPersistenceRuntime invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:125— FunctionTooLong — createWorkbenchPersistenceRuntime runs 438 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 338 over it, 4.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: bitmapStore.createBitmapStore invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:168— FunctionTooLong — createBitmapStore runs 414 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 314 over it, 4.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: PreviewWidgetView.PreviewWidgetView invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:188— FunctionTooLong — PreviewWidgetView runs 409 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 309 over it, 4.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: FontsPage.FontLibrary invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:305— 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.
FunctionTooLong: ReferenceImageCropDialog.ReferenceImageCropDialog invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCropDialog.tsx:212— FunctionTooLong — ReferenceImageCropDialog runs 385 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 285 over it, 3.85× 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: ScrubberField.ScrubberField invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:228— FunctionTooLong — ScrubberField runs 381 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 281 over it, 3.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: AddNodeDialog.AddNodeDialogContent invokeai/frontend/webv2/src/features/workflow/ui/editor/AddNodeDialog.tsx:375— FunctionTooLong — AddNodeDialogContent runs 362 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 262 over it, 3.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
TodoComment invokeai/app/api_app.py:107— # TODO: create this all in a method so configuration/etc. can be passed in? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment invokeai/app/api_app.py:765— # TODO: consider doing this in services to support different configurations — 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/app/api/extract_metadata.py:96— # TODO(psyche): Due to pydantic's handling of None values, it is possible for the graph to fail validation, — 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/app/api/dependencies.py:80— # TODO: is there a better way to achieve this? — 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/app/api/routers/model_manager.py:591— # TODO(MM2): Core models should be handled by the model manager so we can determine if they are installed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment REDACTED:275— # TODO: Implement token invalidation when server-side session management is added — 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/app/invocations/upscale.py:16— # TODO: Populate this from disk? — 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/app/invocations/upscale.py:17— # TODO: Use model manager to load? — 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/app/invocations/upscale.py:115— # TODO: This strips the alpha... is that okay? — 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/app/invocations/tiles.py:203— # TODO(ryand): The only reason that PairTileImage is needed is because the iterate/collect nodes don't preserve — 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/app/invocations/tiles.py:256— # TODO(ryand): It pains me that we spend time PNG decoding each tile from disk when they almost certainly — 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/app/invocations/segment_anything.py:117— # TODO(ryand): Setting the torch_dtype here doesn't work. Investigate whether fp16 is supported by the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment invokeai/app/invocations/grounding_dino.py:77— # TODO(ryand): Setting the torch_dtype here doesn't work. Investigate whether fp16 is supported by the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment invokeai/app/invocations/model.py:395— # TODO: precision? — 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/app/invocations/sd/sdxl.py:36— # TODO: precision? — 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/app/invocations/sd/sdxl.py:76— # TODO: precision? — 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/app/invocations/model.py:398— # TODO: not found exceptions — 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/app/invocations/sd/sdxl.py:41— # TODO: not found exceptions — 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/app/invocations/sd/sdxl.py:81— # TODO: not found exceptions — 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/app/invocations/metadata.py:392— # TODO: should this be stricter or do we just let the UI handle it? — 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/app/invocations/infill.py:23— # TODO: add mosaic back — 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/app/invocations/infill.py:25— # TODO: add mosaic back — 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/app/invocations/image.py:73— # TODO: how to handle failure? — 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/app/invocations/image.py:203— # TODO: probably shouldn't invert mask here... should user be required to do it? — 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/app/invocations/grounding_dino.py:92— # TODO(ryand): I copied this "."-handling logic from the transformers example code. Test it and see if it — 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 — 4030 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3530 over it, 8.06× 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 — 2903 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: createDurableSyncedWorkbenchPersistence (561-3804). The bar is 500 significant lines; this is 2403 over it, 5.81× 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 — 2172 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1672 over it, 4.34× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: canvas-engine/engine.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts— FileTooLong — 2122 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: createCanvasEngine (333-2935). The bar is 500 significant lines; this is 1622 over it, 4.24× 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 — 2116 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1616 over it, 4.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 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: 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: scripts/mock-backend.mjs invokeai/frontend/webv2/scripts/mock-backend.mjs— FileTooLong — 1954 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: startMockBackend (932-2879). The bar is 500 significant lines; this is 1454 over it, 3.91× 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: queue/runtime.ts invokeai/frontend/webv2/src/features/queue/runtime.ts— FileTooLong — 1776 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: createQueueRuntime (430-2554). The bar is 500 significant lines; this is 1276 over it, 3.55× 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: fields/WorkflowFieldInput.tsx invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx— FileTooLong — 1643 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1143 over it, 3.29× 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 — 1605 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: GalleryImageGrid (404-2118). The bar is 500 significant lines; this is 1105 over it, 3.21× 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: core/videoPolicies.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts— FileTooLong — 1536 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1036 over it, 3.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: model_loaders/flux.py invokeai/backend/model_manager/load/model_loaders/flux.py— FileTooLong — 1494 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 994 over it, 2.99× 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 — 1426 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 926 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: model_cache/model_cache.py invokeai/backend/model_manager/load/model_cache/model_cache.py— FileTooLong — 1408 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 908 over it, 2.82× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/graph.ts invokeai/frontend/webv2/src/features/generation/core/graph.ts— FileTooLong — 1331 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 831 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: core/baseGenerationPolicies.ts invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts— FileTooLong — 1292 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 792 over it, 2.58× 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: networks/pixeldit_official.py invokeai/backend/pid/_src/networks/pixeldit_official.py— FileTooLong — 1196 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 696 over it, 2.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: projects/indexedDbDraftStore.ts invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts— FileTooLong — 1189 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 689 over it, 2.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: types/field.ts invokeai/frontend/webv1/src/features/nodes/types/field.ts— FileTooLong — 1180 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 680 over it, 2.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: invocations/composition-nodes.py invokeai/app/invocations/composition-nodes.py— FileTooLong — 1165 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 665 over it, 2.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: document-model/documentModel.ts invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts— FileTooLong — 1153 significant lines (blank, comment-only and punctuation-only lines excluded), about 70% of them inside a single declaration: createDocumentModel (463-1578). The bar is 500 significant lines; this is 653 over it, 2.31× 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.
No assertions: FilterType invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:35— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: IP Adapter Method invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:41— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: CLIP Vision Model invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:45— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Control Mode invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:49— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: DepthAnything Model Size invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:53— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Processor Configs invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:57— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: CanvasEntityIdentifier invokeai/frontend/webv1/src/features/controlLayers/store/types.test.ts:105— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: keeps the initial state aligned with the persisted schema invokeai/frontend/webv1/src/features/controlLayers/store/canvasStagingAreaSlice.test.ts:32— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: keeps the initial state aligned with the persisted schema invokeai/frontend/webv1/src/features/controlLayers/store/canvasSettingsSlice.test.ts:19— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: BoardRecordOrderBy invokeai/frontend/webv1/src/features/gallery/store/types.test.ts:10— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: should narrow the type of the element if a type guard is provided and the element matches invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/form-manipulation.test.ts:65— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: should infer field names invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.test.ts:181— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: covers all runtime config image subfolder strategies exposed by the API invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsImageSubfolderStrategySelect.test.ts:13— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: starts the next test with an element at the iframe corner reachable invokeai/frontend/webv2/src/architecture/browserTestViewport.browser.test.ts:22— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: opens an empty library on Add Fonts, and its empty state leads back there invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.browser.test.tsx:397— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: accepts an optional nullable expansion seed invokeai/frontend/webv2/src/features/generation/data/promptUtilities.test.ts:6— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: requires the backend-selected expansion seed in responses invokeai/frontend/webv2/src/features/generation/data/promptUtilities.test.ts:17— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: hands focus to the picker the last row was excluded from once that row is removed invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.browser.test.tsx:331— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: reaches Add Models from the library header invokeai/frontend/webv2/src/features/models/ui/ModelManagerDrafts.browser.test.tsx:543— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: shows the detail when a model is opened from elsewhere, such as the install queue invokeai/frontend/webv2/src/features/models/ui/ModelManagerDrafts.browser.test.tsx:584— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: opens a non-empty library on the list invokeai/frontend/webv2/src/features/models/ui/ModelManagerDrafts.browser.test.tsx:622— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: stays on the list, now empty, when the last model is deleted invokeai/frontend/webv2/src/features/models/ui/ModelManagerDrafts.browser.test.tsx:652— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: shows compatible installed models through the public picker invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.browser.test.tsx:72— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: remembers the base filter across a close and reopen invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.browser.test.tsx:215— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: opens a non-empty library on the list invokeai/frontend/webv2/src/features/nodes/ui/NodeManagerView.browser.test.tsx:152— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
Repeated repair: invokeai/backend/util/vae_working_memory.py invokeai/backend/util/vae_working_memory.py:207— invokeai/backend/util/vae_working_memory.py changed 29 times in last 90 days and 15 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is vae_working_memory.estimate_vae_working_memory_sd15_sdxl at line 207), 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): calibrate the VAE under the app's ROCm runtime”; “fix(wan): budget the video VAE decode against reserved memory”; “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”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/backend/quantization/fp8_scaled.py invokeai/backend/quantization/fp8_scaled.py:581— invokeai/backend/quantization/fp8_scaled.py changed 20 times in last 90 days and 14 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 fp8_scaled.extract_fp8_scaled_layers at line 581), 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(fp8): keep the matmul probe off the forward path, probe CUDA for storage”; “fix(fp8): decide keep_fp8 once, derive the compute dtype from a float param”; “fix(loaders): refuse quantization payloads a plain scale fold cannot decode”; “fix(loaders): refuse a quantized checkpoint where no loader handles its scales”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/backend/quantization/fp8_scaled.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/anima.py invokeai/backend/model_manager/load/model_loaders/anima.py:189— invokeai/backend/model_manager/load/model_loaders/anima.py changed 18 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is AnimaCheckpointModel._load_from_singlefile at line 189), 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(fp8): reserve cache room before the scale fold, not after it”; “fix(loaders): refuse a quantized checkpoint where no loader handles its scales”; “fix(models): never cast a model that already holds fp8 weights”; “fix(models): keep scaled fp8 weights packed when FP8 Storage is on”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/backend/model_manager/load/model_loaders/anima.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/workbench/WorkbenchContext.tsx invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx:64— invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx changed 17 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is WorkbenchContext.WorkbenchProvider at line 64), 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(webv2): release intermediate holds and require undo media refs”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/WorkbenchContext.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/features/gallery/index.ts invokeai/frontend/webv2/src/features/gallery/index.ts:141— invokeai/frontend/webv2/src/features/gallery/index.ts changed 15 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 6 (its worst body is index.addConfirmedPartition at line 141), 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(gallery): send results to the project board by default”; “fix(gallery): keep the upload format table out of the eager chunk graph”; “fix(gallery): accept every media format the upload routes ingest”; “fix(webv2): don't error-toast video board attach for virtual destinations”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/gallery/index.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/services/shared/execution_state_migration.py invokeai/app/services/shared/execution_state_migration.py:42— invokeai/app/services/shared/execution_state_migration.py changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is execution_state_migration._compact_effects at line 42), 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(execution): harden queue and workflow state recovery”; “fix(execution): preserve loop state across rehydration”; “fix(execution): hide runtime ledgers from API schemas”; “fix(execution): preserve nullable Iterate checkpoints”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/backend/architectures/capabilities.py invokeai/backend/architectures/capabilities.py:163— invokeai/backend/architectures/capabilities.py changed 8 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 163), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/frontend/webv2/src/features/generation/core/dynamicPrompts.ts invokeai/frontend/webv2/src/features/generation/core/dynamicPrompts.ts:33— invokeai/frontend/webv2/src/features/generation/core/dynamicPrompts.ts changed 13 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is dynamicPrompts.getWildcardLookupPath at line 33), 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: normalize prompt template view state”; “fix: align wildcard handling with backend syntax”; “fix(webv2): treat a wildcard comment the same in every format”; “fix(webv2): make a wildcard round-trip an identity”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/core/dynamicPrompts.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/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx:30— invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is PromptTemplatesButton.PromptTemplatesButton at line 30), 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): square the icon-only prompt action buttons”; “fix(webv2): strengthen row hover contrast”; “fix(webv2): restore prompt row hover contrast”; “fix(webv2): gate the template catalog fetch, and say when one is gone”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.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/features/models/data/installsStore.ts invokeai/frontend/webv2/src/features/models/data/installsStore.ts:301— invokeai/frontend/webv2/src/features/models/data/installsStore.ts changed 12 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 12 (its worst body is installsStore.handleModelInstallSocketEvent at line 301), 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(ui): coalesce library refreshes from install completions”; “fix(ui): unwrap backend error details in model manager notifications”; “fix(ui): retry starter and install-queue loads after a failed first fetch”; “fix(ui): prune finished install progress entries”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/models/data/installsStore.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/frontend/webv2/src/features/generation/ui/promptFields/usePromptTriggerAutocomplete.tsx invokeai/frontend/webv2/src/features/generation/ui/promptFields/usePromptTriggerAutocomplete.tsx:106— invokeai/frontend/webv2/src/features/generation/ui/promptFields/usePromptTriggerAutocomplete.tsx changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is usePromptTriggerAutocomplete.usePromptTriggerAutocomplete.handleKeyDown at line 106), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve prompt behavior during template flattening”; “fix(webv2): correct three prompt affordances”; “fix(webv2): reach embeddings whose names contain spaces”; “fix(webv2): dismiss the trigger pickers when the page moves”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/ui/promptFields/usePromptTriggerAutocomplete.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/app/services/model_load/model_load_default.py invokeai/app/services/model_load/model_load_default.py:149— 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 149), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/api/routers/_access.py invokeai/app/api/routers/_access.py:174— invokeai/app/api/routers/_access.py changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is _access.redact_project_ids at line 174), 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(gallery): refresh the gallery when media is uploaded elsewhere”; “fix: align upstream authorization contracts”; “fix(api): report partial failures and bound batch bodies on image routes (#9394)”; “fix(api): grant board owners read access to board images”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/app/api/routers/_access.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:29— invokeai/frontend/webv2/src/app/WorkbenchApp.tsx changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is WorkbenchApp.WorkbenchApp at line 29), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/features/models/ui/detail/useModelActions.ts invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.ts:16— invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.ts changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is useModelActions.useModelActions at line 16), 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(ui): single-path relationship pruning on model deletes”; “fix(ui): refresh starter install flags after model deletes”; “fix(ui): make scoped actions report success and block re-entry”; “fix(ui): translate remaining model manager strings”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.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/services/intermediates/intermediates_default.py invokeai/app/services/intermediates/intermediates_default.py:330— invokeai/app/services/intermediates/intermediates_default.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 14 (its worst body is IntermediatesService._resolve_scope at line 330), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/frontend/webv2/src/features/models/data/relationshipsStore.ts invokeai/frontend/webv2/src/features/models/data/relationshipsStore.ts:96— invokeai/frontend/webv2/src/features/models/data/relationshipsStore.ts 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 8 (its worst body is relationshipsStore.fetchRelatedKeys at line 96), 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(ui): single-path relationship pruning on model deletes”; “fix(ui): drop relationship entries for models gone after a refresh”; “fix(ui): restore the relationships store to text”; “fix(ui): load the relationships store on first picker open”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/models/data/relationshipsStore.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/util/wddm.py invokeai/backend/util/wddm.py:211— invokeai/backend/util/wddm.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 10 (its worst body is wddm._resolve_adapter at line 211), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/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), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/frontend/webv2/src/features/generation/core/architectureCapabilities.ts invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts:77— invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is architectureCapabilities.toBaseGenerationConfig at line 77), 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(webv2): fail closed everywhere, and give the VAE facet a reader”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.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/util/video_audio.py invokeai/app/util/video_audio.py:89— invokeai/app/util/video_audio.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 10 (its worst body is video_audio.extract_audio_pcm at line 89), 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(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”; “fix(audio): select first stream for int16 extraction”. 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts:121— invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.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 7 (its worst body is engineRegistry.createEngineRegistry.getOrCreateEngine at line 121), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/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), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/app/services/model_install/model_install_common.py invokeai/app/services/model_install/model_install_common.py:40— invokeai/app/services/model_install/model_install_common.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 6 (its worst body is model_install_common.active_install_claim_scan_lock at line 40), 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): preserve recovery state (#9915)”; “fix(model-manager): harden install lifecycle retries”; “fix(model-manager): harden recovery and cache invalidation”; “fix(model-manager): preserve recovery data across failures”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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/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), 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-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 04:45:43 -06:00' --until='2026-10-20 04:45:43 -06: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.
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 (16 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 16 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: 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 ↔ 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: 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: 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 83% of the time (10 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 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; `48fae7fa` refactor(webv2): share the prompt field and catalog seams — 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 82% of the time (18 of the 22 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 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: SettingsModal.tsx ↔ types.ts invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsModal.tsx:1— `invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsModal.tsx` and `invokeai/frontend/webv1/src/features/system/store/types.ts` change together 82% of the time (9 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 `eaa42bf6` Chore: Code cleanup (#8998) (at that commit the files were still `invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx` and `invokeai/frontend/web/src/features/system/store/types.ts`); `fcdcd7f4` Prompt Attention Fixes (#8860) (at that commit the files were still `invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx` and `invokeai/frontend/web/src/features/system/store/types.ts`); `02b91e8e` feat: :sparkles: highlight focused regions (at that commit the files were still `invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx` and `invokeai/frontend/web/src/features/system/store/types.ts`) — 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 78% of the time (14 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `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: flux_text_encoder.py ↔ sd3_text_encoder.py invokeai/app/invocations/flux_text_encoder.py:1— `invokeai/app/invocations/flux_text_encoder.py` and `invokeai/app/invocations/sd3_text_encoder.py` change together 71% of the time (15 of the 21 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 15 shared commits counted here, the most recent 3 are `68b90174` Fix: compute device partial load (#9375); `80eb0bb2` feat - Migrate to Transformers 5.5.4 (#9248); `76b08380` Feature(backend): Add user toggle to run encoder models on CPU (#8777) — run `git show` on any of them.
Change coupling: InpaintMaskMenuItems.tsx ↔ RasterLayerMenuItems.tsx invokeai/frontend/webv1/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx:1— `invokeai/frontend/webv1/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `bd6ff3de` feat(ui): add merge down for all entity types (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.tsx`); `56222a84` feat(ui): organize layer context menu items (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.tsx`); `7211d1a6` feat(ui): add context menu options for layer type convert/copy (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.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: 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: 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: 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 67% of the time (10 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 — 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.
Change coupling: DndImage.tsx ↔ GalleryImage.tsx invokeai/frontend/webv1/src/features/dnd/DndImage.tsx:1— `invokeai/frontend/webv1/src/features/dnd/DndImage.tsx` and `invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx` 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `4347b43e` Fix (UI): Extend input draggability fix to all browsers (#9100) (at that commit the files were still `invokeai/frontend/web/src/features/dnd/DndImage.tsx` and `invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx`); `eaa42bf6` Chore: Code cleanup (#8998) (at that commit the files were still `invokeai/frontend/web/src/features/dnd/DndImage.tsx` and `invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx`); `3104a1ba` remove crossOrigin for thumbnail loading (at that commit the files were still `invokeai/frontend/web/src/features/dnd/DndImage.tsx` and `invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx`) — 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: 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: index.ts ↔ executeVideoRecall.ts invokeai/frontend/webv2/src/features/video/index.ts:1— `invokeai/frontend/webv2/src/features/video/index.ts` and `invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.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 `f9b5e99a` feat(video): place a gallery image in the Video panel from the recall…; `97c0adaa` feat(video): let LTX-2 soundtrack conditioning keep first and last fr…; `701b657d` feat(video-recall): place a video as the LTX-2 conditioning clip — 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: queryCache.ts ↔ useGalleryData.ts invokeai/frontend/webv2/src/features/gallery/data/queryCache.ts:1— `invokeai/frontend/webv2/src/features/gallery/data/queryCache.ts` and `invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.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 `2910b2fb` feat: rank gallery semantic search within the selected board; `40e5c29b` feat(gallery): anchored infinite windows so deep reveals can land; `09d0745f` feat: semantic gallery search over the embedding index — 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: VideoReferenceListField.tsx ↔ VideoSourceClipField.tsx invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:1— `invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx` and `invokeai/frontend/webv2/src/features/video/ui/VideoSourceClipField.tsx` change together 57% of the time (8 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, 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 `06843a22` refactor(webv2): move Video sliders to ScrubberField; `1a9c6081` feat(webv2): play a reference clip's trimmed window in Preview; `280de2c5` fix(webv2): keep a recorded video_audio reference on recall — run `git show` on any of them.
Change coupling: submissionApi.ts ↔ runtime.ts invokeai/frontend/webv2/src/features/queue/data/submissionApi.ts:1— `invokeai/frontend/webv2/src/features/queue/data/submissionApi.ts` and `invokeai/frontend/webv2/src/features/queue/runtime.ts` change together 57% of the time (8 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `acedb1ec` fix(webv2): show a finished video in the preview when its run completes; `5b83931e` fix(webv2): keep node-boarded workflow images off the selected board; `3446c76e` fix(webv2): replay pre-seed-mode queue items with the expansion they … — 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'.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:16— invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:16 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:4— invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:4 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:38— invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:38 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:2— invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:6— invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:6 imports invokeai/frontend/webv1/src/features/toast/toast.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:22— invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:22 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/hooks/useIsAdmin.ts:1— invokeai/frontend/webv1/src/features/auth/hooks/useIsAdmin.ts:1 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:1— invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:1 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:4— invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:4 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:6— invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:6 imports invokeai/frontend/webv1/src/features/auth/store/authSlice.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:7— invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:7 imports invokeai/frontend/webv1/src/features/auth/store/authTokenRefresh.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:16— invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:16 imports invokeai/frontend/webv1/src/features/gallery/store/gallerySelectors.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:17— invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:17 imports invokeai/frontend/webv1/src/features/toast/toast.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:3— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:3 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:5— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:5 imports invokeai/frontend/webv1/src/features/system/store/systemSlice.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsPreserveMask.tsx:2— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsPreserveMask.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSaveAllImagesToGallery.tsx:2— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSaveAllImagesToGallery.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSelectedEntityStatus.tsx:5— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsSelectedEntityStatus.tsx:5 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAutoProcessSwitch.tsx:2— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAutoProcessSwitch.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasContextMenu/CanvasContextMenuSelectedEntityMenuItems.tsx:2— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasContextMenu/CanvasContextMenuSelectedEntityMenuItems.tsx:2 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:4— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:4 imports invokeai/frontend/webv1/src/features/dnd/dnd.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:5— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:5 imports invokeai/frontend/webv1/src/features/dnd/DndDropTarget.tsx against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:3— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:3 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
Boundary violation [fsd:cross-slice] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:8— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:8 imports invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx against the feature-sliced rules.
Boundary violation [fsd:upward-import] invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:5— invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:5 imports invokeai/frontend/webv1/src/app/store/storeHooks.ts against the feature-sliced rules.
+ 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.
+ 15 more in this group — see findings.md.
AC2 · Forms & labels· <Combobox> field component without a label · ×30
<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/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:387— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:396— 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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/FilterAdjustImage.tsx:69— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/FilterBlur.tsx:46— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/FilterDepthAnythingDepthEstimation.tsx:40— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/FilterNoise.tsx:61— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/Transform/TransformFitToBboxButtons.tsx:59— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/FLUXReduxImageInfluence.tsx:55— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/controlLayers/components/common/MaskFillStyle.tsx:59— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/dynamicPrompts/components/ParamDynamicPromptsSeedBehaviour.tsx:50— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/gallery/components/Boards/BoardAutoAddSelect.tsx:55— 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/gallery/components/Boards/BoardsListSortControls.tsx:73— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/gallery/components/Boards/BoardsListSortControls.tsx:77— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/gallery/components/GallerySettingsPopover/SortDirectionCombobox.tsx:43— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/Fields/BaseModelSelect.tsx:29— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/Fields/ModelFormatSelect.tsx:29— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/Fields/ModelTypeSelect.tsx:29— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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/Fields/ModelVariantSelect.tsx:26— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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.
HackComment invokeai/app/invocations/tiles.py:147— # HACK: The width and height fields are 'meta' fields that can easily be calculated from the other fields on this — 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/app/invocations/flux/flux_denoise.py:768— # HACK(ryand): We have to load the ControlNet model to determine whether the VAE needs to be run. We really — 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/app/invocations/sd/denoise_latents.py:126— # hack copied over from generate.py — 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/app/invocations/sd/denoise_latents.py:333— # HACK(ryand): The fact that we have to choose a single pooled_embedding and add_time_ids here is 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/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/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 REDACTED:65— # 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/hidiffusion/hidiffusion.py:2110— # 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.
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/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/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/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_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/model_manager/load/model_util.py:68— # 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_cache/cached_model/cached_model_with_partial_load.py:51— # 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:181— # 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/model_manager/load/model_cache/torch_module_autocast/torch_module_autocast.py:79— # 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:93— # 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_module_mixin.py:48— # 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/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_loaders/lora.py:133— # 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_loaders/flux.py:606— # 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:1046— # 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.
Duplicated block (6 lines × 2) invokeai/app/api/routers/model_manager.py:910— invokeai/app/api/routers/model_manager.py:910-915 | invokeai/app/api/routers/model_manager.py:955-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.
Duplicated block (6 lines × 2) invokeai/app/invocations/baseinvocation.py:762— invokeai/app/invocations/baseinvocation.py:762-767 | invokeai/app/invocations/baseinvocation.py:890-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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:797-802 — 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:794` 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:86— invokeai/app/invocations/krea2/krea2_model_loader.py:86-95 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py:79-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
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/image_files/image_files_disk.py:411— invokeai/app/services/image_files/image_files_disk.py:411-416 | invokeai/app/services/video_files/video_files_disk.py:163-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:419` 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 (6 lines × 2) invokeai/app/services/session_queue/session_queue_default.py:903— invokeai/app/services/session_queue/session_queue_default.py:903-908 | invokeai/app/services/session_queue/session_queue_default.py:948-953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) invokeai/app/services/shared/database/queries/images.py:521— invokeai/app/services/shared/database/queries/images.py:521-526 | invokeai/app/services/shared/database/queries/videos.py:460-465 — 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 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) invokeai/app/services/shared/execution_engine/scheduler.py:365— invokeai/app/services/shared/execution_engine/scheduler.py:365-370 | invokeai/app/services/shared/execution_engine/scheduler.py:410-415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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/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) REDACTED:1313— REDACTED:1313-1318 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:330-335 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/z_image.py:1054— invokeai/backend/model_manager/load/model_loaders/z_image.py:1054-1059 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1063-1068 — both copies are in the same file, so extract the block into 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/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:143— invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:143-148 | invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:171-176 — both copies are in the same file, so extract the 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) 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/z_image/z_image_control_transformer.py:542— invokeai/backend/z_image/z_image_control_transformer.py:542-547 | invokeai/backend/z_image/z_image_controlnet_extension.py:308-315 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/z_image/z_image_controlnet_extension.py:308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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/z_image/z_image_control_transformer.py:541` calls `all` and `invokeai/backend/z_image/z_image_controlnet_extension.py:307` 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/app/api/routers/utilities.py:208— invokeai/app/api/routers/utilities.py:208-214 | invokeai/app/services/fonts/fonts_parsing.py:119-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 (7 lines × 2) invokeai/app/api/routers/videos.py:1125— invokeai/app/api/routers/videos.py:1125-1131 | invokeai/app/api/routers/videos.py:1153-1159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/videos.py:1125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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/image.py:1227— invokeai/app/invocations/image.py:1227-1233 | invokeai/app/invocations/image.py:1303-1309 — both copies are in the same file, so extract the 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:1312` calls `_prepare_mask`, `get_pil` and `invokeai/app/invocations/image.py:1236` 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:448— invokeai/app/invocations/model.py:448-454 | invokeai/app/invocations/model.py:608-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) invokeai/app/invocations/model.py:551— invokeai/app/invocations/model.py:551-557 | invokeai/app/invocations/model.py:715-721 — both copies are in the same file, so extract the block into 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/vae/wan_latents_to_video.py:199— invokeai/app/invocations/vae/wan_latents_to_video.py:199-205 | invokeai/app/invocations/vae/wan_latents_to_video.py:230-236 — both copies are in the same file, so extract the 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/vae/wan_latents_to_video.py:206` calls `iter_wan_vae_decode_chunks`, `cpu` and `invokeai/app/invocations/vae/wan_latents_to_video.py:237` 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/services/shared/execution_engine/scheduler.py:379— invokeai/app/services/shared/execution_engine/scheduler.py:379-385 | invokeai/app/services/shared/execution_engine/scheduler.py:423-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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:378` calls `add` and `invokeai/app/services/shared/execution_engine/scheduler.py:422` 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:269— invokeai/backend/anima/anima_transformer.py:269-275 | invokeai/backend/anima/anima_transformer_patch.py:36-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:118— invokeai/backend/ernie_image/denoise.py:118-124 | invokeai/backend/ernie_image/denoise.py:164-170 — both copies are in the same file, so extract the block into 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/controlnet/state_dict_utils.py:87— invokeai/backend/flux/controlnet/state_dict_utils.py:87-93 | invokeai/backend/flux/controlnet/state_dict_utils.py:149-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/controlnet/state_dict_utils.py:87` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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/flux/controlnet/state_dict_utils.py:148` calls `pop` and `invokeai/backend/flux/controlnet/state_dict_utils.py:86` 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/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/minimax_h3/rocm_causal_conv3d.py:62— invokeai/backend/minimax_h3/rocm_causal_conv3d.py:62-68 | invokeai/backend/wan/rocm_causal_conv3d.py:56-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) invokeai/backend/model_manager/configs/lora.py:187— invokeai/backend/model_manager/configs/lora.py:187-193 | invokeai/backend/model_manager/configs/lora.py:200-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:2239— invokeai/backend/model_manager/load/model_loaders/flux.py:2239-2245 | invokeai/backend/model_manager/load/model_loaders/flux.py:2295-2312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:2239` it begins part-way through the construct above it, so those 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/model_manager/load/model_loaders/flux.py:2294` calls `pop` and `invokeai/backend/model_manager/load/model_loaders/flux.py:2238` 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/model_manager/load/model_loaders/flux.py:2272— invokeai/backend/model_manager/load/model_loaders/flux.py:2272-2278 | invokeai/backend/model_manager/load/model_loaders/flux.py:2298-2317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:2272` it begins part-way through the construct above it, so those exact lines 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:345— invokeai/backend/pid/_src/networks/pixeldit_official.py:345-351 | invokeai/backend/pid/_src/networks/pixeldit_official.py:356-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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:593— invokeai/backend/stable_diffusion/diffusers_pipeline.py:593-599 | 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/backend/z_image/z_image_control_transformer.py:279— invokeai/backend/z_image/z_image_control_transformer.py:279-285 | invokeai/backend/z_image/z_image_patchify_utils.py:70-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/app/services/gallery_maintenance/gallery_maintenance_default.py:965— invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:965-971 | 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:91— invokeai/app/services/model_records/model_records_base.py:91-97 | 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/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:145— invokeai/backend/pid/_src/networks/pixeldit_official.py:145-151 | invokeai/backend/pid/_src/networks/pixeldit_official.py:187-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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:184` calls `arange` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:143` 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/api/routers/utilities.py:530— invokeai/app/api/routers/utilities.py:530-534 | invokeai/app/api/routers/utilities.py:647-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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/api/routers/utilities.py:540— invokeai/app/api/routers/utilities.py:540-544 | invokeai/app/api/routers/utilities.py:656-660 — both copies are in the same file, so extract the block into 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/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/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/services/shared/execution_engine/child.py:60— invokeai/app/services/shared/execution_engine/child.py:60-64 | invokeai/app/services/shared/execution_engine/primitives.py:61-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) invokeai/app/services/shared/execution_engine/child.py:67— invokeai/app/services/shared/execution_engine/child.py:67-71 | invokeai/app/services/shared/execution_engine/primitives.py:68-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 (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:120— invokeai/backend/flux/controlnet/state_dict_utils.py:120-124 | invokeai/backend/flux/controlnet/state_dict_utils.py:151-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/state_dict_utils.py:120` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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/flux/controlnet/state_dict_utils.py:142— invokeai/backend/flux/controlnet/state_dict_utils.py:142-146 | invokeai/backend/model_manager/load/model_loaders/flux.py:2288-2292 — 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:142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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/color_conversion.py:691— invokeai/backend/image_util/color_conversion.py:691-695 | invokeai/backend/image_util/color_conversion.py:947-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. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/color_conversion.py:691` it begins part-way through the construct above it, so those exact lines 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/hed.py:128— invokeai/backend/image_util/hed.py:128-132 | invokeai/backend/image_util/hed.py:201-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 (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:139— invokeai/backend/pid/_src/networks/pixeldit_official.py:139-143 | invokeai/backend/pid/_src/networks/pixeldit_official.py:178-182 — both copies are in the same file, so extract the 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:185` calls `arange` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:145` 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/backend/z_image/z_image_control_transformer.py:586— invokeai/backend/z_image/z_image_control_transformer.py:586-590 | invokeai/backend/z_image/z_image_controlnet_extension.py:341-346 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/invocations/wan/wan_denoise.py:779— invokeai/app/invocations/wan/wan_denoise.py:779-783 | invokeai/app/invocations/wan/wan_video_denoise.py:404-408 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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/services/shared/execution_engine/child.py:26— invokeai/app/services/shared/execution_engine/child.py:26-30 | 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:777— invokeai/app/invocations/metadata_linked.py:777-781 | invokeai/app/invocations/metadata_linked.py:849-853 — both copies are in the same file, so extract the block into 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:326— invokeai/app/services/shared/database/queries/images.py:326-330 | 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 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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:1527-1531 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
Swallowed exception (caught, then discarded) invokeai/app/api/dependencies.py:92— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/api/routers/utilities.py:151— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/api/routers/model_manager.py:1714— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/api/routers/board_images.py:35— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/api/routers/app_info.py:77— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/api/routers/app_info.py:262— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/api/routers/app_info.py:270— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/external_generation/external_generation_default.py:176— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/fonts/fonts_parsing.py:84— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) REDACTED:272— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/image_index/image_index_default.py:1317— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/image_index/image_index_default.py:1496— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/image_index/image_index_default.py:1757— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/image_index/image_index_default.py:1797— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/model_records/model_records_sql.py:258— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/shared/graph_validation.py:138— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/shared/graph_validation.py:159— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/shared/graph_validation.py:177— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/shared/graph.py:1923— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/services/shared/database/database.py:48— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/util/video_thumbnails.py:168— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/util/video_thumbnails.py:386— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/util/video_decode_worker.py:125— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/util/video_decode_worker.py:216— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) invokeai/app/util/video_decode_worker.py:239— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
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/invocations/pid/flux2_pid_decode.py:217— invokeai/app/invocations/pid/flux2_pid_decode.py:217-225 | invokeai/app/invocations/pid/z_image_pid_decode.py:186-194 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/z_image_pid_decode.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:217` it does not close everything it opens, so those exact lines 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/external_generation/providers/alibabacloud.py:224— invokeai/app/services/external_generation/providers/alibabacloud.py:224-232 | invokeai/app/services/external_generation/providers/alibabacloud.py:263-271 — both copies are in the same file, so extract the 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/external_generation/providers/alibabacloud.py:220` calls `get`, `isinstance`, `ExternalProviderRequestError` and `invokeai/app/services/external_generation/providers/alibabacloud.py:261` 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/services/images/images_default.py:403— invokeai/app/services/images/images_default.py:403-411 | invokeai/app/services/images/images_default.py:417-425 — both copies are in the same file, so extract the block into 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/images/images_default.py:605— invokeai/app/services/images/images_default.py:605-613 | 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:605` it does not close everything it opens, so those exact lines 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:76-84 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:423— invokeai/app/services/shared/database/queries/images.py:423-431 | 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 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:423` it begins part-way through the construct above it, so those 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 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) invokeai/backend/flux/extensions/kontext_extension.py:174— invokeai/backend/flux/extensions/kontext_extension.py:174-183 | invokeai/backend/flux2/ref_image_extension.py:252-260 — 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:1035— invokeai/backend/hidiffusion/hidiffusion.py:1035-1043 | 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:2169— invokeai/backend/hidiffusion/hidiffusion.py:2169-2177 | invokeai/backend/hidiffusion/hidiffusion.py:2202-2210 — both copies are in the same file, so extract the block into 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:103— invokeai/backend/model_manager/load/model_loaders/qwen_image.py:103-111 | invokeai/backend/model_manager/load/model_loaders/wan.py:334-342 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:251— invokeai/backend/pid/_src/networks/pixeldit_official.py:251-259 | invokeai/backend/pid/_src/networks/pixeldit_official.py:675-683 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:818— invokeai/backend/pid/_src/networks/pixeldit_official.py:818-826 | invokeai/backend/pid/_src/networks/pixeldit_official.py:855-863 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:818` it does not close everything it opens, so those exact lines 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/backend/z_image/z_image_control_adapter.py:40— invokeai/backend/z_image/z_image_control_adapter.py:40-48 | invokeai/backend/z_image/z_image_control_transformer.py:45-53 — before extracting anything, compare `invokeai/backend/z_image/z_image_control_adapter.py` and `invokeai/backend/z_image/z_image_control_transformer.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:243— invokeai/app/invocations/sd/denoise_latents.py:243-251 | 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) invokeai/backend/model_manager/load/model_loaders/ltx2.py:422— invokeai/backend/model_manager/load/model_loaders/ltx2.py:422-430 | invokeai/backend/model_manager/load/model_loaders/minimax_h3.py:193-201 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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/invocations/anima/anima_denoise.py:995— invokeai/app/invocations/anima/anima_denoise.py:995-1006 | invokeai/app/invocations/z_image/z_image_denoise.py:917-924 — 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/composition-nodes.py:1443— invokeai/app/invocations/composition-nodes.py:1443-1450 | invokeai/app/invocations/composition-nodes.py:1531-1538 — both copies are in the same file, so extract the block into 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/ltx2/ltx2_lora_loader.py:100— 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 (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:540— invokeai/app/invocations/model.py:540-547 | invokeai/app/invocations/model.py:704-711 — both copies are in the same file, so extract the 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:163— invokeai/app/invocations/pid/flux2_pid_decode.py:163-170 | invokeai/app/invocations/pid/pid_upscale.py:135-142 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_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 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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/invocations/video_frame_extract.py:58— invokeai/app/invocations/video_frame_extract.py:58-65 | invokeai/app/invocations/video_frame_extract_range.py:194-201 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) invokeai/app/services/download/download_default.py:549— invokeai/app/services/download/download_default.py:549-556 | invokeai/app/services/download/download_default.py:654-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) invokeai/app/services/shared/database/queries/images.py:487— invokeai/app/services/shared/database/queries/images.py:487-494 | invokeai/app/services/shared/database/queries/videos.py:426-433 — 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 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 (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/model_manager/configs/lora.py:482— invokeai/backend/model_manager/configs/lora.py:482-489 | invokeai/backend/model_manager/configs/lora.py:490-497 — both copies are in the same file, so extract the 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:693— invokeai/backend/model_manager/configs/qwen3_encoder.py:693-700 | invokeai/backend/model_manager/configs/qwen3_encoder.py:744-751 — both copies are in the same file, so extract the 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/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/download/download_default.py:369— invokeai/app/services/download/download_default.py:369-376 | invokeai/app/services/model_install/model_install_default.py:1232-1239 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 `job` to `DownloadJobBase` in one and `ModelInstallJob` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 2) 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 (8 lines × 2) invokeai/backend/model_manager/configs/flux_redux.py:33— invokeai/backend/model_manager/configs/flux_redux.py:33-40 | invokeai/backend/model_manager/configs/ltx2_duration_head.py:33-40 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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.
TooManyMethods: ModelInstallService invokeai/app/services/model_install/model_install_default.py:138— TooManyMethods — 96 methods. The bar is 30 methods; this is 66 over it, 3.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: _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: SessionQueue invokeai/app/services/session_queue/session_queue_default.py:110— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ModelCache invokeai/backend/model_manager/load/model_cache/model_cache.py:534— TooManyMethods — 61 methods. The bar is 30 methods; this is 31 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ImageIndexService invokeai/app/services/image_index/image_index_default.py:227— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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: SessionQueueBase invokeai/app/services/session_queue/session_queue_base.py:42— 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: SessionQueueQueries invokeai/app/services/shared/database/queries/session_queue.py:750— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× 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:73— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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: GalleryMaintenanceService invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:92— 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: DownloadQueueService invokeai/app/services/download/download_default.py:52— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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: DiskImageFileStorage invokeai/app/services/image_files/image_files_disk.py:93— 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: 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 (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/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/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/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:2867— invokeai/backend/model_manager/load/model_cache/model_cache.py:2867-2877 | invokeai/backend/model_manager/load/model_cache/model_cache.py:2954-2964 — both copies are in the same file, so extract the 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:2966` calls `release` and `invokeai/backend/model_manager/load/model_cache/model_cache.py:2879` 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/ernie_image.py:104— invokeai/backend/model_manager/load/model_loaders/ernie_image.py:104-114 | invokeai/backend/model_manager/load/model_loaders/ernie_image.py:151-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:293— invokeai/backend/model_manager/load/model_loaders/z_image.py:293-303 | invokeai/backend/model_manager/load/model_loaders/z_image.py:413-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1060— invokeai/backend/pid/_src/networks/pixeldit_official.py:1060-1070 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1134-1144 — both copies are in the same file, so extract the 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/backend/z_image/z_image_control_adapter.py:192— invokeai/backend/z_image/z_image_control_adapter.py:192-202 | invokeai/backend/z_image/z_image_control_transformer.py:365-375 — before extracting anything, compare `invokeai/backend/z_image/z_image_control_adapter.py` and `invokeai/backend/z_image/z_image_control_transformer.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) invokeai/backend/model_manager/configs/main.py:104— invokeai/backend/model_manager/configs/main.py:104-114 | 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:92— invokeai/app/api/routers/board_images.py:92-102 | 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.
Duplicated block (12 lines × 2) invokeai/app/api/routers/images.py:553— invokeai/app/api/routers/images.py:553-564 | invokeai/app/api/routers/images.py:991-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/images.py:553` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:142— invokeai/app/invocations/cogview4/cogview4_denoise.py:142-153 | invokeai/app/invocations/sd3/sd3_denoise.py:161-172 — `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 8 separate duplicated blocks between them, totalling at least 153 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:1013— invokeai/app/invocations/image.py:1013-1024 | invokeai/app/invocations/image.py:1078-1089 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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:174— invokeai/app/invocations/qwen_image/qwen_image_denoise.py:174-185 | invokeai/app/invocations/z_image/z_image_denoise.py:245-256 — 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/invocations/vae/ltx2_latents_to_video.py:310— invokeai/app/invocations/vae/ltx2_latents_to_video.py:310-321 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:259-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 (12 lines × 2) invokeai/app/services/model_install/model_install_default.py:2276— invokeai/app/services/model_install/model_install_default.py:2276-2287 | invokeai/app/services/model_install/model_install_default.py:2296-2307 — both copies are in the same file, so extract the block into 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/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:91— invokeai/backend/model_manager/configs/ip_adapter.py:91-102 | invokeai/backend/model_manager/configs/ip_adapter.py:164-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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:212— invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:212-223 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:130-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/pid_net.py:364— invokeai/backend/pid/_src/networks/pid_net.py:364-375 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1459-1470 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1026— invokeai/backend/pid/_src/networks/pixeldit_official.py:1026-1037 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1100-1111 — both copies are in the same file, so extract the block into 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/backend/util/attention.py:326— invokeai/backend/util/attention.py:326-337 | invokeai/backend/util/sage_attention.py:358-369 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/api/routers/utilities.py:116— invokeai/app/api/routers/utilities.py:116-128 | 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 (10 lines × 2) invokeai/app/api/sockets.py:1051— invokeai/app/api/sockets.py:1051-1061 | invokeai/app/api/sockets.py:1110-1119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/sockets.py:1051` it begins part-way through the construct above it, so those exact lines 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/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/invocations/ltx2/ltx2_denoise.py:222— invokeai/app/invocations/ltx2/ltx2_denoise.py:222-231 | invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:651-660 — 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 (10 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:461— invokeai/app/invocations/wan/wan_denoise.py:461-470 | invokeai/app/invocations/wan/wan_video_denoise.py:208-217 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (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:274— invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:274-283 | invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:408-417 — both copies are in the same file, so extract the block into 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:1113— invokeai/app/services/session_queue/session_queue_default.py:1113-1122 | invokeai/app/services/session_queue/session_queue_default.py:1129-1138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) invokeai/app/services/shared/database/queries/images.py:379— invokeai/app/services/shared/database/queries/images.py:379-388 | 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 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:379` it begins part-way through the construct above it, so those 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:1658— invokeai/backend/model_manager/load/model_loaders/z_image.py:1658-1667 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1834-1843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1658` it does not close everything it opens, so those exact lines 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/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:65— invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:65-74 | invokeai/backend/patches/lora_conversions/flux_onetrainer_lora_conversion_utils.py:62-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `state_dict` to `Dict[str, torch.Tensor]` in one and `dict[str | int, 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 (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/backend/z_image/z_image_control_adapter.py:212— invokeai/backend/z_image/z_image_control_adapter.py:212-221 | invokeai/backend/z_image/z_image_control_transformer.py:404-413 — before extracting anything, compare `invokeai/backend/z_image/z_image_control_adapter.py` and `invokeai/backend/z_image/z_image_control_transformer.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) invokeai/backend/z_image/z_image_control_transformer.py:574— invokeai/backend/z_image/z_image_control_transformer.py:574-583 | invokeai/backend/z_image/z_image_controlnet_extension.py:328-337 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) 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:61— invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:61-77 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:158-167 — before extracting anything, compare `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py` and `invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×16
Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/api/dependencies.py:119— invokeai/app/api/dependencies.py:119-295 | invokeai/app/services/image_records/image_records_common.py:176-215 | invokeai/backend/pid/_src/networks/pid_net.py:102-175 | invokeai/backend/z_image/z_image_control_transformer.py:156-242 — 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/api/routers/images.py:135— invokeai/app/api/routers/images.py:135-214 | invokeai/app/api/routers/style_presets.py:109-166 | invokeai/app/api/routers/style_presets.py:201-252 | invokeai/app/api/routers/workflows.py:356-380 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) 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/ltx2/ltx2_lora_loader.py:88— invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88-113 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:142-171 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81-106 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:135-164 — 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-689 | invokeai/app/invocations/metadata_linked.py:703-743 | invokeai/app/invocations/metadata_linked.py:757-795 | invokeai/app/invocations/metadata_linked.py:827-871 — 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:364— invokeai/app/services/shared/database/queries/images.py:364-388 | invokeai/app/services/shared/database/queries/images.py:407-431 | 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/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12-45 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:125-141 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:158-173 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:190-205 — 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/hidiffusion/hidiffusion.py:1534— invokeai/backend/hidiffusion/hidiffusion.py:1534-1664 | invokeai/backend/hidiffusion/hidiffusion.py:1669-1814 | invokeai/backend/hidiffusion/hidiffusion.py:1819-1894 | invokeai/backend/hidiffusion/hidiffusion.py:1899-1965 — 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:1192— invokeai/backend/model_manager/configs/main.py:1192-1234 | invokeai/backend/model_manager/configs/main.py:3569-3627 | invokeai/backend/model_manager/configs/main.py:3723-3777 | invokeai/backend/model_manager/configs/main.py:3888-3933 — 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:1111-1141 | invokeai/backend/model_manager/load/model_loaders/flux.py:1153-1218 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:158-196 — 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:290— invokeai/backend/model_manager/load/model_loaders/z_image.py:290-407 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1193-1460 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1500-1671 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1705-1846 — 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:410— invokeai/backend/model_manager/load/model_loaders/z_image.py:410-451 | invokeai/backend/model_manager/load/model_loaders/z_image.py:478-726 | invokeai/backend/model_manager/load/model_loaders/z_image.py:753-797 | invokeai/backend/model_manager/load/model_loaders/z_image.py:880-919 — 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:176— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:176-212 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:164-197 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:219-250 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:214-260 — 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.
Swallowed exception (empty catch) invokeai/app/api/routers/videos.py:563— 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/app/api/routers/videos.py:567— 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/app/invocations/video_frame_extract_range.py:347— 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/app/invocations/vae/wan_latents_to_video.py:259— 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/app/invocations/vae/minimax_h3_latents_to_video.py:213— 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/app/invocations/vae/minimax_h3_latents_to_video.py:218— 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/app/invocations/wan/wan_denoise.py:246— 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/app/services/model_install/model_install_default.py:2255— 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/app/services/model_install/model_install_default.py:2262— 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/app/services/video_files/video_files_disk.py:93— 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/app/util/video_smart_concat.py:486— 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/app/util/video_smart_concat.py:493— 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/app/util/video_smart_concat.py:496— 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/app/util/video_decode_worker.py:104— 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/app/util/video_decode_worker.py:182— 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.
ClassTooLong: GalleryImageGrid invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1— ClassTooLong — 1266 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 866 over it, 3.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: LayersTree invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1— ClassTooLong — 912 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 512 over it, 2.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: 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: useImageActions invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1— ClassTooLong — 700 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 300 over it, 1.75× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: 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: setEventListeners invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:1— ClassTooLong — 591 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 191 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), 45 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: VideoWidgetView invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:1— ClassTooLong — 576 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 176 over it, 1.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: useGalleryData invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:1— ClassTooLong — 482 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods. The bar is 400 significant lines; this is 82 over it, 1.21× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UpscaleWidgetView invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:1— ClassTooLong — 459 significant lines (blank, comment-only and punctuation-only lines excluded), 8 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.
ClassTooLong: GalleryPickerView invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:1— ClassTooLong — 456 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 56 over it, 1.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PreviewWidgetView invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:1— ClassTooLong — 409 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 9 over it, 1.02× 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.mergeSelected invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:390— MethodTooLong — mergeSelected runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× 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:72— MethodTooLong — commit runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: 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:174— 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: MergeLayerController.mergeVisible invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:232— MethodTooLong — mergeVisible runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ExtractMaskedAreaController.extract invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:104— MethodTooLong — extract runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MergeLayerController.mergeDown invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:84— MethodTooLong — mergeDown runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: StagedResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:72— MethodTooLong — commit runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: 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: 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: PsdExportController.export invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:67— MethodTooLong — export runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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.
MethodTooLong: BooleanMergeController.merge invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:61— MethodTooLong — merge runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.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.
D30 · Dependency Vulnerabilities· Medium CVE · ×14
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
X2 · Cancellation propagation· Async function without AbortSignal · ×14
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 })`.
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: 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: 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: waitForPreview invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:51— `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 invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:116— `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 invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:280— `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:20— `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:70— `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: waitForPreview invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:113— `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:328— `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: 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 })`.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×13
Recursive walk over a caller-supplied document has no depth cap invokeai/app/services/shared/execution_state_migration.py:168— `load_execution_state` is public, takes a document from its caller (line 172) and hands it to `_normalize_persisted_effects_in_snapshot`, which calls itself at line 168 (`_normalize_persisted_effects_in_snapshot`) with a piece of `payload` — and nowhere in `_normalize_persisted_effects_in_snapshot` 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_effects_in_snapshot` 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/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/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/frontend/webv2/src/features/queue/core/graphInputMedia.ts:19— `collectGraphInputMediaNames` is exported, takes a document from its caller (line 12) and hands it to `visit`, which calls itself at line 19 (`visit`) with a piece of `value` (and at line 37) — 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/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/workflow/data/publication.ts:85— `isWorkflowContentEquivalent` is exported, takes a document from its caller (line 100) and hands it to `canonicalize`, which calls itself at line 85 (`canonicalize`) with a piece of `value` (and at line 92) — 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/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/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/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/projects/projectAssets.ts:223— `stripInstallationState` is exported, takes a document from its caller (line 264) and hands it to `mapDocument`, which calls itself at line 223 (`mapDocument`) with a piece of `node` (and at line 244) — 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.
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:175-189 — `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 8 separate duplicated blocks between them, totalling at least 153 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:1426— invokeai/app/invocations/composition-nodes.py:1426-1440 | invokeai/app/invocations/composition-nodes.py:1510-1524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:108-122 — 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 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) invokeai/app/services/gallery/gallery_default.py:141— invokeai/app/services/gallery/gallery_default.py:141-155 | invokeai/app/services/gallery/gallery_default.py:176-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:1115— invokeai/app/services/model_install/model_install_default.py:1115-1129 | invokeai/app/services/model_install/model_install_default.py:1131-1145 — both copies are in the same file, so extract the block into 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:526— invokeai/backend/hidiffusion/hidiffusion.py:526-540 | invokeai/backend/hidiffusion/hidiffusion.py:562-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (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:113— invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_only_full_load.py:113-127 | invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:227-241 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1897— invokeai/backend/model_manager/load/model_loaders/flux.py:1897-1911 | invokeai/backend/model_manager/load/model_loaders/flux.py:1912-1926 — both copies are in the same file, so extract the block into 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/model_manager/load/model_loaders/krea2.py:731— invokeai/backend/model_manager/load/model_loaders/krea2.py:731-745 | invokeai/backend/model_manager/load/model_loaders/z_image.py:967-985 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
FixmeComment invokeai/app/invocations/sd/denoise_latents.py:109— # 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:1115— # 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:491— # 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.
FixmeComment invokeai/app/invocations/vae/image_to_latents.py:173— # 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 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/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/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.
Duplicated block (14 lines × 2) invokeai/app/invocations/pid/flux_pid_decode.py:156— invokeai/app/invocations/pid/flux_pid_decode.py:156-169 | invokeai/app/invocations/pid/sd3_pid_decode.py:145-158 — before extracting anything, compare `invokeai/app/invocations/pid/flux_pid_decode.py` and `invokeai/app/invocations/pid/sd3_pid_decode.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (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/model_install/model_install_default.py:1351— invokeai/app/services/model_install/model_install_default.py:1351-1364 | invokeai/app/services/model_install/model_install_default.py:1386-1399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/model_install/model_install_default.py:1351` it begins part-way through the construct above it, so those exact lines 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/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/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:3571— invokeai/backend/model_manager/configs/main.py:3571-3584 | invokeai/backend/model_manager/configs/main.py:3725-3738 — both copies are in the same file, so extract the 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/backend/pid/_src/networks/pid_net.py:378— invokeai/backend/pid/_src/networks/pid_net.py:378-391 | invokeai/backend/pid/_src/networks/pid_net.py:414-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:378` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) invokeai/backend/z_image/z_image_control_transformer.py:390— invokeai/backend/z_image/z_image_control_transformer.py:390-403 | invokeai/backend/z_image/z_image_control_transformer.py:522-535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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/backend/z_image/z_image_control_transformer.py:482— invokeai/backend/z_image/z_image_control_transformer.py:482-495 | invokeai/backend/z_image/z_image_controlnet_extension.py:263-277 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/z_image/z_image_control_transformer.py:480` calls `super`, `forward` and `invokeai/backend/z_image/z_image_controlnet_extension.py:261` 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/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.
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: 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: engine.ts → paintTool.ts, operationController.ts, ControlLayerSettings.tsx invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts— `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` changes together with 3 other files — `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/layers/ControlLayerSettings.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: tiled_multi_diffusion_denoise_latents.py → compel.py, denoise_latents.py, flux_text_encoder.py, sd3_text_encoder.py, layer_patcher.py invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py— `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py` changes together with 5 other files — `invokeai/app/invocations/compel.py`, `invokeai/app/invocations/denoise_latents.py`, `invokeai/app/invocations/flux_text_encoder.py`, `invokeai/app/invocations/sd3_text_encoder.py`, `invokeai/backend/patches/layer_patcher.py` — 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: 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: compel.py → denoise_latents.py, flux_text_encoder.py, sd3_text_encoder.py invokeai/app/invocations/compel.py— `invokeai/app/invocations/compel.py` changes together with 3 other files — `invokeai/app/invocations/denoise_latents.py`, `invokeai/app/invocations/flux_text_encoder.py`, `invokeai/app/invocations/sd3_text_encoder.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.
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.
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:315-330 — `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 8 separate duplicated blocks between them, totalling at least 153 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:322-337 — 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:318` 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/pid/flux_pid_decode.py:152— invokeai/app/invocations/pid/flux_pid_decode.py:152-167 | invokeai/app/invocations/pid/pid_upscale.py:192-207 — 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 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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/app/services/download/download_default.py:434— invokeai/app/services/download/download_default.py:434-449 | invokeai/app/services/download/download_default.py:452-467 — both copies are in the same file, so extract the block into 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/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:1039— invokeai/backend/pid/_src/networks/pixeldit_official.py:1039-1054 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1113-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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 (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:280-292 — 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:286— invokeai/app/invocations/sd/denoise_latents.py:286-298 | 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:154— invokeai/backend/flux/denoise.py:154-166 | invokeai/backend/flux/denoise.py:192-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/denoise.py:154` it does not close everything it opens, so those exact lines 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/backend/patches/lora_conversions/anima_lora_conversion_utils.py:216— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:216-228 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:195-210 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 × 3) invokeai/app/invocations/metadata_linked.py:737— invokeai/app/invocations/metadata_linked.py:737-743 | invokeai/app/invocations/metadata_linked.py:788-795 | invokeai/app/invocations/metadata_linked.py:865-871 — 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:788` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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/qwen_image_pid_decode.py:158— invokeai/app/invocations/pid/qwen_image_pid_decode.py:158-164 | invokeai/app/invocations/pid/sdxl_pid_decode.py:134-140 | invokeai/app/invocations/pid/z_image_pid_decode.py:131-137 — before extracting anything, compare `invokeai/app/invocations/pid/qwen_image_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 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/qwen_image_pid_decode.py:158` it begins part-way through the construct above it, so those exact lines 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:1097— invokeai/app/services/session_queue/session_queue_default.py:1097-1103 | invokeai/app/services/session_queue/session_queue_default.py:1115-1121 | invokeai/app/services/session_queue/session_queue_default.py:1131-1137 — 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 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ 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:3486— invokeai/backend/model_manager/configs/main.py:3486-3492 | invokeai/backend/model_manager/configs/main.py:3655-3662 | invokeai/backend/model_manager/configs/main.py:3814-3821 — 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:1465-1471 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1490-1496 — 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cognitive 73) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1330— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject has cognitive complexity 73 (threshold 15). Drivers by points: if/else 19 (52 pts), ternaries 3 (11 pts), error handling 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 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 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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:2142— 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: 5 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 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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 25) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1431— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 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. This shape REPEATS in the file: 5 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 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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 23) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1066— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (9 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. This shape REPEATS in the file: 5 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 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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:855— 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: 5 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 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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 16) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1624— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 5, 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. This shape REPEATS in the file: 5 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 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
Duplicated block (19 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:644— invokeai/app/invocations/wan/wan_denoise.py:644-662 | invokeai/app/invocations/wan/wan_video_denoise.py:299-317 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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:644` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (19 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:148— invokeai/backend/flux/controlnet/state_dict_utils.py:148-166 | invokeai/backend/model_manager/load/model_loaders/flux.py:2294-2312 — 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:148` it begins part-way through the construct above it, so those exact lines 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/app/api/routers/utilities.py:166— invokeai/app/api/routers/utilities.py:166-186 | 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 (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:67-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. The matched lines also transfer control out of the body holding them, 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/vae/flux2_vae_encode.py:102— invokeai/app/invocations/vae/flux2_vae_encode.py:102-113 | invokeai/app/invocations/vae/flux_vae_encode.py:110-120 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–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 (11–12 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:394— invokeai/backend/pid/_src/networks/pid_net.py:394-405 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1481-1491 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–12 lines × 2) invokeai/backend/z_image/z_image_control_transformer.py:419— invokeai/backend/z_image/z_image_control_transformer.py:419-430 | invokeai/backend/z_image/z_image_control_transformer.py:619-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/z_image/z_image_control_transformer.py:419` it does not close everything it opens, so those 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.
AC2 · Forms & labels· <Select> field component without a label · ×5
<Select> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListSelectedEntityActionBarCompositeOperation.tsx:63— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/CanvasWorkflowIntegrationWorkflowSelector.tsx:77— 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.
<Select> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:372— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Transform/TransformSmoothingControls.tsx:41— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label invokeai/frontend/webv1/src/features/cropper/components/CropImageEditor.tsx:160— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing it renders carries one either (a name prop is the form-submission key, not a label). 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.
durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cyclomatic 31) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1330— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject 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. 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:2142— 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 20) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1431— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves 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::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::pushStagedProject::reconcile (cyclomatic 18) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1624— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile 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. 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::stageProject (cyclomatic 17) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1066— durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject 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: 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.
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/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:542— invokeai/backend/hidiffusion/hidiffusion.py:542-558 | invokeai/backend/hidiffusion/hidiffusion.py:578-594 — both copies are in the same file, so extract the block into 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 (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:1133— invokeai/app/invocations/sd/denoise_latents.py:1133-1143 | 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 (10–11 lines × 2) invokeai/backend/model_manager/load/model_loaders/vae.py:324— invokeai/backend/model_manager/load/model_loaders/vae.py:324-333 | invokeai/backend/model_manager/load/model_loaders/vae.py:474-484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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/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:461— invokeai/backend/pid/_src/networks/pixeldit_official.py:461-468 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1064-1071 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1138-1145 — 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.
AC1 · Text alternatives· <canvas> without a text alternative · ×4
<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/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:102— 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:103— 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.
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:734— 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:832— 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:530— 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:1266— 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.
Duplicated block (22 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:691— invokeai/app/invocations/wan/wan_denoise.py:691-712 | invokeai/app/invocations/wan/wan_video_denoise.py:352-373 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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:347` calls `expand` and `invokeai/app/invocations/wan/wan_denoise.py:689` 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:364— invokeai/app/services/shared/database/queries/images.py:364-385 | invokeai/app/services/shared/database/queries/images.py:407-428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (22 lines × 2) invokeai/backend/z_image/z_image_control_adapter.py:107— invokeai/backend/z_image/z_image_control_adapter.py:107-128 | invokeai/backend/z_image/z_image_control_transformer.py:221-242 — before extracting anything, compare `invokeai/backend/z_image/z_image_control_adapter.py` and `invokeai/backend/z_image/z_image_control_transformer.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/z_image/z_image_control_adapter.py:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) invokeai/app/api/routers/utilities.py:136— invokeai/app/api/routers/utilities.py:136-155 | 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/flux2/denoise.py:147— invokeai/backend/flux2/denoise.py:147-166 | invokeai/backend/flux2/denoise.py:252-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) 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.
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:868-881 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `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/flux/denoise.py:224— invokeai/backend/flux/denoise.py:224-237 | invokeai/backend/flux2/denoise.py:192-206 — 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–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) invokeai/backend/hidiffusion/hidiffusion.py:2151— invokeai/backend/hidiffusion/hidiffusion.py:2151-2162 | invokeai/backend/hidiffusion/hidiffusion.py:2206-2220 — both copies are in the same file, so extract the block into 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/backend/minimax_h3/rocm_causal_conv3d.py:50— invokeai/backend/minimax_h3/rocm_causal_conv3d.py:50-61 | invokeai/backend/wan/rocm_causal_conv3d.py:41-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.
Duplicated block (6 lines × 3) invokeai/app/invocations/krea2/krea2_denoise.py:884— invokeai/app/invocations/krea2/krea2_denoise.py:884-889 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:568-573 | invokeai/app/invocations/text_encoder/krea2_text_encoder.py:129-134 — 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:40— invokeai/app/services/shared/execution_engine/child.py:40-45 | 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) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:56— invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:56-61 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:36-41 | invokeai/backend/flux/model.py:54-59 — 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 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) 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 | invokeai/backend/model_manager/load/model_loaders/wan.py:535-540 — 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/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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×3
Animation without a prefers-reduced-motion guard docs/src/styles/custom.css:50— `.site-title` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/src/styles/custom.css:309— `.sl-link-button` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/src/styles/custom.css:401— `.splash-img::before` moves (`animation: splash-animate 6s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
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· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py:995— invokeai/app/invocations/anima/anima_denoise.py:995-1014 | 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:917-925 — 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-260 — 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· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
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/backend/model_manager/configs/base.py:242— invokeai/backend/model_manager/configs/base.py:242-253 | invokeai/backend/model_manager/configs/main.py:3554-3565 | invokeai/backend/model_manager/configs/main.py:3708-3719 | invokeai/backend/model_manager/configs/main.py:3872-3884 | invokeai/backend/model_manager/model_on_disk.py:153-167 — 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:872— invokeai/backend/model_manager/load/model_loaders/flux.py:872-1013 | invokeai/backend/model_manager/load/model_loaders/flux.py:1265-1549 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:362-516 | invokeai/backend/model_manager/load/model_loaders/krea2.py:403-638 | invokeai/backend/model_manager/load/model_loaders/z_image.py:478-726 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (27 lines × 2) invokeai/app/invocations/metadata_linked.py:1015— invokeai/app/invocations/metadata_linked.py:1015-1041 | invokeai/app/invocations/metadata_linked.py:1095-1121 — both copies are in the same file, so extract the block into 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 (27 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:322— invokeai/backend/pid/_src/networks/pid_net.py:322-348 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1424-1450 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:1451` 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 (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 (25 lines × 2) invokeai/app/util/user_management.py:244— invokeai/app/util/user_management.py:244-268 | invokeai/app/util/user_management.py:292-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 (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:171— invokeai/backend/flux2/denoise.py:171-188 | invokeai/backend/flux2/denoise.py:276-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:273— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:273-290 | invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:292-309 — both copies are in the same file, so extract the 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:107— invokeai/app/services/images/images_default.py:107-122 | 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:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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–13 lines × 3) invokeai/app/invocations/composition-nodes.py:93— invokeai/app/invocations/composition-nodes.py:93-105 | invokeai/app/invocations/composition-nodes.py:1428-1439 | invokeai/app/invocations/composition-nodes.py:1512-1523 — 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 (12–13 lines × 3) invokeai/app/invocations/pid/flux2_pid_decode.py:153— invokeai/app/invocations/pid/flux2_pid_decode.py:153-164 | invokeai/app/invocations/pid/sdxl_pid_decode.py:119-130 | invokeai/app/invocations/pid/z_image_pid_decode.py:114-126 — 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 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12–13 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:999— invokeai/backend/model_manager/load/model_loaders/flux.py:999-1010 | invokeai/backend/model_manager/load/model_loaders/flux.py:1535-1546 | invokeai/backend/model_manager/load/model_loaders/z_image.py:702-714 — 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/model_manager/load/model_loaders/z_image.py:702` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:1101— invokeai/app/invocations/sd/denoise_latents.py:1101-1108 | 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 (7–9 lines × 2) invokeai/app/invocations/vae/flux2_vae_decode.py:147— invokeai/app/invocations/vae/flux2_vae_decode.py:147-155 | invokeai/app/invocations/vae/flux_vae_decode.py:152-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/flux2_vae_decode.py:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–9 lines × 2) invokeai/backend/anima/anima_transformer.py:244— invokeai/backend/anima/anima_transformer.py:244-252 | invokeai/backend/anima/anima_transformer.py:836-842 — both copies are in the same file, so extract the block into 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–9 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:354— invokeai/backend/pid/_src/networks/pid_net.py:354-362 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1451-1457 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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: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 (7–8 lines × 2) invokeai/app/invocations/model.py:532— invokeai/app/invocations/model.py:532-538 | invokeai/app/invocations/model.py:692-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/invocations/model.py:702` calls `model_copy` and `invokeai/app/invocations/model.py:540` 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 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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 (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:919-925 — 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/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.
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.
Outbound HTTP without resilience scripts/check_classifiers.py:21— `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience scripts/get_external_contributions.py:50— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience scripts/get_external_contributions.py:61— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
AC2 · Forms & labels· <Textarea> field component without a label · ×2
<Textarea> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.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.
<Textarea> field component without a label invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/InvocationNodeNotesTextarea.tsx:26— This UI-library field component has no label / aria-label / aria-labelledby / id — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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· <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 it renders carries one either (a name prop is the form-submission key, not a label). 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 it renders carries one either (a name prop is the form-submission key, not a label). 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:832— 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:530— 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: 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:43— 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.
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.
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.
Duplicated block (31–35 lines × 2) invokeai/backend/anima/regional_prompting.py:143— invokeai/backend/anima/regional_prompting.py:143-173 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:171-205 — 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:171` it does not close everything it opens, so those 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:3593— invokeai/backend/model_manager/configs/main.py:3593-3627 | invokeai/backend/model_manager/configs/main.py:3747-3777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–32 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:656— invokeai/app/invocations/anima/anima_denoise.py:656-685 | invokeai/app/invocations/z_image/z_image_denoise.py:419-450 — 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:652` calls `unsqueeze` and `invokeai/app/invocations/z_image/z_image_denoise.py:415` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (30–32 lines × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:173— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:173-202 | invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:215-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
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:252-281 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (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:1115-1141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:554— REDACTED:554-581 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1123-1149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (24 lines × 2) 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:308— invokeai/backend/model_manager/configs/qwen3_encoder.py:308-331 | invokeai/backend/model_manager/configs/qwen3_encoder.py:492-515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–23 lines × 2) invokeai/backend/model_manager/configs/qwen3_encoder.py:371— invokeai/backend/model_manager/configs/qwen3_encoder.py:371-393 | invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:117-136 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:311— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:311-333 | invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:493-512 — both copies are in the same file, so extract the 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/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:308` calls `warning` and `invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:491` 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–19 lines × 2) invokeai/app/invocations/krea2/krea2_denoise.py:801— invokeai/app/invocations/krea2/krea2_denoise.py:801-819 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:358-372 — 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_denoise.py:801` it does not close everything it opens, so those 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–19 lines × 2) invokeai/app/services/image_files/image_files_disk.py:634— invokeai/app/services/image_files/image_files_disk.py:634-652 | 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 (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 (18–19 lines × 2) invokeai/app/invocations/z_image/z_image_denoise.py:757— invokeai/app/invocations/z_image/z_image_denoise.py:757-775 | invokeai/backend/flux2/denoise.py:193-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/app/invocations/z_image/z_image_denoise.py:757` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–19 lines × 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 (14–18 lines × 4) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12— invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12-29 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:127-141 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:160-173 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:192-205 — 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. The matched lines also transfer control out of the body holding them, 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 (14–18 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:383— invokeai/backend/model_manager/load/model_loaders/z_image.py:383-396 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1428-1445 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1635-1648 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1818-1831 — 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:1632` calls `info` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:381` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16–18 lines × 2) invokeai/app/invocations/vae/qwen_image_2_1_image_to_latents.py:51— invokeai/app/invocations/vae/qwen_image_2_1_image_to_latents.py:51-68 | 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 (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–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 (15–16 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:2215— invokeai/backend/model_manager/load/model_loaders/flux.py:2215-2229 | invokeai/backend/model_manager/load/model_loaders/flux.py:2281-2296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:2215` it does not close everything it opens, so those exact lines 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–16 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:581— invokeai/backend/minimax_h3/transformer_minimax_h3.py:581-596 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:191-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:1532— invokeai/backend/model_manager/load/model_loaders/z_image.py:1532-1547 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1739-1751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1532` it does not close everything it opens, so those 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 × 4) invokeai/app/api/dependencies.py:262— invokeai/app/api/dependencies.py:262-276 | invokeai/app/services/image_records/image_records_common.py:201-215 | invokeai/backend/pid/_src/networks/pid_net.py:114-128 | invokeai/backend/z_image/z_image_control_transformer.py:158-172 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/dependencies.py:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:306— invokeai/backend/model_manager/load/model_loaders/z_image.py:306-320 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1255-1269 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1527-1541 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1734-1748 — 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:1752` calls `ValueError` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:323` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 3) invokeai/app/api/routers/gallery.py:73— invokeai/app/api/routers/gallery.py:73-86 | invokeai/app/api/routers/gallery.py:128-141 | invokeai/app/api/routers/gallery.py:256-269 — 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:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/api/routers/gallery.py:143` calls `HTTPException` and `invokeai/app/api/routers/gallery.py:89` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 3) invokeai/app/invocations/pid/flux2_pid_decode.py:233— invokeai/app/invocations/pid/flux2_pid_decode.py:233-246 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:222-235 | invokeai/app/invocations/pid/sdxl_pid_decode.py:195-208 — 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 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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:312-324 | invokeai/app/invocations/z_image/z_image_denoise.py:872-884 — `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 8 separate duplicated blocks between them, totalling at least 153 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:464-477 | invokeai/app/invocations/model.py:627-640 — 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 × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:154— invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:154-167 | 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:41— invokeai/backend/quantization/gguf/ggml_tensor.py:41-54 | 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:40` 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/load/model_loaders/krea2.py:213— invokeai/backend/model_manager/load/model_loaders/krea2.py:213-225 | invokeai/backend/model_manager/load/model_loaders/krea2.py:226-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/krea2.py:226` it begins part-way through the construct above it, so those 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/krea2.py:226` calls `startswith` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:213` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 5) invokeai/backend/model_manager/configs/base.py:242— invokeai/backend/model_manager/configs/base.py:242-253 | invokeai/backend/model_manager/configs/main.py:3554-3565 | invokeai/backend/model_manager/configs/main.py:3708-3719 | invokeai/backend/model_manager/configs/main.py:3873-3884 | invokeai/backend/model_manager/model_on_disk.py:156-167 — 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 (12 lines × 3) invokeai/app/services/model_install/model_install_default.py:649— invokeai/app/services/model_install/model_install_default.py:649-660 | invokeai/app/services/model_install/model_install_default.py:1346-1357 | invokeai/app/services/model_install/model_install_default.py:1381-1392 — 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/model_install/model_install_default.py:649` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) invokeai/backend/z_image/z_image_control_transformer.py:388— invokeai/backend/z_image/z_image_control_transformer.py:388-399 | invokeai/backend/z_image/z_image_control_transformer.py:520-531 | invokeai/backend/z_image/z_image_control_transformer.py:559-570 — 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/z_image/z_image_control_transformer.py:388` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–12 lines × 2) invokeai/backend/model_manager/configs/main.py:3483— invokeai/backend/model_manager/configs/main.py:3483-3492 | invokeai/backend/model_manager/configs/main.py:3810-3821 — both copies are in the same file, so extract the block into 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 × 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:105-115 — 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 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `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/download/download_default.py:440— invokeai/app/services/download/download_default.py:440-448 | invokeai/app/services/download/download_default.py:458-466 | invokeai/app/services/download/download_default.py:486-496 — 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/download/download_default.py:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 2) invokeai/app/api/routers/session_queue.py:621— invokeai/app/api/routers/session_queue.py:621-631 | invokeai/app/api/routers/session_queue.py:874-882 — both copies are in the same file, so extract the 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 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
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 (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 (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) invokeai/backend/pid/_src/networks/pid_net.py:374— invokeai/backend/pid/_src/networks/pid_net.py:374-378 | invokeai/backend/pid/_src/networks/pid_net.py:410-414 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1469-1473 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1494-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 (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/minimax_h3/taehv_decoder.py:82— invokeai/backend/minimax_h3/taehv_decoder.py:82-86 | invokeai/backend/minimax_h3/taehv_decoder.py:88-92 | invokeai/backend/minimax_h3/taehv_decoder.py:94-98 — 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.
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/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.
Schema created by SQLAlchemy create_all() (no migration path) invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_impl.py:526— 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 (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.
Duplication concentrated across 2 sibling directories (5 clone groups) invokeai/frontend/webv2/scripts/write-workbench-ownership-inventory.mjs:62— 5 duplicated blocks under invokeai/frontend/webv2/ have copies in at least two of the sibling directories scripts, src — 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.
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/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.
Length read from the parsed input is spent without ever being bounded invokeai/backend/quantization/int8_convrot.py:173— `header_len` is read from the bytes being parsed at line 172 (`struct.unpack("<Q")`), then passed as the size of `read` at line 173 — 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.
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.
AC1 · Text alternatives· <video> without a captions track · ×1
<video> without a captions track invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:894— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
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 — and neither does anything it renders (a name prop is the form-submission key, not a label) — 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.
mock-backend.startMockBackend.server (cyclomatic 523) invokeai/frontend/webv2/scripts/mock-backend.mjs:937— mock-backend.startMockBackend.server has cyclomatic complexity 523 (threshold 15). Of this number, 501 points are the body's own statements and 22 belong to 11 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workbenchState.__workbenchReducerInternal (cyclomatic 384) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3890— workbenchState.__workbenchReducerInternal has cyclomatic complexity 384 (threshold 15). Of this number, 205 points are the body's own statements and 179 belong to 70 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.
GalleryImageGrid.GalleryImageGrid (cyclomatic 322) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:404— GalleryImageGrid.GalleryImageGrid has cyclomatic complexity 322 (threshold 15). Of this number, 90 points are the body's own statements and 232 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 227) invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169— LayersTree.LayersTree has cyclomatic complexity 227 (threshold 15). Of this number, 29 points are the body's own statements and 198 belong to 49 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.
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.
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.
WorkflowEditorView.WorkflowFlow (cyclomatic 139) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:305— WorkflowEditorView.WorkflowFlow has cyclomatic complexity 139 (threshold 15). Of this number, 17 points are the body's own statements and 122 belong to 48 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.
useImageActions.useImageActions (cyclomatic 129) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:194— useImageActions.useImageActions has cyclomatic complexity 129 (threshold 15). Most of this is not in the body itself: 1 of the 129 points is its own statement and the rest belongs to 42 function literals inside it that branch (lines 435, 750, 898, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
videoRecall.buildVideoRecallSettings (cyclomatic 113) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:474— videoRecall.buildVideoRecallSettings has cyclomatic complexity 113 (threshold 15). Of this number, 110 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.
recallParameters.buildRecallParametersSettings (cyclomatic 110) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:185— recallParameters.buildRecallParametersSettings has cyclomatic complexity 110 (threshold 15). Of this number, 91 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.
setEventListeners.setEventListeners (cyclomatic 107) invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:81— setEventListeners.setEventListeners has cyclomatic complexity 107 (threshold 15). Most of this is not in the body itself: 1 of the 107 points is its own statement and the rest belongs to 36 function items inside it that branch (a function literal at line 544, a function literal at line 786, a function literal at line 669, …). 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.
LayerContextMenu.LayerMenu (cyclomatic 107) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:217— LayerContextMenu.LayerMenu has cyclomatic complexity 107 (threshold 15). Most of this is not in the body itself: 9 of the 107 points are its own statements and the rest belongs to 35 function literals inside it that branch (lines 649, 462, 362, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
videoPolicies.getVideoValidationReasons (cyclomatic 100) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2291— videoPolicies.getVideoValidationReasons has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent 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:228— 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.
canvasHotkeyCommands.executeCanvasHotkeyCommand (cyclomatic 97) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:120— canvasHotkeyCommands.executeCanvasHotkeyCommand has cyclomatic complexity 97 (threshold 15). Of this number, 94 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.
VideoWidgetView.VideoWidgetView (cyclomatic 94) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:122— VideoWidgetView.VideoWidgetView has cyclomatic complexity 94 (threshold 15). Of this number, 65 points are the body's own statements and 29 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.
GalleryPickerView.GalleryPickerView (cyclomatic 91) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:65— GalleryPickerView.GalleryPickerView has cyclomatic complexity 91 (threshold 15). Of this number, 54 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.
queueRunRestoration.normalizeRestoredQueueItem (cyclomatic 90) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17— queueRunRestoration.normalizeRestoredQueueItem has cyclomatic complexity 90 (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.
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.
document.applyProjectGraphAction (cyclomatic 89) invokeai/frontend/webv2/src/features/workflow/core/document.ts:907— document.applyProjectGraphAction has cyclomatic complexity 89 (threshold 15). Of this number, 71 points are the body's own statements and 18 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.
ModelInstallQueueItem.ModelInstallQueueItem (cyclomatic 81) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:108— ModelInstallQueueItem.ModelInstallQueueItem has cyclomatic complexity 81 (threshold 15). Of this number, 36 points are the body's own statements and 45 belong to 15 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.
PreviewFrame.PreviewVideo (cyclomatic 80) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:376— PreviewFrame.PreviewVideo has cyclomatic complexity 80 (threshold 15). Most of this is not in the body itself: 11 of the 80 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 462, 792, 601, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
canvasProjectMutations.applyCanvasProjectMutation (cyclomatic 77) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:669— canvasProjectMutations.applyCanvasProjectMutation has cyclomatic complexity 77 (threshold 15). Of this number, 64 points are the body's own statements and 13 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.
useGalleryData.useGalleryData (cyclomatic 75) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:257— useGalleryData.useGalleryData has cyclomatic complexity 75 (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.
videoPolicies.getVideoModelSelectionResult (cyclomatic 74) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1964— videoPolicies.getVideoModelSelectionResult has cyclomatic complexity 74 (threshold 15). Of this number, 71 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.
ImageMapPlot.ImageMapPlot (cyclomatic 74) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:113— 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 446, a function literal at line 392, a function literal at line 197, …). 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.
executeVideoRecall.applyVideoRecallMetadata (cyclomatic 72) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:169— executeVideoRecall.applyVideoRecallMetadata has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
workbenchState.enqueueCompiledSnapshot (cyclomatic 70) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3538— workbenchState.enqueueCompiledSnapshot has cyclomatic complexity 70 (threshold 15). Of this number, 66 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.
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.
PreviewWidgetView.PreviewWidgetView (cyclomatic 69) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:188— PreviewWidgetView.PreviewWidgetView has cyclomatic complexity 69 (threshold 15). Of this number, 17 points are the body's own statements and 52 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.
DownloadQueueService._do_download (cyclomatic 68) invokeai/app/services/download/download_default.py:423— DownloadQueueService._do_download has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
WorkflowPublicationHost.WorkflowPublicationHost (cyclomatic 67) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowPublicationHost.tsx:90— WorkflowPublicationHost.WorkflowPublicationHost has cyclomatic complexity 67 (threshold 15). Of this number, 25 points are the body's own statements and 42 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.
lora._is_flux2_lora_state_dict (cyclomatic 66) invokeai/backend/model_manager/configs/lora.py:225— lora._is_flux2_lora_state_dict has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FloatingWidgetWindow.FloatingWidgetWindow (cyclomatic 66) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:328— FloatingWidgetWindow.FloatingWidgetWindow has cyclomatic complexity 66 (threshold 15). Of this number, 25 points are the body's own statements and 41 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.
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.
utilityGraph.runUtilityGraph (cyclomatic 65) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:196— utilityGraph.runUtilityGraph has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 5 of the 65 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 359, 426, 258, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LayerRow.LayerRowComponent (cyclomatic 65) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:78— LayerRow.LayerRowComponent has cyclomatic complexity 65 (threshold 15). Of this number, 45 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.
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.
GalleryMediaSlot.GalleryMediaSlot (cyclomatic 62) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx:82— GalleryMediaSlot.GalleryMediaSlot has cyclomatic complexity 62 (threshold 15). Of this number, 46 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.
AddModelsView.AddModelsView (cyclomatic 62) invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx:71— AddModelsView.AddModelsView has cyclomatic complexity 62 (threshold 15). Of this number, 25 points are the body's own statements and 37 belong to 14 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.isVideoSettings (cyclomatic 61) invokeai/frontend/webv2/src/features/video/core/settings.ts:446— settings.isVideoSettings has cyclomatic complexity 61 (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.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.
runtime.createQueueRuntime.reconcile (cyclomatic 58) invokeai/frontend/webv2/src/features/queue/runtime.ts:2076— runtime.createQueueRuntime.reconcile has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 8 of the 58 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2168, 2121, 2092, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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_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.
hidiffusion.apply_hidiffusion (cyclomatic 55) invokeai/backend/hidiffusion/hidiffusion.py:2040— hidiffusion.apply_hidiffusion has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
imageRecall.buildImageRecallSettings (cyclomatic 55) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1115— imageRecall.buildImageRecallSettings has cyclomatic complexity 55 (threshold 15). Of this number, 53 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.
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.
List.List (cyclomatic 54) invokeai/frontend/webv2/src/platform/ui/list/List.tsx:129— List.List has cyclomatic complexity 54 (threshold 15). Of this number, 20 points are the body's own statements and 34 belong to 12 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.
ZImageDenoiseInvocation._run_diffusion (cyclomatic 53) invokeai/app/invocations/z_image/z_image_denoise.py:337— ZImageDenoiseInvocation._run_diffusion has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
widgetValues.syncVideoWidgetValuesWithModels (cyclomatic 53) invokeai/frontend/webv2/src/features/video/core/widgetValues.ts:39— 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.
WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cyclomatic 53) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:85— WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 13 of the 53 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 143, 182, 237, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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.
GenerateAdvancedFields.GenerateAdvancedFields (cyclomatic 52) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:71— GenerateAdvancedFields.GenerateAdvancedFields has cyclomatic complexity 52 (threshold 15). Of this number, 46 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
batch.planWorkflowBatch (cyclomatic 52) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:681— 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.
GalleryItemSearch.GalleryItemSearch (cyclomatic 51) invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:66— GalleryItemSearch.GalleryItemSearch has cyclomatic complexity 51 (threshold 15). Of this number, 22 points are the body's own statements and 29 belong to 12 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.
settings.getUpscaleValidationReasons (cyclomatic 51) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:948— settings.getUpscaleValidationReasons has cyclomatic complexity 51 (threshold 15). Of this number, 50 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.
PreviewFrame.PreviewImageFrame (cyclomatic 51) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:97— 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.
ControlLayerSettings.ControlLayerSettings (cyclomatic 51) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx:69— ControlLayerSettings.ControlLayerSettings has cyclomatic complexity 51 (threshold 15). Of this number, 22 points are the body's own statements and 29 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.
_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.
FontsPage.FontLibrary (cyclomatic 50) invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:305— FontsPage.FontLibrary has cyclomatic complexity 50 (threshold 15). Of this number, 26 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.
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 540, 558, 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.
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.
layerChildRows.layerChildRowCommand (cyclomatic 49) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:507— layerChildRows.layerChildRowCommand has cyclomatic complexity 49 (threshold 15). Of this number, 45 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_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.
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.
GalleryMaintenance.GalleryMaintenance (cyclomatic 48) invokeai/frontend/webv2/src/workbench/settings/GalleryMaintenance.tsx:77— GalleryMaintenance.GalleryMaintenance has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 13 of the 48 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 157, 235, 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.
useGalleryActions.useGalleryActions (cyclomatic 47) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryActions.ts:35— useGalleryActions.useGalleryActions has cyclomatic complexity 47 (threshold 15). 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 237, 98, 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.
UpscaleWidgetView.UpscaleWidgetView (cyclomatic 47) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:352— UpscaleWidgetView.UpscaleWidgetView has cyclomatic complexity 47 (threshold 15). Of this number, 20 points are the body's own statements and 27 belong to 14 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ListItem.ListItem (cyclomatic 47) invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx:83— ListItem.ListItem has cyclomatic complexity 47 (threshold 15). Of this number, 32 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.
ProjectConflictBanner.ProjectConflictBanner (cyclomatic 47) invokeai/frontend/webv2/src/workbench/shell/ProjectConflictBanner.tsx:27— ProjectConflictBanner.ProjectConflictBanner has cyclomatic complexity 47 (threshold 15). Of this number, 32 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.
WanDenoiseInvocation._run_diffusion (cyclomatic 46) invokeai/app/invocations/wan/wan_denoise.py:424— WanDenoiseInvocation._run_diffusion 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.
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.
settings.normalizeVideoSettings (cyclomatic 46) invokeai/frontend/webv2/src/features/video/core/settings.ts:329— settings.normalizeVideoSettings 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.
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.
CanvasWidgetView.CanvasWidgetView (cyclomatic 46) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:110— CanvasWidgetView.CanvasWidgetView has cyclomatic complexity 46 (threshold 15). Of this number, 17 points are the body's own statements and 29 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.
usePreviewNavigation.usePreviewNavigation.navigate (cyclomatic 46) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:711— 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 780, 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.
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.
settings.normalizeGenerateSettings (cyclomatic 45) invokeai/frontend/webv2/src/features/generation/core/settings.ts:743— settings.normalizeGenerateSettings has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ExtractMaskedAreaController.extract (cyclomatic 45) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:104— ExtractMaskedAreaController.extract 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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_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.
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.
lora._get_flux2_lora_variant (cyclomatic 43) invokeai/backend/model_manager/configs/lora.py:395— lora._get_flux2_lora_variant 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.
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.
ModelSelect.ModelSelect (cyclomatic 42) invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx:96— ModelSelect.ModelSelect has cyclomatic complexity 42 (threshold 15). Of this number, 34 points are the body's own statements and 8 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.
InvocationFlowNode.ExpandedInvocationNode (cyclomatic 42) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:961— InvocationFlowNode.ExpandedInvocationNode has cyclomatic complexity 42 (threshold 15). Of this number, 41 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.
compositor.compositeDocument (cyclomatic 42) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:520— compositor.compositeDocument has cyclomatic complexity 42 (threshold 15). Of this number, 32 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.
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.
useGalleryUploadAction.useGalleryUploadAction (cyclomatic 41) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts:44— useGalleryUploadAction.useGalleryUploadAction has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 68, 218, 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.
GalleryBoardsPanel.GalleryBoardsPanel (cyclomatic 41) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx:41— GalleryBoardsPanel.GalleryBoardsPanel has cyclomatic complexity 41 (threshold 15). Of this number, 24 points are the body's own statements and 17 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.
GalleryThumbnail.GalleryThumbnail (cyclomatic 41) invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx:75— GalleryThumbnail.GalleryThumbnail has cyclomatic complexity 41 (threshold 15). Of this number, 19 points are the body's own statements and 22 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.
useCompareLoupe.useCompareLoupe (cyclomatic 41) invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:57— useCompareLoupe.useCompareLoupe has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 2 of the 41 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 399, 323, 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.
QueueRecoveryNotice.QueueRecoveryNotice (cyclomatic 41) invokeai/frontend/webv2/src/workbench/queue-integration/QueueRecoveryNotice.tsx:33— QueueRecoveryNotice.QueueRecoveryNotice has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 13 of the 41 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 66, 92, 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.
AnimaDenoiseInvocation._run_diffusion (cyclomatic 40) invokeai/app/invocations/anima/anima_denoise.py:592— AnimaDenoiseInvocation._run_diffusion 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.
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.
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.
fields.isWorkflowFieldValueValid (cyclomatic 40) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:384— fields.isWorkflowFieldValueValid has cyclomatic complexity 40 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LayerMutationController.commitDuplicate (cyclomatic 40) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:174— 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:382— 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.
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.
runtime.createQueueRuntime.submitQueueItem (cyclomatic 39) invokeai/frontend/webv2/src/features/queue/runtime.ts:1745— runtime.createQueueRuntime.submitQueueItem has cyclomatic complexity 39 (threshold 15). Of this number, 18 points are the body's own statements and 21 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.
usePreviewNavigation.usePreviewNavigation (cyclomatic 39) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:211— 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.
GalleryMaintenanceService._remove_missing_page (cyclomatic 38) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:594— 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.
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.
BooleanMergeController.merge (cyclomatic 38) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:61— BooleanMergeController.merge has cyclomatic complexity 38 (threshold 15). Of this number, 37 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.
Flux2DenoiseInvocation._run_diffusion (cyclomatic 37) invokeai/app/invocations/flux2/flux2_denoise.py:311— Flux2DenoiseInvocation._run_diffusion 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.
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.
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.
runtime.createQueueItemBackendSubmission (cyclomatic 37) invokeai/frontend/webv2/src/features/queue/runtime.ts:260— 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.
WorkflowLibraryDialog.WorkflowLibraryDialog (cyclomatic 37) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx:89— WorkflowLibraryDialog.WorkflowLibraryDialog has cyclomatic complexity 37 (threshold 15). Of this number, 17 points are the body's own statements and 20 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.
FilterResultController.commit (cyclomatic 37) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:72— FilterResultController.commit has cyclomatic complexity 37 (threshold 15). Of this number, 34 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.
layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cyclomatic 37) invokeai/frontend/webv2/src/workbench/canvas-engine/layerRasterizer.ts:73— layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 151, 120). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ChildExecutionCapability.create_dependency (cyclomatic 36) invokeai/app/services/shared/execution_engine/child.py:311— ChildExecutionCapability.create_dependency 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.
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.
denoise.denoise (cyclomatic 36) invokeai/backend/flux2/denoise.py:20— denoise.denoise 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.
MergeLayerController.mergeSelected (cyclomatic 36) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:390— MergeLayerController.mergeSelected has cyclomatic complexity 36 (threshold 15). Of this number, 32 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.
RasterExportController.rasterize (cyclomatic 36) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts:110— RasterExportController.rasterize has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Krea2DenoiseInvocation._run_diffusion (cyclomatic 35) invokeai/app/invocations/krea2/krea2_denoise.py:352— Krea2DenoiseInvocation._run_diffusion has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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.
measure-architecture-performance.runSample (cyclomatic 35) invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:328— measure-architecture-performance.runSample has cyclomatic complexity 35 (threshold 15). Of this number, 23 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.
GallerySettingField.GallerySettingField (cyclomatic 35) invokeai/frontend/webv2/src/features/gallery/ui/GallerySettingField.tsx:10— GallerySettingField.GallerySettingField 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 one function literal inside it that branches (line 15). 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.
GalleryBoardMenu.GalleryBoardMenu (cyclomatic 35) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:35— GalleryBoardMenu.GalleryBoardMenu has cyclomatic complexity 35 (threshold 15). Of this number, 22 points are the body's own statements and 13 belong to 10 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.
InvocationFlowNode.InputFieldRow (cyclomatic 35) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:535— InvocationFlowNode.InputFieldRow has cyclomatic complexity 35 (threshold 15). Of this number, 33 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.
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.
createCanvasEngine.createCanvasEngine (cyclomatic 35) invokeai/frontend/webv2/src/workbench/canvas-operations/createCanvasEngine.ts:65— createCanvasEngine.createCanvasEngine 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 items inside it that branch (a function literal at line 129, 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.
WanVideoDenoiseInvocation._run_diffusion (cyclomatic 34) invokeai/app/invocations/wan/wan_video_denoise.py:157— WanVideoDenoiseInvocation._run_diffusion 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:1413— 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.
baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cyclomatic 34) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1461— baseGenerationPolicies.getSettingsWithCompatibleModelSelections 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.
WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cyclomatic 34) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryThumbnail.tsx:47— WorkflowLibraryThumbnail.WorkflowLibraryThumbnail has cyclomatic complexity 34 (threshold 15). Of this number, 22 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.
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:147— 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.
OverviewPane.ConnectedOverview (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/OverviewPane.tsx:50— OverviewPane.ConnectedOverview has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 266, 153, 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.
MergeLayerController.mergeVisible (cyclomatic 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:232— MergeLayerController.mergeVisible has cyclomatic complexity 34 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
projectFile.importProjectFile (cyclomatic 34) invokeai/frontend/webv2/src/workbench/projects/projectFile.ts:272— 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:64— 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 220, 146, 172, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WanModelLoaderInvocation.invoke (cyclomatic 33) invokeai/app/invocations/wan/wan_model_loader.py:125— WanModelLoaderInvocation.invoke 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.
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.
ModelInstallService._enqueue_remote_download (cyclomatic 33) invokeai/app/services/model_install/model_install_default.py:2185— ModelInstallService._enqueue_remote_download 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:22— 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.
hidiffusion_utils.hidiffusion_patch (cyclomatic 33) invokeai/backend/stable_diffusion/hidiffusion_utils.py:19— hidiffusion_utils.hidiffusion_patch 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.
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.
settings.normalizeUpscaleWidgetValues (cyclomatic 33) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:785— 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.
WorkflowWidgetChrome.WorkflowDialogHost (cyclomatic 33) invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx:298— WorkflowWidgetChrome.WorkflowDialogHost has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 382, 367, 480, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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.
canvasProjectMutations.patchLayerConfig (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:536— canvasProjectMutations.patchLayerConfig 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.
RunLayerWorkflowDialog.RunLayerWorkflowDialog (cyclomatic 33) invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx:193— RunLayerWorkflowDialog.RunLayerWorkflowDialog 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 10 function literals inside it that branch (lines 349, 315, 250, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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:275— 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 286, 348). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
revealGalleryItem.revealGalleryItem (cyclomatic 33) invokeai/frontend/webv2/src/workbench/image-actions/revealGalleryItem.ts:53— 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 69, 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.
Qwen3EncoderCheckpointLoader._load_from_singlefile (cyclomatic 32) invokeai/backend/model_manager/load/model_loaders/z_image.py:1189— 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.
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.
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.
LayerChildRow.LayerChildRowComponent (cyclomatic 32) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:81— LayerChildRow.LayerChildRowComponent has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 160, 136, 181, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LayerGroupContextMenu.LayerGroupContextMenu (cyclomatic 32) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:73— LayerGroupContextMenu.LayerGroupContextMenu has cyclomatic complexity 32 (threshold 15). Of this number, 22 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.
store.normalizeWorkbenchPreferences (cyclomatic 32) invokeai/frontend/webv2/src/workbench/settings/store.ts:285— store.normalizeWorkbenchPreferences has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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.
ModelInstallService._restore_incomplete_installs (cyclomatic 31) invokeai/app/services/model_install/model_install_default.py:489— ModelInstallService._restore_incomplete_installs 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.
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.
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.
ToolStripFlyout.ToolFamilyButton (cyclomatic 31) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:46— ToolStripFlyout.ToolFamilyButton has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 4 of the 31 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 116, 149, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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.
CropLayerController.crop (cyclomatic 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:68— CropLayerController.crop has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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) invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:902— 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 1039, a function literal at line 1107, …). 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:196— 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.
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.
holdLease.startIntermediatesHoldLease (cyclomatic 30) invokeai/frontend/webv2/src/features/intermediates/holdLease.ts:32— holdLease.startIntermediatesHoldLease has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 10 function items inside it that branch (sendOnce, bodyFor, send, …). 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.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.
buildGraph.getProjectGraphReadiness (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:125— buildGraph.getProjectGraphReadiness 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.
ProjectWorkflowsView.ProjectWorkflowDetailPanel (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:224— ProjectWorkflowsView.ProjectWorkflowDetailPanel has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 12 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.
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.
paintTool.resolveTarget (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:81— paintTool.resolveTarget 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.
shapeTool.createShapeTool.commitPixels (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:154— shapeTool.createShapeTool.commitPixels 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
generationComposite.composeForGeneration (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-operations/generationComposite.ts:131— generationComposite.composeForGeneration has cyclomatic complexity 30 (threshold 15). Of this number, 26 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.
ModelInstallService._install_path_with_info_claimed (cyclomatic 29) invokeai/app/services/model_install/model_install_default.py:1038— 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:1353— 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:281— 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.
WorkflowFieldInput.SavedWorkflowInput (cyclomatic 29) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1675— 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.
MergeLayerController.mergeDown (cyclomatic 29) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:84— MergeLayerController.mergeDown has cyclomatic complexity 29 (threshold 15). Of this number, 24 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.
SettingsEntryView.SettingsEntryView (cyclomatic 29) invokeai/frontend/webv2/src/workbench/settings/SettingsEntryView.tsx:59— SettingsEntryView.SettingsEntryView has cyclomatic complexity 29 (threshold 15). Of this number, 22 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
ModelInstallService._clear_pending_jobs (cyclomatic 28) invokeai/app/services/model_install/model_install_default.py:782— ModelInstallService._clear_pending_jobs 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._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:1261— 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.
LoRALoader._load_model (cyclomatic 28) invokeai/backend/model_manager/load/model_loaders/lora.py:96— LoRALoader._load_model 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.
Qwen3EncoderGGUFLoader._load_from_gguf (cyclomatic 28) invokeai/backend/model_manager/load/model_loaders/z_image.py:1496— 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.
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:192— 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 386, 281, 322, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
GalleryBoardRow.GalleryBoardRow (cyclomatic 28) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx:30— GalleryBoardRow.GalleryBoardRow has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 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.
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.
ModelEditForm.ModelEditForm (cyclomatic 28) invokeai/frontend/webv2/src/features/models/ui/detail/ModelEditForm.tsx:72— ModelEditForm.ModelEditForm 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 9 function literals inside it that branch (lines 157, 134, 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.
InstallJobRow.InstallJobRow (cyclomatic 28) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallJobRow.tsx:93— InstallJobRow.InstallJobRow 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.
runtime.createQueueRuntime.handleUnadoptedRerunSettled (cyclomatic 28) invokeai/frontend/webv2/src/features/queue/runtime.ts:1672— runtime.createQueueRuntime.handleUnadoptedRerunSettled 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
coordinator.createQueueCoordinator.reconcile (cyclomatic 28) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1043— 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:860— 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.
graphToDocument.previewGraphToDocument (cyclomatic 28) invokeai/frontend/webv2/src/features/workflow/core/graphToDocument.ts:36— graphToDocument.previewGraphToDocument 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.
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.
PsdExportController.export (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:67— PsdExportController.export has cyclomatic complexity 28 (threshold 15). Of this number, 20 points are the body's own statements and 8 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.
rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/rasterSnapshotCapture.ts:93— rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
StatusBar.CompactBottomWidget (cyclomatic 28) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:271— StatusBar.CompactBottomWidget has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 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.
QwenImageDenoiseInvocation._run_diffusion (cyclomatic 27) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:285— QwenImageDenoiseInvocation._run_diffusion 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.
ChildDependencyRecord._validate_relationship (cyclomatic 27) invokeai/app/services/shared/execution_engine/child.py:479— 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.
ModelCache.put (cyclomatic 27) invokeai/backend/model_manager/load/model_cache/model_cache.py:928— 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.
parseSchema.parseSchema (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:97— parseSchema.parseSchema 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 5 function literals inside it that branch (lines 120, 200, 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.
GeneratePresetsPopover.GeneratePresetsPopover (cyclomatic 27) invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx:130— GeneratePresetsPopover.GeneratePresetsPopover has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 12 of the 27 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 190, 166, 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.
runtime.createQueueRuntime.initialize (cyclomatic 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:2373— 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 2419, a function literal at line 2438). 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.
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.
NodeFieldControl.NodeFieldControl (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx:57— NodeFieldControl.NodeFieldControl has cyclomatic complexity 27 (threshold 15). Of this number, 24 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.
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.
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.
PreferencesPage.PreferencesPage (cyclomatic 27) invokeai/frontend/webv2/src/workbench/settings/PreferencesPage.tsx:31— 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.
LayerFilterControls.FilterParamField (cyclomatic 27) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterControls.tsx:133— LayerFilterControls.FilterParamField has cyclomatic complexity 27 (threshold 15). Of this number, 21 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.
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.
QwenImage21DenoiseInvocation._run_diffusion (cyclomatic 26) invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:166— QwenImage21DenoiseInvocation._run_diffusion 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.
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.
calibrate_flux_vae_working_memory.main (cyclomatic 26) scripts/calibrate_flux_vae_working_memory.py:149— calibrate_flux_vae_working_memory.main 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.
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.
index.dynamicBaseQuery (cyclomatic 26) invokeai/frontend/webv1/src/services/api/index.ts:97— index.dynamicBaseQuery has cyclomatic complexity 26 (threshold 15). 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, 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.
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.
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:153— 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.
WorkflowFieldInput.VideoFrameIndexInput (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1148— WorkflowFieldInput.VideoFrameIndexInput has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkflowFieldInput.WorkflowFieldInput (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1815— WorkflowFieldInput.WorkflowFieldInput has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
layerPanelState.reconcileLayerPanelState (cyclomatic 26) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:201— 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.
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.
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.
ModelInstallService._remove_stale_install_source_claims_locked (cyclomatic 25) invokeai/app/services/model_install/model_install_default.py:316— ModelInstallService._remove_stale_install_source_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.
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.
MistralEncoderCheckpointLoader._load_text_encoder (cyclomatic 25) REDACTED:1174— 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.
Qwen3EncoderSDNQLoader._load_from_sdnq (cyclomatic 25) invokeai/backend/model_manager/load/model_loaders/z_image.py:1701— 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.
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.
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.
queries.ensureLifecycle (cyclomatic 25) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:295— queries.ensureLifecycle has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 361, a function literal at line 316, 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.
InstallQueueBar.InstallQueueBar (cyclomatic 25) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallQueueBar.tsx:59— InstallQueueBar.InstallQueueBar has cyclomatic complexity 25 (threshold 15). Of this number, 22 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.
runtime.createQueueRuntime.synchronizeRunPersistence (cyclomatic 25) invokeai/frontend/webv2/src/features/queue/runtime.ts:1923— runtime.createQueueRuntime.synchronizeRunPersistence 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.
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.
StagingBar.StagingBar (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:114— StagingBar.StagingBar has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 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.
SelectionPixelController.edit (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:133— SelectionPixelController.edit has cyclomatic complexity 25 (threshold 15). Of this number, 22 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 25) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:72— StagedResultController.commit has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 5 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.
filterOperationSession.createFilterOperationSession.commit (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts:253— filterOperationSession.createFilterOperationSession.commit 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.
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 139, 67, 110, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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:916— 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:256— 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:445— PositivePromptActions.ExpandPromptButton has cyclomatic complexity 24 (threshold 15). Of this number, 17 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.
PromptTextarea.PromptTextarea (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTextarea.tsx:61— PromptTextarea.PromptTextarea has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 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.
settings.syncGenerateWidgetValuesWithModels (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/core/settings.ts:623— settings.syncGenerateWidgetValuesWithModels 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.
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:188— 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.
GraphPreviewDialog.GraphPreviewDialog (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx:87— GraphPreviewDialog.GraphPreviewDialog has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 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.
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 168, a function literal at line 146, 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:301— 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 342, survivingGroup, a function literal at line 367, …). 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.
shortcutHints.getCanvasShortcutHints (cyclomatic 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/shortcutHints.ts:18— shortcutHints.getCanvasShortcutHints 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.
ImageMapWidgetView.ImageMapWidgetView (cyclomatic 24) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx:71— ImageMapWidgetView.ImageMapWidgetView 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.
TransformEditingController.apply (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/transformEditingController.ts:125— TransformEditingController.apply 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.
psdExport.planPsdExport (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:178— psdExport.planPsdExport has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 2 function items inside it that branch (buildTree, walk). 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.
pointerPipeline.createPointerPipeline.onKeyDown (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:376— pointerPipeline.createPointerPipeline.onKeyDown 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.
imageRecall.getRefinerRecall (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:781— 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. This is NOT this file's highest cyclomatic complexity: imageRecall.getImageRecallCapabilities (cyclomatic 34) 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.
imageMapStore.refreshImageIndexStatus (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts:424— 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 437, 496). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.
QueueCluster.QueueCluster (cyclomatic 24) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:38— QueueCluster.QueueCluster has cyclomatic complexity 24 (threshold 15). Of this number, 21 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.
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:402— 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:114— 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:184— 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.
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.
mock-backend.filterGalleryItems (cyclomatic 23) invokeai/frontend/webv2/scripts/mock-backend.mjs:565— mock-backend.filterGalleryItems 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 2 function literals inside it that branch (lines 577, 616). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
QueueRuntimeAdapter.QueueRuntimeAdapter (cyclomatic 23) invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx:25— 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 4 function literals inside it that branch (lines 40, 163, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
compileCanvasGraph.getCanvasValidationReasons (cyclomatic 23) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:112— compileCanvasGraph.getCanvasValidationReasons 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.
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.
QueueItemRow.QueueItemRow (cyclomatic 23) invokeai/frontend/webv2/src/features/queue/ui/QueueItemRow.tsx:29— QueueItemRow.QueueItemRow 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.readProperty (cyclomatic 23) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:300— 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.
flowAdapters.toFlowNodes (cyclomatic 23) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:197— flowAdapters.toFlowNodes 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 211). 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.
SettingControl.SettingControl (cyclomatic 23) invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx:24— SettingControl.SettingControl has cyclomatic complexity 23 (threshold 15). Of this number, 19 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.
invocation.resolveInvocationRouteInput (cyclomatic 23) invokeai/frontend/webv2/src/workbench/invocation.ts:200— invocation.resolveInvocationRouteInput 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.
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:1657— 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:212— 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.
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:792— 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:288— 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:289— 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.
nvfp4._find_nvfp4_layers (cyclomatic 22) invokeai/backend/quantization/nvfp4.py:196— nvfp4._find_nvfp4_layers 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.
calibrate_flux2_working_memory.report_vae (cyclomatic 22) scripts/calibrate_flux2_working_memory.py:466— calibrate_flux2_working_memory.report_vae 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.
GenerateReferenceImagesSection.GenerateReferenceImagesContent (cyclomatic 22) invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx:45— GenerateReferenceImagesSection.GenerateReferenceImagesContent 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 8 function items inside it that branch (addGalleryImages, a function literal at line 188, a function literal at line 69, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
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.
videoPolicies.getVideoComponentSectionPolicy (cyclomatic 22) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1508— 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:555— 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:203— 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:604— 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 629). 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.
PreviewFilmstrip.FilmstripLiveThumb (cyclomatic 22) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx:125— PreviewFilmstrip.FilmstripLiveThumb has cyclomatic complexity 22 (threshold 15). 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, separate the cases: extract each independent 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.removeGalleryItemsFromAllProjects (cyclomatic 22) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2996— workbenchState.removeGalleryItemsFromAllProjects 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 4 function literals inside it that branch (lines 3020, 3058, 3005, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
PixelEditController.begin (cyclomatic 22) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:123— PixelEditController.begin has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
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.
imageRecall.getMetadataModelTuning (cyclomatic 22) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:501— imageRecall.getMetadataModelTuning has cyclomatic complexity 22 (threshold 15). Of this number, 19 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. This is NOT this file's highest cyclomatic complexity: imageRecall.getImageRecallCapabilities (cyclomatic 34) 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.
ImageContextMenu.SingleItemMenuItems (cyclomatic 22) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:308— ImageContextMenu.SingleItemMenuItems has cyclomatic complexity 22 (threshold 15). Of this number, 16 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.
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:381— 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.
AdjustmentSettings.CurvesEditor (cyclomatic 22) invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx:452— 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 552, 526, 582, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.
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.
TextLLMPipeline.run (cyclomatic 21) invokeai/backend/text_llm_pipeline.py:144— 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.
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.
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.
settings.normalizeReferenceImageConfig (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/core/settings.ts:335— settings.normalizeReferenceImageConfig 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.buildFlux2Graph (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/core/graph.ts:745— 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.
GenerateRenderSection.GenerateRenderSection::renderFields (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:559— 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.
WildcardsPanel.WildcardsPanel (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx:50— WildcardsPanel.WildcardsPanel has cyclomatic complexity 21 (threshold 15). Of this number, 15 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.
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.getWorkflowFieldInvalidReason (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:465— fields.getWorkflowFieldInvalidReason 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.
modelRequirements.extractWorkflowModelRequirements (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts:191— modelRequirements.extractWorkflowModelRequirements has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 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.
WorkflowFieldInput.MediaInput (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:964— WorkflowFieldInput.MediaInput has cyclomatic complexity 21 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.
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:153— 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.
workbenchState.isWidgetRegionState (cyclomatic 21) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2153— 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:744— 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:328— 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 407, a function literal at line 431, …). 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.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:335— SelectObjectCoordinator.createSelectObjectOperationCoordinator.save 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.
firstPartyCommands.useRegisterFirstPartyCommands (cyclomatic 21) invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts:99— firstPartyCommands.useRegisterFirstPartyCommands 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 items inside it that branch (a function literal at line 238, recallSelectedImage, 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.
executeImageRecall.executeLoadMediaWorkflow (cyclomatic 21) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:103— 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.
GenerationDevicesSettings.GenerationDevicesSettings (cyclomatic 21) invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx:16— GenerationDevicesSettings.GenerationDevicesSettings has cyclomatic complexity 21 (threshold 15). Of this number, 14 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 21) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:310— LayoutPresetStrip.PresetTab 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 5 function literals inside it that branch (lines 390, 367, 333, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
session_queue.strip_missing_image_results (cyclomatic 20) invokeai/app/api/routers/session_queue.py:76— 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:573— 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.
WanLatentsToVideoInvocation.invoke (cyclomatic 20) invokeai/app/invocations/vae/wan_latents_to_video.py:98— WanLatentsToVideoInvocation.invoke 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:1125— 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.
ModelInstallService._install_next_item (cyclomatic 20) invokeai/app/services/model_install/model_install_default.py:1667— ModelInstallService._install_next_item 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:253— 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:1960— 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.
ZImageControlTransformer2DModel.forward (cyclomatic 20) invokeai/backend/z_image/z_image_control_transformer.py:451— ZImageControlTransformer2DModel.forward has cyclomatic complexity 20 (threshold 15). 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.
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.
galleryStateView.getGalleryStateView (cyclomatic 20) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:398— galleryStateView.getGalleryStateView has cyclomatic complexity 20 (threshold 15). Of this number, 18 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.
useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cyclomatic 20) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridSelection.ts:98— 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.
addRegionalGuidance.addRegionalGuidance (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:227— addRegionalGuidance.addRegionalGuidance 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.
baseGenerationPolicies.getBaseComponentSectionPolicy (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:915— baseGenerationPolicies.getBaseComponentSectionPolicy 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, 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.
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.
GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/ui/GenerateConditioningRebalanceField.tsx:61— GenerateConditioningRebalanceField.GenerateConditioningRebalanceField has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 7 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.
InstallProgressCell.useInstallProgressCaption (cyclomatic 20) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallProgressCell.tsx:46— 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:1552— 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.
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.
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:390— 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.
workbenchState.compileInvocationSnapshot (cyclomatic 20) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2705— workbenchState.compileInvocationSnapshot 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 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.
FilterOperationCoordinator.createFilterOperationCoordinator.start (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/FilterOperationCoordinator.ts:93— FilterOperationCoordinator.createFilterOperationCoordinator.start 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.
DiagnosticsPanel.DiagnosticsPanel (cyclomatic 20) invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx:127— DiagnosticsPanel.DiagnosticsPanel has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 153, 186, 162, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.createUnloadJournalServer (cyclomatic 20) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:25— 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 124, a function literal at line 50, a function literal at line 97, …). 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.
board_images.remove_images_from_board (cyclomatic 19) invokeai/app/api/routers/board_images.py:303— 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.
model_manager.get_is_installed (cyclomatic 19) invokeai/app/api/routers/model_manager.py:1550— model_manager.get_is_installed 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.
ImageIndexService._process_projection (cyclomatic 19) invokeai/app/services/image_index/image_index_default.py:1575— 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.
ModelInstallService._register_or_install (cyclomatic 19) invokeai/app/services/model_install/model_install_default.py:1745— ModelInstallService._register_or_install 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.
DefaultSessionProcessor._process (cyclomatic 19) invokeai/app/services/session_processor/session_processor_default.py:1102— 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.
denoise.denoise (cyclomatic 19) invokeai/backend/ernie_image/denoise.py:21— denoise.denoise 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.
StableDiffusionGeneratorPipeline.step (cyclomatic 19) invokeai/backend/stable_diffusion/diffusers_pipeline.py:438— StableDiffusionGeneratorPipeline.step 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.
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.
referenceImage.resolveRatioDrag (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/referenceImage.ts:325— 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.
graph.buildSDGraph (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/graph.ts:314— graph.buildSDGraph 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.
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.
utilityGraph.reconcileUtilityCompletedOutput (cyclomatic 19) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:155— utilityGraph.reconcileUtilityCompletedOutput 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.
settings.clearDeletedVideoMedia (cyclomatic 19) invokeai/frontend/webv2/src/features/video/core/settings.ts:1078— 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.
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.
assetTransport.createAssetResponseReader (cyclomatic 19) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:105— assetTransport.createAssetResponseReader 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 4 function items inside it that branch (a function literal at line 140, refuseTooLarge, cancelReader, …). 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.
projectAssets.createOpenProjectsHeldMediaReader (cyclomatic 19) invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:152— projectAssets.createOpenProjectsHeldMediaReader 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 items inside it that branch (collectParts, a function literal at line 192). 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.
persistenceRuntime.createWorkbenchPersistenceRuntime.load (cyclomatic 19) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:484— 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.
runLayerWorkflow.runLayerWorkflow (cyclomatic 19) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:116— 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.
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.
workbenchStore.createCommands (cyclomatic 19) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:87— workbenchStore.createCommands 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 10 function literals inside it that branch (lines 393, 425, 478, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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.
documentMirror.diffValueEdit (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:171— 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:2149— 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.
groupSurfaceCache.createGroupSurfaceCache.resolve (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:331— groupSurfaceCache.createGroupSurfaceCache.resolve 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.
selectObjectSession.createSelectObjectSession.update (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:541— selectObjectSession.createSelectObjectSession.update 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.
queueRecallCache.createIndexedDbQueueRecallCache.put (cyclomatic 19) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts:210— 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:28— 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.
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:960— 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.
_ExpertSwapper.get (cyclomatic 18) invokeai/app/invocations/wan/wan_denoise.py:214— _ExpertSwapper.get 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.
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:734— 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_failed (cyclomatic 18) invokeai/app/services/model_install/model_install_default.py:1324— ModelInstallService.restart_failed 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.
ChildDependencyRecord._record_completion (cyclomatic 18) invokeai/app/services/shared/execution_engine/child.py:638— ChildDependencyRecord._record_completion 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.
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.
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:2653— 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:249— 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:384— 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:1815— 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:175— 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:474— 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.
sage_attention.install_sage_attention (cyclomatic 18) invokeai/backend/util/sage_attention.py:296— sage_attention.install_sage_attention 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.
calibrate_flux2_working_memory.main (cyclomatic 18) scripts/calibrate_flux2_working_memory.py:595— calibrate_flux2_working_memory.main 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:1415— 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.
controlValidation.getControlValidationReason (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/canvas/controlValidation.ts:92— controlValidation.getControlValidationReason 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.
compileCanvasGraph.compileCanvasGraph (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:728— compileCanvasGraph.compileCanvasGraph 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.
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.
settings.cloneGenerateWidgetValues (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/settings.ts:545— settings.cloneGenerateWidgetValues 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.
graph.buildQwenImageGraph (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/graph.ts:963— 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.
GenerateDimensionFields.GenerateDimensionFields::renderSection (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:441— GenerateDimensionFields.GenerateDimensionFields::renderSection 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.
ReferenceImageCard.ReferenceImageCardBase (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx:66— ReferenceImageCard.ReferenceImageCardBase 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, separate the cases: extract each independent 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.FieldControl (cyclomatic 18) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:60— DefaultSettingsSection.FieldControl has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 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.
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.
generationMeta.extractGenerationMeta (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/core/generationMeta.ts:19— generationMeta.extractGenerationMeta 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.
runtime.createQueueRuntime (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:430— runtime.createQueueRuntime 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 1322, 457, 1305, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runtime.createQueueRuntime.deliverResultVideos (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:984— 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.prepareActiveRuns (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:1994— 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 2017, 2000, 2044). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
forLoops.getForLoopBodyBoundaries (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:181— forLoops.getForLoopBodyBoundaries 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 literals inside it that branch (lines 216, 254, 218). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkflowFieldInput.WorkflowFieldSnapshot (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:2021— 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.
layerChildRows.projectLayerChildRows (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:205— 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.
adjustments.buildCurveLut (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:32— 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.
canvasDimsSync.createCanvasDimsSync.syncRenderSize (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:247— canvasDimsSync.createCanvasDimsSync.syncRenderSize 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.
SelectionPixelController.run (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:79— SelectionPixelController.run has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LayerMutationController.duplicate (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:118— LayerMutationController.duplicate 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.
documentMirror.diffForests (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:102— 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.
importGalleryImages.importGalleryImagesToCanvas (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:236— 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.
executeVideoRecall.placeVideoImage (cyclomatic 18) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:637— 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.
HotkeysSettingsSection.HotkeyListRow (cyclomatic 18) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:281— HotkeysSettingsSection.HotkeyListRow 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.
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.
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:84— 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 153, 127, 101, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useMaskTintEditor.useMaskTintEditor (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/useMaskTintEditor.ts:50— useMaskTintEditor.useMaskTintEditor 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 8 function literals inside it that branch (lines 54, 102, 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.
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.
run_app.run_app (cyclomatic 17) invokeai/app/run_app.py:45— run_app.run_app 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.
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.
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.
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:157— 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.
z_image._convert_z_image_gguf_to_diffusers (cyclomatic 17) invokeai/backend/model_manager/load/model_loaders/z_image.py:130— z_image._convert_z_image_gguf_to_diffusers 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.
TorchDevice.get_generation_devices (cyclomatic 17) invokeai/backend/util/devices.py:336— 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.
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.
check_platform_locks.check_torch (cyclomatic 17) scripts/check_platform_locks.py:201— check_platform_locks.check_torch 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.
generate_docs_json._parse_docstring (cyclomatic 17) scripts/generate_docs_json.py:242— generate_docs_json._parse_docstring 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.
settings.getGallerySettings (cyclomatic 17) invokeai/frontend/webv2/src/features/gallery/core/settings.ts:146— settings.getGallerySettings 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.
GalleryProgressSection.GalleryProgressTile (cyclomatic 17) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:183— 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.
VideoModelField.VideoModelField (cyclomatic 17) invokeai/frontend/webv2/src/features/video/ui/VideoModelField.tsx:69— VideoModelField.VideoModelField has cyclomatic complexity 17 (threshold 15). Of this number, 9 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.
batch.getWorkflowGeneratorPropertyInvalidReason (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:401— 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.
WorkflowLibraryCard.WorkflowLibraryCard (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx:83— WorkflowLibraryCard.WorkflowLibraryCard has cyclomatic complexity 17 (threshold 15). Of this number, 15 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.
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:148— 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 178, a function literal at line 196). 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:133— 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 145). 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.
useLayerStackActions.useLayerStackActions (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerStackActions.ts:38— useLayerStackActions.useLayerStackActions has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 61, 69, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LayerSurfaceHost.LayerSurfaceHost (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsx:42— 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:82— 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:364— 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.
ThumbnailController.draw (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:47— ThumbnailController.draw 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.
ThumbnailController.request (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:111— 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.
compositeFrame.createCompositeFrame.draw (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositeFrame.ts:183— compositeFrame.createCompositeFrame.draw 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.
imageRecall.getMetadataConcepts (cyclomatic 17) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:872— imageRecall.getMetadataConcepts has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: imageRecall.getImageRecallCapabilities (cyclomatic 34) 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.
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:52— 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.
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:52— 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.
QwenImagePiDDecodeInvocation.invoke (cyclomatic 16) invokeai/app/invocations/pid/qwen_image_pid_decode.py:115— QwenImagePiDDecodeInvocation.invoke 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:570— 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:1352— 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.
ModelInstallService._resume_remote_download (cyclomatic 16) invokeai/app/services/model_install/model_install_default.py:625— ModelInstallService._resume_remote_download 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.
images._conditions (cyclomatic 16) invokeai/app/services/shared/database/queries/images.py:204— 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:737— 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:245— 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.
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.
ModelConfigFactory.from_model_on_disk (cyclomatic 16) invokeai/backend/model_manager/configs/factory.py:865— ModelConfigFactory.from_model_on_disk 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.
ModelLoader._load_and_cache (cyclomatic 16) invokeai/backend/model_manager/load/load_default.py:354— ModelLoader._load_and_cache 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._log_cache_state (cyclomatic 16) invokeai/backend/model_manager/load/model_cache/model_cache.py:2655— 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:1148— 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.
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.
HuggingFaceMetadataFetch.from_id (cyclomatic 16) invokeai/backend/model_manager/metadata/fetch/huggingface.py:94— HuggingFaceMetadataFetch.from_id 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.
ggml_tensor.dequantize_and_run (cyclomatic 16) invokeai/backend/quantization/gguf/ggml_tensor.py:14— 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.
loaders.gguf_sd_loader (cyclomatic 16) invokeai/backend/quantization/gguf/loaders.py:147— loaders.gguf_sd_loader 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.
calibrate_wan_vae_working_memory._measure (cyclomatic 16) scripts/calibrate_wan_vae_working_memory.py:81— calibrate_wan_vae_working_memory._measure 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.
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.
promptAttention.selectTerminals (cyclomatic 16) invokeai/frontend/webv1/src/common/util/promptAttention.ts:369— promptAttention.selectTerminals 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 literals inside it that branch (lines 370, 396). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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 (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx:42— GalleryImage.buildOnClick has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 42). 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.
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:92— 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.
promptFocus.getActiveTriggerQuery (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptFocus.ts:108— 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.
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.
coordinator.createQueueCoordinator.handleStatusChanged (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:771— coordinator.createQueueCoordinator.handleStatusChanged 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.
InvocationCacheFooter.InvocationCacheFooter (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/ui/InvocationCacheFooter.tsx:29— InvocationCacheFooter.InvocationCacheFooter has cyclomatic complexity 16 (threshold 15). Of this number, 13 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.
settings.cloneVideoWidgetValues (cyclomatic 16) invokeai/frontend/webv2/src/features/video/core/settings.ts:520— 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.
document.updateInvocationNodeToTemplate (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/core/document.ts:499— document.updateInvocationNodeToTemplate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.isFormElementLike (cyclomatic 17) 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.
WorkflowLibraryGrid.WorkflowLibraryGrid (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:52— WorkflowLibraryGrid.WorkflowLibraryGrid has cyclomatic complexity 16 (threshold 15). Of this number, 11 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.
Combobox.Combobox (cyclomatic 16) invokeai/frontend/webv2/src/platform/ui/Combobox.tsx:53— Combobox.Combobox has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 78, 118, 127, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ManagerLayout.ManagerLayout::watchFocus::tick (cyclomatic 16) invokeai/frontend/webv2/src/platform/ui/ManagerLayout.tsx:222— 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:437— 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.
ImageMapDataRuntime.attachImageMapDataRuntime (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx:42— ImageMapDataRuntime.attachImageMapDataRuntime has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 7 function items inside it that branch (refreshProjectionReady, a function literal at line 121, refreshIfLoaded, …). 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.
PreviewHeaderActions.PreviewHeaderActions (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.tsx:21— PreviewHeaderActions.PreviewHeaderActions has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
floatingWindows.validateFloatingWidgets (cyclomatic 16) invokeai/frontend/webv2/src/workbench/floatingWindows.ts:258— 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.
canvasDimsSync.reconcileCanvasDims (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:83— 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.
invocationSubmit.submitResolvedInvocation (cyclomatic 16) invokeai/frontend/webv2/src/workbench/invocationSubmit.ts:178— 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.
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.
LayerMutationController.convert (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:424— LayerMutationController.convert has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
bitmapStore.createBitmapStore.flushPendingUploads (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:668— bitmapStore.createBitmapStore.flushPendingUploads has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
documentMirror.createDocumentMirror.refresh (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:248— documentMirror.createDocumentMirror.refresh 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.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:284— SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply 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.
filterGraphs.resolveSettings (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/filterGraphs.ts:281— 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.
filterGraphs.buildFilterGraph (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/filterGraphs.ts:325— filterGraphs.buildFilterGraph 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.
executeImageRecall.executeImageRecall (cyclomatic 16) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:294— executeImageRecall.executeImageRecall 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.
videoRecall.getRecallableReferences (cyclomatic 16) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:439— videoRecall.getRecallableReferences has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 446). 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.
entries.buildSettingsEntries (cyclomatic 16) invokeai/frontend/webv2/src/workbench/palette/entries.ts:322— 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 330, 422, 421). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.
HotkeysSettingsSection.canScopesOverlap (cyclomatic 16) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:77— 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.
mock-backend.startMockBackend.server (cognitive 888) invokeai/frontend/webv2/scripts/mock-backend.mjs:937— mock-backend.startMockBackend.server has cognitive complexity 888 (threshold 15). Drivers by points: if/else 244 (489 pts), boolean chains 167, ternaries 67 (164 pts), loops 23 (65 pts), error handling 2 (3 pts) (nesting depth added 385). Of this number, 874 points are the body's own statements and 14 belong to 11 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.__workbenchReducerInternal (cognitive 460) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3890— workbenchState.__workbenchReducerInternal has cognitive complexity 460 (threshold 15). Drivers by points: ternaries 112 (244 pts), if/else 71 (144 pts), boolean chains 65, loops 3 (6 pts), match/switch 1 (nesting depth added 208). Of this number, 151 points are the body's own statements and 309 belong to 70 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.
GalleryImageGrid.GalleryImageGrid (cognitive 445) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:404— GalleryImageGrid.GalleryImageGrid has cognitive complexity 445 (threshold 15). Drivers by points: ternaries 92 (201 pts), if/else 89 (144 pts), boolean chains 91, loops 5 (9 pts) (nesting depth added 168). Of this number, 136 points are the body's own statements and 309 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 272) invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169— LayersTree.LayersTree has cognitive complexity 272 (threshold 15). Drivers by points: if/else 96 (125 pts), ternaries 61 (89 pts), boolean chains 53, loops 4 (5 pts) (nesting depth added 58). Of this number, 37 points are the body's own statements and 235 belong to 49 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 257) invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:81— setEventListeners.setEventListeners has cognitive complexity 257 (threshold 15). Drivers by points: if/else 73 (141 pts), ternaries 16 (68 pts), boolean chains 24, error handling 4 (19 pts), loops 3 (5 pts) (nesting depth added 137). None of this is in the body itself: all 257 points belong to 36 function items inside it that branch (a function literal at line 544, a function literal at line 786, a function literal at line 669, …). 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 (cognitive 173) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:185— recallParameters.buildRecallParametersSettings has cognitive complexity 173 (threshold 15). Drivers by points: if/else 58 (90 pts), ternaries 28 (55 pts), boolean chains 20, loops 5 (8 pts) (nesting depth added 62). Of this number, 153 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.
useImageActions.useImageActions (cognitive 160) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:194— useImageActions.useImageActions has cognitive complexity 160 (threshold 15). Drivers by points: if/else 62 (87 pts), ternaries 18 (22 pts), boolean chains 21, error handling 15 (21 pts), loops 9 (nesting depth added 35). None of this is in the body itself: all 160 points belong to 42 function literals inside it that branch (lines 435, 750, 336, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
executeVideoRecall.applyVideoRecallMetadata (cognitive 152) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:169— executeVideoRecall.applyVideoRecallMetadata has cognitive complexity 152 (threshold 15). Drivers by points: if/else 33 (81 pts), ternaries 12 (43 pts), boolean chains 14, error handling 4 (11 pts), loops 1 (3 pts) (nesting depth added 88). 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.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.
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.
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.
canvasHotkeyCommands.executeCanvasHotkeyCommand (cognitive 136) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:120— canvasHotkeyCommands.executeCanvasHotkeyCommand has cognitive complexity 136 (threshold 15). Drivers by points: if/else 64 (96 pts), boolean chains 22, ternaries 7 (18 pts) (nesting depth added 43). Of this number, 127 points are the body's own statements and 9 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.
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.
videoPolicies.getVideoValidationReasons (cognitive 126) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2291— videoPolicies.getVideoValidationReasons has cognitive complexity 126 (threshold 15). Drivers by points: if/else 41 (61 pts), boolean chains 33, ternaries 13 (27 pts), loops 3 (5 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
lora._is_flux2_lora_state_dict (cognitive 124) invokeai/backend/model_manager/configs/lora.py:225— lora._is_flux2_lora_state_dict has cognitive complexity 124 (threshold 15). Drivers by points: if/else 37 (102 pts), boolean chains 14, loops 6 (8 pts) (nesting depth added 67). To reduce it, split the body into named stages: move each independent 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 122) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:65— GalleryPickerView.GalleryPickerView has cognitive complexity 122 (threshold 15). Drivers by points: ternaries 37 (66 pts), if/else 22 (31 pts), boolean chains 24, loops 1 (nesting depth added 38). Of this number, 72 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.
WorkflowEditorView.WorkflowFlow (cognitive 117) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:305— WorkflowEditorView.WorkflowFlow has cognitive complexity 117 (threshold 15). Drivers by points: if/else 54 (57 pts), ternaries 29 (31 pts), boolean chains 27, loops 1, match/switch 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 99 belong to 48 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.
LayerContextMenu.LayerMenu (cognitive 117) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:217— LayerContextMenu.LayerMenu has cognitive complexity 117 (threshold 15). Drivers by points: ternaries 29 (52 pts), if/else 47 (51 pts), boolean chains 9, match/switch 3, error handling 1 (2 pts) (nesting depth added 28). Most of this is not in the body itself: 9 of the 117 points are its own statements and the rest belongs to 35 function literals inside it that branch (lines 462, 362, 727, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
VideoWidgetView.VideoWidgetView (cognitive 115) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:122— VideoWidgetView.VideoWidgetView has cognitive complexity 115 (threshold 15). Drivers by points: ternaries 48 (75 pts), boolean chains 26, if/else 14 (nesting depth added 27). Of this number, 87 points are the body's own statements and 28 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.
ZImageDenoiseInvocation._run_diffusion (cognitive 114) invokeai/app/invocations/z_image/z_image_denoise.py:337— ZImageDenoiseInvocation._run_diffusion has cognitive complexity 114 (threshold 15). Drivers by points: if/else 50 (91 pts), boolean chains 11, ternaries 5 (8 pts), loops 2 (4 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
denoise.denoise (cognitive 113) invokeai/backend/flux2/denoise.py:20— denoise.denoise has cognitive complexity 113 (threshold 15). Drivers by points: if/else 26 (76 pts), ternaries 9 (31 pts), loops 2 (4 pts), boolean chains 2 (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.
workbenchState.enqueueCompiledSnapshot (cognitive 110) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3538— workbenchState.enqueueCompiledSnapshot has cognitive complexity 110 (threshold 15). Drivers by points: ternaries 51 (100 pts), boolean chains 10 (nesting depth added 49). Of this number, 104 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.
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.
videoRecall.buildVideoRecallSettings (cognitive 107) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:474— videoRecall.buildVideoRecallSettings has cognitive complexity 107 (threshold 15). Drivers by points: if/else 42 (60 pts), boolean chains 31, ternaries 8 (14 pts), loops 2 (nesting depth added 24). Of this number, 105 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.
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.
batch.planWorkflowBatch (cognitive 103) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:681— 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.
DownloadQueueService._do_download (cognitive 101) invokeai/app/services/download/download_default.py:423— DownloadQueueService._do_download has cognitive complexity 101 (threshold 15). Drivers by points: if/else 39 (70 pts), boolean chains 21, error handling 2 (5 pts), ternaries 3 (4 pts), loops 1 (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.
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.
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.
ScrubberField.ScrubberField (cognitive 92) invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:228— 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.
videoPolicies.getVideoModelSelectionResult (cognitive 88) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1964— videoPolicies.getVideoModelSelectionResult has cognitive complexity 88 (threshold 15). Drivers by points: if/else 34 (51 pts), boolean chains 21, ternaries 8 (14 pts), loops 2 (nesting depth added 23). Of this number, 87 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.
hidiffusion.apply_hidiffusion (cognitive 85) invokeai/backend/hidiffusion/hidiffusion.py:2040— hidiffusion.apply_hidiffusion has cognitive complexity 85 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 24, loops 5 (9 pts), ternaries 1 (2 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.
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.
document.applyProjectGraphAction (cognitive 81) invokeai/frontend/webv2/src/features/workflow/core/document.ts:907— document.applyProjectGraphAction has cognitive complexity 81 (threshold 15). Drivers by points: if/else 16 (33 pts), ternaries 14 (30 pts), boolean chains 15, loops 1 (2 pts), match/switch 1 (nesting depth added 34). Of this number, 57 points are the body's own statements and 24 belong to 9 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.
LayerRow.LayerRowComponent (cognitive 81) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:78— LayerRow.LayerRowComponent has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 36 (55 pts), boolean chains 14, if/else 12 (nesting depth added 19). Of this number, 62 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.
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.
ProjectConflictBanner.ProjectConflictBanner (cognitive 79) invokeai/frontend/webv2/src/workbench/shell/ProjectConflictBanner.tsx:27— ProjectConflictBanner.ProjectConflictBanner has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 25 (54 pts), if/else 11 (15 pts), boolean chains 7, error handling 2 (3 pts) (nesting depth added 34). Of this number, 58 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.
PixDiT_T2I.forward (cognitive 78) invokeai/backend/pid/_src/networks/pixeldit_official.py:1413— 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.
PreviewFrame.PreviewVideo (cognitive 77) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:376— PreviewFrame.PreviewVideo has cognitive complexity 77 (threshold 15). Drivers by points: if/else 35 (36 pts), boolean chains 20, ternaries 14 (16 pts), error handling 5 (nesting depth added 3). Most of this is not in the body itself: 11 of the 77 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 462, 792, 765, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
lora._get_flux2_lora_variant (cognitive 76) invokeai/backend/model_manager/configs/lora.py:395— lora._get_flux2_lora_variant has cognitive complexity 76 (threshold 15). Drivers by points: if/else 27 (64 pts), boolean chains 8, loops 4 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
canvasProjectMutations.applyCanvasProjectMutation (cognitive 76) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:669— canvasProjectMutations.applyCanvasProjectMutation has cognitive complexity 76 (threshold 15). Drivers by points: ternaries 24 (50 pts), if/else 7 (14 pts), boolean chains 9, loops 1 (2 pts), match/switch 1 (nesting depth added 34). Of this number, 53 points are the body's own statements and 23 belong to 8 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.
GalleryMaintenanceService._remove_missing_page (cognitive 75) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:594— 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.
GalleryMediaSlot.GalleryMediaSlot (cognitive 75) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx:82— GalleryMediaSlot.GalleryMediaSlot has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 32 (50 pts), boolean chains 19, if/else 4 (5 pts), error handling 1 (nesting depth added 19). Of this number, 60 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.
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.
AddModelsView.AddModelsView (cognitive 73) invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx:71— AddModelsView.AddModelsView has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 21 (29 pts), if/else 19 (26 pts), boolean chains 18 (nesting depth added 15). Of this number, 30 points are the body's own statements and 43 belong to 14 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.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.
PreviewWidgetView.PreviewWidgetView (cognitive 71) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:188— PreviewWidgetView.PreviewWidgetView has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 23 (31 pts), boolean chains 19, if/else 18 (19 pts), error handling 1 (2 pts) (nesting depth added 10). Of this number, 19 points are the body's own statements and 52 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, 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_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.
utilityGraph.runUtilityGraph (cognitive 70) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:196— utilityGraph.runUtilityGraph has cognitive complexity 70 (threshold 15). Drivers by points: if/else 30 (33 pts), ternaries 11 (19 pts), error handling 8 (11 pts), boolean chains 6, loops 1 (nesting depth added 14). Most of this is not in the body itself: 5 of the 70 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 359, 258, 220, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ImageMapPlot.ImageMapPlot (cognitive 70) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:113— 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 446, a function literal at line 293, a function literal at line 392, …). 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.
imageRecall.buildImageRecallSettings (cognitive 70) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1115— imageRecall.buildImageRecallSettings has cognitive complexity 70 (threshold 15). Drivers by points: if/else 30 (52 pts), boolean chains 15, ternaries 2 (3 pts) (nesting depth added 23). Of this number, 67 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.
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.
layerChildRows.layerChildRowCommand (cognitive 69) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:507— layerChildRows.layerChildRowCommand has cognitive complexity 69 (threshold 15). Drivers by points: if/else 20 (39 pts), ternaries 9 (20 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 31). Of this number, 66 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.
WanDenoiseInvocation._run_diffusion (cognitive 68) invokeai/app/invocations/wan/wan_denoise.py:424— WanDenoiseInvocation._run_diffusion has cognitive complexity 68 (threshold 15). Drivers by points: if/else 29 (45 pts), ternaries 10 (13 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.
WorkflowPublicationHost.WorkflowPublicationHost (cognitive 68) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowPublicationHost.tsx:90— WorkflowPublicationHost.WorkflowPublicationHost has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 26 (32 pts), if/else 16 (17 pts), boolean chains 16, error handling 2, match/switch 1 (nesting depth added 7). Of this number, 27 points are the body's own statements and 41 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.
AnimaDenoiseInvocation._run_diffusion (cognitive 67) invokeai/app/invocations/anima/anima_denoise.py:592— AnimaDenoiseInvocation._run_diffusion has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (41 pts), loops 7 (13 pts), boolean chains 8, ternaries 3, error handling 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
ModelInstallService._restore_incomplete_installs (cognitive 67) invokeai/app/services/model_install/model_install_default.py:489— ModelInstallService._restore_incomplete_installs has cognitive complexity 67 (threshold 15). Drivers by points: if/else 22 (50 pts), error handling 4 (10 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (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.
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.
settings.getUpscaleValidationReasons (cognitive 67) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:948— settings.getUpscaleValidationReasons has cognitive complexity 67 (threshold 15). Drivers by points: if/else 22 (33 pts), ternaries 9 (18 pts), boolean chains 11, loops 3 (5 pts) (nesting depth added 22). Of this number, 65 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.
WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cognitive 67) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:85— WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (27 pts), ternaries 17 (23 pts), boolean chains 9, error handling 5, loops 2 (3 pts) (nesting depth added 15). Of this number, 17 points are the body's own statements and 50 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.
usePreviewNavigation.usePreviewNavigation.navigate (cognitive 67) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:711— 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 780, 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.
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:22— 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.
FontsPage.FontLibrary (cognitive 66) invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:305— FontsPage.FontLibrary has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 26 (41 pts), if/else 9 (12 pts), boolean chains 8, error handling 3 (4 pts), loops 1 (nesting depth added 19). Of this number, 27 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.
GenerateAdvancedFields.GenerateAdvancedFields (cognitive 66) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:71— GenerateAdvancedFields.GenerateAdvancedFields has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 22 (40 pts), boolean chains 17, if/else 5 (9 pts) (nesting depth added 22). Of this number, 54 points are the body's own statements and 12 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.
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.
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.
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.
graphCoverage.testing.candidatesForSlot (cognitive 63) invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts:73— graphCoverage.testing.candidatesForSlot has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 8 (48 pts), loops 5 (15 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
ChildExecutionCapability.create_dependency (cognitive 61) invokeai/app/services/shared/execution_engine/child.py:311— ChildExecutionCapability.create_dependency has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 9, ternaries 3 (9 pts), loops 5 (8 pts), 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.
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.
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.
ModelInstallQueueItem.ModelInstallQueueItem (cognitive 60) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:108— ModelInstallQueueItem.ModelInstallQueueItem has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 24, 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 34 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.
useGalleryData.useGalleryData (cognitive 60) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:257— useGalleryData.useGalleryData has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 26, ternaries 23, 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.
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.
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.
useGalleryActions.useGalleryActions (cognitive 59) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryActions.ts:35— useGalleryActions.useGalleryActions has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 11, ternaries 8 (11 pts), error handling 7 (nesting depth added 14). None of this is in the body itself: all 59 points belong to 10 function literals inside it that branch (lines 237, 98, 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.
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.
runtime.createQueueRuntime.reconcile (cognitive 59) invokeai/frontend/webv2/src/features/queue/runtime.ts:2076— runtime.createQueueRuntime.reconcile has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 15, 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 59 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2168, 2121, 2276, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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 (cognitive 58) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:328— FloatingWidgetWindow.FloatingWidgetWindow has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (24 pts), ternaries 24, boolean chains 9, loops 1 (nesting depth added 1). Of this number, 24 points are the body's own statements and 34 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.
ModelInstallService._enqueue_remote_download (cognitive 57) invokeai/app/services/model_install/model_install_default.py:2185— ModelInstallService._enqueue_remote_download has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (31 pts), error handling 4 (10 pts), boolean chains 8, loops 3 (6 pts), ternaries 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
InvocationFlowNode.ExpandedInvocationNode (cognitive 57) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:961— InvocationFlowNode.ExpandedInvocationNode has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 22 (41 pts), boolean chains 15, if/else 1 (nesting depth added 19). Of this number, 54 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.
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.
ModelInstallService._install_path_with_info_claimed (cognitive 56) invokeai/app/services/model_install/model_install_default.py:1038— 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.
GalleryItemSearch.GalleryItemSearch (cognitive 56) invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:66— GalleryItemSearch.GalleryItemSearch has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 21 (31 pts), boolean chains 13, if/else 11, match/switch 1 (nesting depth added 10). Of this number, 28 points are the body's own statements and 28 belong to 12 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.
canvasProjectMutations.patchLayerConfig (cognitive 55) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:536— canvasProjectMutations.patchLayerConfig has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 13 (20 pts), boolean chains 7 (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.
compositor.compositeDocument (cognitive 55) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:520— compositor.compositeDocument has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 6 (10 pts), boolean chains 8, loops 4 (8 pts) (nesting depth added 21). Of this number, 46 points are the body's own statements and 9 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.
WanModelLoaderInvocation.invoke (cognitive 54) invokeai/app/invocations/wan/wan_model_loader.py:125— WanModelLoaderInvocation.invoke has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (46 pts), boolean chains 7, 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.
calibrate_flux2_working_memory.report_vae (cognitive 54) scripts/calibrate_flux2_working_memory.py:466— calibrate_flux2_working_memory.report_vae has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 6 (21 pts), if/else 7 (20 pts), loops 6 (11 pts), boolean chains 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1189— 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 558, 540, 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.
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.
buildGraph.getProjectGraphReadiness (cognitive 52) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:125— buildGraph.getProjectGraphReadiness has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 6, loops 2 (3 pts), ternaries 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.
buildGraph.compileProjectGraph (cognitive 52) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:281— 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.
useGalleryUploadAction.useGalleryUploadAction (cognitive 51) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts:44— useGalleryUploadAction.useGalleryUploadAction has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 18 (26 pts), if/else 10 (14 pts), boolean chains 7, error handling 2 (3 pts), loops 1 (nesting depth added 13). None of this is in the body itself: all 51 points belong to 8 function literals inside it that branch (lines 68, 148, 218, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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.
_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.
hidiffusion_utils.hidiffusion_patch (cognitive 50) invokeai/backend/stable_diffusion/hidiffusion_utils.py:19— hidiffusion_utils.hidiffusion_patch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (22 pts), error handling 8 (19 pts), boolean chains 5, ternaries 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.
check_platform_locks.check_torch (cognitive 50) scripts/check_platform_locks.py:201— check_platform_locks.check_torch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (26 pts), loops 5 (15 pts), ternaries 1 (5 pts), boolean chains 4 (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.
modelRequirements.extractWorkflowModelRequirements (cognitive 50) invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts:191— modelRequirements.extractWorkflowModelRequirements has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (41 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 30). Of this number, 39 points are the body's own statements and 11 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.
GalleryMaintenance.GalleryMaintenance (cognitive 50) invokeai/frontend/webv2/src/workbench/settings/GalleryMaintenance.tsx:77— GalleryMaintenance.GalleryMaintenance has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 14, ternaries 7, error handling 4 (6 pts) (nesting depth added 7). Most of this is not in the body itself: 10 of the 50 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 157, 235, 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.
_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.
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:734— 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.
ListItem.ListItem (cognitive 48) invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx:83— ListItem.ListItem has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 18 (22 pts), boolean chains 19, if/else 7 (nesting depth added 4). Of this number, 34 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.
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.
measure-architecture-performance.runSample (cognitive 47) invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:328— measure-architecture-performance.runSample has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 8, ternaries 3 (4 pts) (nesting depth added 14). Of this number, 33 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.
ModelSelect.ModelSelect (cognitive 47) invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx:96— ModelSelect.ModelSelect has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 24 (30 pts), boolean chains 11, if/else 5 (6 pts) (nesting depth added 7). Of this number, 39 points are the body's own statements and 8 belong to 7 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 47) invokeai/frontend/webv2/src/platform/ui/ManagerLayout.tsx:147— ManagerLayout.ManagerLayout has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 21, if/else 17 (19 pts), ternaries 6 (7 pts) (nesting depth added 3). Most of this is not in the body itself: 3 of the 47 points are its own statements and the rest belongs to 10 function items inside it that branch (watchFocus::tick, a function literal at line 255, 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.
queueRunRestoration.normalizeRestoredQueueItem (cognitive 47) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17— queueRunRestoration.normalizeRestoredQueueItem has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 23, ternaries 12, if/else 9 (11 pts), error handling 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.
ControlLayerSettings.ControlLayerSettings (cognitive 47) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx:69— ControlLayerSettings.ControlLayerSettings has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 16, ternaries 15 (16 pts), if/else 14 (15 pts) (nesting depth added 2). Of this number, 19 points are the body's own statements and 28 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.
Krea2DenoiseInvocation._run_diffusion (cognitive 46) invokeai/app/invocations/krea2/krea2_denoise.py:352— Krea2DenoiseInvocation._run_diffusion has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (32 pts), ternaries 8, 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.
ModelInstallService._remove_stale_install_source_claims_locked (cognitive 46) invokeai/app/services/model_install/model_install_default.py:316— ModelInstallService._remove_stale_install_source_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.
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.
FilterResultController.commit (cognitive 46) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:72— FilterResultController.commit has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (25 pts), ternaries 6 (11 pts), boolean chains 9, error handling 1 (nesting depth added 9). Of this number, 43 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.
WanVideoDenoiseInvocation._run_diffusion (cognitive 45) invokeai/app/invocations/wan/wan_video_denoise.py:157— WanVideoDenoiseInvocation._run_diffusion has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 9 (13 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.
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.
calibrate_flux_vae_working_memory.main (cognitive 45) scripts/calibrate_flux_vae_working_memory.py:149— calibrate_flux_vae_working_memory.main has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 7 (15 pts), loops 4 (8 pts), boolean chains 4 (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.
settings.normalizeVideoSettings (cognitive 45) invokeai/frontend/webv2/src/features/video/core/settings.ts:329— settings.normalizeVideoSettings has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 34 (35 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.
graphToDocument.previewGraphToDocument (cognitive 45) invokeai/frontend/webv2/src/features/workflow/core/graphToDocument.ts:36— graphToDocument.previewGraphToDocument has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (25 pts), ternaries 4 (9 pts), boolean chains 6, loops 4 (5 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.
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.
InvocationFlowNode.InputFieldRow (cognitive 45) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:535— InvocationFlowNode.InputFieldRow has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 23 (36 pts), boolean chains 8, if/else 1 (nesting depth added 13). Of this number, 40 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.
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:97— 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:174— 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:311— Flux2DenoiseInvocation._run_diffusion has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (26 pts), ternaries 11 (12 pts), boolean chains 6 (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.
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:1043— 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.
List.List (cognitive 44) invokeai/frontend/webv2/src/platform/ui/list/List.tsx:129— List.List has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 11, ternaries 10 (11 pts), loops 1, match/switch 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 25 belong to 12 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.
CanvasWidgetView.CanvasWidgetView (cognitive 44) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:110— CanvasWidgetView.CanvasWidgetView has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 16 (17 pts), if/else 13 (14 pts), boolean chains 10, error handling 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 14 of the 44 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 318, 156, 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.
layerPanelRows.navigateTree (cognitive 44) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:147— 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.
ImageIndexService._worker_loop (cognitive 43) invokeai/app/services/image_index/image_index_default.py:1125— 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:792— 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.
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.
GalleryBoardsPanel.GalleryBoardsPanel (cognitive 43) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx:41— GalleryBoardsPanel.GalleryBoardsPanel has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 22 (25 pts), boolean chains 12, if/else 6 (nesting depth added 3). Of this number, 23 points are the body's own statements and 20 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.
UpscaleWidgetView.UpscaleWidgetView (cognitive 43) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:352— UpscaleWidgetView.UpscaleWidgetView has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 17 (19 pts), boolean chains 16, if/else 8 (nesting depth added 2). Of this number, 16 points are the body's own statements and 27 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.
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.
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.
ExtractMaskedAreaController.extract (cognitive 43) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:104— ExtractMaskedAreaController.extract has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 13, ternaries 4 (7 pts), loops 2 (nesting depth added 4). Of this number, 42 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.
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.
QwenImageDenoiseInvocation._run_diffusion (cognitive 42) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:285— QwenImageDenoiseInvocation._run_diffusion has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (34 pts), boolean chains 5, ternaries 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.
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:1496— 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.
z_image._convert_z_image_gguf_to_diffusers (cognitive 42) invokeai/backend/model_manager/load/model_loaders/z_image.py:130— z_image._convert_z_image_gguf_to_diffusers has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (35 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.normalizeGenerateSettings (cognitive 42) invokeai/frontend/webv2/src/features/generation/core/settings.ts:743— settings.normalizeGenerateSettings has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 34 (36 pts), boolean chains 4, if/else 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.
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.
runtime.createQueueRuntime.synchronizeRunPersistence (cognitive 42) invokeai/frontend/webv2/src/features/queue/runtime.ts:1923— runtime.createQueueRuntime.synchronizeRunPersistence has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1353— 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.
StagingBar.StagingBar (cognitive 41) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:114— StagingBar.StagingBar has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 17 (33 pts), boolean chains 4, if/else 3 (4 pts) (nesting depth added 17). Of this number, 32 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.
useCompareLoupe.useCompareLoupe (cognitive 41) invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:57— useCompareLoupe.useCompareLoupe has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (28 pts), boolean chains 8, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 399, 210, 323, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.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.
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.
runtime.createQueueRuntime.submitQueueItem (cognitive 40) invokeai/frontend/webv2/src/features/queue/runtime.ts:1745— runtime.createQueueRuntime.submitQueueItem has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25 (28 pts), boolean chains 10, ternaries 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 24 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.
WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cognitive 40) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryThumbnail.tsx:47— WorkflowLibraryThumbnail.WorkflowLibraryThumbnail has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 13 (20 pts), if/else 9 (10 pts), boolean chains 9, error handling 1 (nesting depth added 8). Of this number, 26 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.
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.
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.
rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/rasterSnapshotCapture.ts:93— rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (27 pts), loops 5, ternaries 2 (5 pts), boolean chains 3 (nesting depth added 14). 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, split the body into named stages: move each independent 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 39) invokeai/app/api/routers/model_manager.py:1550— model_manager.get_is_installed has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (30 pts), boolean chains 5, 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.
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:1174— 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:1701— 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.
GalleryThumbnail.GalleryThumbnail (cognitive 39) invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx:75— GalleryThumbnail.GalleryThumbnail has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 18, if/else 10 (11 pts), boolean chains 10 (nesting depth added 1). Of this number, 17 points are the body's own statements and 22 belong to 14 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.
WorkflowWidgetChrome.WorkflowDialogHost (cognitive 39) invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx:298— WorkflowWidgetChrome.WorkflowDialogHost has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 10 (17 pts), if/else 12 (14 pts), boolean chains 7, loops 1 (nesting depth added 9). Most of this is not in the body itself: 3 of the 39 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 382, 367, 480, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.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.
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.
ModelInstallService._clear_pending_jobs (cognitive 38) invokeai/app/services/model_install/model_install_default.py:782— ModelInstallService._clear_pending_jobs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 9, loops 3 (5 pts), error handling 1 (2 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.
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:1261— 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.
WorkflowLibraryDialog.WorkflowLibraryDialog (cognitive 38) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx:89— WorkflowLibraryDialog.WorkflowLibraryDialog has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17, ternaries 14 (15 pts), boolean chains 6 (nesting depth added 1). Of this number, 16 points are the body's own statements and 22 belong to 10 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.
bitmapStore.createBitmapStore.flushLayer (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:382— 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.
generationComposite.composeForGeneration (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-operations/generationComposite.ts:131— generationComposite.composeForGeneration has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 8 (10 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 10). Of this number, 34 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent 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 37) invokeai/app/services/model_install/model_install_default.py:1745— ModelInstallService._register_or_install has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (27 pts), error handling 4 (10 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.
_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.
denoise.denoise (cognitive 37) invokeai/backend/ernie_image/denoise.py:21— denoise.denoise has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (27 pts), ternaries 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Krea2CheckpointModel._load_from_singlefile (cognitive 37) invokeai/backend/model_manager/load/model_loaders/krea2.py:402— 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.
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.
OverviewPane.ConnectedOverview (cognitive 37) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/OverviewPane.tsx:50— OverviewPane.ConnectedOverview has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (21 pts), ternaries 5 (11 pts), boolean chains 5 (nesting depth added 7). None of this is in the body itself: all 37 points belong to 15 function literals inside it that branch (lines 266, 117, 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.
paintTool.resolveTarget (cognitive 37) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:81— paintTool.resolveTarget has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 5 (9 pts), boolean chains 6 (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.
projectFile.importProjectFile (cognitive 37) invokeai/frontend/webv2/src/workbench/projects/projectFile.ts:272— 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:76— 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:288— 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.
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.
baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cognitive 36) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1461— baseGenerationPolicies.getSettingsWithCompatibleModelSelections has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 10, ternaries 2 (3 pts), loops 1 (nesting depth added 6). Of this number, 32 points are the body's own statements and 4 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.
settings.normalizeUpscaleWidgetValues (cognitive 36) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:785— 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.
ToolStripFlyout.ToolFamilyButton (cognitive 36) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:46— ToolStripFlyout.ToolFamilyButton has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 6, ternaries 4, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 36 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 116, 149, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BooleanMergeController.merge (cognitive 36) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:61— BooleanMergeController.merge has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 10, ternaries 4 (6 pts), loops 1 (nesting depth added 5). Of this number, 35 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.
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:1102— 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:1815— 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:289— 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.
StableDiffusionGeneratorPipeline.step (cognitive 35) invokeai/backend/stable_diffusion/diffusers_pipeline.py:438— StableDiffusionGeneratorPipeline.step has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 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.
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.
InstallQueueBar.InstallQueueBar (cognitive 35) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallQueueBar.tsx:59— InstallQueueBar.InstallQueueBar has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 17 (29 pts), boolean chains 5, if/else 1 (nesting depth added 12). Of this number, 33 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.
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.
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.
selectObjectSession.createSelectObjectSession.runRequest (cognitive 35) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:275— 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 286, 348). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:916— 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:790— 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:1148— 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.
anima_lora_conversion_utils.lora_model_from_anima_state_dict (cognitive 34) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:231— 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.
GraphPreviewDialog.GraphPreviewDialog (cognitive 34) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx:87— GraphPreviewDialog.GraphPreviewDialog has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 16 (26 pts), if/else 6, boolean chains 2 (nesting depth added 10). Of this number, 26 points are the body's own statements and 8 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.
CropLayerController.crop (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:68— CropLayerController.crop has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18, boolean chains 7, ternaries 4 (7 pts), error handling 2 (nesting depth added 3). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:232— MergeLayerController.mergeVisible has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 4 (6 pts), boolean chains 4, loops 4 (nesting depth added 6). Of this number, 24 points are the body's own statements and 10 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.
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.
RasterExportController.rasterize (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts:110— RasterExportController.rasterize has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (18 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.
createCanvasEngine.createCanvasEngine (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-operations/createCanvasEngine.ts:65— createCanvasEngine.createCanvasEngine has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 10 (12 pts), boolean chains 4, error handling 2 (nesting depth added 4). None of this is in the body itself: all 34 points belong to 13 function items inside it that branch (a function literal at line 129, 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.
SettingsEntryView.SettingsEntryView (cognitive 34) invokeai/frontend/webv2/src/workbench/settings/SettingsEntryView.tsx:59— SettingsEntryView.SettingsEntryView has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 11, if/else 2 (nesting depth added 7). Of this number, 26 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.
MetadataToSDXLLorasInvocation.invoke (cognitive 33) invokeai/app/invocations/metadata_linked.py:1076— 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._install_next_item (cognitive 33) invokeai/app/services/model_install/model_install_default.py:1667— ModelInstallService._install_next_item has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 3 (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.
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.
ZImageControlTransformer2DModel.forward (cognitive 33) invokeai/backend/z_image/z_image_control_transformer.py:451— ZImageControlTransformer2DModel.forward has cognitive complexity 33 (threshold 15). Drivers by points: loops 9 (13 pts), ternaries 3 (9 pts), if/else 7 (8 pts), boolean chains 3 (nesting depth added 11). 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.
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.
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.
widgetValues.syncVideoWidgetValuesWithModels (cognitive 33) invokeai/frontend/webv2/src/features/video/core/widgetValues.ts:39— 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.
ProjectWorkflowsView.ProjectWorkflowDetailPanel (cognitive 33) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:224— ProjectWorkflowsView.ProjectWorkflowDetailPanel has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (21 pts), boolean chains 10, if/else 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 14 belong to 12 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.
WorkflowFieldInput.VideoFrameIndexInput (cognitive 33) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1148— WorkflowFieldInput.VideoFrameIndexInput has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (24 pts), boolean chains 8, if/else 1 (nesting depth added 11). Of this number, 26 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.
SettingControl.SettingControl (cognitive 33) invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx:24— SettingControl.SettingControl has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (28 pts), if/else 4, boolean chains 1 (nesting depth added 11). Of this number, 29 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.
layerPanelRows.flattenPanelRows (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:65— layerPanelRows.flattenPanelRows has cognitive complexity 33 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (9 pts), ternaries 2 (9 pts), boolean chains 5 (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.
LayerChildRow.LayerChildRowComponent (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:81— LayerChildRow.LayerChildRowComponent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12, ternaries 10 (12 pts), boolean chains 9 (nesting depth added 2). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 160, 181, 136, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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 33) invokeai/frontend/webv2/src/workbench/settings/store.ts:285— store.normalizeWorkbenchPreferences has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 29 (31 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
board_images.remove_images_from_board (cognitive 32) invokeai/app/api/routers/board_images.py:303— 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.
ChildDependencyRecord._validate_relationship (cognitive 32) invokeai/app/services/shared/execution_engine/child.py:479— 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.
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.
GallerySettingField.GallerySettingField (cognitive 32) invokeai/frontend/webv2/src/features/gallery/ui/GallerySettingField.tsx:10— GallerySettingField.GallerySettingField has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, if/else 9, ternaries 5 (8 pts) (nesting depth added 3). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to one function literal inside it that branches (line 15). 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.
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.
ReferenceImageCard.ReferenceImageCardBase (cognitive 32) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx:66— ReferenceImageCard.ReferenceImageCardBase has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 15 (30 pts), if/else 2 (nesting depth added 15). Of this number, 30 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.
runtime.createQueueRuntime.initialize::initializeProjects (cognitive 32) invokeai/frontend/webv2/src/features/queue/runtime.ts:2379— 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.
buildGraph.planWorkflowSeeds (cognitive 32) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:463— 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.
RunLayerWorkflowDialog.RunLayerWorkflowDialog (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx:193— RunLayerWorkflowDialog.RunLayerWorkflowDialog has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 8 (9 pts), boolean chains 6, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 12 of the 32 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 349, 315, 250, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.getMetadataModelTuning (cognitive 32) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:501— imageRecall.getMetadataModelTuning has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13 (25 pts), if/else 4, boolean chains 3 (nesting depth added 12). Of this number, 28 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageRecall.getRefinerRecall (cognitive 32) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:781— 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:33— 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 66, 113, 92, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:64— 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 220, 146, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.
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:761— 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.
GalleryBoardRow.GalleryBoardRow (cognitive 31) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx:30— GalleryBoardRow.GalleryBoardRow has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 17 (22 pts), if/else 6, boolean chains 3 (nesting depth added 5). Of this number, 17 points are the body's own statements and 14 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.
holdLease.startIntermediatesHoldLease (cognitive 31) invokeai/frontend/webv2/src/features/intermediates/holdLease.ts:32— holdLease.startIntermediatesHoldLease has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (16 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 31 points belong to 10 function items inside it that branch (sendOnce, bodyFor, send, …). 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.
ModelEditForm.ModelEditForm (cognitive 31) invokeai/frontend/webv2/src/features/models/ui/detail/ModelEditForm.tsx:72— ModelEditForm.ModelEditForm has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 16 (18 pts), if/else 8 (10 pts), boolean chains 2, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 157, 134, 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.
InstallJobRow.InstallJobRow (cognitive 31) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallJobRow.tsx:93— InstallJobRow.InstallJobRow has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 21 (27 pts), boolean chains 4 (nesting depth added 6). Of this number, 28 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.
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.
MergeLayerController.mergeDown (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:84— MergeLayerController.mergeDown has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 7 (11 pts), boolean chains 7, error handling 1 (nesting depth added 5). Of this number, 25 points are the body's own statements and 6 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.
documentMirror.diffValueEdit (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:171— 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.
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.
QwenImage21DenoiseInvocation._run_diffusion (cognitive 30) invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:166— QwenImage21DenoiseInvocation._run_diffusion has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 8 (10 pts), boolean chains 6, 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.
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:570— 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.
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.
generate_docs_json.build_invocation_context_export (cognitive 30) scripts/generate_docs_json.py:103— generate_docs_json.build_invocation_context_export has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (6 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.
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.
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:1552— 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.
WorkflowFieldInput.SavedWorkflowInput (cognitive 30) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1675— 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.
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.
ImageMapWidgetView.ImageMapWidgetView (cognitive 30) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx:71— ImageMapWidgetView.ImageMapWidgetView has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 10, boolean chains 5 (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.
MergeLayerController.mergeSelected (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:390— MergeLayerController.mergeSelected has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 6, loops 5, ternaries 3 (4 pts) (nesting depth added 2). Of this number, 26 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.
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.
PsdExportController.export (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:67— PsdExportController.export has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 5 (6 pts), boolean chains 3, error handling 1 (nesting depth added 3). Of this number, 20 points are the body's own statements and 10 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.
bitmapStore.createBitmapStore.flushPendingUploads (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:668— bitmapStore.createBitmapStore.flushPendingUploads has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 15). Of this number, 28 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent 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 30) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:271— StatusBar.CompactBottomWidget has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 16 (18 pts), if/else 7 (8 pts), boolean chains 4 (nesting depth added 3). Of this number, 20 points are the body's own statements and 10 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.
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:157— 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:2653— 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:144— 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.
PromptTextarea.PromptTextarea (cognitive 29) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTextarea.tsx:61— PromptTextarea.PromptTextarea has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 15 (21 pts), boolean chains 7, if/else 1 (nesting depth added 6). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 149, 217, 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.
GeneratePresetsPopover.GeneratePresetsPopover (cognitive 29) invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx:130— GeneratePresetsPopover.GeneratePresetsPopover has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 15 (19 pts), if/else 8, boolean chains 2 (nesting depth added 4). Of this number, 15 points are the body's own statements and 14 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.
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.
WorkflowFieldInput.useMediaUpload.onFileChange (cognitive 29) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:604— 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 629). 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.
usePreviewNavigation.usePreviewNavigation (cognitive 29) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:211— 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.
PreviewFilmstrip.FilmstripLiveThumb (cognitive 29) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx:125— PreviewFilmstrip.FilmstripLiveThumb has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (18 pts), if/else 7 (8 pts), boolean chains 3 (nesting depth added 7). Of this number, 21 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.
workbenchState.compileInvocationSnapshot (cognitive 29) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2705— workbenchState.compileInvocationSnapshot has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 6 (10 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.
documentMirror.diffForests (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:102— 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.
documentMirror.createDocumentMirror.refresh (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:248— documentMirror.createDocumentMirror.refresh has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (23 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.
shapeTool.createShapeTool.commitPixels (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:154— shapeTool.createShapeTool.commitPixels has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 7, ternaries 4, error handling 1 (nesting depth added 1). 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: 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.
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.
LayerFilterControls.FilterParamField (cognitive 29) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterControls.tsx:133— LayerFilterControls.FilterParamField has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 7, boolean chains 6 (nesting depth added 4). Of this number, 23 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.
baseinvocation.validate_fields (cognitive 28) invokeai/app/invocations/baseinvocation.py:573— 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:695— 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:1409— 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:450— 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:928— 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.
TorchDevice.get_generation_devices (cognitive 28) invokeai/backend/util/devices.py:336— 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.
addRegionalGuidance.addRegionalGuidance (cognitive 28) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:227— addRegionalGuidance.addRegionalGuidance has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, 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.
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.
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.
invocation.resolveInvocationRouteInput (cognitive 28) invokeai/frontend/webv2/src/workbench/invocation.ts:200— invocation.resolveInvocationRouteInput has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, ternaries 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.
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.
LayerGroupContextMenu.LayerGroupContextMenu (cognitive 28) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:73— LayerGroupContextMenu.LayerGroupContextMenu has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 2). Of this number, 18 points are the body's own statements and 10 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.
SelectionPixelController.edit (cognitive 28) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:133— SelectionPixelController.edit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 7 (9 pts), boolean chains 6 (nesting depth added 3). Of this number, 24 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.
revealGalleryItem.revealGalleryItem (cognitive 28) invokeai/frontend/webv2/src/workbench/image-actions/revealGalleryItem.ts:53— revealGalleryItem.revealGalleryItem has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 10, ternaries 6 (7 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 69, 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:31— 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.
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.
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.
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.
mistral_encoder._load_tokenizer_for_model (cognitive 27) REDACTED:1008— 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:114— 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.
HuggingFaceMetadataFetch.from_id (cognitive 27) invokeai/backend/model_manager/metadata/fetch/huggingface.py:94— HuggingFaceMetadataFetch.from_id has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 4 (8 pts), boolean chains 3, ternaries 2 (3 pts), 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.
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.
runtime.createQueueItemBackendSubmission (cognitive 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:260— 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.
settings.sanitizeVideoReferences (cognitive 27) invokeai/frontend/webv2/src/features/video/core/settings.ts:188— 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.
adjustments.buildCurveLut (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:32— 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.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:335— SelectObjectCoordinator.createSelectObjectOperationCoordinator.save has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 2 (4 pts), boolean chains 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.
executeImageRecall.executeLoadMediaWorkflow (cognitive 27) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:103— 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.
run_app.run_app (cognitive 26) invokeai/app/run_app.py:45— run_app.run_app has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (15 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.
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:1731— 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.
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.
loaders.gguf_sd_loader (cognitive 26) invokeai/backend/quantization/gguf/loaders.py:147— loaders.gguf_sd_loader has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 2 (5 pts), boolean chains 2, loops 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.
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.
calibrate_flux2_working_memory.report_denoise (cognitive 26) scripts/calibrate_flux2_working_memory.py:534— calibrate_flux2_working_memory.report_denoise has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 5 (10 pts), ternaries 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.
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.
parseSchema.parseSchema (cognitive 26) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:97— parseSchema.parseSchema has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, ternaries 6 (8 pts), boolean chains 2, error handling 2 (nesting depth added 2). None of this is in the body itself: all 26 points belong to 5 function literals inside it that branch (lines 120, 200, 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.
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.
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:196— 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.
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.
WildcardsPanel.WildcardsPanel (cognitive 26) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx:50— WildcardsPanel.WildcardsPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (16 pts), if/else 5, boolean chains 3, error handling 2 (nesting depth added 6). Of this number, 18 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.
settings.isVideoSettings (cognitive 26) invokeai/frontend/webv2/src/features/video/core/settings.ts:446— 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.
shortcutHints.getCanvasShortcutHints (cognitive 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/shortcutHints.ts:18— shortcutHints.getCanvasShortcutHints has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, ternaries 4 (8 pts), boolean chains 6 (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.
workbenchState.assembleWorkbenchProject (cognitive 26) invokeai/frontend/webv2/src/workbench/workbenchState.ts:1657— workbenchState.assembleWorkbenchProject has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, ternaries 4 (5 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:127— DiagnosticsPanel.DiagnosticsPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 4, boolean chains 2, error handling 1 (nesting depth added 8). Of this number, 13 points are the body's own statements and 13 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.
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.
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.
_ExpertSwapper.get (cognitive 25) invokeai/app/invocations/wan/wan_denoise.py:214— _ExpertSwapper.get has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 4, boolean chains 2, 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.
DiskImageFileStorage.__iter_supported_paths (cognitive 25) invokeai/app/services/image_files/image_files_disk.py:131— 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.
ModelInstallService._multifile_download (cognitive 25) invokeai/app/services/model_install/model_install_default.py:2319— ModelInstallService._multifile_download has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (9 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.
_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:1960— 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.
LoRALoader._load_model (cognitive 25) invokeai/backend/model_manager/load/model_loaders/lora.py:96— LoRALoader._load_model has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (24 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.
ggml_tensor.dequantize_and_run (cognitive 25) invokeai/backend/quantization/gguf/ggml_tensor.py:14— 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.
calibrate_flux2_working_memory.main (cognitive 25) scripts/calibrate_flux2_working_memory.py:595— calibrate_flux2_working_memory.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2 (5 pts), ternaries 1 (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.
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) invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:902— 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 970, 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:1415— 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.
GalleryBoardMenu.GalleryBoardMenu (cognitive 25) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:35— GalleryBoardMenu.GalleryBoardMenu has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, if/else 9, ternaries 2. Of this number, 14 points are the body's own statements and 11 belong to 10 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.
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.
videoPolicies.getVideoComponentSectionPolicy (cognitive 25) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1508— 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:300— 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.
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.
layerPanelState.reconcileLayerPanelState (cognitive 25) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:201— 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.
imageMapStore.refreshImageIndexStatus (cognitive 25) invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts:424— 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 437, 496). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.
GenerationDevicesSettings.GenerationDevicesSettings (cognitive 25) invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx:16— GenerationDevicesSettings.GenerationDevicesSettings has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (16 pts), if/else 5, boolean chains 3, error handling 1 (nesting depth added 5). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
QueueCluster.QueueCluster (cognitive 25) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:38— QueueCluster.QueueCluster has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 7, if/else 3 (4 pts) (nesting depth added 5). 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 into named stages: move each independent 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:254— 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:999— 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.
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.
DefaultSessionRunner._run_session_loop (cognitive 24) invokeai/app/services/session_processor/session_processor_default.py:179— DefaultSessionRunner._run_session_loop has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
CachedModelWithPartialLoad.partial_load_to_vram_chunk (cognitive 24) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:384— 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.
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.
nvfp4._find_nvfp4_layers (cognitive 24) invokeai/backend/quantization/nvfp4.py:196— nvfp4._find_nvfp4_layers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 8, error handling 1 (2 pts), loops 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.
attention._chunked_sdpa (cognitive 24) invokeai/backend/util/attention.py:220— 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.
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.
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:192— 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 386, 281, 332, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:445— PositivePromptActions.ExpandPromptButton has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 8, if/else 2, error handling 1 (nesting depth added 3). Of this number, 17 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
graph.buildQwenImageGraph (cognitive 24) invokeai/frontend/webv2/src/features/generation/core/graph.ts:963— 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.
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:153— 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.
DefaultSettingsSection.FieldControl (cognitive 24) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:60— DefaultSettingsSection.FieldControl has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 6 (8 pts), boolean chains 4 (nesting depth added 7). Of this number, 15 points are the body's own statements and 9 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.
runtime.createQueueRuntime.handleUnadoptedRerunSettled (cognitive 24) invokeai/frontend/webv2/src/features/queue/runtime.ts:1672— runtime.createQueueRuntime.handleUnadoptedRerunSettled has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 4 (5 pts) (nesting depth added 3). Of this number, 12 points are the body's own statements and 12 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.
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.
assetTransport.createAssetResponseReader (cognitive 24) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:105— assetTransport.createAssetResponseReader has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 2 (3 pts), boolean chains 2, error handling 2 (nesting depth added 6). 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 140, refuseTooLarge, cancelReader, …). 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.
rasterComposite.renderRasterComposite (cognitive 24) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterComposite.ts:227— rasterComposite.renderRasterComposite has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). None of this is in the body itself: all 24 points belong to 2 function items inside it that branch (drawLayer, renderRange). 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.
layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cognitive 24) invokeai/frontend/webv2/src/workbench/canvas-engine/layerRasterizer.ts:73— layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, error handling 2 (3 pts), ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 151, 120). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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 24) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:331— groupSurfaceCache.createGroupSurfaceCache.resolve has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, ternaries 2 (5 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:210— 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.
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:253— 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:249— 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.
index.dynamicBaseQuery (cognitive 23) invokeai/frontend/webv1/src/services/api/index.ts:97— index.dynamicBaseQuery has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 14, if/else 6 (7 pts), ternaries 2 (nesting depth added 1). 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, 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.
onModelInstallError.buildOnModelInstallError (cognitive 23) invokeai/frontend/webv1/src/services/events/onModelInstallError.tsx:54— onModelInstallError.buildOnModelInstallError has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (23 pts) (nesting depth added 8). None of this is in the body itself: all 23 points belong to 2 function literals inside it that branch (lines 55, 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.
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.
QueueItemRow.QueueItemRow (cognitive 23) invokeai/frontend/webv2/src/features/queue/ui/QueueItemRow.tsx:29— QueueItemRow.QueueItemRow has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 5, if/else 2 (nesting depth added 3). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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 168, a function literal at line 146, 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.
WorkflowFieldInput.MediaInput (cognitive 23) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:964— WorkflowFieldInput.MediaInput has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 3, if/else 1 (nesting depth added 4). Of this number, 21 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.
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:301— 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 342, a function literal at line 367, 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.
PixelEditController.beginMaterialized (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:328— 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.
imageRecall.getMetadataConcepts (cognitive 23) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:872— imageRecall.getMetadataConcepts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (8 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.
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.
ModelInstallService._resume_remote_download (cognitive 22) invokeai/app/services/model_install/model_install_default.py:625— ModelInstallService._resume_remote_download has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, ternaries 3, loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelInstallService._download_cancelled_callback (cognitive 22) invokeai/app/services/model_install/model_install_default.py:2503— ModelInstallService._download_cancelled_callback has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3 (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.
ChildDependencyRecord._record_completion (cognitive 22) invokeai/app/services/shared/execution_engine/child.py:638— ChildDependencyRecord._record_completion has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 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.
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:737— 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.
model_cache._run_deferred_work (cognitive 22) invokeai/backend/model_manager/load/model_cache/model_cache.py:194— 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.
QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile (cognitive 22) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:433— QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 2 (4 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.
ModelOnDisk.load_state_dict (cognitive 22) invokeai/backend/model_manager/model_on_disk.py:169— 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.
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:184— 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.
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 (cognitive 22) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx:42— GalleryImage.buildOnClick has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4 (nesting depth added 6). None of this is in the body itself: all 22 points belong to one function literal inside it that branches (line 42). 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.
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.
mock-backend.filterGalleryItems (cognitive 22) invokeai/frontend/webv2/scripts/mock-backend.mjs:565— mock-backend.filterGalleryItems has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 9, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 22 points belong to 2 function literals inside it that branch (lines 577, 616). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.getGallerySelectedImageQuery (cognitive 22) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:256— 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.
compileCanvasGraph.getCanvasValidationReasons (cognitive 22) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:112— compileCanvasGraph.getCanvasValidationReasons has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 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.
graph.buildFlux2Graph (cognitive 22) invokeai/frontend/webv2/src/features/generation/core/graph.ts:745— 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.
GenerateRenderSection.GenerateRenderSection::renderFields (cognitive 22) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:559— GenerateRenderSection.GenerateRenderSection::renderFields has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 16 (18 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.
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.
InstallProgressCell.useInstallProgressCaption (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallProgressCell.tsx:46— 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.
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:203— 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.
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.
prepareCanvasInvocation.resolveRegionalReferenceImages (cognitive 22) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:192— 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.
pointerPipeline.createPointerPipeline.onKeyDown (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:376— pointerPipeline.createPointerPipeline.onKeyDown has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 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.
groupSurfaceCache.createGroupSurfaceCache.drawRange (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:202— 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.
queueRunJournal.createIndexedDbQueueRunJournal.record (cognitive 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:381— 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.
queueRecall.buildQueueRecallValues (cognitive 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:52— 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.
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:784— 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.
WanLatentsToVideoInvocation.invoke (cognitive 21) invokeai/app/invocations/vae/wan_latents_to_video.py:98— WanLatentsToVideoInvocation.invoke has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, boolean chains 4, loops 1 (2 pts), ternaries 2, 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.
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:329— 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.
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:330— 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:882— 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.
OrphanedModelsService.find_orphaned_models (cognitive 21) invokeai/app/services/orphaned_models/orphaned_models_service.py:77— OrphanedModelsService.find_orphaned_models has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts), loops 4 (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.
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:945— 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:404— 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.
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.
ModelConfigFactory.from_model_on_disk (cognitive 21) invokeai/backend/model_manager/configs/factory.py:865— ModelConfigFactory.from_model_on_disk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 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.
ModelCache._log_cache_state (cognitive 21) invokeai/backend/model_manager/load/model_cache/model_cache.py:2655— 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:2915— 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:2134— 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:474— 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.
flux_bfl_peft_lora_conversion_utils._convert_bfl_layer_to_diffusers (cognitive 21) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:258— flux_bfl_peft_lora_conversion_utils._convert_bfl_layer_to_diffusers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
calibrate_qwen_vae_working_memory.run_grid (cognitive 21) scripts/calibrate_qwen_vae_working_memory.py:202— calibrate_qwen_vae_working_memory.run_grid has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
calibrate_wan_vae_working_memory._measure (cognitive 21) scripts/calibrate_wan_vae_working_memory.py:81— calibrate_wan_vae_working_memory._measure has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, loops 1 (2 pts), 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.
check_platform_locks.has_wheel (cognitive 21) scripts/check_platform_locks.py:141— check_platform_locks.has_wheel has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 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.
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.
useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cognitive 21) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridSelection.ts:98— 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:108— 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:325— 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.
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.
GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cognitive 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateConditioningRebalanceField.tsx:61— GenerateConditioningRebalanceField.GenerateConditioningRebalanceField has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 4, if/else 4 (nesting depth added 3). Of this number, 14 points are the body's own statements and 7 belong to 7 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.
fields.isWorkflowFieldValueValid (cognitive 21) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:384— 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.
NodeFieldControl.NodeFieldControl (cognitive 21) invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx:57— NodeFieldControl.NodeFieldControl has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 6, if/else 2 (nesting depth added 3). Of this number, 18 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.
WorkflowFieldInput.WorkflowFieldSnapshot (cognitive 21) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:2021— 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:264— 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.
persistenceRuntime.createWorkbenchPersistenceRuntime.load (cognitive 21) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:484— 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:390— 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.
layerExportActions.saveLayerToBoard (cognitive 21) invokeai/frontend/webv2/src/workbench/widgets/layers/layerExportActions.ts:81— layerExportActions.saveLayerToBoard has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (3 pts), boolean chains 2, 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.
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:270— 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.
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.
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 139, 67, 110, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
extract_metadata.extract_metadata (cognitive 20) invokeai/app/api/extract_metadata.py:34— extract_metadata.extract_metadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (6 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.
SocketIO._handle_user_access_changed (cognitive 20) invokeai/app/api/sockets.py:708— 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.
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:690— 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.
ImageIndexService._process_batch (cognitive 20) invokeai/app/services/image_index/image_index_default.py:1352— 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.
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:51— 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.
ModelLoader._load_and_cache (cognitive 20) invokeai/backend/model_manager/load/load_default.py:354— ModelLoader._load_and_cache has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 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._make_room_internal (cognitive 20) invokeai/backend/model_manager/load/model_cache/model_cache.py:2740— 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.
krea2_lora_conversion_utils.lora_model_from_krea2_state_dict (cognitive 20) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:184— 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:581— 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.
sage_attention.install_sage_attention (cognitive 20) invokeai/backend/util/sage_attention.py:296— sage_attention.install_sage_attention has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, 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.
ZImageControlTransformer2DModel.forward_control (cognitive 20) invokeai/backend/z_image/z_image_control_transformer.py:329— ZImageControlTransformer2DModel.forward_control has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (7 pts), ternaries 2 (6 pts), if/else 4 (5 pts), boolean chains 2 (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.
ZImageControlNetExtension.compute_hints (cognitive 20) invokeai/backend/z_image/z_image_controlnet_extension.py:87— ZImageControlNetExtension.compute_hints has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (7 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_controlnet_extension.z_image_forward_with_control (cognitive 20) invokeai/backend/z_image/z_image_controlnet_extension.py:233— z_image_controlnet_extension.z_image_forward_with_control has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 7, boolean chains 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.
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.
generate_docs_json._parse_docstring (cognitive 20) scripts/generate_docs_json.py:242— generate_docs_json._parse_docstring has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
GalleryProgressSection.GalleryProgressTile (cognitive 20) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:183— GalleryProgressSection.GalleryProgressTile has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (15 pts), if/else 3, boolean chains 2 (nesting depth added 4). 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.buildSDGraph (cognitive 20) invokeai/frontend/webv2/src/features/generation/core/graph.ts:314— graph.buildSDGraph has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (12 pts), if/else 6, boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GenerateReferenceImagesSection.GenerateReferenceImagesContent (cognitive 20) invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx:45— GenerateReferenceImagesSection.GenerateReferenceImagesContent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, ternaries 8, boolean chains 4. Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 8 function items inside it that branch (addGalleryImages, a function literal at line 69, a function literal at line 155, …). 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.
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:196— 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.
InvocationCacheFooter.InvocationCacheFooter (cognitive 20) invokeai/frontend/webv2/src/features/queue/ui/InvocationCacheFooter.tsx:29— InvocationCacheFooter.InvocationCacheFooter has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 2, error handling 1, if/else 1 (nesting depth added 6). 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, split the body into named stages: move each independent 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:197— 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 211). 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:437— 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.
projectHalves.findRepeatedWorkflowItem (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:131— 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:116— 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.
shapeRasterizer.buildParametricShapePath (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterizers/shapeRasterizer.ts:22— shapeRasterizer.buildParametricShapePath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (7 pts), loops 1 (2 pts) (nesting depth added 8). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent 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.recordDiagnosticForAction (cognitive 20) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:744— 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.
invocationSubmit.submitResolvedInvocation (cognitive 20) invokeai/frontend/webv2/src/workbench/invocationSubmit.ts:178— invocationSubmit.submitResolvedInvocation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (6 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.
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.
engine.createCanvasEngine::getDuplicateRasterPlan (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2149— 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.
filterOperationSession.createFilterOperationSession.commit (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts:253— filterOperationSession.createFilterOperationSession.commit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 2, 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.
SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:284— SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 2 (4 pts), boolean chains 1, error handling 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.
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.
videoRecall.getRecallableReferences (cognitive 20) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:439— videoRecall.getRecallableReferences has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 6, if/else 4 (nesting depth added 5). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 446). 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.
ImageContextMenu.SingleItemMenuItems (cognitive 20) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:308— ImageContextMenu.SingleItemMenuItems has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, ternaries 7, if/else 6. 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: 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.
entries.buildProviderSectionRows (cognitive 20) invokeai/frontend/webv2/src/workbench/palette/entries.ts:610— 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:25— 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 124, a function literal at line 50, a function literal at line 97, …). 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.
useProjectActions.useProjectActions.closeProject (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts:150— useProjectActions.useProjectActions.closeProject has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 173, persistCanvasPixels, a function literal at line 211). 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.
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:276— 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:162— 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.
QwenImagePiDDecodeInvocation.invoke (cognitive 19) invokeai/app/invocations/pid/qwen_image_pid_decode.py:115— QwenImagePiDDecodeInvocation.invoke has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1575— 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.
OrphanedModelsService.delete_orphaned_models (cognitive 19) invokeai/app/services/orphaned_models/orphaned_models_service.py:145— OrphanedModelsService.delete_orphaned_models has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 4 (8 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.
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:3568— 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:3722— 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:27— 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.
ZImageControlCheckpointModel._load_control_adapter (cognitive 19) invokeai/backend/model_manager/load/model_loaders/z_image.py:1035— ZImageControlCheckpointModel._load_control_adapter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3, boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
krea2_lora_conversion_utils._get_lora_layer_values (cognitive 19) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:242— krea2_lora_conversion_utils._get_lora_layer_values has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 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.
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:74— 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.
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.
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 (cognitive 19) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryVideoItem.tsx:44— GalleryVideoItem.buildOnClick has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (nesting depth added 5). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 44). 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 (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.
GenerationUiAdapter.getQueueInsights (cognitive 19) invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:71— 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.
PromptTemplatesPanel.PromptTemplatesPanel (cognitive 19) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx:64— PromptTemplatesPanel.PromptTemplatesPanel has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 3, if/else 2, error handling 1 (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generationMeta.extractGenerationMeta (cognitive 19) invokeai/frontend/webv2/src/features/queue/core/generationMeta.ts:19— generationMeta.extractGenerationMeta has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, loops 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.
settings.syncUpscaleWidgetValuesWithModels (cognitive 19) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:860— 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.
forLoops.getForLoopBodyBoundaries (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:181— forLoops.getForLoopBodyBoundaries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, loops 2, ternaries 1 (nesting depth added 3). 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 216, 218, 254). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.getWorkflowFieldInvalidReason (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:465— fields.getWorkflowFieldInvalidReason 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.
NodeContextMenu.NodeContextMenu (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/editor/NodeContextMenu.tsx:39— 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.
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.
http.getValidationIssueMessage (cognitive 19) invokeai/frontend/webv2/src/platform/transport/http.ts:124— 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.
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:265— 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:153— 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:172— 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.
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:364— 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:212— 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.
previewPublisher.createPreviewPublisher.decodePreview (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/previewPublisher.ts:107— previewPublisher.createPreviewPublisher.decodePreview has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 10). Of this number, 15 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.
groupSurfaceCache.createGroupSurfaceCache.drawnEntries (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:167— 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.
importGalleryImages.importGalleryImagesToCanvas (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:236— 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.
firstPartyCommands.useRegisterFirstPartyCommands (cognitive 19) invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts:99— firstPartyCommands.useRegisterFirstPartyCommands has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, loops 3, ternaries 2, error handling 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 9 function items inside it that branch (recallSelectedImage, a function literal at line 238, 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.
executeVideoRecall.placeVideoImage (cognitive 19) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:637— 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:28— 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.
LayoutPresetStrip.PresetTab (cognitive 19) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:310— LayoutPresetStrip.PresetTab has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11, if/else 5, boolean chains 3. 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 390, 333, 352, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:205— 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:1601— 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.
DiskImageFileStorage.save (cognitive 18) invokeai/app/services/image_files/image_files_disk.py:238— DiskImageFileStorage.save has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 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.
IntermediatesService._summary_rows (cognitive 18) invokeai/app/services/intermediates/intermediates_default.py:221— 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:552— 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.
ExecutionScheduler.complete (cognitive 18) invokeai/app/services/shared/execution_engine/scheduler.py:397— 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:431— 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.
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.
Flux2RefImageExtension._prepare_ref_images (cognitive 18) invokeai/backend/flux2/ref_image_extension.py:181— Flux2RefImageExtension._prepare_ref_images has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 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.
mistral_encoder._count_mistral_layers (cognitive 18) invokeai/backend/model_manager/configs/mistral_encoder.py:99— 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:211— 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._offload_unlocked_models (cognitive 18) invokeai/backend/model_manager/load/model_cache/model_cache.py:2590— 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.
LTX2Gemma4EncoderModel._load_text_encoder (cognitive 18) invokeai/backend/model_manager/load/model_loaders/ltx2.py:485— LTX2Gemma4EncoderModel._load_text_encoder has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (4 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.
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.
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:12— 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.
benchmark_database._seed (cognitive 18) scripts/benchmark_database.py:219— benchmark_database._seed has cognitive complexity 18 (threshold 15). Drivers by points: loops 10, if/else 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 4). 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.
calibrate_z_image_working_memory.report (cognitive 18) scripts/calibrate_z_image_working_memory.py:213— calibrate_z_image_working_memory.report has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (6 pts), boolean chains 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.
check_pins.check_pins (cognitive 18) scripts/check_pins.py:275— check_pins.check_pins has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 6 (9 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.
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.
promptAttention.selectTerminals (cognitive 18) invokeai/frontend/webv1/src/common/util/promptAttention.ts:369— promptAttention.selectTerminals has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8 (nesting depth added 4). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 370, 396). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:810— 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:67— 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.
compileCanvasGraph.compileCanvasGraph (cognitive 18) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:728— compileCanvasGraph.compileCanvasGraph has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
baseGenerationPolicies.getReferenceImageValidationReasons (cognitive 18) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1695— baseGenerationPolicies.getReferenceImageValidationReasons has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 1708). 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.
coordinator.createQueueCoordinator.handleStatusChanged (cognitive 18) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:771— coordinator.createQueueCoordinator.handleStatusChanged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utilityGraph.reconcileUtilityCompletedOutput (cognitive 18) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:155— utilityGraph.reconcileUtilityCompletedOutput has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 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.
VideoModelField.VideoModelField (cognitive 18) invokeai/frontend/webv2/src/features/video/ui/VideoModelField.tsx:69— VideoModelField.VideoModelField has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 6, boolean chains 2 (nesting depth added 2). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
outputFields.formatOutputValue (cognitive 18) invokeai/frontend/webv2/src/features/workflow/core/outputFields.ts:62— 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.
WorkflowLibraryGrid.WorkflowLibraryGrid (cognitive 18) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:52— WorkflowLibraryGrid.WorkflowLibraryGrid has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 5, if/else 3 (nesting depth added 3). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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:63— 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 119). 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:160— 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:214— 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:134— 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:205— 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:279— 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:82— 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.
ProjectWidgetView.DetailsSection (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx:87— ProjectWidgetView.DetailsSection has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 2 (3 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 7). 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 into named stages: move each independent 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.
workbenchState.removeGalleryItemsFromAllProjects (cognitive 18) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2996— workbenchState.removeGalleryItemsFromAllProjects has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, if/else 3. Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3020, 3058, 3005, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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 (cognitive 18) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:87— workbenchStore.createCommands has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, ternaries 5, boolean chains 2. None of this is in the body itself: all 18 points belong to 10 function literals inside it that branch (lines 393, 425, 478, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
prepareCanvasInvocation.runCanvasInvocation (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:293— prepareCanvasInvocation.runCanvasInvocation has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 4 (5 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StagedResultController.commit (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:72— StagedResultController.commit has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 4, error handling 1. Of this number, 12 points are the body's own statements and 6 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.
psdExport.executePsdExport (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:406— psdExport.executePsdExport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (5 pts), loops 2, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (drawPreview, a function literal at line 440). 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.
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:124— 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.
queueRecall.buildVideoQueueRecallPatch (cognitive 18) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:121— 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.
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.
useMaskTintEditor.useMaskTintEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/useMaskTintEditor.ts:50— useMaskTintEditor.useMaskTintEditor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, boolean chains 4, ternaries 2. None of this is in the body itself: all 18 points belong to 8 function literals inside it that branch (lines 54, 102, 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.
AdjustmentSettings.CurvesEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx:452— 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 552, 526, 582, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
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:960— 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.
DownloadQueueService._download_next_item (cognitive 17) invokeai/app/services/download/download_default.py:387— 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:896— 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.
ModelInstallService.restart_failed (cognitive 17) invokeai/app/services/model_install/model_install_default.py:1324— ModelInstallService.restart_failed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 3, error handling 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.
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:146— 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:204— 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:354— 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.
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:150— 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._is_flux2_model (cognitive 17) invokeai/backend/model_manager/configs/main.py:370— main._is_flux2_model has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 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.
main._sdnq_component_declared_classes (cognitive 17) invokeai/backend/model_manager/configs/main.py:3364— 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.
ModelCache._load_locked_model (cognitive 17) invokeai/backend/model_manager/load/model_cache/model_cache.py:2085— ModelCache._load_locked_model has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 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.
Flux2CheckpointModel._dequantize_fp8_weights (cognitive 17) invokeai/backend/model_manager/load/model_loaders/flux.py:1551— 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.
HuggingFaceMetadata.download_urls (cognitive 17) invokeai/backend/model_manager/metadata/metadata_base.py:106— HuggingFaceMetadata.download_urls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (4 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.
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:42— 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.
LayerPatcher.apply_smart_model_patch (cognitive 17) invokeai/backend/patches/layer_patcher.py:113— LayerPatcher.apply_smart_model_patch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
check_platform_locks.walk_closure (cognitive 17) scripts/check_platform_locks.py:243— check_platform_locks.walk_closure 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.
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 (cognitive 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:60— AddNodeCmdk.useAddNode 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). None of this is in the body itself: all 17 points belong to 3 function literals inside it that branch (lines 68, 90, 95). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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 (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.
controlValidation.getControlValidationReason (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/canvas/controlValidation.ts:92— controlValidation.getControlValidationReason has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 5, 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.
ConceptRow.ConceptRowContent (cognitive 17) invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.tsx:164— ConceptRow.ConceptRowContent has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 11 (14 pts), boolean chains 2, if/else 1 (nesting depth added 3). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.normalizeReferenceImageConfig (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/settings.ts:335— 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.
settings.cloneGenerateWidgetValues (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/settings.ts:545— settings.cloneGenerateWidgetValues has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 17. 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.getModelFamilyValidationReasons (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1761— baseGenerationPolicies.getModelFamilyValidationReasons has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 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.
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.
GenerateModelCard.GenerateModelCard (cognitive 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx:36— GenerateModelCard.GenerateModelCard has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 3, if/else 3 (nesting depth added 6). Of this number, 11 points are the body's own statements and 6 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.
runtime.createQueueRuntime.deliverResultVideos (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:984— 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.loadProjectJournal (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:2305— 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 2313, 2332). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
LayerEditorPanes.LayerPaneBlock (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.tsx:48— LayerEditorPanes.LayerPaneBlock has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PreviewHeaderActions.PreviewHeaderActions (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.tsx:21— PreviewHeaderActions.PreviewHeaderActions has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 6 (nesting depth added 2). Of this number, 15 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.
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.
compositeFrame.createCompositeFrame.draw (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositeFrame.ts:183— compositeFrame.createCompositeFrame.draw has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 5, if/else 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.
psdExport.planPsdExport::buildTree (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:258— 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.
executeImageRecall.executeImageRecall (cognitive 17) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:294— executeImageRecall.executeImageRecall has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 4, boolean chains 1, 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.
entries.buildSettingsEntries (cognitive 17) invokeai/frontend/webv2/src/workbench/palette/entries.ts:322— 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 330, 422, 421). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
OpenProjectDialog.OpenProjectDialog (cognitive 17) invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx:47— OpenProjectDialog.OpenProjectDialog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (6 pts), boolean chains 1, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 63, 120, 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.
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:77— 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.
HotkeysSettingsSection.HotkeyListRow (cognitive 17) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:281— HotkeysSettingsSection.HotkeyListRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 5, if/else 1 (nesting depth added 1). 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: 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.
CenterArea.CenterArea (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:52— 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.
GenerateCanvasRenderSize.GenerateCanvasRenderSize (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasRenderSize.tsx:84— 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 153, 127, 101, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:571— 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.
model_manager._reidentify_model (cognitive 16) invokeai/app/api/routers/model_manager.py:483— model_manager._reidentify_model has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SocketIO._revalidate_socket_users (cognitive 16) invokeai/app/api/sockets.py:452— 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:939— 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:530— 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:301— 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.
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.
GalleryMaintenanceService._archive_file (cognitive 16) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:837— 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:528— 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.
ModelInstallService._download_complete_callback (cognitive 16) invokeai/app/services/model_install/model_install_default.py:2443— 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.
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:981— 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.
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.
InstantXControlNetFlux.forward (cognitive 16) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:107— InstantXControlNetFlux.forward has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4, boolean chains 3 (nesting depth added 2). 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.
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.
Krea2MemoryEfficientAttnProcessor.__call__ (cognitive 16) invokeai/backend/krea2/attention.py:152— Krea2MemoryEfficientAttnProcessor.__call__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnimaCheckpointModel._load_from_singlefile (cognitive 16) invokeai/backend/model_manager/load/model_loaders/anima.py:189— AnimaCheckpointModel._load_from_singlefile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 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.
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:92— 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:1169— 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.
loaders.parse_q8_cr_markers (cognitive 16) invokeai/backend/quantization/gguf/loaders.py:103— loaders.parse_q8_cr_markers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 1 (3 pts), boolean chains 2, 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.
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.
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.
settings.getGallerySettings (cognitive 16) invokeai/frontend/webv2/src/features/gallery/core/settings.ts:146— settings.getGallerySettings 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.
galleryStateView.getGalleryStateView (cognitive 16) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:398— galleryStateView.getGalleryStateView has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 7 (8 pts) (nesting depth added 1). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
queries.ensureLifecycle (cognitive 16) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:295— queries.ensureLifecycle has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (5 pts), loops 2 (nesting depth added 1). 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 items inside it that branch (a function literal at line 316, 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.
queries.fetchVerifiedGalleryItemPage (cognitive 16) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:739— 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:140— 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.getGenerationModelAvailabilityReasons (cognitive 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1611— baseGenerationPolicies.getGenerationModelAvailabilityReasons has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 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.
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:441— GenerateDimensionFields.GenerateDimensionFields::renderSection has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 11, boolean chains 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.
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.
runtime.createQueueRuntime.flushJournalRecords (cognitive 16) invokeai/frontend/webv2/src/features/queue/runtime.ts:601— runtime.createQueueRuntime.flushJournalRecords has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 609, 647). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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:578— 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:555— 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.updateWorkflowNodes (cognitive 16) invokeai/frontend/webv2/src/features/workflow/core/document.ts:579— 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:135— 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.
WorkflowLibraryCard.WorkflowLibraryCard (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx:83— WorkflowLibraryCard.WorkflowLibraryCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 13, boolean chains 3. Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, 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.
useWorkflowPublication.useWorkflowPublication.settle (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/library/useWorkflowPublication.ts:132— useWorkflowPublication.useWorkflowPublication.settle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1519— 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 1547, 1561, 1531, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.
editorSession.createEditorSessionProvider (cognitive 16) REDACTED:69— editorSession.createEditorSessionProvider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 2, error handling 2, ternaries 2, loops 1 (nesting depth added 3). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (claim, a function literal at line 118, persist). 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.
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:142— 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.
layerRowSummary.layerRowSummary (cognitive 16) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowSummary.ts:4— layerRowSummary.layerRowSummary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
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.
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:111— 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.
LayerMutationController.duplicate (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:118— LayerMutationController.duplicate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:288— groupSurfaceCache.createGroupSurfaceCache.damagedRegion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
FilterOperationCoordinator.createFilterOperationCoordinator.start (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/FilterOperationCoordinator.ts:93— FilterOperationCoordinator.createFilterOperationCoordinator.start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 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.
selectObjectSession.createSelectObjectSession.update (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:541— selectObjectSession.createSelectObjectSession.update has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 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.
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.
InvokeButton.InvokeTooltipContent (cognitive 16) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:133— InvokeButton.InvokeTooltipContent has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 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.
ProjectSwitcher.ProjectSwitcher (cognitive 16) invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx:62— ProjectSwitcher.ProjectSwitcher has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 6, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 114, 134, 85, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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 (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, 45 shared lines) · ×1
Near-duplicate member family (7 members, 45 shared lines) invokeai/app/invocations/pid/flux2_pid_decode.py:126— invokeai/app/invocations/pid/flux2_pid_decode.py:126-249 | invokeai/app/invocations/pid/flux_pid_decode.py:83-172 | invokeai/app/invocations/pid/pid_upscale.py:106-212 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:118-238 | invokeai/app/invocations/pid/sd3_pid_decode.py:80-161 | invokeai/app/invocations/pid/sdxl_pid_decode.py:107-211 | invokeai/app/invocations/pid/z_image_pid_decode.py:100-230 — These 7 members are variants of one another: a block of 45 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 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.
D4 · Code Duplication· Near-duplicate member family (3 members, 3 shared lines) · ×1
Near-duplicate member family (3 members, 3 shared lines) invokeai/backend/z_image/z_image_control_adapter.py:163— invokeai/backend/z_image/z_image_control_adapter.py:163-236 | invokeai/backend/z_image/z_image_control_transformer.py:339-449 | invokeai/backend/z_image/z_image_control_transformer.py:461-643 — These 3 members are variants of one another: a block of 3 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 (114 shared lines) invokeai/app/invocations/wan/wan_denoise.py:425— invokeai/app/invocations/wan/wan_denoise.py:425-731 | invokeai/app/invocations/wan/wan_video_denoise.py:158-394 — These two members are variants of one another: 114 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 (80 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:1414-1533 — These two members are variants of one another: 80 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
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 (30 shared lines) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:82— invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:82-128 | invokeai/app/invocations/z_image/z_image_lora_loader.py:58-101 — These two members are variants of one another: 30 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:531— invokeai/app/invocations/model.py:531-559 | invokeai/app/invocations/model.py:691-726 — 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· Edited copy of a member (18 corresponding lines) · ×1
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.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×1
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.
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:248— invokeai/app/invocations/anima/anima_denoise.py:248-269 | 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:679-695 | invokeai/app/invocations/krea2/krea2_denoise.py:215-227 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:134-148 | invokeai/app/invocations/sd3/sd3_denoise.py:81-113 | invokeai/app/invocations/wan/wan_denoise.py:786-802 | invokeai/app/invocations/z_image/z_image_denoise.py:165-182 — 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.
Duplicated block (60–61 lines × 2) invokeai/app/invocations/z_image/z_image_denoise.py:693— invokeai/app/invocations/z_image/z_image_denoise.py:693-752 | invokeai/app/invocations/z_image/z_image_denoise.py:809-869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (53 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:239— invokeai/app/invocations/cogview4/cogview4_denoise.py:239-291 | invokeai/app/invocations/sd3/sd3_denoise.py:229-281 — `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 8 separate duplicated blocks between them, totalling at least 153 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:228` 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 (41–53 lines × 2) invokeai/app/services/shared/invocation_context.py:274— invokeai/app/services/shared/invocation_context.py:274-326 | invokeai/app/services/shared/invocation_context.py:441-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–50 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:594— invokeai/app/invocations/wan/wan_denoise.py:594-643 | invokeai/app/invocations/wan/wan_video_denoise.py:273-297 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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:594` it does not close everything it opens, so those 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 (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 (38–42 lines × 7) invokeai/app/invocations/pid/flux2_pid_decode.py:171— invokeai/app/invocations/pid/flux2_pid_decode.py:171-210 | invokeai/app/invocations/pid/flux_pid_decode.py:98-136 | invokeai/app/invocations/pid/pid_upscale.py:143-180 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:165-202 | invokeai/app/invocations/pid/sd3_pid_decode.py:92-129 | invokeai/app/invocations/pid/sdxl_pid_decode.py:141-178 | invokeai/app/invocations/pid/z_image_pid_decode.py:138-179 — 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 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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 (28–39 lines × 2) invokeai/backend/anima/regional_prompting.py:78— invokeai/backend/anima/regional_prompting.py:78-105 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:67-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. The matched lines also transfer control out of the body holding them, 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 `regional_text_conditioning` to `AnimaRegionalTextConditioning` in one and `ZImageRegionalTextConditioning` 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 (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 (25–37 lines × 3) invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:164— invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:164-188 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:219-243 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:214-250 — before extracting anything, compare `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py` and `invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (37 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1600— invokeai/backend/hidiffusion/hidiffusion.py:1600-1636 | invokeai/backend/hidiffusion/hidiffusion.py:1756-1792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30–36 lines × 2) invokeai/backend/model_manager/load/model_loaders/krea2.py:544— invokeai/backend/model_manager/load/model_loaders/krea2.py:544-579 | invokeai/backend/model_manager/load/model_loaders/z_image.py:652-681 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/z_image.py:632` calls `extract_comfy_quant_hints`, `extract_fp8_scaled_layers`, `_keep_fp8_weights` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:535` 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 (31–33 lines × 2) invokeai/backend/minimax_h3/sampling.py:232— invokeai/backend/minimax_h3/sampling.py:232-262 | invokeai/backend/minimax_h3/sampling.py:392-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/sampling.py:392` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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–32 lines × 2) invokeai/backend/model_manager/load/model_loaders/anima.py:280— invokeai/backend/model_manager/load/model_loaders/anima.py:280-311 | 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:280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ 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:277` 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–31 lines × 4) invokeai/backend/hidiffusion/hidiffusion.py:1558— invokeai/backend/hidiffusion/hidiffusion.py:1558-1587 | invokeai/backend/hidiffusion/hidiffusion.py:1692-1722 | invokeai/backend/hidiffusion/hidiffusion.py:1829-1858 | invokeai/backend/hidiffusion/hidiffusion.py:1910-1939 — 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 (31 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:285— invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:285-315 | invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:332-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–31 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:353— invokeai/backend/model_manager/load/model_loaders/z_image.py:353-381 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1785-1815 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:353` it begins part-way through the construct above it, so those 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:1816` calls `info` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:382` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–30 lines × 3) invokeai/backend/model_manager/load/model_loaders/anima.py:282— invokeai/backend/model_manager/load/model_loaders/anima.py:282-311 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:440-463 | invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py:179-195 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/backend/model_manager/load/model_loaders/anima.py:282` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:839— invokeai/backend/model_manager/load/model_loaders/flux.py:839-866 | invokeai/backend/model_manager/load/model_loaders/flux.py:1230-1259 — both copies are in the same file, so extract the 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:128-156 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
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:901— invokeai/backend/model_manager/configs/main.py:901-922 | invokeai/backend/model_manager/configs/main.py:973-1000 | invokeai/backend/model_manager/configs/main.py:1340-1363 — 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:973` it begins part-way through the construct above it, so those 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: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. ★ 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:124` 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:273-294 — 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 (26–27 lines × 2) invokeai/backend/z_image/z_image_control_transformer.py:302— invokeai/backend/z_image/z_image_control_transformer.py:302-327 | invokeai/backend/z_image/z_image_patchify_utils.py:108-134 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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/z_image/z_image_control_transformer.py:302` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18–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:127-152 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:124` 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 (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 (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:428— invokeai/backend/model_manager/load/model_loaders/z_image.py:428-451 | invokeai/backend/model_manager/load/model_loaders/z_image.py:773-797 | invokeai/backend/model_manager/load/model_loaders/z_image.py:896-919 — 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:891` calls `detect`, `strip` and `invokeai/backend/model_manager/load/model_loaders/z_image.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 (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 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `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:206— invokeai/backend/minimax_h3/sampling.py:206-230 | invokeai/backend/minimax_h3/sampling.py:363-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:206` it begins part-way through the construct above it, so those 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:362` calls `cat`, `MiniMaxH3Scheduler` and `invokeai/backend/minimax_h3/sampling.py:206` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22–24 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:346— invokeai/backend/model_manager/load/model_loaders/z_image.py:346-367 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1593-1616 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1777-1800 — 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:346` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–24 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:439— invokeai/app/invocations/wan/wan_denoise.py:439-459 | invokeai/app/invocations/wan/wan_video_denoise.py:183-206 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–23 lines × 2) invokeai/app/api/routers/images.py:761— invokeai/app/api/routers/images.py:761-783 | invokeai/app/api/routers/images.py:819-835 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:761` it does not close everything it opens, so those exact lines 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:323— invokeai/backend/model_manager/load/model_loaders/z_image.py:323-345 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1753-1774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–22 lines × 2) invokeai/backend/flux/denoise.py:245— invokeai/backend/flux/denoise.py:245-266 | invokeai/backend/flux2/denoise.py:212-228 — 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 (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 (21–22 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1757— invokeai/backend/model_manager/load/model_loaders/flux.py:1757-1777 | invokeai/backend/model_manager/load/model_loaders/flux.py:1875-1896 — both copies are in the same file, so extract the 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:1754` calls `get` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1870` 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:1433— invokeai/backend/model_manager/load/model_loaders/z_image.py:1433-1454 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1639-1657 — both copies are in the same file, so extract the block into 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:327— invokeai/backend/model_manager/load/model_loaders/z_image.py:327-338 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1564-1584 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1757-1768 — 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 (20–21 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:58— invokeai/backend/flux/controlnet/state_dict_utils.py:58-77 | invokeai/backend/flux/controlnet/state_dict_utils.py:130-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/controlnet/state_dict_utils.py:58` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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–21 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1622— invokeai/backend/model_manager/load/model_loaders/z_image.py:1622-1642 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1809-1825 — both copies are in the same file, so extract the block into 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 (20 lines × 3) invokeai/app/invocations/anima/anima_denoise.py:664— invokeai/app/invocations/anima/anima_denoise.py:664-683 | invokeai/app/invocations/flux2/flux2_denoise.py:423-442 | invokeai/app/invocations/z_image/z_image_denoise.py:427-446 — 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 × 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 (14–20 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:669— invokeai/app/invocations/wan/wan_denoise.py:669-688 | invokeai/app/invocations/wan/wan_video_denoise.py:320-333 — 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 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 × 4) invokeai/app/invocations/metadata_linked.py:640— invokeai/app/invocations/metadata_linked.py:640-658 | invokeai/app/invocations/metadata_linked.py:703-721 | invokeai/app/invocations/metadata_linked.py:757-775 | invokeai/app/invocations/metadata_linked.py:827-845 — 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:699` calls `FluxDenoiseLatentsMetaInvocation` and `invokeai/app/invocations/metadata_linked.py:824` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:431— invokeai/backend/model_manager/load/model_loaders/z_image.py:431-448 | invokeai/backend/model_manager/load/model_loaders/z_image.py:528-545 | invokeai/backend/model_manager/load/model_loaders/z_image.py:777-794 | invokeai/backend/model_manager/load/model_loaders/z_image.py:899-916 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–18 lines × 4) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:191— invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:191-206 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:176-191 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:231-246 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:237-254 — before extracting anything, compare `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py` and `invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
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:1437— invokeai/backend/model_manager/load/model_loaders/flux.py:1437-1454 | invokeai/backend/model_manager/load/model_loaders/flux.py:1762-1779 | invokeai/backend/model_manager/load/model_loaders/flux.py:1882-1898 — 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:1434` calls `reject_unmarked_int8_weights` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1760` 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 (13–18 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1398— invokeai/backend/model_manager/load/model_loaders/flux.py:1398-1415 | invokeai/backend/model_manager/load/model_loaders/flux.py:1742-1754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1398` it begins part-way through the construct above it, so those exact lines 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–17 lines × 9) invokeai/app/invocations/anima/anima_denoise.py:253— invokeai/app/invocations/anima/anima_denoise.py:253-266 | 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:680-692 | invokeai/app/invocations/krea2/krea2_denoise.py:215-225 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:134-145 | invokeai/app/invocations/sd3/sd3_denoise.py:95-110 | invokeai/app/invocations/wan/wan_denoise.py:791-801 | invokeai/app/invocations/z_image/z_image_denoise.py:166-179 — 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 (17 lines × 3) invokeai/app/invocations/cogview4/cogview4_denoise.py:271— invokeai/app/invocations/cogview4/cogview4_denoise.py:271-287 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:440-456 | invokeai/app/invocations/sd3/sd3_denoise.py:261-277 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/qwen_image/qwen_image_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 3 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/cogview4/cogview4_denoise.py:271` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 2) invokeai/app/invocations/vae/flux2_vae_encode.py:115— invokeai/app/invocations/vae/flux2_vae_encode.py:115-129 | invokeai/app/invocations/vae/flux_vae_encode.py:122-138 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/flux2_vae_encode.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.
Duplicated block (12–17 lines × 2) invokeai/backend/util/vae_working_memory.py:424— invokeai/backend/util/vae_working_memory.py:424-440 | invokeai/backend/util/vae_working_memory.py:553-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–17 lines × 2) scripts/calibrate_flux2_working_memory.py:147— scripts/calibrate_flux2_working_memory.py:147-163 | scripts/calibrate_z_image_working_memory.py:100-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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–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:124-137 | invokeai/app/invocations/text_encoder/sd3_text_encoder.py:189-203 — 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:223— invokeai/backend/model_manager/load/model_loaders/qwen_image.py:223-230 | invokeai/backend/model_manager/load/model_loaders/z_image.py:756-770 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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–14 lines × 3) invokeai/backend/model_manager/configs/main.py:673— invokeai/backend/model_manager/configs/main.py:673-686 | invokeai/backend/model_manager/configs/main.py:860-873 | invokeai/backend/model_manager/configs/main.py:3247-3258 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, 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–14 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:1394— invokeai/backend/model_manager/load/model_loaders/flux.py:1394-1407 | invokeai/backend/model_manager/load/model_loaders/flux.py:1739-1747 | invokeai/backend/model_manager/load/model_loaders/flux.py:1837-1850 — 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:1394` it begins part-way through the construct above it, so those 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:1851` calls `hasattr` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1408` 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:517-527 — 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 (13–14 lines × 2) invokeai/app/services/external_generation/providers/openai.py:121— invokeai/app/services/external_generation/providers/openai.py:121-133 | invokeai/app/services/external_generation/providers/seedream.py:103-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.
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:1511-1518 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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:1508` 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 × 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 (13 lines × 3) invokeai/app/invocations/z_image/z_image_denoise.py:757— invokeai/app/invocations/z_image/z_image_denoise.py:757-770 | invokeai/backend/flux/denoise.py:225-237 | invokeai/backend/flux2/denoise.py:193-206 — 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:757` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:638— invokeai/app/invocations/anima/anima_denoise.py:638-649 | invokeai/app/invocations/z_image/z_image_denoise.py:403-415 — 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/invocations/anima/anima_denoise.py:652` calls `unsqueeze` and `invokeai/app/invocations/z_image/z_image_denoise.py:419` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–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 (8–12 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1011— invokeai/backend/hidiffusion/hidiffusion.py:1011-1022 | 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 (9–11 lines × 4) invokeai/backend/model_manager/configs/main.py:1192— invokeai/backend/model_manager/configs/main.py:1192-1202 | invokeai/backend/model_manager/configs/main.py:3569-3577 | invokeai/backend/model_manager/configs/main.py:3723-3731 | invokeai/backend/model_manager/configs/main.py:3889-3898 — 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:1111-1121 | invokeai/backend/model_manager/load/model_loaders/flux.py:1153-1163 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:158-168 — 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:1172` 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 (10 lines × 5) invokeai/app/invocations/pid/flux2_pid_decode.py:238— invokeai/app/invocations/pid/flux2_pid_decode.py:238-247 | invokeai/app/invocations/pid/flux_pid_decode.py:161-170 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:227-236 | invokeai/app/invocations/pid/sd3_pid_decode.py:150-159 | invokeai/app/invocations/pid/sdxl_pid_decode.py:200-209 — 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 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–10 lines × 5) invokeai/backend/model_manager/load/model_loaders/flux.py:997— invokeai/backend/model_manager/load/model_loaders/flux.py:997-1003 | invokeai/backend/model_manager/load/model_loaders/flux.py:1533-1539 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:488-494 | invokeai/backend/model_manager/load/model_loaders/krea2.py:599-608 | invokeai/backend/model_manager/load/model_loaders/z_image.py:700-706 — 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:692` 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 (9–10 lines × 4) invokeai/app/api/routers/images.py:141— invokeai/app/api/routers/images.py:141-149 | 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 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10 lines × 3) invokeai/app/invocations/vae/anima_image_to_latents.py:133— invokeai/app/invocations/vae/anima_image_to_latents.py:133-142 | invokeai/app/invocations/vae/qwen_image_image_to_latents.py:135-144 | invokeai/app/invocations/vae/z_image_image_to_latents.py:114-123 — 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 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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:133` 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–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 (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:188-195 | invokeai/app/invocations/sd3/sd3_denoise.py:184-192 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/qwen_image/qwen_image_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 3 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6–9 lines × 3) invokeai/backend/z_image/z_image_controlnet_extension.py:161— invokeai/backend/z_image/z_image_controlnet_extension.py:161-169 | invokeai/backend/z_image/z_image_controlnet_extension.py:295-300 | invokeai/backend/z_image/z_image_controlnet_extension.py:320-325 — 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 (1–9 lines × 6) invokeai/app/invocations/vae/anima_image_to_latents.py:104— invokeai/app/invocations/vae/anima_image_to_latents.py:104-112 | invokeai/app/invocations/vae/anima_latents_to_image.py:141-141 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:106-106 | invokeai/app/invocations/vae/wan_image_to_latents.py:73-81 | invokeai/app/invocations/vae/wan_latents_to_image.py:102-105 | invokeai/app/invocations/vae/wan_latents_to_video.py:193-193 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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. ★ 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 (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:155-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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:51-57 | 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 (7–8 lines × 3) invokeai/backend/z_image/z_image_control_adapter.py:217— invokeai/backend/z_image/z_image_control_adapter.py:217-223 | invokeai/backend/z_image/z_image_control_transformer.py:409-415 | invokeai/backend/z_image/z_image_controlnet_extension.py:177-184 — before extracting anything, compare `invokeai/backend/z_image/z_image_control_adapter.py` and `invokeai/backend/z_image/z_image_control_transformer.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (1–8 lines × 6) invokeai/app/invocations/vae/anima_image_to_latents.py:113— invokeai/app/invocations/vae/anima_image_to_latents.py:113-120 | invokeai/app/invocations/vae/anima_latents_to_image.py:142-142 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:107-107 | invokeai/app/invocations/vae/wan_image_to_latents.py:82-89 | invokeai/app/invocations/vae/wan_latents_to_image.py:106-106 | invokeai/app/invocations/vae/wan_latents_to_video.py:194-194 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 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 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_image_to_latents.py:107` calls `encode`, `sample`, `to` and `invokeai/app/invocations/vae/anima_latents_to_image.py:137` 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 × 7) invokeai/app/invocations/pid/flux2_pid_decode.py:212— invokeai/app/invocations/pid/flux2_pid_decode.py:212-218 | invokeai/app/invocations/pid/flux_pid_decode.py:138-144 | invokeai/app/invocations/pid/pid_upscale.py:182-188 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:204-210 | invokeai/app/invocations/pid/sd3_pid_decode.py:131-137 | invokeai/app/invocations/pid/sdxl_pid_decode.py:180-186 | invokeai/app/invocations/pid/z_image_pid_decode.py:181-187 — 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 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:212` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 6) invokeai/app/invocations/pid/flux2_pid_decode.py:242— invokeai/app/invocations/pid/flux2_pid_decode.py:242-247 | invokeai/app/invocations/pid/flux_pid_decode.py:165-170 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:231-236 | invokeai/app/invocations/pid/sd3_pid_decode.py:154-159 | invokeai/app/invocations/pid/sdxl_pid_decode.py:204-209 | invokeai/app/invocations/pid/z_image_pid_decode.py:221-227 — 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 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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:919-924 — 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 (5 lines × 7) invokeai/app/util/user_management.py:124— invokeai/app/util/user_management.py:124-128 | invokeai/app/util/user_management.py:164-168 | invokeai/app/util/user_management.py:241-245 | invokeai/app/util/user_management.py:289-293 | invokeai/app/util/user_management.py:474-478 | invokeai/app/util/user_management.py:524-528 | invokeai/app/util/user_management.py:581-585 — 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 (3–5 lines × 4) invokeai/backend/z_image/z_image_control_adapter.py:205— invokeai/backend/z_image/z_image_control_adapter.py:205-207 | invokeai/backend/z_image/z_image_control_transformer.py:380-385 | invokeai/backend/z_image/z_image_control_transformer.py:512-517 | invokeai/backend/z_image/z_image_control_transformer.py:552-556 — before extracting anything, compare `invokeai/backend/z_image/z_image_control_adapter.py` and `invokeai/backend/z_image/z_image_control_transformer.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–5 lines × 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 (132 lines × 2) invokeai/app/services/image_files/image_files_base.py:14— invokeai/app/services/image_files/image_files_base.py:14-145 | 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-145 | 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:101— invokeai/backend/model_manager/configs/controlnet.py:101-105 | invokeai/backend/model_manager/configs/controlnet.py:166-170 | invokeai/backend/model_manager/configs/ip_adapter.py:56-60 | invokeai/backend/model_manager/configs/ip_adapter.py:136-140 | invokeai/backend/model_manager/configs/lora.py:536-540 | invokeai/backend/model_manager/configs/lora.py:601-605 | invokeai/backend/model_manager/configs/lora.py:1476-1480 | invokeai/backend/model_manager/configs/main.py:282-286 | invokeai/backend/model_manager/configs/main.py:1084-1088 | 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:178— invokeai/backend/model_manager/load/model_loaders/anima.py:178-187 | invokeai/backend/model_manager/load/model_loaders/flux.py:1025-1034 | invokeai/backend/model_manager/load/model_loaders/flux.py:1071-1080 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:208-217 | invokeai/backend/model_manager/load/model_loaders/z_image.py:463-472 | invokeai/backend/model_manager/load/model_loaders/z_image.py:738-747 — 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.
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:10— `src/**/*.browser.test.{ts,tsx}` removes 2801 test(s) in 353 file(s) (e.g. `invokeai/frontend/webv2/src/workbench/widgetImplementationResource.browser.test.tsx`, `invokeai/frontend/webv2/src/workbench/widgetDnd.browser.test.ts`) 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 invokeai/frontend/webv2/scripts/run-project-file-journey.mjs:180— `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 (222 clone groups) invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx:12— 222 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 115 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 222 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 222 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 222 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 (160 clone groups) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:202— 160 duplicated blocks under invokeai/frontend/webv2/src/ have copies in at least two of the sibling directories app, features, platform, workbench — 56 of them are reported below, and 104 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 160 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 160 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 160 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 (89 clone groups) invokeai/frontend/webv2/src/features/models/data/modelsStore.ts:51— 89 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) — 44 of them are reported below, and 45 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 89 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 89 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 89 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 (64 clone groups) invokeai/frontend/webv2/src/workbench/launchpad/HelpMenu.tsx:73— 64 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) — 29 of them are reported below, and 35 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 64 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 64 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 64 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 2 sibling directories (52 clone groups) invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170— 52 duplicated blocks under invokeai/frontend/ have copies in at least two of the sibling directories webv1, webv2 — 26 of them are reported below, and 26 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 52 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 52 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 52 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 (16 clone groups) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx:71— 16 duplicated blocks under invokeai/frontend/webv2/src/workbench/widgets/ have copies in at least two of the sibling directories autosave-status, canvas, gallery, generate, image-map, layers (+6 more sibling(s) not listed) — 5 of them are reported below, and 11 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 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 16 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 (8 clone groups) invokeai/frontend/webv2/src/features/models/ui/detail/UpdatePathDialog.tsx:60— 8 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, library, manager (+1 more sibling(s) not listed) — 4 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 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 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 8 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 8 sibling directories (8 clone groups) invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.ts:28— 8 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, math, render (+2 more sibling(s) not listed) — 6 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 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 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 8 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/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 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 3 sibling directories (5 clone groups) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:403— 5 duplicated blocks under invokeai/frontend/webv2/src/features/workflow/ have copies in at least two of the sibling directories core, data, ui — 3 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 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.
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.
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 (166 matched lines × 2 locations) · ×1
Duplicated block with local edits (166 matched lines × 2 locations) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:256— invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:256 · invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:329 — the two spans are one implementation copied and then locally edited — 834 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 (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 (143 matched lines × 2 locations) · ×1
Duplicated block with local edits (143 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:52— invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:52 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:41 — the two spans are one implementation copied and then locally edited — 1011 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.
R10 · Code Duplication· Duplicated block with local edits (112 matched lines × 2 locations) · ×1
Duplicated block with local edits (112 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:134— invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:134 · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:136 — the two spans are one implementation copied and then locally edited — 626 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.
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 (100 matched lines × 2 locations) · ×1
Duplicated block with local edits (100 matched lines × 2 locations) invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:78— invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:78 · invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:112 — the two spans are one implementation copied and then locally edited — 628 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 (88 matched lines × 2 locations) · ×1
Duplicated block with local edits (88 matched lines × 2 locations) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515— invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515 · invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1293 — the two spans are one implementation copied and then locally edited — 689 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (82 matched lines × 2 locations) · ×1
Duplicated block with local edits (82 matched lines × 2 locations) invokeai/frontend/webv1/src/features/prompt/ExpandPromptButton.tsx:126— invokeai/frontend/webv1/src/features/prompt/ExpandPromptButton.tsx:126 · invokeai/frontend/webv1/src/features/prompt/ImageToPromptButton.tsx:96 — the two spans are one implementation copied and then locally edited — 429 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (78 matched lines × 2 locations) · ×1
Duplicated block with local edits (78 matched lines × 2 locations) invokeai/frontend/webv1/src/common/components/ColorPicker/RgbColorPicker.tsx:10— invokeai/frontend/webv1/src/common/components/ColorPicker/RgbColorPicker.tsx:10 · invokeai/frontend/webv1/src/common/components/ColorPicker/RgbaColorPicker.tsx:10 — the two spans are one implementation copied and then locally edited — 536 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function (anonymous) (cyclomatic 586, cognitive 957) invokeai/frontend/webv2/scripts/mock-backend.mjs:937— (anonymous) has cyclomatic complexity 586 and cognitive complexity 957; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 241, cognitive 183) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3894— (anonymous) has cyclomatic complexity 241 and cognitive complexity 183; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 111, cognitive 147) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:497— (anonymous) has cyclomatic complexity 111 and cognitive complexity 147; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 102, cognitive 126) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2291— (anonymous) has cyclomatic complexity 102 and cognitive complexity 126; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 GalleryImageGrid (cyclomatic 97, cognitive 86) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:404— GalleryImageGrid has cyclomatic complexity 97 and cognitive complexity 86; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 95, cognitive 129) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:120— (anonymous) has cyclomatic complexity 95 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 94, cognitive 159) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:197— (anonymous) has cyclomatic complexity 94 and cognitive complexity 159; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 94, cognitive 61) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17— (anonymous) has cyclomatic complexity 94 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 89, cognitive 77) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:295— (anonymous) has cyclomatic complexity 89 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function VideoWidgetView (cyclomatic 83, cognitive 75) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:122— VideoWidgetView has cyclomatic complexity 83 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 81, cognitive 72) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3555— (anonymous) has cyclomatic complexity 81 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 73, cognitive 164) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:194— (anonymous) has cyclomatic complexity 73 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 73, cognitive 57) invokeai/frontend/webv2/src/features/workflow/core/document.ts:907— (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 90) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1972— (anonymous) has cyclomatic complexity 71 and cognitive complexity 90; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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.
R3 · Large Files· invokeai/frontend/webv2/src/workbench/workbenchState.ts · ×1
invokeai/frontend/webv2/src/workbench/workbenchState.ts: 5287 lines of code invokeai/frontend/webv2/src/workbench/workbenchState.ts:1— invokeai/frontend/webv2/src/workbench/workbenchState.ts has 5287 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: 3700 lines of code invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1— invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts has 3700 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/workbench/canvas-engine/engine.ts · ×1
invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts: 2790 lines of code invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:1— invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts has 2790 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: 2388 lines of code invokeai/frontend/webv2/src/features/queue/runtime.ts:1— invokeai/frontend/webv2/src/features/queue/runtime.ts has 2388 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: 2277 lines of code invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1— invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts has 2277 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/workflow/ui/fields/WorkflowFieldInput.tsx · ×1
invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx: 1961 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 1961 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: 1927 lines of code invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1— invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx has 1927 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/features/generation/core/baseGenerationPolicies.ts · ×1
invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts: 1625 lines of code invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1— invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts has 1625 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/features/generation/core/graph.ts · ×1
invokeai/frontend/webv2/src/features/generation/core/graph.ts: 1554 lines of code invokeai/frontend/webv2/src/features/generation/core/graph.ts:1— invokeai/frontend/webv2/src/features/generation/core/graph.ts has 1554 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/workbench/canvas-engine/document-model/documentModel.ts · ×1
invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts: 1527 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 1527 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.
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.
REDACTED: 1391 lines of code REDACTED:1— REDACTED has 1391 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/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/platform/ui/theme/recipes.ts · ×1
invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts: 1333 lines of code invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts:1— invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts has 1333 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: 1316 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:1— invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx has 1316 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: 1278 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1— invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx has 1278 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: 1234 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 1234 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/image-actions/imageRecall.ts · ×1
invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts: 1162 lines of code invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1— invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts has 1162 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: 1113 lines of code invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1— invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts has 1113 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/services/api/endpoints/images.ts · ×1
invokeai/frontend/webv1/src/services/api/endpoints/images.ts: 1108 lines of code invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1— invokeai/frontend/webv1/src/services/api/endpoints/images.ts has 1108 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: 1105 lines of code invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1— invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts has 1105 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/ImageContextMenu.tsx · ×1
invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx: 1086 lines of code invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:1— invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx has 1086 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/core/document.ts · ×1
invokeai/frontend/webv2/src/features/workflow/core/document.ts: 1081 lines of code invokeai/frontend/webv2/src/features/workflow/core/document.ts:1— invokeai/frontend/webv2/src/features/workflow/core/document.ts has 1081 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/CanvasEntity/CanvasEntityTransformer.ts · ×1
invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts: 1067 lines of code invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1— invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts has 1067 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/graph.ts · ×1
invokeai/frontend/webv2/src/features/video/core/graph.ts: 1059 lines of code invokeai/frontend/webv2/src/features/video/core/graph.ts:1— invokeai/frontend/webv2/src/features/video/core/graph.ts has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx · ×1
invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx: 1041 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 1041 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/common/components/Picker/Picker.tsx · ×1
invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx: 1033 lines of code invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:1— invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx has 1033 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/nodesSlice.ts · ×1
invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts: 1019 lines of code invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts:1— invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts has 1019 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: 1008 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:1— invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· invokeai/frontend/webv2/src/features/upscale/core/settings.ts · ×1
invokeai/frontend/webv2/src/features/upscale/core/settings.ts: 1004 lines of code invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1— invokeai/frontend/webv2/src/features/upscale/core/settings.ts has 1004 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/settings.ts · ×1
invokeai/frontend/webv2/src/features/video/core/settings.ts: 991 lines of code invokeai/frontend/webv2/src/features/video/core/settings.ts:1— invokeai/frontend/webv2/src/features/video/core/settings.ts has 991 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~66 LoC) invokeai/frontend/webv1/src/features/nodes/types/common.test-d.ts— no import path from any entry point (370 application, 17 tooling, 1194 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 (370 application, 17 tooling, 1194 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 (370 application, 17 tooling, 1194 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 (370 application, 17 tooling, 1194 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 (370 application, 17 tooling, 1194 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 (370 application, 17 tooling, 1194 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 (370 application, 17 tooling, 1194 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:20— `store` is never created by `PersistenceController` — it is the constructor parameter `store` (line 7), and its declared type `BitmapStore` is an interface — yet this class disposes it here (line 20). 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.
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/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/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/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/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/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/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.
Orphaned file invokeai/app/invocations/tiles.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/model_hash/hash_validator.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/modelManagerV2/subpanels/ModelPanel/RelatedModels.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/lineart_anime.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/hooks/saveCanvasHooks.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.
Mock-dominated test: waits for media-cookie refreshes before logging out invokeai/frontend/webv1/src/features/auth/store/logoutAfterServerConfirmation.test.ts:23— This test sets up 4 test doubles (for example `vi.fn`) 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: issues a single batch request for a multi-video deletion invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.test.ts:155— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: persists on layout change after debounce invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.test.ts:1123— This test sets up 5 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: does not second-guess a chunk the server itself refused invokeai/frontend/webv1/src/services/api/endpoints/images.test.ts:435— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does not publish a chunk that came back after the session changed invokeai/frontend/webv1/src/services/api/endpoints/images.test.ts:937— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: invalidates workflow list caches on workflow_created invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:66— 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: ignores unrelated events for workflow cache invalidation invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:94— 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: clears selected workflow ids from call_saved_workflow nodes on workflow_deleted invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:117— 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: does not clear selected workflow ids from call_saved_workflow nodes on workflow_updated invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:164— 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: clears selected workflow ids when another user revokes shared access invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:221— 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: keeps selected workflow ids when access remains for $user_id invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:271— 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: routes the admin's own invocation_complete to the own-event handler invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:566— 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: hands back a disposer that ends the completion handler session invokeai/frontend/webv1/src/services/events/setEventListeners.test.ts:592— This test sets up 5 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: processes each completion event exactly once — a duplicate delivery does no gallery work invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:312— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: rejects a duplicate that arrives while the first delivery is still awaiting its DTO fetch invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:336— 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: retries only the output whose lookup failed, leaving the ones that landed alone invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:450— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: retries a failed lookup inside an image collection invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:487— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: lets a duplicate that overlapped a lost delivery become the retry invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:517— This test sets up 3 test doubles (for example `vi.fn`) against 2 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: retries only the image half of a mixed result, not the video that landed invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:600— This test sets up 5 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: retries the lost output alongside an intermediate one, without redoing the intermediate invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:686— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: serializes several duplicates waiting on one lost delivery into a single retry invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:721— This test sets up 3 test doubles (for example `vi.fn`) against 2 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does not move the selection again when a retry lands the lost output invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:843— This test sets up 5 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: refetches a lost output on its own, without waiting for a duplicate delivery invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:886— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: gives up after a bounded number of refetches invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:917— 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: drops a scheduled refetch when a duplicate delivery recovers the output first invokeai/frontend/webv1/src/services/events/onInvocationComplete.test.ts:944— This test sets up 4 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
README/code drift invokeai/backend/ip_adapter/README.md:20— invokeai/backend/ip_adapter/README.md names `image_encoder.txt`, but no file or folder `image_encoder.txt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/index.mdx:86— docs/src/content/docs/index.mdx links to `/start-here/installation/`, but `start-here/installation` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/index.mdx:86— docs/src/content/docs/index.mdx links to `/configuration/docker/`, but `configuration/docker` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/index.mdx:86— docs/src/content/docs/index.mdx links to `/start-here/manual/`, but `start-here/manual` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/index.mdx:102— docs/src/content/docs/index.mdx links to `/troubleshooting/faq/`, but `troubleshooting/faq` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/index.mdx:108— docs/src/content/docs/index.mdx links to `/contributing/contributors/`, but `contributing/contributors` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/index.mdx:108— docs/src/content/docs/index.mdx links to `/contributing/`, but `contributing` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/configuration/01.invokeai-yaml.mdx:215— docs/src/content/docs/configuration/01.invokeai-yaml.mdx links to `/users-guide/gallery/image-storage-maintenance/`, but `users-guide/gallery/image-storage-maintenance` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/configuration/01.invokeai-yaml.mdx:252— docs/src/content/docs/configuration/01.invokeai-yaml.mdx links to `/configuration/external-database/`, but `configuration/external-database` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/configuration/01.invokeai-yaml.mdx:362— docs/src/content/docs/configuration/01.invokeai-yaml.mdx links to `/configuration/optimization/low-vram-mode/`, but `configuration/optimization/low-vram-mode` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/configuration/02.docker.mdx:58— docs/src/content/docs/configuration/02.docker.mdx links to `/configuration/invokeai-yaml/`, but `configuration/invokeai-yaml` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/configuration/02.docker.mdx:77— docs/src/content/docs/configuration/02.docker.mdx names `build.sh`, but no file or folder `build.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/external-providers.md:13— docs/src/content/docs/contributing/external-providers.md names `invokeai/backend/model_manager/starter_models.py`, but no file or folder `invokeai/backend/model_manager/starter_models.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:13— docs/src/content/docs/contributing/index.md links to `/development/`, but `development` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:15— docs/src/content/docs/contributing/index.md links to `/contributing/new-contributor-guide/`, but `contributing/new-contributor-guide` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:19— docs/src/content/docs/contributing/index.md links to `/development/guides/creating-nodes/`, but `development/guides/creating-nodes` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:29— docs/src/content/docs/contributing/index.md links to `/contributing/`, but `contributing` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:33— docs/src/content/docs/contributing/index.md links to `/contributing/translations/`, but `contributing/translations` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:41— docs/src/content/docs/contributing/index.md links to `/contributing/contributors/`, but `contributing/contributors` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/index.md:45— docs/src/content/docs/contributing/index.md links to `/contributing/code-of-conduct/`, but `contributing/code-of-conduct` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/new-contributor-guide.mdx:15— docs/src/content/docs/contributing/new-contributor-guide.mdx links to `/development/`, but `development` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/new-contributor-guide.mdx:32— docs/src/content/docs/contributing/new-contributor-guide.mdx links to `/development/setup/dev-environment/`, but `development/setup/dev-environment` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/new-model-integration.mdx:47— docs/src/content/docs/contributing/new-model-integration.mdx names `architectures/defs/new_model.py`, but no file or folder `architectures/defs/new_model.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/new-model-integration.mdx:48— docs/src/content/docs/contributing/new-model-integration.mdx names `app/invocations/new_model/__init__.py`, but no file or folder `app/invocations/new_model/__init__.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/src/content/docs/contributing/new-model-integration.mdx:49— docs/src/content/docs/contributing/new-model-integration.mdx names `starter_models/new_model.py`, but no file or folder `starter_models/new_model.py` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Interpolated log message defeats structured logging invokeai/app/api_app.py:135— `warning` at line 135 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api_app.py:848— `warning` at line 848 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/extract_metadata.py:69— `debug` at line 69 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/extract_metadata.py:118— `debug` at line 118 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/extract_metadata.py:157— `debug` at line 157 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/dependencies.py:121— `info` at line 121 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/dependencies.py:122— `info` at line 122 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/routers/utilities.py:546— `error` at line 546 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/api/routers/utilities.py:662— `error` at line 662 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/invocations/load_custom_nodes.py:61— `warning` at line 61 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/invocations/load_custom_nodes.py:64— `info` at line 64 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/invocations/load_custom_nodes.py:75— `error` at line 75 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/invocations/load_custom_nodes.py:81— `info` at line 81 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/events/events_fastapievents.py:52— `error` at line 52 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:597— `warning` at line 597 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:632— `warning` at line 632 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:821— `warning` at line 821 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:924— `info` at line 924 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1028— `info` at line 1028 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1324— `info` at line 1324 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1345— `warning` at line 1345 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1350— `info` at line 1350 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1367— `warning` at line 1367 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1378— `exception` at line 1378 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging invokeai/app/services/image_index/image_index_default.py:1383— `error` at line 1383 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
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/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/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/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx:70— `!event.over || event.active.id === event.over.id` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx, invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.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/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:424— `!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/features/gallery/data/realtimeRuntime.ts:67— `!isActive() || invalidationTimer !== null` appears character-identically in 2 files — invokeai/frontend/webv2/src/features/gallery/data/realtimeRuntime.ts, invokeai/frontend/webv2/src/features/queue/data/realtimeRuntime.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/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:60— `!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:103— `!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:114— `!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:374— `!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.
Silent fallback default in catch invokeai/app/api/sockets.py:432— `_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:437— `_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:2421— `_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:841— `_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:143— `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:152— `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:345— `_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/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:348— `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.
Silent fallback default in catch invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts:22— `readStored` 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.
Fat interface: GalleryCommandsPort (19 required operations) invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx:63— `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 (25 required operations) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:22— `GalleryActions` declares 25 required operations: `archiveBoard`, `createBoard`, `deleteBoard`, `downloadBoard`, `exportProject`, `loadMore`, `moveBoard`, `refresh`, `renameBoard`, `setBoardGeneralAccess`, `selectBoard`, `selectItem`, `selectItemRange`, `setCompareItem`, `setSearchTerm`, `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:344— `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: 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 (29 required operations) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:508— `DurableSyncedWorkbenchPersistence` declares 29 required operations: `acknowledgeProjectResolution`, `abortProjectResolution`, `adoptProjectRecord`, `clearWorkbench`, `close`, `deleteRecoverableDraft`, `deleteProjectOnServer`, `ensureProjectOnServer`, `flushProjectToServer`, `getProjectDraftDocument`, `getRecoverableDraftDocument`, `hasClosedSession`, `journalBeforeUnload`, `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 (31 required operations) invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:141— `LayerContextActionEffects` declares 31 required operations: `reorder`, `duplicate`, `mergeSelected`, `group`, `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 (24 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts:579— `CanvasEngineLayerCapability` declares 24 required operations: `applyTransform`, `booleanMergeRasterLayers`, `cancelTextEdit`, `cancelTransform`, `clearMask`, `commitLayerConversion`, `commitLayerCopy`, `commitMaskImageResult`, `commitOpenTextSession`, `commitRasterFilterResult`, `commitTextEdit`, `copyLayerToRaster`, `cropLayerToBbox`, `duplicateLayers`, `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:35— `CanvasApplicationHost` declares 27 required operations: `captureGuard`, `clearFilterPreview`, `clearSamPreview`, `commitFilter`, `commitGenerated`, `commitMask`, `decodeSelectObjectPreview`, `encodeSurface`, `exportBakedLayerBlob`, `exportLayerPixels`, `getCompositeExecutorDeps`, `getDocument`, `isGuardCurrent`, `isInteractionLocked`, `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: CanvasOperationCapability (22 required operations) invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:59— `CanvasOperationCapability` declares 22 required operations: `composeForGeneration`, `uploadIntermediate`, `getOperationState`, `subscribeOperation`, `getFilterSessionState`, `subscribeFilterSession`, `getSamSessionState`, `subscribeSamSession`, `startSelectObject`, `startFilterOperation`, `updateFilterOperation`, `setFilterOperationAutoProcess`, `processFilterOperation`, `resetFilterOperation`, `commitFilterOperation`, `cancelFilterOperation`, `updateSelectObjectSession`, `processSelectObjectSession`, `applySelectObjectSession`, `saveSelectObjectSession`, `resetSelectObjectSession`, `cancelSelectObjectSession`. 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 (20 required operations) invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:194— `CanvasSelectObjectCoordinatorDeps` declares 20 required operations: `isInteractionLocked`, `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 (23 required operations) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:103— `ImageActions` declares 23 required operations: `copyImage`, `createCanvasFromImages`, `deleteImages`, `deriveImageRecallCapabilities`, `downloadImage`, `downloadImages`, `getImageRecallCapabilities`, `loadImageWorkflow`, `getVideoRecallCapabilities`, `hasVideoWorkflow`, `loadVideoWorkflow`, `moveImagesToBoard`, `openImageInPreview`, `recallImageData`, `recallVideoData`, `sendToInitialVideo`, `savePromptAsTemplate`, `selectForCompare`, `sendToCanvas`, `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.
P2 · Observability· Console output used as the logging channel · ×13
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/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/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/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/webv2/src/workbench/canvas-engine/engine.ts:2504— `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` reports through `console.*` at line 2504 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 577 significant file(s) lose their only recent owner: invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts, invokeai/frontend/webv2/src/workbench/projects/draftStore.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts, invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx, invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx, invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts, invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts, invokeai/frontend/webv2/src/workbench/projects/draftStore.contract.ts (+569 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 103 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/app/invocations/anima/anima_denoise.py, invokeai/app/invocations/krea2/krea2_denoise.py, invokeai/backend/anima/anima_transformer.py, invokeai/backend/quantization/int8_convrot.py, invokeai/app/invocations/wan/wan_denoise.py (+95 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 79 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/backend/ltx2/denoise.py, invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts, invokeai/app/util/video_thumbnails.py, invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts, invokeai/app/services/image_index/projection.py (+71 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 61 significant file(s) lose their only recent owner: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts, invokeai/frontend/webv1/src/features/cropper/lib/editor.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts, invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts, invokeai/frontend/webv1/src/services/api/run-graph.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts, invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/ContainerElement.tsx (+53 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 23 significant file(s) lose their only recent owner: invokeai/app/services/shared/graph.py, invokeai/app/services/shared/execution_engine/child.py, invokeai/app/services/shared/graph_scheduler.py, 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, invokeai/app/services/shared/execution_engine/scheduler.py (+15 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 14 significant file(s) lose their only recent owner: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts, 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/gallery/components/GalleryImageGridPaged.tsx, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasObject/CanvasObjectGradient.ts (+6 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 9 significant file(s) lose their only recent owner: invokeai/backend/flux/extensions/regional_prompting_extension.py, invokeai/backend/flux/controlnet/state_dict_utils.py, invokeai/backend/stable_diffusion/multi_diffusion_pipeline.py, invokeai/backend/flux/extensions/instantx_controlnet_extension.py, invokeai/backend/flux/controlnet/instantx_controlnet_flux.py, invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py, invokeai/backend/flux/custom_block_processor.py, invokeai/backend/flux/extensions/xlabs_controlnet_extension.py (+1 more). Pair on, review, or document these before any departure.
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.
IC1 · Incompleteness & stubs· Empty method body · ×3
Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:358— `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:359— `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:360— `focusRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method.
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/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.
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.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — Accessibility checks run in tests (Verified) but aren't gated in CI — run the suite that holds those checks in your pipeline so an accessibility regression blocks the merge (Prevented). What was searched, so you can tell an absence from a miss: the 1502 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
C4 · Data Retention· Partial data-retention evidence · ×1
Partial data-retention evidence — A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept, a scheduled purge / cleanup job (a Celery beat task, APScheduler job or management command that deletes rows past their retention — Session.objects.filter(created__lt=cutoff).delete(), purge_expired… / delete_old…).
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 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 (870 single-owned of 2366 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 2366 of the 4522 production source files in this repository met that bar). They are anonymized user #8 (2 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (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/backend/stable_diffusion/diffusion_backend.py, invokeai/backend/stable_diffusion/denoise_context.py, invokeai/app/services/external_generation/providers/openai.py, invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsBooleanSubMenu.tsx.
No ADRs found — 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/`.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 3 of 7 project(s) overshoot their size bounds, lowering Project Cohesion to 1.4/10. The most over is `invokeai/frontend/webv2` (275135 LoC, 3553 module-visible types across 143 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 427 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/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, invokeai/backend/flux/extensions/regional_prompting_extension.py, invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts (and 419 more) (444 orphaned of 2403 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 2403 of the 4522 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 src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
No SAST — 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 73791 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P4 · Deployment & Rollback· No rollback/health safety · ×1
No rollback/health safety — 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:233— 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.
R7 · Dead Code· Unused export 'insertPositivePromptText' · ×1
Unused export 'insertPositivePromptText' invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptFocus.ts:65— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'LoginFormValues' · ×1
Unused export 'LoginFormValues' invokeai/frontend/webv2/src/features/identity/core/schemas.ts:53— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'UserManagement' · ×1
Unused export 'UserManagement' invokeai/frontend/webv2/src/features/identity/ui/UserManagement.tsx:18— 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:96— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'useActiveProgressTarget' · ×1
Unused export 'useActiveProgressTarget' invokeai/frontend/webv2/src/features/queue/data/activeProgressTargetStore.ts:103— Nothing ultimately consumes this binding: its only referrer is the re-export in invokeai/frontend/webv2/src/features/queue/react.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in invokeai/frontend/webv2/src/features/queue/react.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'ensureQueueLoaded' · ×1
Unused export 'ensureQueueLoaded' invokeai/frontend/webv2/src/features/queue/ui/queueDataStore.ts:50— 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.
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 14/28 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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 (`!`) reduce the strict null checking score — ~1.2 `!` null assertions per 1k TypeScript source lines — 584 assertion(s) across the 471189 source line(s) of the 3140 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/webv1/src/common/util/promptAST.ts (28), invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts (27), invokeai/frontend/webv2/src/platform/browser/sha256.ts (23). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:224— 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:229— 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:246— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
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 126 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`, … (+121 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 01a15a87-a205-7aa5-8240-410df8b40f6d · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 53 · Warnings: 4064 · Recommendations: 822 · Info: 3 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 20-10-2026 @ 18:16 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.