Public report of THU-MAIC/OpenMAIC, published 7 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.2). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 7 November 2026, 18:07 UTC · Survey ID cd_0e3af61d78aa4385a7d185408a0b0e4b
THU-MAIC/OpenMAIC
Measured 7 November 2026, 18:04 UTC, at code version 5bd8cc8
CAI scoreAt riskDown 3 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 403,067 lines of product code in 9 projects, tests not counted · Estimated rebuild effort: about 5.7 person-years · Weakest lens: Production Readiness, 33
Findings by how serious they are
194 critical2653 serious278 minor
8 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
7 November 2026, 18:04 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
87of 87 dimensions measured by tools.
3103of 3125 findings point to an exact file and line, so you can open each one in the code. The other 22 concern the repository as a whole, such as missing documentation.
87dimensions across 7 lenses, read from 403,067 lines of product code in 9 projects.
THU-MAIC/OpenMAIC is rated At risk because critical security findings are open, most of them in the packages it uses. Its score is held back because four passwords or keys sit in the current code and we found no automated security scanning of the code, its secrets or its dependencies. It scores 44 out of 100, which the At risk rating leaves unchanged.
Production Readiness, at 33, is the weakest lens and counts most in the score. The best first step is replacing the four exposed passwords or keys and switching the old ones off, worth about 10 points. Making the tests check their results comes next, worth about 5 points. Raising Production Readiness to 70 would lift the score to about 54.
Sixty-seven known security holes in the packages the code depends on can be used by attackers. Twenty pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with, and thirty-seven controls can't be used without a mouse. Updating the vulnerable packages, pinning each tool to an exact version and making the controls work with a keyboard would close these risks. Fixing the weaknesses the scanner points to would fix the 12 security weaknesses in the code, and the four passwords or keys in the code and the password or key in the code's history need replacing, with the old ones switched off. The 24 form fields without a label need a label.
The product code is 403,067 lines, about €830,000 to rebuild. The check for the health of its packages couldn't finish, so that result is missing, not a clean pass.
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 33 to 70, the lowest score rated Strong, the score would rise from 44 to about 54.
Code composition: what the lines of code are
Product code 51%Tests 49%
New since the last survey: 471 findings
These 471 critical or serious findings weren't in the previous survey, on 21 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 1679 findings
These 1679 critical or serious findings were in the previous survey, on 21 October 2026, and are gone from this one. The first 100 are listed here.
God Classes · FunctionTooLong: runner.runSession lib/server/agent-runtime/runner.ts
God Classes · FunctionTooLong: hero.PBLV2Hero components/scene-renderers/pbl/v2/hero.tsx
God Classes · FunctionTooLong: ClassroomSurface.ClassroomSurface components/classroom/ClassroomSurface.tsx
God Classes · FunctionTooLong: stage.Stage components/stage.tsx
God Classes · FunctionTooLong: pbl-renderer.PBLV2WorkspaceLayer components/scene-renderers/pbl-renderer.tsx
God Classes · FileTooLong: components/visualizers.tsx app/generation-preview/components/visualizers.tsx
God Classes · FunctionTooLong: folder-dialogs.NewFolderDialog components/discovery/folder-dialogs.tsx
Test Quality · Fixed-sleep synchronisation: keeps the published result when a stale attempt finishes after the one that took over tests/server/material-extraction.pg.test.ts
Test Quality · Fixed-sleep synchronisation: drops an extraction whose material is deleted, cancelling the extractor and holding the slot until it stops tests/server/material-extraction.pg.test.ts
Test Quality · Fixed-sleep synchronisation: times out an extraction at its budget, even when the extractor ignores the signal tests/server/material-extraction.pg.test.ts
Test Quality · Fixed-sleep synchronisation: runs at most its concurrency, hands its leases back on stop, and another process resumes them tests/server/material-extraction.pg.test.ts
€280,000 to €1,400,000, for 4,596 to 14,580 hours of work, about 5.7 person-years for 3 to 11 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 44. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 403,067 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 4 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED, REDACTED.
Raises the score by about 10 points · Low effort · Secret Scanning
2
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with pg-agent-session-store.pg.test.ts.
Raises the score by about 5 points · Low effort · Test Quality
3
Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — so a security regression fails the build instead of landing.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €830,000 to build again, about 5.7 person-years of work. Its weakest lens is Production Readiness, at 33 (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 4 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 10 points for low effort, because it clears the 4 Secret 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 4.6 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 8% to 19% on every change. The history of the code shows how much it changes: about 711,252 lines over the last 90 days, which is about 2,884,522 lines a year. At that pace, the extra work comes to an estimated 611.5 to 3669.3 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
1396 modules, with 1951 dependencies between them. One loop runs through 2 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 1356 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.
lib.server.model-config uses lib.types.provider, so a change to lib.types.provider can break lib.server.model-config, while a change to lib.server.model-config can't break lib.types.provider.
Position
Below the diagonal: lib.server.model-config uses a module listed above it, which is the healthy direction.
lib.types.chat uses lib.pbl.v3.domain.orchestration.types, so a change to lib.pbl.v3.domain.orchestration.types can break lib.types.chat, while a change to lib.types.chat can't break lib.pbl.v3.domain.orchestration.types.
Position
Below the diagonal: lib.types.chat uses a module listed above it, which is the healthy direction.
lib.types.chat uses lib.types.provider, so a change to lib.types.provider can break lib.types.chat, while a change to lib.types.chat can't break lib.types.provider.
Position
Below the diagonal: lib.types.chat uses a module listed above it, which is the healthy direction.
lib.types.generation uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break lib.types.generation, while a change to lib.types.generation can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: lib.types.generation uses a module listed above it, which is the healthy direction.
packages.@openmaic.dsl.src.stage uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break packages.@openmaic.dsl.src.stage, while a change to packages.@openmaic.dsl.src.stage can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: packages.@openmaic.dsl.src.stage uses a module listed above it, which is the healthy direction.
packages.@openmaic.editor.src.react.types uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break packages.@openmaic.editor.src.react.types, while a change to packages.@openmaic.editor.src.react.types can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: packages.@openmaic.editor.src.react.types uses a module listed above it, which is the healthy direction.
packages.@openmaic.importer.src.adapter.types uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break packages.@openmaic.importer.src.adapter.types, while a change to packages.@openmaic.importer.src.adapter.types can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: packages.@openmaic.importer.src.adapter.types uses a module listed above it, which is the healthy direction.
packages.@openmaic.storage.src.runtime.pg uses packages.@openmaic.storage.src.runtime.types, so a change to packages.@openmaic.storage.src.runtime.types can break packages.@openmaic.storage.src.runtime.pg, while a change to packages.@openmaic.storage.src.runtime.pg can't break packages.@openmaic.storage.src.runtime.types.
Position
Below the diagonal: packages.@openmaic.storage.src.runtime.pg uses a module listed above it, which is the healthy direction.
components.edit.surfaces.slide uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break components.edit.surfaces.slide, while a change to components.edit.surfaces.slide can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: components.edit.surfaces.slide uses a module listed above it, which is the healthy direction.
components.edit.surfaces.slide uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break components.edit.surfaces.slide, while a change to components.edit.surfaces.slide can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: components.edit.surfaces.slide uses a module listed above it, which is the healthy direction.
lib.audio uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.audio, while a change to lib.audio can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.audio uses a module listed above it, which is the healthy direction.
lib.edit uses components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate, so a change to components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate can break lib.edit, while a change to lib.edit can't break components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate.
Position
Below the diagonal: lib.edit uses a module listed above it, which is the healthy direction.
lib.edit uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break lib.edit, while a change to lib.edit can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: lib.edit uses a module listed above it, which is the healthy direction.
lib.edit uses lib.types.generation, so a change to lib.types.generation can break lib.edit, while a change to lib.edit can't break lib.types.generation.
Position
Below the diagonal: lib.edit uses a module listed above it, which is the healthy direction.
lib.edit uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.edit, while a change to lib.edit can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.edit uses a module listed above it, which is the healthy direction.
lib.edit uses packages.@openmaic.importer.src.adapter.types, so a change to packages.@openmaic.importer.src.adapter.types can break lib.edit, while a change to lib.edit can't break packages.@openmaic.importer.src.adapter.types.
Position
Below the diagonal: lib.edit uses a module listed above it, which is the healthy direction.
lib.export uses packages.@openmaic.dsl.src.pbl, so a change to packages.@openmaic.dsl.src.pbl can break lib.export, while a change to lib.export can't break packages.@openmaic.dsl.src.pbl.
Position
Below the diagonal: lib.export uses a module listed above it, which is the healthy direction.
lib.export uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break lib.export, while a change to lib.export can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: lib.export uses a module listed above it, which is the healthy direction.
lib.export uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.export, while a change to lib.export can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.export uses a module listed above it, which is the healthy direction.
lib.export uses packages.@openmaic.importer.src.adapter.types, so a change to packages.@openmaic.importer.src.adapter.types can break lib.export, while a change to lib.export can't break packages.@openmaic.importer.src.adapter.types.
Position
Below the diagonal: lib.export uses a module listed above it, which is the healthy direction.
lib.legacy-browser-import uses packages.@openmaic.storage.src.kv.types, so a change to packages.@openmaic.storage.src.kv.types can break lib.legacy-browser-import, while a change to lib.legacy-browser-import can't break packages.@openmaic.storage.src.kv.types.
Position
Below the diagonal: lib.legacy-browser-import uses a module listed above it, which is the healthy direction.
lib.legacy-browser-import uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.legacy-browser-import, while a change to lib.legacy-browser-import can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.legacy-browser-import uses a module listed above it, which is the healthy direction.
lib.pbl.v2.types uses packages.@openmaic.dsl.src.pbl, so a change to packages.@openmaic.dsl.src.pbl can break lib.pbl.v2.types, while a change to lib.pbl.v2.types can't break packages.@openmaic.dsl.src.pbl.
Position
Below the diagonal: lib.pbl.v2.types uses a module listed above it, which is the healthy direction.
lib.pbl.v2.types uses lib.types.generation, so a change to lib.types.generation can break lib.pbl.v2.types, while a change to lib.pbl.v2.types can't break lib.types.generation.
Position
Below the diagonal: lib.pbl.v2.types uses a module listed above it, which is the healthy direction.
lib.persistence uses packages.@openmaic.storage.src.document.types, so a change to packages.@openmaic.storage.src.document.types can break lib.persistence, while a change to lib.persistence can't break packages.@openmaic.storage.src.document.types.
Position
Below the diagonal: lib.persistence uses a module listed above it, which is the healthy direction.
lib.persistence uses packages.@openmaic.storage.src.runtime.types, so a change to packages.@openmaic.storage.src.runtime.types can break lib.persistence, while a change to lib.persistence can't break packages.@openmaic.storage.src.runtime.types.
Position
Below the diagonal: lib.persistence uses a module listed above it, which is the healthy direction.
lib.persistence uses packages.@openmaic.storage.src.runtime.pg, so a change to packages.@openmaic.storage.src.runtime.pg can break lib.persistence, while a change to lib.persistence can't break packages.@openmaic.storage.src.runtime.pg.
Position
Below the diagonal: lib.persistence uses a module listed above it, which is the healthy direction.
lib.server uses lib.types.provider, so a change to lib.types.provider can break lib.server, while a change to lib.server can't break lib.types.provider.
Position
Below the diagonal: lib.server uses a module listed above it, which is the healthy direction.
lib.server uses packages.@openmaic.storage.src.document.types, so a change to packages.@openmaic.storage.src.document.types can break lib.server, while a change to lib.server can't break packages.@openmaic.storage.src.document.types.
Position
Below the diagonal: lib.server uses a module listed above it, which is the healthy direction.
lib.server uses packages.@openmaic.storage.src.runtime.pg, so a change to packages.@openmaic.storage.src.runtime.pg can break lib.server, while a change to lib.server can't break packages.@openmaic.storage.src.runtime.pg.
Position
Below the diagonal: lib.server uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses lib.types.stage, so a change to lib.types.stage can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break lib.types.stage.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses packages.@openmaic.dsl.src.action, so a change to packages.@openmaic.dsl.src.action can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break packages.@openmaic.dsl.src.action.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses packages.@openmaic.storage.src.document.types, so a change to packages.@openmaic.storage.src.document.types can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break packages.@openmaic.storage.src.document.types.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses lib.types.generation, so a change to lib.types.generation can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break lib.types.generation.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.agent-runtime uses packages.@openmaic.storage.src.runtime.pg, so a change to packages.@openmaic.storage.src.runtime.pg can break lib.server.agent-runtime, while a change to lib.server.agent-runtime can't break packages.@openmaic.storage.src.runtime.pg.
Position
Below the diagonal: lib.server.agent-runtime uses a module listed above it, which is the healthy direction.
lib.server.generation.run uses lib.types.stage, so a change to lib.types.stage can break lib.server.generation.run, while a change to lib.server.generation.run can't break lib.types.stage.
Position
Below the diagonal: lib.server.generation.run uses a module listed above it, which is the healthy direction.
lib.server.generation.run uses lib.types.generation, so a change to lib.types.generation can break lib.server.generation.run, while a change to lib.server.generation.run can't break lib.types.generation.
Position
Below the diagonal: lib.server.generation.run uses a module listed above it, which is the healthy direction.
lib.server.generation.run uses packages.@openmaic.storage.src.runtime.pg, so a change to packages.@openmaic.storage.src.runtime.pg can break lib.server.generation.run, while a change to lib.server.generation.run can't break packages.@openmaic.storage.src.runtime.pg.
Position
Below the diagonal: lib.server.generation.run uses a module listed above it, which is the healthy direction.
lib.server.materials uses packages.@openmaic.storage.src.runtime.pg, so a change to packages.@openmaic.storage.src.runtime.pg can break lib.server.materials, while a change to lib.server.materials can't break packages.@openmaic.storage.src.runtime.pg.
Position
Below the diagonal: lib.server.materials uses a module listed above it, which is the healthy direction.
lib.server.pbl-v3 uses lib.pbl.v3.domain.orchestration.types, so a change to lib.pbl.v3.domain.orchestration.types can break lib.server.pbl-v3, while a change to lib.server.pbl-v3 can't break lib.pbl.v3.domain.orchestration.types.
Position
Below the diagonal: lib.server.pbl-v3 uses a module listed above it, which is the healthy direction.
lib.server.pbl-v3 uses lib.types.provider, so a change to lib.types.provider can break lib.server.pbl-v3, while a change to lib.server.pbl-v3 can't break lib.types.provider.
Position
Below the diagonal: lib.server.pbl-v3 uses a module listed above it, which is the healthy direction.
lib.server.pbl-v3 uses packages.@openmaic.storage.src.runtime.pg, so a change to packages.@openmaic.storage.src.runtime.pg can break lib.server.pbl-v3, while a change to lib.server.pbl-v3 can't break packages.@openmaic.storage.src.runtime.pg.
Position
Below the diagonal: lib.server.pbl-v3 uses a module listed above it, which is the healthy direction.
lib.utils uses components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate, so a change to components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate can break lib.utils, while a change to lib.utils can't break components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate.
Position
Below the diagonal: lib.utils uses a module listed above it, which is the healthy direction.
lib.utils uses packages.@openmaic.dsl.src.action, so a change to packages.@openmaic.dsl.src.action can break lib.utils, while a change to lib.utils can't break packages.@openmaic.dsl.src.action.
Position
Below the diagonal: lib.utils uses a module listed above it, which is the healthy direction.
lib.utils uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break lib.utils, while a change to lib.utils can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: lib.utils uses a module listed above it, which is the healthy direction.
lib.utils uses packages.@openmaic.storage.src.document.types, so a change to packages.@openmaic.storage.src.document.types can break lib.utils, while a change to lib.utils can't break packages.@openmaic.storage.src.document.types.
Position
Below the diagonal: lib.utils uses a module listed above it, which is the healthy direction.
lib.utils uses packages.@openmaic.storage.src.runtime.types, so a change to packages.@openmaic.storage.src.runtime.types can break lib.utils, while a change to lib.utils can't break packages.@openmaic.storage.src.runtime.types.
Position
Below the diagonal: lib.utils uses a module listed above it, which is the healthy direction.
lib.utils uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.utils, while a change to lib.utils can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.utils uses a module listed above it, which is the healthy direction.
lib.video-export.deps uses packages.@openmaic.dsl.src.action, so a change to packages.@openmaic.dsl.src.action can break lib.video-export.deps, while a change to lib.video-export.deps can't break packages.@openmaic.dsl.src.action.
Position
Below the diagonal: lib.video-export.deps uses a module listed above it, which is the healthy direction.
lib.video-export.deps uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.video-export.deps, while a change to lib.video-export.deps can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.video-export.deps uses a module listed above it, which is the healthy direction.
lib.workbench uses lib.pbl.v3.domain.orchestration.types, so a change to lib.pbl.v3.domain.orchestration.types can break lib.workbench, while a change to lib.workbench can't break lib.pbl.v3.domain.orchestration.types.
Position
Below the diagonal: lib.workbench uses a module listed above it, which is the healthy direction.
lib.workbench uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.workbench, while a change to lib.workbench can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.workbench uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in packages.@openmaic.editor.src.react uses a type in components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate.
packages.@openmaic.editor.src.react uses components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate, so a change to components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate can break packages.@openmaic.editor.src.react, while a change to packages.@openmaic.editor.src.react can't break components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate.
Position
Below the diagonal: packages.@openmaic.editor.src.react uses a module listed above it, which is the healthy direction.
packages.@openmaic.editor.src.react uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break packages.@openmaic.editor.src.react, while a change to packages.@openmaic.editor.src.react can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: packages.@openmaic.editor.src.react uses a module listed above it, which is the healthy direction.
packages.@openmaic.editor.src.react uses packages.@openmaic.editor.src.react.types, so a change to packages.@openmaic.editor.src.react.types can break packages.@openmaic.editor.src.react, while a change to packages.@openmaic.editor.src.react can't break packages.@openmaic.editor.src.react.types.
Position
Below the diagonal: packages.@openmaic.editor.src.react uses a module listed above it, which is the healthy direction.
packages.@openmaic.editor.src.ui.types uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break packages.@openmaic.editor.src.ui.types, while a change to packages.@openmaic.editor.src.ui.types can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: packages.@openmaic.editor.src.ui.types uses a module listed above it, which is the healthy direction.
packages.@openmaic.editor.src.ui.types uses packages.@openmaic.editor.src.react.types, so a change to packages.@openmaic.editor.src.react.types can break packages.@openmaic.editor.src.ui.types, while a change to packages.@openmaic.editor.src.ui.types can't break packages.@openmaic.editor.src.react.types.
Position
Below the diagonal: packages.@openmaic.editor.src.ui.types uses a module listed above it, which is the healthy direction.
packages.@openmaic.generation.src uses lib.types.generation, so a change to lib.types.generation can break packages.@openmaic.generation.src, while a change to packages.@openmaic.generation.src can't break lib.types.generation.
Position
Below the diagonal: packages.@openmaic.generation.src uses a module listed above it, which is the healthy direction.
packages.@openmaic.generation.src uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break packages.@openmaic.generation.src, while a change to packages.@openmaic.generation.src can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: packages.@openmaic.generation.src uses a module listed above it, which is the healthy direction.
packages.@openmaic.generation.src uses packages.@openmaic.importer.src.adapter.types, so a change to packages.@openmaic.importer.src.adapter.types can break packages.@openmaic.generation.src, while a change to packages.@openmaic.generation.src can't break packages.@openmaic.importer.src.adapter.types.
Position
Below the diagonal: packages.@openmaic.generation.src uses a module listed above it, which is the healthy direction.
packages.@openmaic.importer.src.serializer uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break packages.@openmaic.importer.src.serializer, while a change to packages.@openmaic.importer.src.serializer can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: packages.@openmaic.importer.src.serializer uses a module listed above it, which is the healthy direction.
packages.@openmaic.importer.src.serializer uses packages.@openmaic.importer.src.parser.XmlParser, so a change to packages.@openmaic.importer.src.parser.XmlParser can break packages.@openmaic.importer.src.serializer, while a change to packages.@openmaic.importer.src.serializer can't break packages.@openmaic.importer.src.parser.XmlParser.
Position
Below the diagonal: packages.@openmaic.importer.src.serializer uses a module listed above it, which is the healthy direction.
packages.@openmaic.importer.src.serializer uses packages.@openmaic.importer.src.adapter.types, so a change to packages.@openmaic.importer.src.adapter.types can break packages.@openmaic.importer.src.serializer, while a change to packages.@openmaic.importer.src.serializer can't break packages.@openmaic.importer.src.adapter.types.
Position
Below the diagonal: packages.@openmaic.importer.src.serializer uses a module listed above it, which is the healthy direction.
lib.media uses components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate, so a change to components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate can break lib.media, while a change to lib.media can't break components.slide-renderer.Editor.Canvas.Operate.CommonElementOperate.
Position
Below the diagonal: lib.media uses a module listed above it, which is the healthy direction.
lib.media uses packages.@openmaic.dsl.src.slides, so a change to packages.@openmaic.dsl.src.slides can break lib.media, while a change to lib.media can't break packages.@openmaic.dsl.src.slides.
Position
Below the diagonal: lib.media uses a module listed above it, which is the healthy direction.
lib.media uses packages.@openmaic.dsl.src.stage, so a change to packages.@openmaic.dsl.src.stage can break lib.media, while a change to lib.media can't break packages.@openmaic.dsl.src.stage.
Position
Below the diagonal: lib.media uses a module listed above it, which is the healthy direction.
lib.media uses lib.video-export.deps, so a change to lib.video-export.deps can break lib.media, while a change to lib.media can't break lib.video-export.deps.
Position
Below the diagonal: lib.media uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 58% · 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
A03:2025 — Software Supply Chain Failures
123
High / Critical
A05:2025 — Injection
69
High / Critical
A07:2025 — Authentication Failures
6
High / Critical
A02:2025 — Security Misconfiguration
5
Medium
Roadmap
Top priorities: Resolve the 4 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED, REDACTED; Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — so a security regression fails the build instead of landing; Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with pg-agent-session-store.pg.test.ts.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 4 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED, REDACTED.
Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — so a security regression fails the build instead of landing.
Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
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 — 194
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 — 2653
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 — 278
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 8
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 87 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 87 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, 3103 of 3125 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the jest suite in packages/mathml2omml/ ran and not one test passed (No tests found, exiting with code 1), so the coverage would describe the failed run, not the code — but the repository pins Node 22 in .nvmrc and the analyzer image ran it on Node 24, so the failure describes our runtime, not the suite. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo. In the meantime, commit (or publish into the working tree) the lcov/Cobertura report your CI produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the JavaScript/TypeScript suite (vitest via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/dsl/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/editor/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/generation/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/geometry/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/importer/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/renderer/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/@openmaic/storage/; jest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/mathml2omml/; vitest via `npm ci --ignore-scripts` in render-service/) did not finish re-running within its budget: the tier's time budget ran out before a run finished.
D12 Dependency Hygiene — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository's dependency manifests WERE read and their pinning discipline assessed; what went unanswered is the currency half, because registry.npmjs.org — the registry that answers it — was asked and did not reply (registry returned 429). This is OUR side and it is an ENVIRONMENT fault, not a missing collector: the collector exists and ran. An HTTP 403 here is what this scan's egress allowlist returns for a host that is not on it, so the remedy is to add registry.npmjs.org to the allowlist and re-run — not to build anything.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D23 Boundary Type-Coupling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind measured 0/40 valid on a seeded held-out sample of its rows on 98 C# repositories (docs/plans/deterministic-engine/adjudication/P5c-D23-units.md, "Version 1 ON MAIN"): the noise rows were dependencies on layer folders, shared cores and grouping folders read as contexts. By the pre-registered fallback (PREREGISTRATION v37) it publishes no row until version 4 passes its gate. The candidates are counted here, not reported as findings, and the score does not include them.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `app/api/persistence/[...path]/route.ts`, `components/scene-renderers/pbl/v2/chat.tsx`, `components/scene-renderers/pbl/v2/workspace.tsx`, `components/settings/model-services.tsx`, `components/settings/use-llm-picker-groups.ts`, … (+60 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 19 further occurrence(s) are not listed individually; the score already reflects all 59.
AC4 Keyboard semantics — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 10 further occurrence(s) are not listed individually; the score already reflects all 50.
AC6 Visual & motion safety — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 59 further occurrence(s) are not listed individually; the score already reflects all 99.
AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in packages/@openmaic/storage/src/asset/references.ts, 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.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. User interface: 447 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. Boot: crawled PUBLIC routes only — add a Playwright storageState (e.g. playwright/.auth/user.json) or a test auth-setup to crawl authenticated screens rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:5432: page.goto: net::ERR_EMPTY_RESPONSE at http://127.0.0.1:5432/
Call log:
- navigating to "http://127.0.0.1:5432/", waiting until "load"
ran the repo's playwright suite against the booted app but captured no surfaces (suite failed to install/run, or visited no pages) — see runtime diagnostics.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P2 Observability — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 169 further occurrence(s) are not listed individually; the score already reflects all 209.
P7 Outbound HTTP resilience — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 46 further occurrence(s) are not listed individually; the score already reflects all 86.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1001 further occurrence(s) are not listed individually; the score already reflects all 1041.
R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 203 further occurrence(s) are not listed individually; the score already reflects all 243.
R4 Test Coverage — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 60 further occurrence(s) are not listed individually; the score already reflects all 100.
R7 Dead Code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 130 further occurrence(s) are not listed individually; the score already reflects all 170.
X2 Cancellation propagation — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 24 further occurrence(s) are not listed individually; the score already reflects all 64.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 235 further occurrence(s) are not listed individually; the score already reflects all 275.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, 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.
Repo exclusion declarations: 10 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
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.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a 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.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
697 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was index.Roundtable at 328. A further 10 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 read.isEmptyLegacyPBLConfig at 35 — they are counted neither in the figure above nor in this dimension's score. 6 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: lib/pbl/legacy/read.ts (read.isEmptyLegacyPBLConfig at 35), packages/@openmaic/editor/src/react/text/commandExecutor.ts (commandExecutor.executeTextCommand at 28), packages/@openmaic/importer/src/utils/color.ts (color.applyColorModifiers at 22), components/workbench/chat/status-dot.tsx (status-dot.normalizeStatusDot at 18), packages/@openmaic/dsl/src/pbl.ts (pbl.isPBLProject at 18), and 1 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 673 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 59 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with index.Roundtable (cyclomatic 328), PlaybackChromeRoot.PlaybackChromeRoot (cyclomatic 288), workspace.PBLV3WorkspaceContent (cyclomatic 262). — 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 59 together lifts Cyclomatic Complexity from 2.0 to about 4.1/10, projected with the scoring formula itself and assuming each lands exactly at 60; 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.
+ 786 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 96 bodies over 60 down to 60 or less in Cognitive Complexity — start with use-export-pptx.buildPptxBlob (cognitive 630), textSerializer.renderTextBody (cognitive 514), transformParsedToSlides.transformParsedToSlides::parseElements (cognitive 413). — 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 96 together lifts Cognitive Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God 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 262 FunctionTooLong finding(s) in God Classes — start with REDACTED (8), presets.ts (6), route.ts (6). — One of this dimension's main actionable groups (262 warning-level).
Resolve the 96 FileTooLong finding(s) in God Classes — start with pg.ts (3), engine.ts (3), REDACTED (3). — One of this dimension's main actionable groups (96 warning-level).
Resolve the 10 ClassTooLong finding(s) in God Classes — start with pg.ts (2), engine.ts (2), MaterialLibraryPage.tsx. — One of this dimension's main actionable groups (10 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.
Do you agree with this assessment?
D5 · Coupling9.0 / 10Stronggated by 1 serious finding✓ 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.
8 production modules (npm), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence.
Off the main sequence: @openmaic/geometry
What to do
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with slide.ts. — 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 Distribution9.8 / 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.
14903 test methods: 14728 unit, 0 integration, 0 BDD, 175 e2e. The JavaScript/TypeScript suite contributes 14903 `it`/`test` case(s) across 1497 test file(s) declaring at least one; its tier split is read from package names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Adequategated by 1 critical finding✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
24 skipped (19 with a documented reason), 22 zero-assertion, 15 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 14903 tests.
No assertions (empty test): skips title-state constraint locks and scans once validation is completepackages/@openmaic/storage/test/pg-agent-session-store.pg.test.ts:380
No assertions: keeps bigint cursors as decimal strings and compares beyond Number precision · ×21tests/workbench/owner-session-client.test.ts:281
Fixed-sleep synchronisation: fetches sources for the query and conversation while open, and again on a library change · ×15tests/workbench/material-mention.test.ts:518
Mock-dominated test: waits while the gate has not answered, holding the composer, then stages it · ×66tests/workbench/material-seed.test.ts:294
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with pg-agent-session-store.pg.test.ts. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 21 No assertions finding(s) in Test Quality — start with owner-session-client.test.ts (11), stage.test.ts (2), interactive-self-hosted.browser.test.ts. — One of this dimension's main actionable groups (21 warning-level).
Resolve the 15 Fixed-sleep synchronisation finding(s) in Test Quality — start with stream-buffer.test.ts (3), material-mention.test.ts (2), generation-runs.pg.test.ts (2). — One of this dimension's main actionable groups (15 warning-level).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
Resolve the 4 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Enforce Secret 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: 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: components/edit/PlaybackChromeRoot.tsx (16×288=4608); lib/server/agent-runtime/runner.ts (14×240=3360); app/page.tsx (11×193=2123) Repeated repair below the complexity floor: packages/@openmaic/storage/src/agent-session/pg.ts (5 of 9 changes were fixes); lib/persistence/owner-materials.ts (5 of 9 changes were fixes); lib/server/material-extraction/extract.ts (5 of 7 changes were fixes)
Resolve the 181 Hotspot finding(s) in Churn × Complexity Hotspots — start with route.ts (17), REDACTED (7), engine.ts (2). — One of this dimension's main actionable groups (181 warning-level).
Resolve the 14 Repeated repair finding(s) in Churn × Complexity Hotspots — start with pg.ts, owner-materials.ts, extract.ts. — One of this dimension's main actionable groups (14 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 Factor8.8 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
156 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is packages/@openmaic/importer/src/shapes/presets.ts. Counted over 1316 of the 1974 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×5
Further sole-owners (lower concentration)
What to do
Resolve the 5 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (5 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.
8 deducted task-comment markers across 396342 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 8 TodoComment finding(s) in Explicit Debt — start with useInsertFromCreateSelection.ts (2), imageSerializer.ts, main.py. — One of this dimension's main actionable groups (8 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 2 documentation facets pass in full; short on: F2 example. 27 document(s) read across 9 unit(s).
Documentation: no build, run or usage examplepackages/@openmaic/generation/README.md:1
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
6 naming inconsistencies among 481 declarations measured against a convention their peers follow.
`baseURL` spells `URL` where 374 names in the project spell it `Url`eval/pbl-v2-planner/runner.ts:145
`UseExportPPTXOptions` spells `PPTX` where 22 names in the project spell it `Pptx`REDACTED:1407
`useExportPPTX` spells `PPTX` where 22 names in the project spell it `Pptx`REDACTED:1425
`NodeXMLHttpRequest` spells `XML` where 46 names in the project spell it `Xml`lib/server/agent-runtime/node-xhr.ts:9
`responseURL` spells `URL` where 374 names in the project spell it `Url`lib/server/agent-runtime/node-xhr.ts:28
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 `baseURL` spells `URL` where 374 names in the project spell it `Url` finding(s) in Naming Consistency — start with runner.ts. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `UseExportPPTXOptions` spells `PPTX` where 22 names in the project spell… finding(s) in Naming Consistency — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `useExportPPTX` spells `PPTX` where 22 names in the project spell it… finding(s) in Naming Consistency — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
4 of 9 build units (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: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
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 High secret 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).
70 finding(s): 0 critical, 33 high, 29 medium, 8 low. 16 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 71 file(s) — `app/api/persistence/[...path]/route.ts` (line 341), `components/edit/PlaybackChromeRoot.tsx`, `components/scene-renderers/pbl/v2/chat.tsx` (line 817, line 828, line 1444), `components/scene-renderers/pbl/v2/workspace.tsx` (line 96), `components/settings/model-services.tsx` (line 81), … (+66 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 2 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
+ 12 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 4 REDACTED finding(s) charged to Static Analysis (SAST) — the other 16 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 (20 issue-level, 4 of them charged here).
Resolve the 7 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 60 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (53), REDACTED (4), REDACTED (3). — One of this dimension's main actionable groups (60 issue-level).
Resolve the 6 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 issue-level).
Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-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 (2), REDACTED. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 Low IaC finding(s) in IaC & Container Security — start with REDACTED (2). — One of this dimension's main actionable groups (2 recommendation-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.
3 of 1316 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is lib/media/comfyui-workflows.ts. Counted over 1316 of the 1974 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 8 Boundary-crossing change coupling finding(s) in Change Coupling — start with page.tsx (3), REDACTED (3), agent-bar.tsx. — One of this dimension's main actionable groups (8 issue-level).
Resolve the 3 Change coupling finding(s) in Change Coupling — start with provider-config.ts, types.ts, REDACTED. — One of this dimension's main actionable groups (3 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.
Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 148 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 alternatives6.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.
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). (×4) — components/slide-renderer/Editor/RendererScreenCanvas.tsx:141, components/slide-renderer/components/element/VideoElement/BaseVideoElement.tsx:170, components/slide-renderer/components/element/VideoElement/index.tsx:121, …
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels5.7 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×22) — app/page.tsx:1855, app/page.tsx:2237, components/access-code-modal.tsx:133, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×6) — app/page.tsx:1870, app/page.tsx:2273, components/chat/chat-area.tsx:315, …
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×2) — components/canvas/canvas-toolbar.tsx:234, components/discovery/folder-card.tsx:513
This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. — components/discovery/folder-dialogs.tsx:108
This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. — components/discovery/move-to-folder-menu.tsx:87
This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. (×5) — components/edit/ActionsBar/ActionPicker.tsx:60, components/edit/surfaces/slide/ElementPickLayer.tsx:451, components/roundtable/index.tsx:835, …
This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it. (×2) — components/edit/ActionsBar/ActionsBar.tsx:780, components/generation/generation-toolbar.tsx:273
A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. — components/scene-renderers/pbl/v3/workbench-panel.tsx:267
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×3) — app/layout.tsx:75, packages/@openmaic/importer/index.html:2, packages/docs/components/root-shell.tsx:21
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). (×3) — components/slide-renderer/components/element/TableElement/StaticTable.tsx:93, REDACTED:203, packages/@openmaic/renderer/src/elements/table/StaticTable.tsx:71
A page with no <title> gives no name in the tab, history or screen-reader page list. Declare it the way this router does — Next App Router `export const metadata = { title }`, React Router/Remix `export function meta`, TanStack Start `head`, or a Helmet/Head component. — packages/docs/components/root-shell.tsx:21
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. (×10) — app/page.tsx:1774, app/page.tsx:1818, app/page.tsx:1827, …
This <p> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. — app/page.tsx:2259
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×17) — components/agent/agent-bar.tsx:777, components/canvas/canvas-area.tsx:345, components/canvas/canvas-area.tsx:352, …
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. — components/canvas/canvas-toolbar.tsx:199
This <span> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. (×3) — components/edit/SlideNavRail/ThumbItem.tsx:197, components/workbench/workspace/MaterialLibraryPage.tsx:1335, components/workbench/workspace/MaterialLibraryPage.tsx:1452
This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — components/scene-renderers/pbl/v2/submission.tsx:836
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — components/scene-renderers/pbl/v2/submission.tsx:1172
This <div> announces itself as a role="separator" and is operated by mousedown, but nothing can put focus on it: no tabIndex={0}, no key handler, and nothing in its scripts moves focus. A keyboard cannot produce a pointer drag, so the control cannot be operated at all (WCAG 2.1.1). Give it tabIndex={0}="0" and move it with the arrow keys in a key handler (with aria-valuenow for the position it holds). — components/scene-renderers/pbl/v2/workspace.tsx:571
This <div> binds mousedown 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. — components/slide-renderer/Editor/Canvas/index.tsx:251
This <div> binds mousedown, touchstart and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. (×2) — components/slide-renderer/components/element/ShapeElement/index.tsx:135, components/slide-renderer/components/element/ShapeElement/index.tsx:185
This <div> 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. — components/whiteboard/whiteboard-canvas.tsx:337
This <span> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. — components/workbench/composer-pill.tsx:121
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.
<div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×4) — app/generation-preview/page.tsx:277, app/generation-preview/page.tsx:295, components/ai-elements/loader.tsx:82, …
<textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×7) — app/page.tsx:960, components/edit/ActionsBar/ActionsBar.tsx:652, components/edit/ActionsBar/ActionsBar.tsx:750, …
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×6) — app/page.tsx:1855, app/page.tsx:2237, components/edit/SlideNavRail/ThumbItem.tsx:171, …
<div> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — components/agent/agent-bar.tsx:912
<span> moves — its inline style sets `animation: speech-ring 2s ease-in-out infinite` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — components/audio/speech-button.tsx:121
<span> moves — its inline style sets `animation: speech-bar ${0.4+i*0.15}s ease-in-out ${i*0.1}s infinite alternate` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — components/audio/speech-button.tsx:135
This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade. (×13) — components/canvas/canvas-area.tsx:216, components/chat/chat-area.tsx:340, components/chat/lecture-notes-view.tsx:88, …
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×3) — components/canvas/canvas-toolbar.tsx:269, components/edit/SlideNavRail/InsertionZone.tsx:34, components/generation/outlines-editor.tsx:819
<span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×2) — components/chat/chat-area.tsx:307, components/chat/session-list.tsx:86
<span> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — components/edit/AgentsView/AgentRosterPanel.tsx:127
<div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — components/edit/SlideNavRail/ThumbItem.tsx:113
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.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
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.
No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 447 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. — REDACTED:190
What to do
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
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 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 dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
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.
`ChatAreaRef` declares 19 required operations: `createSession`, `endSession`, `endActiveSession`, `stopActiveSession`, `continueActiveSoftClosingSession`, `softPauseActiveSession`, `resumeActiveSession`, `sendMessage`, `startDiscussion`, `startLecture`, `addLectureMessage`, `getIsStreaming`, `getActiveSessionType`, `getLectureMessageId`, `pauseBuffer`, `resumeBuffer`, `pauseActiveLiveBuffer`, `resumeActiveLiveBuffer`, `switchToTab`. 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. — components/chat/chat-area.tsx:61
`SandboxProvider` declares 25 required operations: `exportWorkspace`, `importWorkspace`, `initializeWorkspace`, `listWorkspace`, `renew`, `nativePreview`, `previewLifetime`, `openPreviewConnection`, `create`, `find`, `inspect`, `destroy`, `readText`, `writeText`, `startCommand`, `readCommand`, `cancelCommand`, `desktopScreenshot`, `desktopAction`, `createTerminal`, `findTerminal`, `terminalInput`, `resizeTerminal`, `closeTerminal`, `terminalStream`. 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. — lib/sandbox/types.ts:64
`RunStepServices` declares 17 required operations: `materialKinds`, `materialsReady`, `analyzeMaterials`, `research`, `outline`, `agentProfiles`, `presetAgents`, `sceneContent`, `sceneActions`, `narrationTarget`, `narrateClip`, `releaseAssets`, `mediaConnections`, `generateImage`, `generateVideo`, `parallelSceneConcurrency`, `sleep`. 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. — lib/server/generation/run/services.ts:166
`SettingsState` declares 19 required operations: `setTTSVoice`, `setTTSSpeed`, `setASRLanguage`, `setReviewOutlineEnabled`, `setTTSMuted`, `setTTSVolume`, `setAutoPlayLecture`, `setPlaybackSpeed`, `setSelectedAgentIds`, `setAgentMode`, `setAutoAgentCount`, `setAgentVoiceOverride`, `setAgentSelectionIsUserSet`, `setPresetAgentChoice`, `setSidebarCollapsed`, `setChatAreaCollapsed`, `setChatAreaWidth`, `setEditRailCollapsed`, `setEditRailWidth`. 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. — lib/store/settings.ts:90
`AgentSessionStore` declares 18 required operations: `createSession`, `getSession`, `listSessionsByOwner`, `softDeleteSession`, `claimNextSession`, `heartbeat`, `markUserMessageDelivered`, `assertActiveLease`, `finishSession`, `releaseLease`, `requestCancel`, `getCancelRequestedAt`, `isCancelRequested`, `clearCancel`, `requeueSession`, `requeueForRetry`, `postUserMessage`, `mergeOwner`. 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. — packages/@openmaic/storage/src/agent-session/types.ts:282
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Do you agree with this assessment?
C2 · Access Controls7.0 / 10Strong✓ Tool-verified
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.
Here who is asking is taken from the 'lastEventId' request header (const lastEventId = parseLastEventId(req.headers.get('last-event-id')??url.searchParams…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed. — app/api/agent/owner-events/route.ts:71
Here who is asking is taken from the 'lastEventId' request header (const lastEventId = Number(headerId??url.searchParams.get('lastEventId')??0)||0) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed. — app/api/agent/sessions/[id]/events/route.ts:90
Here who is asking is taken from the 'providerId' request header (const{model:languageModel, apiKey:resolvedApiKey, providerId, modelInfo, thinkingConfig…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed. — app/api/chat/pi/route.ts:158
Here who is asking is taken from the request header read into 'providerId' (const providerId = request.headers.get('x-image-provider')?.trim()as ImageProviderId|un…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed. — app/api/generate/image/route.ts:110
Here who is asking is taken from the request header read into 'providerId' (const providerId = request.headers.get('x-video-provider')?.trim()as VideoProviderId|un…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed. — app/api/generate/video/route.ts:115
Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect. — lib/chat/pi/tools/native-spotlight.ts:71
What to do
Keep who is signed in on the server: give the browser only a long random session id (express-session, iron-session, a sessions table), or sign the cookie (cookie-parser with a secret and req.signedCookies, a verified JWT), and look the user up from that — never from an id, role or token claim the browser sends unchecked.
Name the access rules — roles/permissions declared once (a @Roles/@Permissions decorator with its guard, a CASL ability, a casbin model, or Supabase CREATE POLICY) and consulted where access is checked, so the rule set is reviewable and testable on its own.
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) — components/chat/lecture-notes-view.tsx:218, components/roundtable/index.tsx:1802
`onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. (×5) — REDACTED:1073, REDACTED:1086, REDACTED:1098, …
`onCreated` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it. — components/slide-renderer/Editor/Canvas/index.tsx:265
`overrideMimeType` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — lib/server/agent-runtime/node-xhr.ts:52
`parseVideoCodec` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — packages/@openmaic/importer/src/openmaic/utils/videoCodec.ts:22
`isVideoCodecSupported` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — packages/@openmaic/importer/src/openmaic/utils/videoCodec.ts:26
`invalidate` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — packages/@openmaic/storage/src/asset/blob.ts:159
`main` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — render-service/src/resource-stage-copy.mjs:131
`overrideMimeType` has an empty body — confirm it's an intentional no-op and not an unfinished method. — REDACTED:45
A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something. (×5) — tests/document-store/migration.test.ts:658, tests/document-store/migration.test.ts:854, tests/document-store/migration.test.ts:984, …
What to do
Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
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
Add a README to the 2 of 11 project(s) that lack one — worth up to 0.4 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 project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
lib/pdf/README.md links to `images/img_1.png`, but `lib/pdf/images/img_1.png` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, 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. — lib/pdf/README.md:161
What to do
Reconcile the README with reality: lib/pdf/README.md links to `images/img_1.png`, but `lib/pdf/images/img_1.png` 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's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability7.2 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 3/4 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `render-service`.
`instrumentation.ts` reports through `console.*` at line 121 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:121
`instrumentation.ts` reports through `console.*` at line 132 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:132
`instrumentation.ts` reports through `console.*` at line 137 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:137
`instrumentation.ts` reports through `console.*` at line 149 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:149
`instrumentation.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. — instrumentation.ts:154
`instrumentation.ts` reports through `console.*` at line 159 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:159
`instrumentation.ts` reports through `console.*` at line 172 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:172
`instrumentation.ts` reports through `console.*` at line 184 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:184
`instrumentation.ts` reports through `console.*` at line 195 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:195
`instrumentation.ts` reports through `console.*` at line 213 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:213
`instrumentation.ts` reports through `console.*` at line 224 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:224
`instrumentation.ts` reports through `console.*` at line 259 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:259
`instrumentation.ts` reports through `console.*` at line 260 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:260
`instrumentation.ts` reports through `console.*` at line 267 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:267
`instrumentation.ts` reports through `console.*` at line 268 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:268
`instrumentation.ts` reports through `console.*` at line 272 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — instrumentation.ts:272
`lib/workbench/use-workbench-session.ts` reports through `console.*` at line 566 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/workbench/use-workbench-session.ts:566
`lib/workbench/use-workbench-session.ts` reports through `console.*` at line 585 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/workbench/use-workbench-session.ts:585
`lib/workbench/use-workbench-session.ts` reports through `console.*` at line 687 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/workbench/use-workbench-session.ts:687
`lib/workbench/use-workbench-session.ts` reports through `console.*` at line 820 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/workbench/use-workbench-session.ts:820
`lib/workbench/use-workbench-session.ts` reports through `console.*` at line 869 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/workbench/use-workbench-session.ts:869
`lib/video-export-app/build-export-zip.ts` reports through `console.*` at line 59 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/video-export-app/build-export-zip.ts:59
`lib/utils/chat-storage.ts` reports through `console.*` at line 201 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/utils/chat-storage.ts:201
`lib/utils/chat-storage.ts` reports through `console.*` at line 542 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/utils/chat-storage.ts:542
`lib/utils/chat-storage.ts` reports through `console.*` at line 1256 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/utils/chat-storage.ts:1256
`lib/utils/chat-storage.ts` reports through `console.*` at line 1279 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/utils/chat-storage.ts:1279
`lib/standalone-player/SceneErrorBoundary.tsx` reports through `console.*` at line 20 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/standalone-player/SceneErrorBoundary.tsx:20
`lib/standalone-player/mount.tsx` reports through `console.*` at line 57 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/standalone-player/mount.tsx:57
`lib/standalone-player/mount.tsx` reports through `console.*` at line 66 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/standalone-player/mount.tsx:66
`lib/server/config-validation.ts` reports through `console.*` at line 36 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/config-validation.ts:36
`lib/server/resolve-model.ts` reports through `console.*` at line 136 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/resolve-model.ts:136
`lib/server/sandbox/checkpoint-collector.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. — lib/server/sandbox/checkpoint-collector.ts:26
`lib/server/sandbox/checkpoint-collector.ts` reports through `console.*` at line 28 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/sandbox/checkpoint-collector.ts:28
`lib/server/pbl-v3/execution-watchdog.ts` reports through `console.*` at line 171 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/pbl-v3/execution-watchdog.ts:171
`lib/server/pbl-v3/execution-watchdog.ts` reports through `console.*` at line 193 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/pbl-v3/execution-watchdog.ts:193
`lib/server/pbl-v3/lifecycle-schedule.ts` reports through `console.*` at line 27 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/pbl-v3/lifecycle-schedule.ts:27
`lib/server/pbl-v3/lifecycle.ts` reports through `console.*` at line 238 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/pbl-v3/lifecycle.ts:238
`lib/server/pbl-v3/lifecycle.ts` reports through `console.*` at line 485 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/pbl-v3/lifecycle.ts:485
`lib/server/pbl-v3/lifecycle.ts` reports through `console.*` at line 501 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — lib/server/pbl-v3/lifecycle.ts:501
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
Add OpenTelemetry tracing/metrics (@opentelemetry/sdk-node) so requests are traceable across the system, not just health-probable.
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 CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security as a CI step. What was searched, so you can tell an absence from a miss: the 79464 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:18
`REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — REDACTED:40
What to do
Add a SAST step to CI running what this repository's stack ships: CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security — 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.
Do you agree with this assessment?
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
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.
`fetch(` 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. (×21) — app/api/proxy-media/route.ts:54, components/workbench/workspace/workspace-folder-seam.ts:29, lib/audio/voice-registration-client.ts:65, …
`fetchImpl(` 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. (×19) — lib/ai/providers.ts:2184, lib/ai/providers.ts:2191, lib/ai/providers.ts:2194, …
What to do
Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`mkdirSync` in `captureWhiteboard` 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. — eval/whiteboard-layout/capture.ts:49
`mkdirSync` in `runScenario` 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. — eval/whiteboard-layout/runner.ts:155
`readFileSync` in `rescoreRun` 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. — eval/whiteboard-layout/runner.ts:372
`readFileSync` in `scoreScreenshot` 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. — eval/whiteboard-layout/scorer.ts:71
`fs.existsSync` in `listComfyuiWorkflows` 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. — lib/media/comfyui-workflows.ts:82
`fs.readdirSync` in `listComfyuiWorkflows` 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. — lib/media/comfyui-workflows.ts:85
`fs.statSync` in `callback to filter` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — lib/media/comfyui-workflows.ts:87
`existsSync` in `listBuiltinSkills` 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. — lib/server/agent-runtime/skills.ts:232
`existsSync` in `callback to skills.map` 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. — lib/server/agent-runtime/skills.ts:248
`readFileSync` in `callback to skills.map` 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. — lib/server/agent-runtime/skills.ts:250
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.
198 duplicated blocks under the repository root have copies in at least two of the sibling directories app, components, configs, eval, lib, packages (+2 more sibling(s) not listed) — 142 of them are reported below, and 56 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 198 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 198 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 198 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. — configs/shapes.ts:3
79 duplicated blocks under lib/ have copies in at least two of the sibling directories agent, audio, buffer, chat, choreography, classroom (+27 more sibling(s) not listed) — 42 of them are reported below, and 37 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 79 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 79 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 79 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. — lib/document-store/current-scene.ts:10
33 duplicated blocks under components/ have copies in at least two of the sibling directories agent, canvas, chat, discovery, edit, generation (+8 more sibling(s) not listed) — 17 of them are reported below, and 16 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 33 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 33 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 33 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. — components/discovery/folder-dialogs.tsx:36
26 duplicated blocks under packages/@openmaic/storage/src/ have copies in at least two of the sibling directories agent-session, asset, document, kv, material, runtime (+2 more sibling(s) not listed) — 22 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 26 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 26 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 26 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/@openmaic/storage/src/material/pg.ts:98
17 duplicated blocks under app/api/ have copies in at least two of the sibling directories agent, agents, folders, generate, generate-classroom, generation-runs (+9 more sibling(s) not listed) — 16 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 17 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 17 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 17 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. — app/api/verify-image-provider/route.ts:41
14 duplicated blocks under lib/server/ have copies in at least two of the sibling directories agent-runtime, generation, generation-run-hooks, identity, material-extraction, materials (+3 more sibling(s) not listed) — 10 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 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. — lib/server/generation-run-hooks/registry.ts:52
11 of the duplicated blocks reported below have copies in at least two of the sibling directories audio, element, latex, line, text, video under packages/@openmaic/editor/src/ui/. 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. — packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:32
8 duplicated blocks under components/slide-renderer/components/element/ have copies in at least two of the sibling directories ChartElement, ImageElement, LatexElement, LineElement, TableElement, TextElement (+1 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. — components/slide-renderer/components/element/ImageElement/BaseImageElement.tsx:72
7 duplicated blocks under components/slide-renderer/ have copies in at least two of the sibling directories Editor, components — 5 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 7 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — components/slide-renderer/Editor/RendererScreenCanvas.tsx:32
6 duplicated blocks under packages/@openmaic/ have copies in at least two of the sibling directories dsl, editor, generation, importer, renderer — 2 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 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. — REDACTED:20
6 duplicated blocks under packages/@openmaic/importer/src/ have copies in at least two of the sibling directories export, model, serializer, utils — 3 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 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. — packages/@openmaic/importer/src/model/Slide.ts:40
configs/shapes.ts:3 · packages/@openmaic/importer/src/openmaic/configs/shapes.ts:3 — these 2 files are line-for-line copies of one another — 655 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. — configs/shapes.ts:3
REDACTED:3 · REDACTED:3 — these 2 files are line-for-line copies of one another — 418 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. — REDACTED:3
lib/pbl/v2/types.ts:8 · packages/@openmaic/generation/src/pbl/types.ts:8 — these 2 files are line-for-line copies of one another — 282 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. — lib/pbl/v2/types.ts:8
lib/prosemirror/utils.ts:1 · packages/@openmaic/editor/src/react/text/prosemirror/utils.ts:1 — these 2 files are line-for-line copies of one another — 186 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. — lib/prosemirror/utils.ts:1
app/page.tsx:1723 · components/user-profile.tsx:50 — the two spans are one implementation copied and then locally edited — 799 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. — app/page.tsx:1723
packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:32 · packages/@openmaic/editor/src/ui/text/TextFormatToolbar.tsx:53 — the two spans are one implementation copied and then locally edited — 724 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:32
app/api/agent/owner-events/route.ts:73 · app/api/agent/sessions/[id]/events/route.ts:90 — the two spans are one implementation copied and then locally edited — 763 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. — app/api/agent/owner-events/route.ts:73
eval/orchestration/answer-content-runner.ts:193 · eval/orchestration/answering-runner.ts:158 — the two spans are one implementation copied and then locally edited — 1117 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. — eval/orchestration/answer-content-runner.ts:193
lib/prosemirror/schema/nodes.ts:11 · packages/@openmaic/editor/src/react/text/prosemirror/schema/nodes.ts:182 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of MODULE-LEVEL DECLARATIONS — bindings the module declares and exports — rather than statements with a call site. Do not read this as an extract-a-helper row: a call expression cannot stand where a declaration was, and putting one there would delete the names themselves, which are what the rest of the codebase imports. What actually repeats here is the INITIALISER — the same expression shape written once per binding. So give that expression one name (a small helper the initialisers call, or a shared base value they are each derived from) and keep every binding under the name it already has. Where the run is an enumeration — one binding per distinct thing, differing precisely in the thing each one names — the repetition IS the enumeration and collapsing it would delete entries; consider instead whether the set belongs in one exported table the individual names are read out of. Reported because the copies drift apart the first time only one of them is edited. — lib/prosemirror/schema/nodes.ts:11
configs/shapes.ts:39 · packages/@openmaic/editor/src/ui/adapters/shapeFormulas.ts:13 · packages/@openmaic/importer/src/openmaic/configs/shapes.ts:39 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — configs/shapes.ts:39
lib/prosemirror/schema/marks.ts:1 · packages/@openmaic/editor/src/react/text/prosemirror/schema/marks.ts:1 — these 2 files are line-for-line copies of one another — 111 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. — lib/prosemirror/schema/marks.ts:1
components/ui/context-menu.tsx:119 · components/ui/dropdown-menu.tsx:77 — the two spans are one implementation copied and then locally edited — 348 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. — components/ui/context-menu.tsx:119
lib/web-fetch/providers/deepseek.ts:8 · lib/web-fetch/providers/kimi.ts:18 — the two spans are one implementation copied and then locally edited — 546 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. — lib/web-fetch/providers/deepseek.ts:8
components/workbench/compose-extras.tsx:88 · components/workbench/course-mention-menu.tsx:199 — the two spans are one implementation copied and then locally edited — 533 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. — components/workbench/compose-extras.tsx:88
components/slide-renderer/components/element/LineElement/BaseLineElement.tsx:3 · packages/@openmaic/renderer/src/elements/line/BaseLineElement.tsx:3 — these 2 files are line-for-line copies of one another — 85 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. — components/slide-renderer/components/element/LineElement/BaseLineElement.tsx:3
app/api/generate/image/route.ts:42 · app/api/generate/video/route.ts:44 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — app/api/generate/image/route.ts:42
app/api/verify-image-provider/route.ts:41 · app/api/verify-video-provider/route.ts:41 — the two spans are one implementation copied and then locally edited — 592 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. — app/api/verify-image-provider/route.ts:41
components/agent/agent-bar.tsx:196 · components/agent/agent-bar.tsx:466 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — components/agent/agent-bar.tsx:196
packages/@openmaic/storage/src/material/pg.ts:98 · packages/@openmaic/storage/src/skill/pg.ts:98 — the two spans are one implementation copied and then locally edited — 430 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/@openmaic/storage/src/material/pg.ts:98
components/agent/agent-bar.tsx:106 · components/agent/agent-bar.tsx:387 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — components/agent/agent-bar.tsx:106
components/stage/scene-sidebar.tsx:219 · components/stage/scene-thumbnail-content.tsx:64 — the two spans are one implementation copied and then locally edited — 292 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. — components/stage/scene-sidebar.tsx:219
lib/workbench/course-refs.ts:81 · lib/workbench/element-refs.ts:315 — the two spans are one implementation copied and then locally edited — 504 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. — lib/workbench/course-refs.ts:81
components/edit/surfaces/slide/CanvasOverlayPortal.tsx:79 · components/edit/surfaces/slide/use-tracked-rect.ts:6 — the two spans are one implementation copied and then locally edited — 447 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. — components/edit/surfaces/slide/CanvasOverlayPortal.tsx:79
components/settings/asr-settings.tsx:208 · components/settings/tts-settings.tsx:239 — the two spans are one implementation copied and then locally edited — 324 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. — components/settings/asr-settings.tsx:208
REDACTED:20 · packages/@openmaic/renderer/src/elements/table/StaticTable.tsx:9 — the two spans are one implementation copied and then locally edited — 490 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. — REDACTED:20
packages/@openmaic/editor/src/react/useLineHandleGesture.ts:65 · packages/@openmaic/editor/src/react/useResizeGesture.ts:107 — the two spans are one implementation copied and then locally edited — 357 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/@openmaic/editor/src/react/useLineHandleGesture.ts:65
components/slide-renderer/Editor/RendererScreenCanvas.tsx:32 · components/slide-renderer/components/element/VideoElement/BaseVideoElement.tsx:34 — the two spans are one implementation copied and then locally edited — 373 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. — components/slide-renderer/Editor/RendererScreenCanvas.tsx:32
lib/prompts/loader.ts:50 · packages/@openmaic/generation/src/prompts/loader.ts:50 — the two spans are one implementation copied and then locally edited — 345 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — lib/prompts/loader.ts:50
packages/@openmaic/storage/src/document/http.ts:174 · packages/@openmaic/storage/src/runtime/http.ts:63 — the two spans are one implementation copied and then locally edited — 475 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/@openmaic/storage/src/document/http.ts:174
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.
packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../renderer/src/elements/table/StaticTable) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:5
packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../renderer/src/styles) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:6
packages/@openmaic/importer/test/shapeSerializer.flowChartConnector.test.ts:8 reaches past another workspace package's public entry into its internals with a relative path (../../geometry/src/index) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — packages/@openmaic/importer/test/shapeSerializer.flowChartConnector.test.ts:8
render-service/src/runtime-info.ts:43 reaches into another package with a relative path (../node_modules/@hyperframes/producer/REDACTED) — import the package by name instead. — render-service/src/runtime-info.ts:43
scripts/assert-pg-contract-suites.mjs:161 reaches into another package with a relative path (../packages/@openmaic/storage/REDACTED) — import the package by name instead. — scripts/assert-pg-contract-suites.mjs:161
scripts/sync-interactive-assets.mjs:6 reaches into another package with a relative path (../packages/@openmaic/generation/dist/interactive-libraries.js) — import the package by name instead. — scripts/sync-interactive-assets.mjs:6
tests/agent-runtime/event-notify.pg.test.ts:24 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/storage/src/agent-session/pg) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/agent-runtime/event-notify.pg.test.ts:24
tests/agent-runtime/park-attempt-budget.pg.test.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/storage/src/agent-session/pg) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/agent-runtime/park-attempt-budget.pg.test.ts:5
tests/agent-runtime/prior-run-record.pg.test.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/storage/src/agent-session/pg) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/agent-runtime/prior-run-record.pg.test.ts:4
tests/export/pptx-inline-math.test.ts:17 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/export/pptx-inline-math.test.ts:17
tests/export/standalone-html-inline-math.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/export/standalone-html-inline-math.test.ts:16
tests/export/standalone-html-inline-math.test.ts:20 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/utils/inlineMath) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/export/standalone-html-inline-math.test.ts:20
tests/generation/interactive-observation-contract.test.ts:2 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/generation/src/scene-generator) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/generation/interactive-observation-contract.test.ts:2
tests/math/safe-math-render.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/math/safe-math-render.test.ts:16
tests/math/safe-math-render.test.ts:17 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/ui/latex/latex-editor) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/math/safe-math-render.test.ts:17
tests/quiz-answer-key.test.ts:8 reaches past another workspace package's public entry into its internals with a relative path (../packages/@openmaic/generation/src/scene-generator) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/quiz-answer-key.test.ts:8
tests/server/sanitize-scene-content-inline-math.test.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/server/sanitize-scene-content-inline-math.test.ts:11
tests/slide-renderer/edit-elements-render-contract.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/image/useClipImage) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/slide-renderer/edit-elements-render-contract.test.ts:16
tests/slide-renderer/edit-elements-render-contract.test.ts:17 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/image/useFilter) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/slide-renderer/edit-elements-render-contract.test.ts:17
tests/slide-renderer/edit-elements-render-contract.test.ts:18 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/text/BaseTextElement) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/slide-renderer/edit-elements-render-contract.test.ts:18
tests/slide-renderer/edit-elements-render-contract.test.ts:19 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/table/StaticTable) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — tests/slide-renderer/edit-elements-render-contract.test.ts:19
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
presentTool has cyclomatic complexity 232 and cognitive complexity 325; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — components/workbench/chat/tool-presentation.ts:286
Roundtable has cyclomatic complexity 225 and cognitive complexity 205; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — components/roundtable/index.tsx:156
renderTextBody has cyclomatic complexity 222 and cognitive complexity 509; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/@openmaic/importer/src/serializer/textSerializer.ts:1066
parseElements has cyclomatic complexity 186 and cognitive complexity 444; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:498
PBLV3WorkspaceContent has cyclomatic complexity 185 and cognitive complexity 151; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — components/scene-renderers/pbl/v3/workspace.tsx:65
buildPptxBlob has cyclomatic complexity 183 and cognitive complexity 640; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:544
renderShape has cyclomatic complexity 173 and cognitive complexity 210; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/@openmaic/importer/src/serializer/shapeSerializer.ts:839
foldEvent has cyclomatic complexity 143 and cognitive complexity 201; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/workbench/session-store.ts:940
executeSession has cyclomatic complexity 136 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/agent-runtime/runner.ts:1043
validateProjectPackage has cyclomatic complexity 122 and cognitive complexity 158; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/pbl-v3/project-package.ts:172
execute has cyclomatic complexity 106 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/pbl-v3/runtime.ts:539
learningView has cyclomatic complexity 99 and cognitive complexity 133; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/pbl-v3/runtime.ts:988
planModelSettingsImport has cyclomatic complexity 97 and cognitive complexity 188; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/legacy-browser-import/model-settings.ts:297
buildLearningEvidence has cyclomatic complexity 92 and cognitive complexity 135; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/pbl-v3/report.ts:30
HomePage has cyclomatic complexity 91 and cognitive complexity 83; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — app/page.tsx:161
renderTmpl has cyclomatic complexity 89 and cognitive complexity 114; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/@openmaic/importer/src/utils/mtef.ts:753
LearningWorkbenchPanel has cyclomatic complexity 88 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — components/scene-renderers/pbl/v3/workbench-panel.tsx:51
projectConversation has cyclomatic complexity 87 and cognitive complexity 233; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/pbl-v3/conversation.ts:68
analyzeMaterial has cyclomatic complexity 85 and cognitive complexity 108; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — lib/server/generation/steps/material-analysis.ts:193
(anonymous) has cyclomatic complexity 84 and cognitive complexity 145; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — lib/server/pbl-v3/lifecycle.ts:260
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files5.0 / 10Adequate✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
packages/@openmaic/importer/src/shapes/presets.ts has 6087 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/importer/src/shapes/presets.ts:1
lib/ai/providers.ts has 2814 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/ai/providers.ts:1
lib/server/agent-runtime/runner.ts has 2379 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/server/agent-runtime/runner.ts:1
components/workbench/workspace/WorkspaceRail.tsx has 2362 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/workbench/workspace/WorkspaceRail.tsx:1
app/page.tsx has 2292 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — app/page.tsx:1
lib/workbench/session-store.ts has 2276 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/workbench/session-store.ts:1
components/roundtable/index.tsx has 2227 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/roundtable/index.tsx:1
components/chat/use-chat-sessions.ts has 1998 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/chat/use-chat-sessions.ts:1
components/edit/PlaybackChromeRoot.tsx has 1987 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/edit/PlaybackChromeRoot.tsx:1
components/workbench/workspace/WorkspaceShell.tsx has 1945 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/workbench/workspace/WorkspaceShell.tsx:1
components/workbench/workspace/MaterialLibraryPage.tsx has 1908 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/workbench/workspace/MaterialLibraryPage.tsx:1
REDACTED has 1895 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
packages/@openmaic/importer/src/serializer/textSerializer.ts has 1884 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/importer/src/serializer/textSerializer.ts:1
lib/server/generation/run/engine.ts has 1815 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/server/generation/run/engine.ts:1
packages/@openmaic/storage/src/agent-session/pg.ts has 1814 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/storage/src/agent-session/pg.ts:1
lib/pbl/v2/agents/instructor.ts has 1741 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/pbl/v2/agents/instructor.ts:1
lib/audio/constants.ts has 1722 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/audio/constants.ts:1
lib/server/generation/run/store.ts has 1635 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/server/generation/run/store.ts:1
packages/@openmaic/storage/src/document/pg.ts has 1592 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/storage/src/document/pg.ts:1
lib/store/stage.ts has 1590 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/store/stage.ts:1
lib/chat/pi/element-reference.ts has 1567 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/chat/pi/element-reference.ts:1
packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts has 1487 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:1
packages/@openmaic/storage/src/asset/pg.ts has 1482 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/storage/src/asset/pg.ts:1
components/scene-renderers/pbl/v2/chat.tsx has 1474 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/scene-renderers/pbl/v2/chat.tsx:1
REDACTED has 1469 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
components/generation/outlines-editor.tsx has 1453 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/generation/outlines-editor.tsx:1
components/edit/ActionsBar/ActionsBar.tsx has 1452 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/edit/ActionsBar/ActionsBar.tsx:1
lib/audio/tts-providers.ts has 1449 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/audio/tts-providers.ts:1
lib/utils/stage-storage.ts has 1399 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/utils/stage-storage.ts:1
lib/server/pbl-v3/runtime.ts has 1373 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/server/pbl-v3/runtime.ts:1
components/workbench/WorkbenchChat.tsx has 1370 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/workbench/WorkbenchChat.tsx:1
components/scene-renderers/pbl/v2/submission.tsx has 1341 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/scene-renderers/pbl/v2/submission.tsx:1
lib/video-export/emit-hyperframes/index.ts has 1320 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/video-export/emit-hyperframes/index.ts:1
lib/persistence/owner-materials.ts 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. — lib/persistence/owner-materials.ts:1
packages/@openmaic/storage/src/asset/collector.ts has 1292 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/storage/src/asset/collector.ts:1
lib/server/agent-runtime/dsl-tools.ts has 1284 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/server/agent-runtime/dsl-tools.ts:1
components/scene-renderers/pbl/v3/workspace.tsx has 1252 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — components/scene-renderers/pbl/v3/workspace.tsx:1
lib/utils/chat-storage.ts has 1239 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/utils/chat-storage.ts:1
packages/@openmaic/importer/src/serializer/shapeSerializer.ts has 1211 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/@openmaic/importer/src/serializer/shapeSerializer.ts:1
lib/server/agent-runtime/material-tools.ts has 1157 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — lib/server/agent-runtime/material-tools.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 Coverage9.5 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
packages/@openmaic/generation/test/interactive-library-mapper.test.ts:99 imports './fixtures/interactive-libraries/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/@openmaic/generation/test/interactive-library-mapper.test.ts:99
tests/runtime/storage-entrypoint-removal.test.ts:5 imports '../../lib/storage/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — tests/runtime/storage-entrypoint-removal.test.ts:5
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. (×38) — components/ai-elements/prompt-input.tsx:1, eval/pbl-v2-planner/runner.ts:1, packages/@openmaic/generation/src/pbl/types.ts:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each REDACTED 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: REDACTED scanned for test/lint/typecheck script wiring. Deterministic presence check.
This repository declares test tooling, and the ✓ above records that declaration — but packages/@openmaic/generation/test/interactive-library-mapper.test.ts and 1 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to. — packages/@openmaic/generation/test/interactive-library-mapper.test.ts:99
Do you agree with this assessment?
R7 · Dead Code7.5 / 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 583 application, 46 tooling and 1573 test entry point(s) detected in this repo. Gate removals on `pnpm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (583 application, 46 tooling, 1573 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 (×33) — configs/symbol.ts, components/ai-elements/prompt-input.tsx, components/ai-elements/message.tsx, …
no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (components/ai-elements/inline-citation.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — components/ui/carousel.tsx
no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (components/ai-elements/model-selector.tsx, components/ai-elements/prompt-input.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — components/ui/command.tsx
no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (components/ai-elements/tool.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — components/ai-elements/code-block.tsx
no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (components/ai-elements/message.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — components/ui/button-group.tsx
no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (components/ai-elements/plan.tsx, components/ai-elements/reasoning.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — components/ai-elements/shimmer.tsx
no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (components/ai-elements/queue.tsx, components/ai-elements/suggestion.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — components/ui/scroll-area.tsx
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.
Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×3)
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Read from this repository's JavaScript/TypeScript source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Of the server controls, two are read where the source shows them: every session or sign-in cookie the code sets is read for HttpOnly, Secure and SameSite at the line that sets it (a raw `Set-Cookie` header, Express, Fastify, Hono, Koa, Next.js, `cookie.serialize`, express-session and cookie-session), and every Node listener for HTTPS enforcement. HSTS, security response headers and input validation are NOT assessed for JavaScript/TypeScript: each is scored as an absence, an absence is only reportable over the production HTTP server, and in this ecosystem the file that opens the port is build output or a framework launcher rather than a file in the source tree. Their absence here is not a finding about this repository. Its Node HTTP listeners were read for HTTPS enforcement alone — TLS served, a redirect to https:// or HSTS, or a TLS-terminating proxy configuration committed beside the server — each judged per server package.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
`https://cdn.jsdelivr.net/npm/jsoneditor@9.9.2/dist/jsoneditor.min.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. 2 such include(s) across the repository's markup. — packages/@openmaic/importer/index.html:24
`server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.) (×2) — eval/pbl-v2-planner/serve.ts:137, scripts/sandbox-preview-gateway.mjs:517
What to do
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
Enforce HTTPS on each listed server: serve TLS itself, or redirect plain requests to `https://` and send `Strict-Transport-Security` (`helmet()` does by default) behind the TLS-terminating proxy — and commit that proxy's configuration beside the service. A server only this machine reaches should bind `127.0.0.1`.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document1.4 / 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.
`assertJsonValue` is exported, takes a document from its caller (line 194) and hands it to `findNonJsonValue`, which calls itself at line 148 (`findNonJsonValue`) with a piece of `value` (and at line 184) — and nowhere in `findNonJsonValue` 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 `findNonJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/@openmaic/storage/src/runtime/json-value.ts:148
`sameJsonValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 289 (`sameJsonValue`) with a piece of `left` (and at line 299) — and nowhere in `sameJsonValue` 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 `sameJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/workbench/stage-freshness.ts:289
`normalizeAndValidateLegacyWhiteboard` is exported, takes a document from its caller (line 379) and hands it to `validateSchema`, which calls itself at line 181 (`validateSchema`) with a piece of `input` (and at line 214, line 230, line 235) — and nowhere in `validateSchema` 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 `validateSchema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/whiteboard/runtime/validate.ts:181
`normalizeAndValidateWhiteboardElement` is exported, takes a document from its caller (line 282) and hands it to `assertLosslessJson`, which calls itself at line 326 (`assertLosslessJson`) with a piece of `value` (and at line 341) — and nowhere in `assertLosslessJson` 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 `assertLosslessJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/whiteboard/runtime/validate.ts:326
`formatBootFailure` is exported, takes a document from its caller (line 38) and hands it to `describeError`, which calls itself at line 34 (`describeError`) with a piece of `error` — and nowhere in `describeError` 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 `describeError` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/boot-failure.ts:34
`upstreamHttpStatus` is exported, takes a document from its caller (line 26) and hands it to `statusFromError`, which calls itself at line 40 (`statusFromError`) with a piece of `error` (and at line 42, line 52) — and nowhere in `statusFromError` 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 `statusFromError` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/llm-error-response.ts:40
`isUpstreamQuotaExhausted` is exported and takes `error: unknown` from its caller, and it calls itself at line 95 (`isUpstreamQuotaExhausted`) with a piece of `error` (and at line 107) — and nowhere in `isUpstreamQuotaExhausted` 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 `isUpstreamQuotaExhausted` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/llm-error-response.ts:95
`isRetryableLlmError` is exported, takes a document from its caller (line 118) and hands it to `unwrapRetryChain`, which calls itself at line 86 (`unwrapRetryChain`) with a piece of `error` (and at line 95) — and nowhere in `unwrapRetryChain` 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 `unwrapRetryChain` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/llm-fallback.ts:86
`findUnsafeNetworkTargetError` is exported, takes a document from its caller (line 60) and hands it to `visit`, which calls itself at line 68 (`visit`) with a piece of `value` (and at line 72) — 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. — lib/server/ssrf-guard.ts:68
`canonicalJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 24 (`canonicalJson`) with a piece of `value` (and at line 29) — and nowhere in `canonicalJson` 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 `canonicalJson` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/pbl-v3/project-package.ts:24
`collectStringFields` is exported, takes a document from its caller (line 337) and hands it to `walk`, which calls itself at line 341 (`walk`) with a piece of `node` (and at line 344) — 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. — lib/server/agent-runtime/course-edit/apply.ts:341
`containsReadSceneMediaPlaceholder` is exported and takes `value: unknown` from its caller, and it calls itself at line 365 (`containsReadSceneMediaPlaceholder`) with a piece of `value` (and at line 367) — and nowhere in `containsReadSceneMediaPlaceholder` 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 `containsReadSceneMediaPlaceholder` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/agent-runtime/course-edit/media-byte-omission.ts:365
`containsReadScenePlaceholderFragment` is exported and takes `value: unknown` from its caller, and it calls itself at line 381 (`containsReadScenePlaceholderFragment`) with a piece of `value` (and at line 383) — and nowhere in `containsReadScenePlaceholderFragment` 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 `containsReadScenePlaceholderFragment` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — lib/server/agent-runtime/course-edit/media-byte-omission.ts:381
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 83/146 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`aiCall` 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 })`. — scripts/generation-node-smoke.mjs:42
`probe` 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 })`. — scripts/probe-mineru-cloud.mjs:44
`worker` 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 })`. — packages/@openmaic/importer/src/serializer/mathSerializer.ts:325
`dataUrlToBlob` 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 })`. — packages/@openmaic/importer/src/import-pipeline/index.ts:188
`parseElements` 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 })`. — packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:498
`probeFirstScene` 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 })`. — lib/workbench/first-scene-ready.ts:12
`libraryWrite` 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 })`. — lib/workbench/material-library-client.ts:342
`libraryDelete` 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 })`. — lib/workbench/material-library-client.ts:390
`createWorkbenchSession` 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 })`. — lib/workbench/session-store.ts:1975
`renameWorkbenchSession` 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 })`. — lib/workbench/session-store.ts:2042
`cancelWorkbenchSession` 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 })`. — lib/workbench/session-store.ts:2067
`postWorkbenchMessage` 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 })`. — lib/workbench/session-store.ts:2136
`uploadWorkbenchMaterial` 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 })`. — lib/workbench/session-store.ts:2276
`fetchStageManifest` 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 })`. — lib/workbench/stage-freshness.ts:107
`fetchSceneChunk` 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 })`. — lib/workbench/stage-freshness.ts:147
`fetchStageRoster` 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 })`. — lib/workbench/stage-freshness.ts:234
`resolveBytes` 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 })`. — lib/video-export-app/collect.ts:134
`renderFrame` 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 })`. — lib/video-export-app/collect.ts:300
`loadGsapSource` 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 })`. — lib/video-export-app/package-zip.ts:34
`loadVendorAsset` 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 })`. — lib/video-export-app/package-zip.ts:41
`writeCachedCourseThumbnail` 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 })`. — lib/utils/course-thumbnail-cache.ts:101
`listStages` 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 })`. — lib/utils/stage-storage.ts:967
`listFolders` 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 })`. — lib/utils/stage-storage.ts:1388
`createFolder` 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 })`. — lib/utils/stage-storage.ts:1405
`renameFolder` 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 })`. — lib/utils/stage-storage.ts:1421
`deleteFolder` 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 })`. — lib/utils/stage-storage.ts:1444
`setStageFolder` 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 })`. — lib/utils/stage-storage.ts:1462
`startRender` 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 })`. — lib/store/video-render.ts:171
`submit` 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 })`. — lib/store/video-render.ts:281
`poll` 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 })`. — lib/store/video-render.ts:298
`rewriteDataUrls` 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 })`. — lib/server/agent-runtime/import-pptx.ts:241
`fetchServerLearnerKey` 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 })`. — lib/persistence/bootstrap.ts:29
`call` 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 })`. — lib/pbl/v3/package-client.ts:83
`fetchAsBlob` 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 })`. — lib/media/media-orchestrator.ts:793
`pooledAudioBlob` 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 })`. — lib/media/resolve-audio-bytes.ts:47
`fetchBytes` 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 })`. — lib/media/resolve-stored-bytes.ts:192
`loadWorkflow` 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 })`. — lib/media/adapters/comfyui-image-adapter.ts:110
`apiRenameStage` 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 })`. — lib/live/server-api.ts:33
`readBlob` 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 })`. — lib/legacy-browser-storage/index.ts:295
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 758 is called with an argument built by `assignedImages.map((img) => img.id)` (line 758), 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. — REDACTED:758
`debug` at line 761 is called with an argument built by `visionImages.map((img) => img.id)` (line 761), 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. — REDACTED:761
`debug` at line 822 is called with an argument built by `imageElements.map((el) => ({ type : el.type, src : (el as Record < string, unknown >).src && String((el as Record < s...` (line 824), 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. — REDACTED:822
`debug` at line 831 is called with an argument built by `Object.keys(imageMapping)` (line 831), 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. — REDACTED:831
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.
`EVAL_SHAPE_PROSE_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — app/eval/whiteboard/page.tsx:103
`html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×8) — components/ai-elements/code-block.tsx:112, REDACTED:181, REDACTED:119, …
`darkHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — components/ai-elements/code-block.tsx:117
`segment.html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — REDACTED:84, REDACTED:29
`LEGACY_SHAPE_PROSE_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — components/slide-renderer/Editor/ScreenCanvas.tsx:75
`oldHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — REDACTED:307, REDACTED:300
`highlightedHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — REDACTED:318, REDACTED:311
`WHITEBOARD_SHAPE_PROSE_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — components/whiteboard/whiteboard-canvas.tsx:457
`html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×3) — lib/export/standalone-html/rich-text.ts:180, packages/@openmaic/editor/src/react/text/prosemirror/document.ts:14, packages/@openmaic/editor/src/react/text/prosemirror/document.ts:20
`input.html` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:125
`escapeHtml(assetUrl(scene.base.assetRef))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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. — lib/video-export/emit-hyperframes/index.ts:270
`escapeHtml(assetUrl(v.assetRef!))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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. — lib/video-export/emit-hyperframes/index.ts:663
`escapeHtml(assetUrl(seg.audio.assetRef!))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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. — lib/video-export/emit-hyperframes/index.ts:675
`EDITOR_REACT_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/@openmaic/editor/src/react/EditableSlideCanvas.tsx:609
`cell.text` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:313
`EDITING_UI_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/@openmaic/editor/src/ui/EditableSlideCanvasWithUI.tsx:146
`rendered.html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/@openmaic/editor/src/ui/latex/LatexEditorDialog.tsx:96
`cellData.text` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:1154
`escapeHtmlAttr(runStyle.hlinkClick!)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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. — packages/@openmaic/importer/src/serializer/textSerializer.ts:1772
`href` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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. — packages/@openmaic/importer/src/serializer/textSerializer.ts:1809
`SLIDE_RENDERER_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/@openmaic/renderer/src/SlideCanvas.tsx:176
`string` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — packages/@openmaic/renderer/src/utils/inlineMath.ts:260, packages/@openmaic/renderer/src/utils/inlineMath.ts:265
`nonce` is text this program did not author, and it is written into a quoted attribute value through markup this function returns 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. (×2) — scripts/sandbox-preview-activity.mjs:222, scripts/sandbox-preview-activity.mjs:223
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.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×15) — scripts/assert-pg-contract-suites.mjs:212, render-service/src/capped-stream.ts:42, render-service/src/capped-stream.ts:63, …
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. (×25) — scripts/sandbox-preview-activity.mjs:126, render-service/src/chunk-executor.ts:239, render-service/src/chunk-executor.ts:290, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether 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.
12/13 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.8 `!` null assertions per 1k TypeScript source lines — 747 assertion(s) across the 419647 source line(s) of the 1939 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: lib/legacy-browser-import/digest.ts (44), lib/pbl/v3/report-share-image.ts (28), lib/server/pbl-v3/runtime.ts (26). 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 — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
D12 Dependency Hygiene — 39 observation(s) recorded · Dependency currency not established — registry.npmjs.org did not answer
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 8 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 19 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 42 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
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
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 — The runtime tier booted this repository's service, but crawled PUBLIC routes only — add a Playwright storageState (e.g. playwright/.auth/user.json) or a test auth-setup to crawl authenticated screens rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:5432: page.goto: net::ERR_EMPTY_RESPONSE at http://127.0.0.1:5432/
Call log:
- navigating to "http://127.0.0.1:5432/", waiting until "load"
ran the repo's playwright suite against the booted app but captured no surfaces (suite failed to install/run, or visited no pages) — see runtime diagnostics. This repository also has a user interface (447 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates) that the booted service does not serve, and this scan has no strategy that reaches it — so no WCAG success criterion was verified in a rendered page on this run. That is a gap in OUR tooling, not a finding about your application: nothing here says the interface is inaccessible. The static accessibility checks still ran.
AXS1 Runtime exposed surface — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no data at rest for these controls to protect. If it does persist personal data (through a hosted backend configured outside this repository, for instance), the controls belong to wherever that data is stored.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a hosted backend configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound. If it does (through a hosted backend configured outside this repository, for instance), the limit belongs wherever that data is stored.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over. If it does (through a hosted backend configured outside this repository, for instance), the rights are served wherever that data is stored.
D11 Test Reliability — Test reliability not included
D14 License Compliance — Not scored — this repository's 1484 shipped npm package(s) were resolved from its committed lockfile, but registry.npmjs.org could not be asked for the licence of 177 of them (registry returned 429), and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
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 — API consistency is measured on C# only; the exposed TypeScript surface was not measured.
D25 ADR Conformance — no ADRs to check
D27 Navigability — symbol resolution incomplete — navigability not assessed
D32 Data Compliance (PII/GDPR) — 65 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.
D4 Code Duplication — This repository's production source (.ts, .tsx) is not read by D4's token comparison, which compares .NET source: duplication in it is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream. Not scored here — read the R10 card for this repository's duplication.
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 — JavaScript/TypeScript suite
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 1 domain event(s); its domain events are published by services or handlers — no domain entity raises one; a Domain/Aggregates/ValueObjects layer; a domain structure with no aggregate, domain event or strongly-typed id in it: a CRUD / clean-architecture model, measured but not claimed as DDD; a top-level examples/ tree: a library or framework whose examples are its consumers — these types are building blocks, not a domain
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
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `vitest --coverage --coverage.reporter=lcovonly`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for tinybench, mitata, benchmark.js, benny or vitest `bench(...)` calls in files that import them (or `*.bench.*` files), or one of those in a REDACTED, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
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.
X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. TypeScript/JavaScript runs every callback on the one thread that owns its objects: a callback runs only when the body waiting on it has yielded, never alongside it, and a worker thread receives a COPY of what it is sent. A SharedArrayBuffer carries raw bytes, never an Array, Map or Set, so no collection is reachable from two threads at once. Not a gap in the analyzer and not a finding about your code.
X27 Collection changed while being enumerated — Not applicable: this check looks for a loop whose body adds to or removes from the very collection the loop is walking, invalidating the enumerator it holds, and in this repository's languages that cannot happen. JavaScript and TypeScript have no iterator that a change can invalidate: an `Array` is walked by index against its live length, and a `Map` or `Set` by the ECMAScript specification's live entry list, so a body that adds to, removes from or empties what it walks raises nothing — every loop form (`for…of`, `for…in`, `forEach`, `map`, `filter`, `reduce`, `entries()`) on every built-in collection (`Array`, `Map`, `Set`, plain objects, `URLSearchParams`, `Headers`, `FormData`) runs to completion. Such a loop can still skip an element or never end, which is a different defect and not the one this check asks about. 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.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×25
Click handler on a non-interactive <div> app/page.tsx:1774— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> app/page.tsx:1818— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> app/page.tsx:1827— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/agent/agent-bar.tsx:777— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/canvas/canvas-area.tsx:345— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/canvas/canvas-area.tsx:352— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/canvas/canvas-area.tsx:362— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/discovery/folder-card.tsx:305— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/edit/ActionsBar/ActionPicker.tsx:60— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/edit/ActionsBar/ActionsBar.tsx:864— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/edit/AgentsView/AgentRosterPanel.tsx:59— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/edit/surfaces/slide/ElementPickLayer.tsx:451— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/generation/generation-toolbar.tsx:321— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/roundtable/index.tsx:835— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/roundtable/index.tsx:1522— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/roundtable/index.tsx:1778— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/roundtable/index.tsx:2269— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> components/roundtable/presentation-speech-overlay.tsx:134— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/roundtable/presentation-speech-overlay.tsx:164— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/roundtable/presentation-speech-overlay.tsx:264— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/scene-renderers/pbl/v3/conversation-scroll.tsx:54— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> REDACTED:591— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/stage/scene-sidebar.tsx:159— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/stage/scene-sidebar.tsx:352— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> components/stage/scene-sidebar.tsx:472— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· <textarea> without a programmatic label · ×14
<textarea> without a programmatic label components/edit/ActionsBar/ActionsBar.tsx:652— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/edit/ActionsBar/ActionsBar.tsx:750— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/edit/ActionsBar/ActionsBar.tsx:763— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/edit/AgentsView/AgentRosterPanel.tsx:201— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/generation/outlines-editor.tsx:606— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/generation/outlines-editor.tsx:651— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/generation/outlines-editor.tsx:1355— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/generation/outlines-editor.tsx:1371— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/roundtable/index.tsx:904— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/roundtable/index.tsx:1456— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/scene-renderers/pbl/v2/chat.tsx:689— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/scene-renderers/pbl/v2/submission.tsx:1280— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label components/scene-renderers/quiz-renderer.tsx:65— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label REDACTED:446— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
AC2 · Forms & labels· <input> without a programmatic label · ×10
<input> without a programmatic label app/page.tsx:1855— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label app/page.tsx:2237— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label components/access-code-modal.tsx:133— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label components/canvas/canvas-toolbar.tsx:234— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label components/discovery/folder-card.tsx:513— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label components/discovery/folder-dialogs.tsx:111— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label components/generation/outlines-editor.tsx:992— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label components/generation/outlines-editor.tsx:1217— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label components/generation/outlines-editor.tsx:1340— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label components/generation/outlines-editor.tsx:1407— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
Boundary-crossing change coupling: agent-bar.tsx ↔ use-discussion-tts.ts components/agent/agent-bar.tsx:1— `components/agent/agent-bar.tsx` (context components) and `lib/hooks/use-discussion-tts.ts` (context hooks) sit in DIFFERENT parts of the tree yet change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `54c76bf9` fix(audio): follow the interface locale for default speech languages …; `e83db6a5` fix(agents): persist AgentBar voice picks and mode/selection across r…; `d7c0d80a` feat(tts): per-agent auto-voice quality + register-once timbre stabil… — run `git show` on any of them.
Boundary-crossing change coupling: page.tsx ↔ agent-bar.tsx app/generation-preview/page.tsx:1— `app/generation-preview/page.tsx` (context generation-preview) and `components/agent/agent-bar.tsx` (context components) sit in DIFFERENT parts of the tree yet change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `e83db6a5` fix(agents): persist AgentBar voice picks and mode/selection across r…; `d7c0d80a` feat(tts): per-agent auto-voice quality + register-once timbre stabil…; `3e1e9f08` feat(tts): unify provider-enablement model, default browser-native of… — run `git show` on any of them.
Boundary-crossing change coupling: REDACTED ↔ settings.ts components/settings/index.tsx:1— `components/settings/index.tsx` (context components) and `lib/store/settings.ts` (context store) sit in DIFFERENT parts of the tree yet change together 61% of the time (14 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `98904c1c` fix(providers): three silent-behavior fixes from the provider audit (…; `a2886af9` Added ComfyUi to has Image Provider (#850); `07115dff` feat(asr): add Azure STT (Fast Transcription) provider (#175) — run `git show` on any of them.
Boundary-crossing change coupling: REDACTED ↔ types.ts components/settings/index.tsx:1— `components/settings/index.tsx` (context components) and `lib/audio/types.ts` (context audio) sit in DIFFERENT parts of the tree yet 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 — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `07115dff` feat(asr): add Azure STT (Fast Transcription) provider (#175); `5e12ad89` [codex] add VoxCPM2 TTS provider (#496); `9a0060e2` feat(audio): add custom OpenAI-compatible TTS/ASR provider support (#… — run `git show` on any of them.
Boundary-crossing change coupling: page.tsx ↔ use-discussion-tts.ts app/generation-preview/page.tsx:1— `app/generation-preview/page.tsx` (context generation-preview) and `lib/hooks/use-discussion-tts.ts` (context hooks) sit in DIFFERENT parts of the tree yet change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `e83db6a5` fix(agents): persist AgentBar voice picks and mode/selection across r…; `d7c0d80a` feat(tts): per-agent auto-voice quality + register-once timbre stabil…; `3e1e9f08` feat(tts): unify provider-enablement model, default browser-native of… — run `git show` on any of them.
Boundary-crossing change coupling: tts-settings.tsx ↔ tts-providers.ts components/settings/tts-settings.tsx:1— `components/settings/tts-settings.tsx` (context components) and `lib/audio/tts-providers.ts` (context audio) sit in DIFFERENT parts of the tree yet change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `c72a64b4` feat(tts): add Google Gemini TTS provider (Interactions API) (#1687); `5e12ad89` [codex] add VoxCPM2 TTS provider (#496); `9a0060e2` feat(audio): add custom OpenAI-compatible TTS/ASR provider support (#… — run `git show` on any of them.
Boundary-crossing change coupling: REDACTED ↔ constants.ts components/settings/index.tsx:1— `components/settings/index.tsx` (context components) and `lib/audio/constants.ts` (context audio) sit in DIFFERENT parts of the tree yet change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `07115dff` feat(asr): add Azure STT (Fast Transcription) provider (#175); `5e12ad89` [codex] add VoxCPM2 TTS provider (#496); `9a0060e2` feat(audio): add custom OpenAI-compatible TTS/ASR provider support (#… — run `git show` on any of them.
Boundary-crossing change coupling: page.tsx ↔ generation-toolbar.tsx app/generation-preview/page.tsx:1— `app/generation-preview/page.tsx` (context generation-preview) and `components/generation/generation-toolbar.tsx` (context components) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `5a3e81c4` feat(document): ingest uploaded sources into the asset pool and extra…; `c5692951` feat(web-search): add SearXNG provider support (#842); `baff0998` Feat/document bundles milestone 3 (#844) — run `git show` on any of them.
AC2 · Forms & labels· <button> with no accessible text · ×6
<button> with no accessible text app/page.tsx:1870— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text app/page.tsx:2273— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text components/chat/chat-area.tsx:315— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text components/roundtable/index.tsx:2011— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text components/roundtable/index.tsx:2160— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text components/roundtable/index.tsx:2250— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels· Custom control with no accessible name on <div> · ×5
Custom control with no accessible name on <div> components/edit/ActionsBar/ActionPicker.tsx:60— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
Custom control with no accessible name on <div> components/edit/surfaces/slide/ElementPickLayer.tsx:451— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
Custom control with no accessible name on <div> components/roundtable/index.tsx:835— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
Custom control with no accessible name on <div> components/roundtable/index.tsx:1522— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
Custom control with no accessible name on <div> components/roundtable/presentation-speech-overlay.tsx:264— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <div> · ×4
Double-click handler on a non-interactive <div> components/slide-renderer/Editor/Canvas/index.tsx:251— This <div> binds mousedown and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Double-click handler on a non-interactive <div> components/slide-renderer/components/element/ShapeElement/index.tsx:135— This <div> binds mousedown, touchstart and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Double-click handler on a non-interactive <div> components/slide-renderer/components/element/ShapeElement/index.tsx:185— This <div> binds mousedown, touchstart and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Double-click handler on a non-interactive <div> components/whiteboard/whiteboard-canvas.tsx:337— This <div> 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.
Import cycle (2 files) lib/server/pbl-v3/compilation.ts:5— lib/server/pbl-v3/compilation.ts → lib/server/pbl-v3/runtime.ts → lib/server/pbl-v3/compilation.ts (one verified cycle inside a mutually-dependent group of 3 files)
AC4 · Keyboard semantics· Double-click handler on a non-interactive <span> · ×3
Double-click handler on a non-interactive <span> components/edit/SlideNavRail/ThumbItem.tsx:197— This <span> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Double-click handler on a non-interactive <span> components/workbench/workspace/MaterialLibraryPage.tsx:1335— This <span> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
Double-click handler on a non-interactive <span> components/workbench/workspace/MaterialLibraryPage.tsx:1452— This <span> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
AC4 · Keyboard semantics· Click handler on a non-interactive <span> · ×2
Click handler on a non-interactive <span> app/page.tsx:1878— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <span> components/edit/ActionsBar/ActionsBar.tsx:964— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· <label> that labels no control · ×1
<label> that labels no control components/discovery/folder-dialogs.tsx:108— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC3 · Page structure· Document without a <title> · ×1
Document without a <title> packages/docs/components/root-shell.tsx:21— A page with no <title> gives no name in the tab, history or screen-reader page list. Declare it the way this router does — Next App Router `export const metadata = { title }`, React Router/Remix `export function meta`, TanStack Start `head`, or a Helmet/Head component.
AC4 · Keyboard semantics· Double-click handler on a non-interactive <p> · ×1
Double-click handler on a non-interactive <p> app/page.tsx:2259— This <p> binds double-click and nothing else. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×1
Hover-only interaction on <div> components/canvas/canvas-toolbar.tsx:199— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC4 · Keyboard semantics· Clickable role="separator" that no keyboard user can reach · ×1
Clickable role="separator" that no keyboard user can reach components/scene-renderers/pbl/v2/workspace.tsx:571— This <div> announces itself as a role="separator" and is operated by mousedown, but nothing can put focus on it: no tabIndex={0}, no key handler, and nothing in its scripts moves focus. A keyboard cannot produce a pointer drag, so the control cannot be operated at all (WCAG 2.1.1). Give it tabIndex={0}="0" and move it with the arrow keys in a key handler (with aria-valuenow for the position it holds).
AC4 · Keyboard semantics· Hover-only interaction on <span> · ×1
Hover-only interaction on <span> components/workbench/composer-pill.tsx:121— This <span> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
D10 · Test Quality· No assertions (empty test) · ×1
No assertions (empty test): skips title-state constraint locks and scans once validation is complete packages/@openmaic/storage/test/pg-agent-session-store.pg.test.ts:380— Test method has an empty body — it asserts nothing and exercises no code.
FunctionTooLong: use-chat-sessions.useChatSessions components/chat/use-chat-sessions.ts:517— FunctionTooLong — useChatSessions runs 1109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1009 over it, 11.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: workspace.PBLV3WorkspaceContent components/scene-renderers/pbl/v3/workspace.tsx:65— FunctionTooLong — PBLV3WorkspaceContent runs 1037 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 937 over it, 10.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: engine.executeClaimedRun lib/server/generation/run/engine.ts:400— FunctionTooLong — executeClaimedRun runs 1017 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 917 over it, 10.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: WorkspaceShell.WorkspaceShellController components/workbench/workspace/WorkspaceShell.tsx:187— FunctionTooLong — WorkspaceShellController runs 964 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 864 over it, 9.64× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: MaterialLibraryPage.MaterialLibraryPage components/workbench/workspace/MaterialLibraryPage.tsx:735— FunctionTooLong — MaterialLibraryPage runs 948 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 848 over it, 9.48× 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: runner.executeSession lib/server/agent-runtime/runner.ts:1043— FunctionTooLong — executeSession runs 893 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 793 over it, 8.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: runner-tools.teachingRunnerConfig lib/server/pbl-v3/runner-tools.ts:67— FunctionTooLong — teachingRunnerConfig runs 763 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 663 over it, 7.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: WorkbenchChat.WorkbenchChat components/workbench/WorkbenchChat.tsx:123— FunctionTooLong — WorkbenchChat runs 761 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 661 over it, 7.61× 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: tool-presentation.presentTool components/workbench/chat/tool-presentation.ts:286— FunctionTooLong — presentTool runs 613 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 513 over it, 6.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.
FunctionTooLong: use-application-preview.useApplicationPreview components/scene-renderers/pbl/v3/use-application-preview.ts:89— FunctionTooLong — useApplicationPreview runs 564 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 464 over it, 5.64× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: use-export-pptx.buildPptxBlob REDACTED:544— FunctionTooLong — buildPptxBlob runs 560 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 460 over it, 5.60× 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: workbench-panel.LearningWorkbenchPanel components/scene-renderers/pbl/v3/workbench-panel.tsx:51— FunctionTooLong — LearningWorkbenchPanel runs 526 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 426 over it, 5.26× 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: project-report.ProjectReport components/scene-renderers/pbl/v3/project-report.tsx:28— FunctionTooLong — ProjectReport runs 515 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 415 over it, 5.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: session-store.foldEvent lib/workbench/session-store.ts:940— FunctionTooLong — foldEvent runs 491 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 391 over it, 4.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ImageClipHandler.ImageClipHandler components/slide-renderer/components/element/ImageElement/ImageClipHandler.tsx:22— FunctionTooLong — ImageClipHandler runs 479 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 379 over it, 4.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: textSerializer.renderTextBody packages/@openmaic/importer/src/serializer/textSerializer.ts:1066— FunctionTooLong — renderTextBody runs 474 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 374 over it, 4.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: token-plan-settings.TokenPlanSettings components/settings/token-plan-settings.tsx:187— FunctionTooLong — TokenPlanSettings runs 460 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 360 over it, 4.60× 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: material-tools.buildMaterialTools lib/server/agent-runtime/material-tools.ts:555— FunctionTooLong — buildMaterialTools 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: scene-sidebar.SceneSidebar components/stage/scene-sidebar.tsx:37— FunctionTooLong — SceneSidebar runs 451 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 351 over it, 4.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: report-share-image.renderReportShareImage lib/pbl/v3/report-share-image.ts:23— FunctionTooLong — renderReportShareImage runs 447 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 347 over it, 4.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: report.buildLearningEvidence lib/server/pbl-v3/report.ts:30— FunctionTooLong — buildLearningEvidence runs 443 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 343 over it, 4.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: page.GenerationPreviewContent app/generation-preview/page.tsx:60— FunctionTooLong — GenerationPreviewContent runs 421 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 321 over it, 4.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: folder-card.FolderCard components/discovery/folder-card.tsx:42— FunctionTooLong — FolderCard runs 416 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 316 over it, 4.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: model-map.ModelMap components/settings/models/model-map.tsx:137— FunctionTooLong — ModelMap runs 415 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 315 over it, 4.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: useScaleElement.useScaleElement components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:120— FunctionTooLong — useScaleElement 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.
Hotspot: components/edit/PlaybackChromeRoot.tsx components/edit/PlaybackChromeRoot.tsx:131— components/edit/PlaybackChromeRoot.tsx changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 288 in PlaybackChromeRoot.PlaybackChromeRoot at line 131. 5 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/edit/PlaybackChromeRoot.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: lib/server/agent-runtime/runner.ts lib/server/agent-runtime/runner.ts:1043— lib/server/agent-runtime/runner.ts changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 240 in runner.executeSession at line 1043. 7 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/agent-runtime/runner.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: app/page.tsx app/page.tsx:161— app/page.tsx changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 193 in page.HomePage at line 161. 1 of those changes was a fix/bug commit, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- app/page.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: components/workbench/workspace/WorkspaceShell.tsx components/workbench/workspace/WorkspaceShell.tsx:187— components/workbench/workspace/WorkspaceShell.tsx changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 207 in WorkspaceShell.WorkspaceShellController at line 187. 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-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/workbench/workspace/WorkspaceShell.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:544— REDACTED changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 187 in use-export-pptx.buildPptxBlob at line 544. 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-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/ai/providers.ts lib/ai/providers.ts:1747— lib/ai/providers.ts changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 83 in providers.getCompatThinkingBodyParams at line 1747. 7 of those changes were fix/bug commits, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/ai/providers.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: components/roundtable/index.tsx components/roundtable/index.tsx:156— components/roundtable/index.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 328 in index.Roundtable at line 156. 1 of those changes was a fix/bug commit, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/roundtable/index.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: lib/workbench/session-store.ts lib/workbench/session-store.ts:940— lib/workbench/session-store.ts changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 160 in session-store.foldEvent at line 940. 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-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/workbench/session-store.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: packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:414— packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 226 in transformParsedToSlides.transformParsedToSlides at line 414. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.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: lib/store/stage.ts lib/store/stage.ts:740— lib/store/stage.ts changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in stage.useStageStoreBase at line 740. 8 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/store/stage.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: app/api/chat/pi/route.ts app/api/chat/pi/route.ts:65— app/api/chat/pi/route.ts changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in route.chat at line 65. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- app/api/chat/pi/route.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: components/workbench/WorkbenchChat.tsx components/workbench/WorkbenchChat.tsx:123— components/workbench/WorkbenchChat.tsx changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 149 in WorkbenchChat.WorkbenchChat at line 123. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/workbench/WorkbenchChat.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: packages/@openmaic/importer/src/serializer/textSerializer.ts packages/@openmaic/importer/src/serializer/textSerializer.ts:1066— packages/@openmaic/importer/src/serializer/textSerializer.ts changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 207 in textSerializer.renderTextBody at line 1066. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- packages/@openmaic/importer/src/serializer/textSerializer.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: components/workbench/chat/tool-presentation.ts components/workbench/chat/tool-presentation.ts:286— components/workbench/chat/tool-presentation.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 189 in tool-presentation.presentTool at line 286. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/workbench/chat/tool-presentation.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: components/stage.tsx components/stage.tsx:52— components/stage.tsx changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in stage.Stage at line 52. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/stage.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: lib/server/generation/run/engine.ts lib/server/generation/run/engine.ts:400— lib/server/generation/run/engine.ts changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 224 in engine.executeClaimedRun at line 400. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/generation/run/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: lib/workbench/use-workbench-session.ts lib/workbench/use-workbench-session.ts:444— lib/workbench/use-workbench-session.ts changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in use-workbench-session.useStageFreshnessSync at line 444. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/workbench/use-workbench-session.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: render-service/src/main.ts render-service/src/main.ts:270— render-service/src/main.ts changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in main.createApp at line 270. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- render-service/src/main.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: lib/chat/pi/tools/call-agent.ts lib/chat/pi/tools/call-agent.ts:587— lib/chat/pi/tools/call-agent.ts changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in call-agent.buildCallAgentTool.execute at line 587. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/chat/pi/tools/call-agent.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: lib/server/agent-runtime/material-tools.ts lib/server/agent-runtime/material-tools.ts:555— lib/server/agent-runtime/material-tools.ts changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in material-tools.buildMaterialTools at line 555. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/agent-runtime/material-tools.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: components/classroom/ClassroomSurface.tsx components/classroom/ClassroomSurface.tsx:70— components/classroom/ClassroomSurface.tsx changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in ClassroomSurface.ClassroomSurfaceContent at line 70. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- components/classroom/ClassroomSurface.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: lib/server/agent-runtime/generation-tools.ts lib/server/agent-runtime/generation-tools.ts:274— lib/server/agent-runtime/generation-tools.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in generation-tools.buildGenerationTools at line 274. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/agent-runtime/generation-tools.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: REDACTED REDACTED:1270— REDACTED changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in scene-generator.generateWidgetContent at line 1270. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/playback/engine.ts lib/playback/engine.ts:576— lib/playback/engine.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in PlaybackEngine.processNext at line 576. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/playback/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: lib/audio/tts-providers.ts lib/audio/tts-providers.ts:1377— lib/audio/tts-providers.ts changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in tts-providers.generateDoubaoTTS at line 1377. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/audio/tts-providers.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.
FileTooLong: shapes/presets.ts packages/@openmaic/importer/src/shapes/presets.ts— FileTooLong — 5121 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4621 over it, 10.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: app/page.tsx app/page.tsx— FileTooLong — 1957 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1457 over it, 3.91× 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: roundtable/index.tsx components/roundtable/index.tsx— FileTooLong — 1953 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1453 over it, 3.91× 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: ai/providers.ts lib/ai/providers.ts— FileTooLong — 1950 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1450 over it, 3.90× 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: workspace/WorkspaceRail.tsx components/workbench/workspace/WorkspaceRail.tsx— FileTooLong — 1735 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1235 over it, 3.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: agent-runtime/runner.ts lib/server/agent-runtime/runner.ts— FileTooLong — 1702 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1202 over it, 3.40× 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: workspace/MaterialLibraryPage.tsx components/workbench/workspace/MaterialLibraryPage.tsx— FileTooLong — 1489 significant lines (blank, comment-only and punctuation-only lines excluded), about 64% of them inside a single declaration: MaterialLibraryPage (735-1944). The bar is 500 significant lines; this is 989 over it, 2.98× 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: chat/use-chat-sessions.ts components/chat/use-chat-sessions.ts— FileTooLong — 1488 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: useChatSessions (517-2177). The bar is 500 significant lines; this is 988 over it, 2.98× 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: edit/PlaybackChromeRoot.tsx components/edit/PlaybackChromeRoot.tsx— FileTooLong — 1480 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 980 over it, 2.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: agent-session/pg.ts packages/@openmaic/storage/src/agent-session/pg.ts— FileTooLong — 1429 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: PgAgentSessionStore (504-1792). The bar is 500 significant lines; this is 929 over it, 2.86× 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: run/engine.ts lib/server/generation/run/engine.ts— FileTooLong — 1266 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: executeClaimedRun (400-1879). The bar is 500 significant lines; this is 766 over it, 2.53× 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: generation/outlines-editor.tsx components/generation/outlines-editor.tsx— FileTooLong — 1248 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 748 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: serializer/textSerializer.ts packages/@openmaic/importer/src/serializer/textSerializer.ts— FileTooLong — 1243 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 743 over it, 2.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1237 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 737 over it, 2.47× 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: pi/element-reference.ts lib/chat/pi/element-reference.ts— FileTooLong — 1234 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 734 over it, 2.47× 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: workspace/WorkspaceShell.tsx components/workbench/workspace/WorkspaceShell.tsx— FileTooLong — 1193 significant lines (blank, comment-only and punctuation-only lines excluded), about 81% of them inside a single declaration: WorkspaceShellController (187-1855). The bar is 500 significant lines; this is 693 over it, 2.39× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: workbench/session-store.ts lib/workbench/session-store.ts— FileTooLong — 1169 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 669 over it, 2.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: agents/instructor.ts lib/pbl/v2/agents/instructor.ts— FileTooLong — 1153 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 653 over it, 2.31× 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: audio/constants.ts lib/audio/constants.ts— FileTooLong — 1140 significant lines (blank, comment-only and punctuation-only lines excluded), about 70% of them inside a single declaration: TTS_PROVIDERS (176-1356). The bar is 500 significant lines; this is 640 over it, 2.28× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: import-pipeline/transformParsedToSlides.ts packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts— FileTooLong — 1136 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 636 over it, 2.27× 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: ActionsBar/ActionsBar.tsx components/edit/ActionsBar/ActionsBar.tsx— FileTooLong — 1122 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 622 over it, 2.24× 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: pbl-v3/runtime.ts lib/server/pbl-v3/runtime.ts— FileTooLong — 1116 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 616 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: run/store.ts lib/server/generation/run/store.ts— FileTooLong — 1108 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 608 over it, 2.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: v3/workspace.tsx components/scene-renderers/pbl/v3/workspace.tsx— FileTooLong — 1103 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: PBLV3WorkspaceContent (65-1250). The bar is 500 significant lines; this is 603 over it, 2.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: REDACTED REDACTED— FileTooLong — 1080 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 580 over it, 2.16× 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.
Outbound HTTP without resilience app/api/proxy-media/route.ts:54— `fetch(` 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 components/workbench/workspace/workspace-folder-seam.ts:29— `fetch(` 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 lib/ai/providers.ts:2184— `fetchImpl(` 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 lib/ai/providers.ts:2191— `fetchImpl(` 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 lib/ai/providers.ts:2194— `fetchImpl(` 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 lib/ai/providers.ts:2203— `fetchImpl(` 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 lib/audio/voice-registration-client.ts:65— `fetch(` 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 lib/audio/voice-registration-client.ts:90— `fetch(` 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 lib/audio/voice-registration-client.ts:182— `fetch(` 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 lib/classroom/stage-meta-client.ts:42— `fetchImpl(` 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 lib/export/standalone-html/build-standalone-html.ts:528— `fetch(` 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 lib/generation-run-client/api.ts:65— `fetch(` 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 lib/generation-run-client/api.ts:111— `fetch(` 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 lib/generation-run-client/api.ts:151— `fetch(` 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 lib/generation-run-client/api.ts:171— `fetch(` 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 lib/generation-run-client/api.ts:286— `fetch(` 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 lib/generation-run-client/api.ts:313— `fetch(` 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 lib/legacy-browser-import/agents-import.ts:141— `fetchImpl(` 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 lib/legacy-browser-import/agents-import.ts:282— `fetch(` 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 lib/legacy-browser-import/agents-import.ts:298— `fetchImpl(` 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 lib/legacy-browser-import/model-settings-import.ts:73— `fetchImpl(` 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 lib/legacy-browser-import/model-settings-import.ts:253— `fetch(` 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 lib/legacy-browser-import/model-settings-import.ts:258— `fetchImpl(` 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 lib/legacy-browser-import/server.ts:177— `fetch(` 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 lib/legacy-browser-import/server.ts:181— `fetchImpl(` 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.
Swallowed exception (empty catch) scripts/assert-pg-contract-suites.mjs:212— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) scripts/sandbox-preview-activity.mjs:126— 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) render-service/src/capped-stream.ts:42— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/capped-stream.ts:63— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/capped-stream.ts:77— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/chunk-executor.ts:239— 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) render-service/src/chunk-executor.ts:290— 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) render-service/src/chunk-executor.ts:615— 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) render-service/src/main.ts:655— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/preview-renderer.ts:402— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/preview-renderer.ts:403— 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) render-service/src/preview-renderer.ts:459— 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) render-service/src/preview-renderer.ts:468— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/preview-renderer.ts:492— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/render-coordinator.ts:453— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/render-coordinator.ts:480— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/render-coordinator.ts:481— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/render-coordinator.ts:482— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/render-coordinator.ts:483— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/resource-main.ts:120— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) render-service/src/resource-stage-copy.mjs:122— 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) render-service/src/resource-systemd-runner.mjs:375— 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) render-service/src/resource-systemd-runner.mjs:475— 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) render-service/src/resource-task-runner.mjs:202— 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) render-service/src/resource-task-runner.mjs:209— 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 more in this group — see findings.md.
X2 · Cancellation propagation· Async function without AbortSignal · ×39
Async function without AbortSignal: aiCall scripts/generation-node-smoke.mjs:42— `aiCall` 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: probe scripts/probe-mineru-cloud.mjs:44— `probe` 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: worker packages/@openmaic/importer/src/serializer/mathSerializer.ts:325— `worker` 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: dataUrlToBlob packages/@openmaic/importer/src/import-pipeline/index.ts:188— `dataUrlToBlob` 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: parseElements packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:498— `parseElements` 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: probeFirstScene lib/workbench/first-scene-ready.ts:12— `probeFirstScene` 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: libraryWrite lib/workbench/material-library-client.ts:342— `libraryWrite` 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: libraryDelete lib/workbench/material-library-client.ts:390— `libraryDelete` 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: createWorkbenchSession lib/workbench/session-store.ts:1975— `createWorkbenchSession` 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: renameWorkbenchSession lib/workbench/session-store.ts:2042— `renameWorkbenchSession` 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: cancelWorkbenchSession lib/workbench/session-store.ts:2067— `cancelWorkbenchSession` 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: postWorkbenchMessage lib/workbench/session-store.ts:2136— `postWorkbenchMessage` 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: uploadWorkbenchMaterial lib/workbench/session-store.ts:2276— `uploadWorkbenchMaterial` 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: fetchStageManifest lib/workbench/stage-freshness.ts:107— `fetchStageManifest` 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: fetchSceneChunk lib/workbench/stage-freshness.ts:147— `fetchSceneChunk` 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: fetchStageRoster lib/workbench/stage-freshness.ts:234— `fetchStageRoster` 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: resolveBytes lib/video-export-app/collect.ts:134— `resolveBytes` 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: renderFrame lib/video-export-app/collect.ts:300— `renderFrame` 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: loadGsapSource lib/video-export-app/package-zip.ts:34— `loadGsapSource` 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: loadVendorAsset lib/video-export-app/package-zip.ts:41— `loadVendorAsset` 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: writeCachedCourseThumbnail lib/utils/course-thumbnail-cache.ts:101— `writeCachedCourseThumbnail` 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: listStages lib/utils/stage-storage.ts:967— `listStages` 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: listFolders lib/utils/stage-storage.ts:1388— `listFolders` 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: createFolder lib/utils/stage-storage.ts:1405— `createFolder` 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: renameFolder lib/utils/stage-storage.ts:1421— `renameFolder` 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 })`.
+ 14 more in this group — see findings.md.
D30 · Dependency Vulnerabilities· Medium CVE · ×38
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 13 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×38
No test reaches this file components/ai-elements/prompt-input.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 eval/pbl-v2-planner/runner.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 packages/@openmaic/generation/src/pbl/types.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file app/sandbox-lab/sandbox-lab.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 components/ai-elements/message.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 components/ai-elements/context.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 scripts/assert-pg-contract-suites.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 components/ai-elements/open-in-chat.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 eval/whiteboard-shapes/runner.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 components/ui/combobox.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 components/ai-elements/inline-citation.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 eval/pbl-v2-planner/compare-html.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 components/ai-elements/web-preview.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 components/ai-elements/queue.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 components/ui/carousel.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 components/user-profile.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 components/ui/field.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 scripts/generate-video-export-noto-script-fonts.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 packages/@openmaic/importer/src/export/serializePresentation.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 components/ai-elements/chain-of-thought.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 components/ui/command.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 components/settings/agent-settings.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 components/ai-elements/code-block.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 eval/outline-language/runner.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 components/ai-elements/reasoning.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.
+ 13 more in this group — see findings.md.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×37
Untrusted text written into markup unescaped app/eval/whiteboard/page.tsx:103— `EVAL_SHAPE_PROSE_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped components/ai-elements/code-block.tsx:112— `html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped components/ai-elements/code-block.tsx:117— `darkHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:84— `segment.html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped components/slide-renderer/Editor/ScreenCanvas.tsx:75— `LEGACY_SHAPE_PROSE_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:181— `html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:307— `oldHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:318— `highlightedHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:119— `html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:102— `html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped components/whiteboard/whiteboard-canvas.tsx:457— `WHITEBOARD_SHAPE_PROSE_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped lib/export/standalone-html/rich-text.ts:180— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:29— `segment.html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:125— `input.html` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` 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 lib/video-export/emit-hyperframes/index.ts:270— `escapeHtml(assetUrl(scene.base.assetRef))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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.
Untrusted text written into markup unescaped lib/video-export/emit-hyperframes/index.ts:663— `escapeHtml(assetUrl(v.assetRef!))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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.
Untrusted text written into markup unescaped lib/video-export/emit-hyperframes/index.ts:675— `escapeHtml(assetUrl(seg.audio.assetRef!))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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.
Untrusted text written into markup unescaped packages/@openmaic/editor/src/react/EditableSlideCanvas.tsx:609— `EDITOR_REACT_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:313— `cell.text` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/@openmaic/editor/src/react/text/prosemirror/document.ts:14— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/@openmaic/editor/src/react/text/prosemirror/document.ts:20— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/@openmaic/editor/src/ui/EditableSlideCanvasWithUI.tsx:146— `EDITING_UI_STYLES` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/@openmaic/editor/src/ui/latex/LatexEditorDialog.tsx:96— `rendered.html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:1154— `cellData.text` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped packages/@openmaic/importer/src/serializer/textSerializer.ts:1772— `escapeHtmlAttr(runStyle.hlinkClick!)` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup this function returns 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.
No assertions: keeps bigint cursors as decimal strings and compares beyond Number precision tests/workbench/owner-session-client.test.ts:281— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: reapplies events newer than the fetch cursor over a slow full snapshot tests/workbench/owner-session-client.test.ts:287— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: discards an old in-flight snapshot after owner movement advances the epoch tests/workbench/owner-session-client.test.ts:522— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: reclaims the event journal after a successful reconciliation tests/workbench/owner-session-client.test.ts:591— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: does not restart a pending fetch when an in-flight fetch settles after stop tests/workbench/owner-session-client.test.ts:670— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: closes the retired stream, opens a cursor-free replacement, and reconciles tests/workbench/owner-session-client.test.ts:726— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: handles resync_required in place by clearing journal, adopting max, and fetching once tests/workbench/owner-session-client.test.ts:774— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: does not initialize on degraded catch-up and initializes once on authoritative recovery tests/workbench/owner-session-client.test.ts:821— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: retries a failed full fetch when authoritative catch-up arrives tests/workbench/owner-session-client.test.ts:937— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: bounds the journal and converges through a forced authoritative fetch tests/workbench/owner-session-client.test.ts:966— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: resets cursor and journal when stopped tests/workbench/owner-session-client.test.ts:1036— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: typesets math rendered during parsing by %s tests/video-export/interactive-self-hosted.browser.test.ts:110— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: (unnamed test) tests/persistence/owner-materials.pg.test.ts:158— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: (unnamed test) tests/persistence/owner-materials.test.ts:471— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: TAction defaults to the standard Action union so the default Scene carries playback actions packages/@openmaic/dsl/test/stage.test.ts:171— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: skeleton-only consumers can still opt out of actions with Scene<never> packages/@openmaic/dsl/test/stage.test.ts:179— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: close() reaches the server e2e/tests/event-source-parity.spec.ts:217— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: persists always review preference from the outline editor e2e/tests/generation-flow.spec.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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: ${kind}: narration start/resume pauses media; media play pauses narration e2e/tests/iframe-media-coordination.spec.ts:159— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: fullscreen still clips at inner panels and at the fullscreen element itself e2e/tests/interactive-fullscreen-clipping.spec.ts:68— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: re-entering fullscreen after a resize follows the new viewport e2e/tests/interactive-fullscreen-host.spec.ts:145— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
Boundary violation [package:test-cross-package-internals] packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:5— packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:5 reaches past another workspace package's public entry into its internals with a relative path (../../../../renderer/src/elements/table/StaticTable) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:6— packages/@openmaic/editor/test/react/table/tableSpacing.test.tsx:6 reaches past another workspace package's public entry into its internals with a relative path (../../../../renderer/src/styles) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] packages/@openmaic/importer/test/shapeSerializer.flowChartConnector.test.ts:8— packages/@openmaic/importer/test/shapeSerializer.flowChartConnector.test.ts:8 reaches past another workspace package's public entry into its internals with a relative path (../../geometry/src/index) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:relative-cross-package] render-service/src/runtime-info.ts:43— render-service/src/runtime-info.ts:43 reaches into another package with a relative path (../node_modules/@hyperframes/producer/REDACTED) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/assert-pg-contract-suites.mjs:161— scripts/assert-pg-contract-suites.mjs:161 reaches into another package with a relative path (../packages/@openmaic/storage/REDACTED) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/sync-interactive-assets.mjs:6— scripts/sync-interactive-assets.mjs:6 reaches into another package with a relative path (../packages/@openmaic/generation/dist/interactive-libraries.js) — import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/agent-runtime/event-notify.pg.test.ts:24— tests/agent-runtime/event-notify.pg.test.ts:24 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/storage/src/agent-session/pg) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/agent-runtime/park-attempt-budget.pg.test.ts:5— tests/agent-runtime/park-attempt-budget.pg.test.ts:5 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/storage/src/agent-session/pg) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/agent-runtime/prior-run-record.pg.test.ts:4— tests/agent-runtime/prior-run-record.pg.test.ts:4 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/storage/src/agent-session/pg) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/export/pptx-inline-math.test.ts:17— tests/export/pptx-inline-math.test.ts:17 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/export/standalone-html-inline-math.test.ts:16— tests/export/standalone-html-inline-math.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/export/standalone-html-inline-math.test.ts:20— tests/export/standalone-html-inline-math.test.ts:20 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/utils/inlineMath) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/generation/interactive-observation-contract.test.ts:2— tests/generation/interactive-observation-contract.test.ts:2 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/generation/src/scene-generator) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/math/safe-math-render.test.ts:16— tests/math/safe-math-render.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/math/safe-math-render.test.ts:17— tests/math/safe-math-render.test.ts:17 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/ui/latex/latex-editor) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/quiz-answer-key.test.ts:8— tests/quiz-answer-key.test.ts:8 reaches past another workspace package's public entry into its internals with a relative path (../packages/@openmaic/generation/src/scene-generator) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/server/sanitize-scene-content-inline-math.test.ts:11— tests/server/sanitize-scene-content-inline-math.test.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/editor/src/react/text/prosemirror/document) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/slide-renderer/edit-elements-render-contract.test.ts:16— tests/slide-renderer/edit-elements-render-contract.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/image/useClipImage) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/slide-renderer/edit-elements-render-contract.test.ts:17— tests/slide-renderer/edit-elements-render-contract.test.ts:17 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/image/useFilter) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/slide-renderer/edit-elements-render-contract.test.ts:18— tests/slide-renderer/edit-elements-render-contract.test.ts:18 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/text/BaseTextElement) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:test-cross-package-internals] tests/slide-renderer/edit-elements-render-contract.test.ts:19— tests/slide-renderer/edit-elements-render-contract.test.ts:19 reaches past another workspace package's public entry into its internals with a relative path (../../packages/@openmaic/renderer/src/elements/table/StaticTable) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Focus outline removed inline app/page.tsx:960— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline app/page.tsx:1855— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline app/page.tsx:2237— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/canvas/canvas-toolbar.tsx:269— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/ActionsBar/ActionsBar.tsx:652— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/ActionsBar/ActionsBar.tsx:750— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/ActionsBar/ActionsBar.tsx:763— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/AgentsView/AgentRosterPanel.tsx:127— <span> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/SlideNavRail/InsertionZone.tsx:34— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/SlideNavRail/ThumbItem.tsx:113— <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/edit/SlideNavRail/ThumbItem.tsx:171— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/generation/outlines-editor.tsx:819— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/generation/outlines-editor.tsx:1217— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/generation/outlines-editor.tsx:1340— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/generation/outlines-editor.tsx:1355— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/generation/outlines-editor.tsx:1371— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/generation/outlines-editor.tsx:1407— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline components/roundtable/index.tsx:904— <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
D10 · Test Quality· Fixed-sleep synchronisation · ×15
Fixed-sleep synchronisation: fetches sources for the query and conversation while open, and again on a library change tests/workbench/material-mention.test.ts:518— This test starts work it did not wait for (`mounted`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 200))` — 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: offers nothing, and fetches nothing, while materials are disabled tests/workbench/material-mention.test.ts:565— This test starts work it did not wait for (`mounted`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 200))` — 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: a worker that died is taken over from its last checkpoint, and the stale worker is fenced tests/server/generation-runs.pg.test.ts:1042— This test starts work it did not wait for (`executionA`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 10))` — 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: aborts a local execution once its heartbeat finds the lease gone tests/server/generation-runs.pg.test.ts:3815— This test starts work it did not wait for (`execution`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 5))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: a second create of one id waits for the first and saves as an update, never as reserved tests/persistence/host-create-hooks.pg.test.ts:163— This test starts work it did not wait for (`first`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 200))` — 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: does not let a retry overwrite a slot a pending reload shows was set meanwhile tests/model-settings/client.test.ts:393— This test starts work it did not wait for (`reload`, still running when the sleep starts) and then orders itself against it with `new Promise((settle) => setTimeout(settle, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: waits for an in-flight action before flushing later actions and done tests/lib/buffer/stream-buffer.test.ts:201— This test starts work it did not wait for (`flushing`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: coalesces concurrent flush calls so each action executes once tests/lib/buffer/stream-buffer.test.ts:270— This test starts work it did not wait for (`firstFlush`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: stops flush callbacks after shutdown during an awaited action tests/lib/buffer/stream-buffer.test.ts:323— This test starts work it did not wait for (`flushing`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: waits for that run and retries when the gate refused it tests/legacy-browser-import/import.test.ts:636— This test starts work it did not wait for (`tabA`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: keeps the backoff that run recorded for any other reason tests/legacy-browser-import/import.test.ts:660— This test starts work it did not wait for (`tabA`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Fixed-sleep synchronisation: enforces the per-identity cap while allowing another identity render-service/test/preview-route.test.ts:451— This test starts work it did not wait for (`app`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 10))` — 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: never lets more than the permit count into the buffering+extraction section render-service/test/render-route.test.ts:184— This test starts work it did not wait for (`inFlight`, still running when the sleep starts) and then orders itself against it with `new Promise((r) => setTimeout(r, 50))` — 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: a caller transaction holding a spent pin open past its deadline does not park the collector packages/@openmaic/storage/test/pg-asset-store.pg.test.ts:674— This test starts work it did not wait for (`registry`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 400))` — 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: a renewal in flight is waited for, so the collector never judges the deadline it replaces packages/@openmaic/storage/test/pg-asset-store.pg.test.ts:716— This test starts work it did not wait for (`putting`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 1_500))` — 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.
Repeated repair: packages/@openmaic/storage/src/agent-session/pg.ts packages/@openmaic/storage/src/agent-session/pg.ts:1139— packages/@openmaic/storage/src/agent-session/pg.ts changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is PgAgentSessionStore.postUserMessage at line 1139), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent): recover conversations after personal Skill deletion (#2086)”; “fix(storage): sanitize agent session descriptive text (#1504)”; “fix(storage): keep jsonb writes valid when model output contains NUL or lone surrogates (#1499)”; “fix(workbench): persist Pro conversation titles (#1273)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- packages/@openmaic/storage/src/agent-session/pg.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: lib/persistence/owner-materials.ts lib/persistence/owner-materials.ts:777— lib/persistence/owner-materials.ts changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is owner-materials.deleteUploadingRow at line 777), 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(materials): explain a PDF refused for too many pages instead of a bare 422 (#2085)”; “fix(materials): recognise JPEG 2000 MinerU images and reuse results that only hit limits (#2079)”; “fix(pdf): inline image URLs returned by MinerU gateways instead of decoding them as base64 (#2076)”; “fix(security): enforce model authorization for server-managed providers (#1879)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/persistence/owner-materials.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: lib/server/material-extraction/extract.ts lib/server/material-extraction/extract.ts:251— lib/server/material-extraction/extract.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 14 (its worst body is extract.runSourceExtraction at line 251), 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(materials): explain a PDF refused for too many pages instead of a bare 422 (#2085)”; “fix(pdf): inline image URLs returned by MinerU gateways instead of decoding them as base64 (#2076)”; “fix(security): enforce model authorization for server-managed providers (#1879)”; “fix(providers): pin caller-chosen provider requests and keep upstream detail out of errors (#1704)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/material-extraction/extract.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: lib/server/llm-error-response.ts lib/server/llm-error-response.ts:89— lib/server/llm-error-response.ts changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is llm-error-response.isUpstreamQuotaExhausted 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(pbl-v3): keep standalone previews available across teaching steps (#2163)”; “fix(generation): stop retrying explicit provider quota refusals (#1861)”; “fix(generation): explain exhausted plan quotas (#1831)”; “fix(providers): pin caller-chosen provider requests and keep upstream detail out of errors (#1704)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/llm-error-response.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: lib/server/generation/run/failure-code.ts lib/server/generation/run/failure-code.ts:28— lib/server/generation/run/failure-code.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is failure-code.runFailureCode at line 28), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(audio): migrate Qwen voice cloning to CosyVoice (#1949)”; “fix(agent): cap parallel generate_tts calls and keep failure reasons (#1983)”; “fix(security): enforce model authorization for server-managed providers (#1879)”; “fix(generation): explain exhausted plan quotas (#1831)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/generation/run/failure-code.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: render-service/src/preview-renderer.ts render-service/src/preview-renderer.ts:531— render-service/src/preview-renderer.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is ChromiumPreviewRenderer.render at line 531), 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: typeset inline math in render-service previews and export it cleanly to PPTX (#1904)”; “fix(render): bound preview capacity through launch cleanup (#1836)”; “fix(render-service): contain untrusted HTML with a network policy on preview and render (#1512)”; “fix(render): keep preview browser evaluation self-contained (#1421)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- render-service/src/preview-renderer.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: lib/server/agent-runtime/fetch-url.ts lib/server/agent-runtime/fetch-url.ts:63— lib/server/agent-runtime/fetch-url.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is fetch-url.fetchAndExtractUrl at line 63), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent-runtime): unify capability-dependent tool registration (#2118)”; “fix(providers): pin caller-chosen provider requests and keep upstream detail out of errors (#1704)”; “fix(proxy-media): connect only to addresses the SSRF guard validated (#1488)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/agent-runtime/fetch-url.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: lib/audio/voice-registration.ts lib/audio/voice-registration.ts:84— lib/audio/voice-registration.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is voice-registration.getVoiceRegistrationAdapter at line 84), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(audio): migrate Qwen voice cloning to CosyVoice (#1949)”; “fix(providers): pin caller-chosen provider requests and keep upstream detail out of errors (#1704)”; “fix(audio): validate redirects and pin connections on provider requests (#1514)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/audio/voice-registration.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: lib/media/adapters/grok-image-adapter.ts lib/media/adapters/grok-image-adapter.ts:74— lib/media/adapters/grok-image-adapter.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is grok-image-adapter.generateWithGrokImage at line 74), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(providers): pin caller-chosen provider requests and keep upstream detail out of errors (#1704)”; “fix(media): refuse redirects on adapter generation and poll calls (#1636)”; “fix: keep long Grok relay generations alive and inline image bytes (#1364)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/media/adapters/grok-image-adapter.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: packages/@openmaic/renderer/src/elements/shape/BaseShapeElement.tsx packages/@openmaic/renderer/src/elements/shape/BaseShapeElement.tsx:61— packages/@openmaic/renderer/src/elements/shape/BaseShapeElement.tsx changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is BaseShapeElement.ValidShapeElement at line 61), 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(svg): validate malformed slide shapes and recover their text (#1915)”; “fix(sanitize): store inline math as LaTeX source and typeset it in the client (#1829)”; “fix(renderer): preserve literal text line breaks (#1132)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- packages/@openmaic/renderer/src/elements/shape/BaseShapeElement.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: lib/server/agent-runtime/course-edit/element-schema.ts lib/server/agent-runtime/course-edit/element-schema.ts:857— lib/server/agent-runtime/course-edit/element-schema.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is element-schema.validateSlideCanvas at line 857), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent-runtime): make patch_stage robust to legacy data and self-correcting on errors (#2000)”; “fix(svg): validate malformed slide shapes and recover their text (#1915)”; “fix(importer, renderer): preserve PPTX text, chart, and image styling (#1534)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/agent-runtime/course-edit/element-schema.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: packages/@openmaic/renderer/src/elements/chart/Chart.tsx packages/@openmaic/renderer/src/elements/chart/Chart.tsx:22— packages/@openmaic/renderer/src/elements/chart/Chart.tsx changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is Chart.Chart at line 22), 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(renderer): repaint clipped chart series on WebKit (#1825)”; “fix(importer, renderer): preserve PPTX text, chart, and image styling (#1534)”; “fix(renderer): lazy-load optional ECharts runtime (#1420)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- packages/@openmaic/renderer/src/elements/chart/Chart.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: lib/server/audio-provider-fetch.ts lib/server/audio-provider-fetch.ts:215— lib/server/audio-provider-fetch.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is audio-provider-fetch.audioProviderFetch at line 215), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(providers): pin caller-chosen provider requests and keep upstream detail out of errors (#1704)”; “fix(pdf): route MinerU Cloud requests through the strict provider transport (#1688)”; “fix(audio): rebuild platform FormData bodies for the undici transport (#1580)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- lib/server/audio-provider-fetch.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: packages/@openmaic/importer/src/utils/mediaWebConvert.ts packages/@openmaic/importer/src/utils/mediaWebConvert.ts:215— packages/@openmaic/importer/src/utils/mediaWebConvert.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is mediaWebConvert.encodeMediaForWebDisplay at line 215), 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(importer, renderer): preserve PPTX text, chart, and image styling (#1534)”; “fix(importer): convert Equation.3 OLE formulas via MTEF v3, surface degrade telemetry (#1411)”; “fix(importer): stop PPTX import from hanging in non-browser environments (#1424)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 20:52:12 +08:00' --until='2026-11-06 20:52:12 +08:00' --full-history --no-merges -- packages/@openmaic/importer/src/utils/mediaWebConvert.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.
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 packages/@openmaic/storage/src/runtime/json-value.ts:148— `assertJsonValue` is exported, takes a document from its caller (line 194) and hands it to `findNonJsonValue`, which calls itself at line 148 (`findNonJsonValue`) with a piece of `value` (and at line 184) — and nowhere in `findNonJsonValue` 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 `findNonJsonValue` 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 lib/workbench/stage-freshness.ts:289— `sameJsonValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 289 (`sameJsonValue`) with a piece of `left` (and at line 299) — and nowhere in `sameJsonValue` 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 `sameJsonValue` 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 lib/whiteboard/runtime/validate.ts:181— `normalizeAndValidateLegacyWhiteboard` is exported, takes a document from its caller (line 379) and hands it to `validateSchema`, which calls itself at line 181 (`validateSchema`) with a piece of `input` (and at line 214, line 230, line 235) — and nowhere in `validateSchema` 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 `validateSchema` 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 lib/whiteboard/runtime/validate.ts:326— `normalizeAndValidateWhiteboardElement` is exported, takes a document from its caller (line 282) and hands it to `assertLosslessJson`, which calls itself at line 326 (`assertLosslessJson`) with a piece of `value` (and at line 341) — and nowhere in `assertLosslessJson` 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 `assertLosslessJson` 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 lib/server/boot-failure.ts:34— `formatBootFailure` is exported, takes a document from its caller (line 38) and hands it to `describeError`, which calls itself at line 34 (`describeError`) with a piece of `error` — and nowhere in `describeError` 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 `describeError` 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 lib/server/llm-error-response.ts:40— `upstreamHttpStatus` is exported, takes a document from its caller (line 26) and hands it to `statusFromError`, which calls itself at line 40 (`statusFromError`) with a piece of `error` (and at line 42, line 52) — and nowhere in `statusFromError` 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 `statusFromError` 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 lib/server/llm-error-response.ts:95— `isUpstreamQuotaExhausted` is exported and takes `error: unknown` from its caller, and it calls itself at line 95 (`isUpstreamQuotaExhausted`) with a piece of `error` (and at line 107) — and nowhere in `isUpstreamQuotaExhausted` 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 `isUpstreamQuotaExhausted` 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 lib/server/llm-fallback.ts:86— `isRetryableLlmError` is exported, takes a document from its caller (line 118) and hands it to `unwrapRetryChain`, which calls itself at line 86 (`unwrapRetryChain`) with a piece of `error` (and at line 95) — and nowhere in `unwrapRetryChain` 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 `unwrapRetryChain` 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 lib/server/ssrf-guard.ts:68— `findUnsafeNetworkTargetError` is exported, takes a document from its caller (line 60) and hands it to `visit`, which calls itself at line 68 (`visit`) with a piece of `value` (and at line 72) — 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 lib/server/pbl-v3/project-package.ts:24— `canonicalJson` is exported and takes `value: unknown` from its caller, and it calls itself at line 24 (`canonicalJson`) with a piece of `value` (and at line 29) — and nowhere in `canonicalJson` 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 `canonicalJson` 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 lib/server/agent-runtime/course-edit/apply.ts:341— `collectStringFields` is exported, takes a document from its caller (line 337) and hands it to `walk`, which calls itself at line 341 (`walk`) with a piece of `node` (and at line 344) — 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 lib/server/agent-runtime/course-edit/media-byte-omission.ts:365— `containsReadSceneMediaPlaceholder` is exported and takes `value: unknown` from its caller, and it calls itself at line 365 (`containsReadSceneMediaPlaceholder`) with a piece of `value` (and at line 367) — and nowhere in `containsReadSceneMediaPlaceholder` 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 `containsReadSceneMediaPlaceholder` 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 lib/server/agent-runtime/course-edit/media-byte-omission.ts:381— `containsReadScenePlaceholderFragment` is exported and takes `value: unknown` from its caller, and it calls itself at line 381 (`containsReadScenePlaceholderFragment`) with a piece of `value` (and at line 383) — and nowhere in `containsReadScenePlaceholderFragment` 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 `containsReadScenePlaceholderFragment` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
ClassTooLong: PgAgentSessionStore packages/@openmaic/storage/src/agent-session/pg.ts:504— ClassTooLong — 968 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods. The bar is 400 significant lines; this is 568 over it, 2.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MaterialLibraryPage components/workbench/workspace/MaterialLibraryPage.tsx:1— ClassTooLong — 948 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 548 over it, 2.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WorkbenchChat components/workbench/WorkbenchChat.tsx:1— ClassTooLong — 761 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 361 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: PgAssetStore packages/@openmaic/storage/src/asset/pg.ts:482— ClassTooLong — 568 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 168 over it, 1.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PlaybackEngine lib/playback/engine.ts:58— ClassTooLong — 530 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 130 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.
ClassTooLong: ActionEngine lib/action/engine.ts:180— ClassTooLong — 481 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 81 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ImageClipHandler components/slide-renderer/components/element/ImageElement/ImageClipHandler.tsx:1— ClassTooLong — 479 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 79 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: LearningStore lib/server/pbl-v3/store.ts:91— ClassTooLong — 444 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 44 over it, 1.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: HttpAssetStore packages/@openmaic/storage/src/asset/http.ts:237— ClassTooLong — 409 significant lines (blank, comment-only and punctuation-only lines excluded), 18 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.
ClassTooLong: useScaleElement components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:1— ClassTooLong — 409 significant lines (blank, comment-only and punctuation-only lines excluded), 6 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.
Sync-over-async blocking eval/whiteboard-layout/capture.ts:49— `mkdirSync` in `captureWhiteboard` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking eval/whiteboard-layout/runner.ts:155— `mkdirSync` in `runScenario` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking eval/whiteboard-layout/runner.ts:372— `readFileSync` in `rescoreRun` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking eval/whiteboard-layout/scorer.ts:71— `readFileSync` in `scoreScreenshot` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking lib/media/comfyui-workflows.ts:82— `fs.existsSync` in `listComfyuiWorkflows` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking lib/media/comfyui-workflows.ts:85— `fs.readdirSync` in `listComfyuiWorkflows` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking lib/media/comfyui-workflows.ts:87— `fs.statSync` in `callback to filter` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking lib/server/agent-runtime/skills.ts:232— `existsSync` in `listBuiltinSkills` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking lib/server/agent-runtime/skills.ts:248— `existsSync` in `callback to skills.map` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking lib/server/agent-runtime/skills.ts:250— `readFileSync` in `callback to skills.map` 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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×9
Animation without a prefers-reduced-motion guard app/generation-preview/page.tsx:277— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard app/generation-preview/page.tsx:295— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/agent/agent-bar.tsx:912— <div> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/ai-elements/loader.tsx:82— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/audio/speech-button.tsx:121— <span> moves — its inline style sets `animation: speech-ring 2s ease-in-out infinite` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/audio/speech-button.tsx:135— <span> moves — its inline style sets `animation: speech-bar ${0.4+i*0.15}s ease-in-out ${i*0.1}s infinite alternate` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/canvas/canvas-area.tsx:229— <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/chat/chat-area.tsx:307— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard components/chat/session-list.tsx:86— <span> moves — its `animate-ping` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
TodoComment packages/@openmaic/importer/src/serializer/imageSerializer.ts:405— // TODO: optional cover image from blipEmbed — 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 examples/pbl/future-self-lite/skeleton/src/main.py:2— # TODO: 返回给未来的自己的留言。 — 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 components/slide-renderer/Editor/ScreenElement.tsx:44— // TODO: Add other element types — 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 components/slide-renderer/Editor/Canvas/EditableElement.tsx:66— // TODO: Add other element types — 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 components/slide-renderer/Editor/Canvas/index.tsx:266— // TODO: implement insertCustomShape — 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 components/slide-renderer/Editor/Canvas/hooks/useDrop.ts:18— // TODO: implement createTextElement — 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 components/slide-renderer/Editor/Canvas/hooks/useInsertFromCreateSelection.ts:122— // TODO: Implement createShapeElement — 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 components/slide-renderer/Editor/Canvas/hooks/useInsertFromCreateSelection.ts:127— // TODO: Implement createLineElement — 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.
route.POST (cognitive 16) app/api/agent/skills/route.ts:48— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 5). 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 50). 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.
route.POST (cognitive 16) app/api/folders/route.ts:78— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (4 pts), loops 1 (3 pts), error handling 2 (nesting depth added 6). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 16) app/api/generate/image/route.ts:47— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 16) app/api/generate/video/route.ts:51— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 16) app/api/pbl/v2/evaluate/route.ts:56— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, error handling 2, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
route.POST (cognitive 16) app/api/pbl/v3/route.ts:99— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, error handling 1 (nesting depth added 5). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 100). 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.
route.POST (cognitive 16) app/api/quiz-grade/route.ts:29— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (6 pts), if/else 4 (5 pts), boolean chains 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.
route.POST (cognitive 16) app/api/stages/route.ts:71— route.POST has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, error handling 2, ternaries 2 (nesting depth added 2). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Low contrast Tailwind colour pair (4.4:1) components/canvas/canvas-area.tsx:216— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) components/edit/EditDock/ElementRefLassoButton.tsx:124— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) components/edit/SlideNavRail/ThumbItem.tsx:160— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) components/edit/surfaces/quiz/QuestionCard.tsx:132— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) components/edit/surfaces/quiz/QuestionCard.tsx:154— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) components/edit/surfaces/slide/ElementPickLayer.tsx:539— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (4.4:1) components/edit/surfaces/slide/ElementRefPinLayer.tsx:143— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
IC1 · Incompleteness & stubs· Markup wires an event to an empty handler · ×6
Markup wires an event to an empty handler REDACTED:1073— `onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler REDACTED:1086— `onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler REDACTED:1098— `onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler components/settings/sandbox-settings.tsx:131— `onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler components/slide-renderer/Editor/Canvas/index.tsx:265— `onCreated` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
Markup wires an event to an empty handler packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:215— `onChange` is wired to an arrow whose body is empty — the markup attaches a listener that does nothing. Implement the handler, or remove the attribute that wires it.
C2 · Access Controls· Anyone can act as another user by changing what their browser sends · ×5
Anyone can act as another user by changing what their browser sends app/api/agent/owner-events/route.ts:71— Here who is asking is taken from the 'lastEventId' request header (const lastEventId = parseLastEventId(req.headers.get('last-event-id')??url.searchParams…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed.
Anyone can act as another user by changing what their browser sends app/api/agent/sessions/[id]/events/route.ts:90— Here who is asking is taken from the 'lastEventId' request header (const lastEventId = Number(headerId??url.searchParams.get('lastEventId')??0)||0) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed.
Anyone can act as another user by changing what their browser sends app/api/chat/pi/route.ts:158— Here who is asking is taken from the 'providerId' request header (const{model:languageModel, apiKey:resolvedApiKey, providerId, modelInfo, thinkingConfig…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed.
Anyone can act as another user by changing what their browser sends app/api/generate/image/route.ts:110— Here who is asking is taken from the request header read into 'providerId' (const providerId = request.headers.get('x-image-provider')?.trim()as ImageProviderId|un…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed.
Anyone can act as another user by changing what their browser sends app/api/generate/video/route.ts:115— Here who is asking is taken from the request header read into 'providerId' (const providerId = request.headers.get('x-video-provider')?.trim()as VideoProviderId|un…) and nothing checks it: no signature, no server-side session, no verified token. Cookies, headers and form or address values come from the visitor's browser and they can change them, so anyone can put another person's id there and be treated as that person — no password needed.
MethodTooLong: LegacyBrowserDatabase.constructor lib/legacy-browser-storage/schema.ts:205— MethodTooLong — constructor runs 171 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 71 over it, 1.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InProcessExecutor.execute render-service/src/render-executor.ts:190— MethodTooLong — execute runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PlaybackEngine.processNext lib/playback/engine.ts:576— MethodTooLong — processNext runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× 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: HttpAssetStore.fetchBytes packages/@openmaic/storage/src/asset/http.ts:469— MethodTooLong — fetchBytes runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.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.
MethodTooLong: StreamBuffer.tick lib/buffer/stream-buffer.ts:495— MethodTooLong — tick 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.
AC1 · Text alternatives· <video> without a captions track · ×4
<video> without a captions track components/slide-renderer/Editor/RendererScreenCanvas.tsx:141— 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).
<video> without a captions track components/slide-renderer/components/element/VideoElement/BaseVideoElement.tsx:170— 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).
<video> without a captions track components/slide-renderer/components/element/VideoElement/index.tsx:121— 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).
<video> without a captions track lib/standalone-player/scenes/SlideScene.tsx:41— 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).
AC3 · Page structure· Page without a main landmark · ×3
Page without a main landmark app/layout.tsx:75— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark packages/@openmaic/importer/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark packages/docs/components/root-shell.tsx:21— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC3 · Page structure· Data table has no header cells · ×3
Data table has no header cells components/slide-renderer/components/element/TableElement/StaticTable.tsx:93— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells REDACTED:203— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells packages/@openmaic/renderer/src/elements/table/StaticTable.tsx:71— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
route.POST (cyclomatic 23) app/api/generate/tts/route.ts:57— route.POST 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
route.POST (cyclomatic 23) app/api/parse-pdf/route.ts:27— route.POST 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
route.POST (cyclomatic 23) app/api/verify-video-provider/route.ts:43— route.POST 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.
route.POST (cyclomatic 16) app/api/agents/import/route.ts:39— route.POST has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 41). 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.
route.POST (cyclomatic 16) app/api/pbl/v2/evaluate/route.ts:56— route.POST 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.
route.POST (cyclomatic 16) app/api/quiz-grade/route.ts:29— route.POST 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.
route.POST (cognitive 28) app/api/export-video/render/route.ts:29— route.POST has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 6 (7 pts), boolean chains 4, error handling 1 (nesting depth added 10). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 30). 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.
route.POST (cognitive 28) app/api/pbl/v2/task/update/route.ts:46— route.POST has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1, match/switch 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.
route.POST (cognitive 28) app/api/proxy-media/route.ts:23— route.POST has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, ternaries 2 (4 pts), error handling 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TooManyMethods: PgAgentSessionStore packages/@openmaic/storage/src/agent-session/pg.ts:504— 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: PgDocumentStore packages/@openmaic/storage/src/document/pg.ts:717— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PlaybackEngine lib/playback/engine.ts:58— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Change coupling: provider-config.ts ↔ settings.ts lib/server/provider-config.ts:1— `lib/server/provider-config.ts` and `lib/store/settings.ts` change together 64% of the time (18 of the 28 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 shared commits counted here, the most recent 3 are `c72a64b4` feat(tts): add Google Gemini TTS provider (Interactions API) (#1687); `a7e9dc83` fix(providers): apply server-pinned models for image and video provid…; `98904c1c` fix(providers): three silent-behavior fixes from the provider audit (… — run `git show` on any of them.
Change coupling: types.ts ↔ provider-config.ts lib/audio/types.ts:1— `lib/audio/types.ts` and `lib/server/provider-config.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 — 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 `c72a64b4` feat(tts): add Google Gemini TTS provider (Interactions API) (#1687); `07115dff` feat(asr): add Azure STT (Fast Transcription) provider (#175); `5e12ad89` [codex] add VoxCPM2 TTS provider (#496) — run `git show` on any of them.
Change coupling: REDACTED ↔ stage.tsx components/roundtable/index.tsx:1— `components/roundtable/index.tsx` and `components/stage.tsx` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — 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 `e3bdc470` feat: keyboard shortcuts for roundtable (T/V/Escape/Space) (#256); `815cdc22` fix: presentation mode bubble polish and TTS timing improvements (#244); `0533adbe` feat: refine presentation mode speech bubbles, input flow, and access… — run `git show` on any of them.
R10 · Code Duplication· Duplicated block with local edits (61 matched lines × 2 locations) · ×3
Duplicated block with local edits (61 matched lines × 2 locations) components/slide-renderer/Editor/RendererScreenCanvas.tsx:32— components/slide-renderer/Editor/RendererScreenCanvas.tsx:32 · components/slide-renderer/components/element/VideoElement/BaseVideoElement.tsx:34 — the two spans are one implementation copied and then locally edited — 373 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 (61 matched lines × 2 locations) lib/prompts/loader.ts:50— lib/prompts/loader.ts:50 · packages/@openmaic/generation/src/prompts/loader.ts:50 — the two spans are one implementation copied and then locally edited — 345 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (61 matched lines × 2 locations) packages/@openmaic/storage/src/document/http.ts:174— packages/@openmaic/storage/src/document/http.ts:174 · packages/@openmaic/storage/src/runtime/http.ts:63 — the two spans are one implementation copied and then locally edited — 475 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.
AC2 · Forms & labels· <Select> field component without a label · ×2
<Select> field component without a label components/edit/ActionsBar/ActionsBar.tsx:780— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label components/generation/generation-toolbar.tsx:273— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×2
Modal dialog does not manage focus components/scene-renderers/pbl/v2/submission.tsx:836— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus components/scene-renderers/pbl/v2/submission.tsx:1172— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
route.POST (cyclomatic 27) app/api/agent/sessions/[id]/messages/route.ts:28— route.POST has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 33). 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.
route.POST (cyclomatic 27) app/api/pbl/v3/packages/route.ts:14— route.POST 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 3 function literals inside it that branch (lines 15, 62, 78). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
route.POST (cyclomatic 21) app/api/pbl/v2/task/update/route.ts:46— route.POST 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.
route.POST (cyclomatic 21) app/api/proxy-media/route.ts:23— route.POST 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.
BaseLineElement.BaseLineElement (cyclomatic 17) components/slide-renderer/components/element/LineElement/BaseLineElement.tsx:21— BaseLineElement.BaseLineElement has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 37, 51, 27, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BaseLineElement.BaseLineElement (cyclomatic 17) packages/@openmaic/renderer/src/elements/line/BaseLineElement.tsx:16— BaseLineElement.BaseLineElement has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 32, 43, 22, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
types.hasPBLProjectV2Containers (cyclomatic 17) lib/pbl/v2/types.ts:625— types.hasPBLProjectV2Containers 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.
types.hasPBLProjectV2Containers (cyclomatic 17) packages/@openmaic/generation/src/pbl/types.ts:625— types.hasPBLProjectV2Containers 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.
utils.findNodesWithSameMark (cyclomatic 17) lib/prosemirror/utils.ts:40— utils.findNodesWithSameMark 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.
utils.findNodesWithSameMark (cyclomatic 17) packages/@openmaic/editor/src/react/text/prosemirror/utils.ts:28— utils.findNodesWithSameMark 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.
useScaleElement.useScaleElement.scaleElement::handleMouseMove (cognitive 75) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:306— useScaleElement.useScaleElement.scaleElement::handleMouseMove has cognitive complexity 75 (threshold 15). Drivers by points: if/else 37 (69 pts), boolean chains 4, ternaries 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (useScaleElement.useScaleElement.scaleElement, useScaleElement.useScaleElement.scaleElement::alignedAdsorption) 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.
useScaleElement.useScaleElement.scaleElement::alignedAdsorption (cognitive 20) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:260— useScaleElement.useScaleElement.scaleElement::alignedAdsorption has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (8 pts), 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. This shape REPEATS in the file: 2 other methods here (useScaleElement.useScaleElement.scaleElement, useScaleElement.useScaleElement.scaleElement::handleMouseMove) 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.
engine.executeClaimedRun::runStep (cognitive 35) lib/server/generation/run/engine.ts:592— engine.executeClaimedRun::runStep has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (21 pts), ternaries 4 (10 pts), boolean chains 3, match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident. This shape REPEATS in the file: 2 other methods here (engine.executeClaimedRun, engine.executeClaimedRun::executeMediaOnly) 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.
engine.executeClaimedRun::executeMediaOnly (cognitive 18) lib/server/generation/run/engine.ts:1721— engine.executeClaimedRun::executeMediaOnly has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (engine.executeClaimedRun, engine.executeClaimedRun::runStep) 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.
route.POST (cognitive 31) app/api/agent/sessions/[id]/messages/route.ts:28— route.POST has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, ternaries 5, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to one function literal inside it that branches (line 33). 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.
route.POST (cognitive 31) app/api/verify-image-provider/route.ts:43— route.POST has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, error handling 2 (3 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.
route.POST (cognitive 29) app/api/generate/tts/route.ts:57— route.POST has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, ternaries 3 (4 pts), error handling 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.
route.POST (cognitive 29) app/api/verify-video-provider/route.ts:43— route.POST has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4, error handling 2 (3 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.
utils.findNodesWithSameMark (cognitive 21) lib/prosemirror/utils.ts:40— utils.findNodesWithSameMark has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 8, 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.
utils.findNodesWithSameMark (cognitive 21) packages/@openmaic/editor/src/react/text/prosemirror/utils.ts:28— utils.findNodesWithSameMark has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 8, 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.
BaseLineElement.BaseLineElement (cognitive 18) components/slide-renderer/components/element/LineElement/BaseLineElement.tsx:21— BaseLineElement.BaseLineElement has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 5, boolean chains 4 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 37, 51, 27, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BaseLineElement.BaseLineElement (cognitive 18) packages/@openmaic/renderer/src/elements/line/BaseLineElement.tsx:16— BaseLineElement.BaseLineElement has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 5, boolean chains 4 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 32, 43, 22, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×2
REDACTED
REDACTED
IC1 · Incompleteness & stubs· Both branches are identical · ×2
Both branches are identical — the condition decides nothing components/chat/lecture-notes-view.tsx:218— 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 components/roundtable/index.tsx:1802— 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.
Hollow method — returns a constant without doing the work packages/@openmaic/importer/src/openmaic/utils/videoCodec.ts:22— `parseVideoCodec` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Hollow method — returns a constant without doing the work packages/@openmaic/importer/src/openmaic/utils/videoCodec.ts:26— `isVideoCodecSupported` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
Fake-async — async method never awaits packages/@openmaic/storage/src/asset/blob.ts:159— `invalidate` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
Fake-async — async method never awaits render-service/src/resource-stage-copy.mjs:131— `main` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
R4 · Test Coverage· This test file cannot be loaded · ×2
This test file cannot be loaded packages/@openmaic/generation/test/interactive-library-mapper.test.ts:99— packages/@openmaic/generation/test/interactive-library-mapper.test.ts:99 imports './fixtures/interactive-libraries/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded tests/runtime/storage-entrypoint-removal.test.ts:5— tests/runtime/storage-entrypoint-removal.test.ts:5 imports '../../lib/storage/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
Dead file (~231 LoC) components/ai-elements/queue.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~231 LoC) components/ui/carousel.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (components/ai-elements/inline-citation.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
AC2 · Forms & labels· <FolderInput> field component without a label · ×1
<FolderInput> field component without a label components/discovery/move-to-folder-menu.tsx:87— This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC2 · Forms & labels· <fieldset> without a <legend> · ×1
<fieldset> without a <legend> components/scene-renderers/pbl/v3/workbench-panel.tsx:267— A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
Low contrast Tailwind colour pair (1.3:1) components/chat/chat-area.tsx:340— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (1.7:1) components/chat/lecture-notes-view.tsx:88— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.6:1) components/chat/proactive-card.tsx:139— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (3.1:1) components/chat/proactive-card.tsx:224— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.9:1) components/edit/ActionsBar/ActionsBar.tsx:964— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
Low contrast Tailwind colour pair (2.5:1) components/edit/surfaces/quiz/QuestionCard.tsx:245— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung REDACTED:190— No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 447 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.
index.Roundtable (cyclomatic 328) components/roundtable/index.tsx:156— index.Roundtable has cyclomatic complexity 328 (threshold 15). Of this number, 213 points are the body's own statements and 115 belong to 35 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.
PlaybackChromeRoot.PlaybackChromeRoot (cyclomatic 288) components/edit/PlaybackChromeRoot.tsx:131— PlaybackChromeRoot.PlaybackChromeRoot has cyclomatic complexity 288 (threshold 15). Of this number, 64 points are the body's own statements and 224 belong to 65 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.
workspace.PBLV3WorkspaceContent (cyclomatic 262) components/scene-renderers/pbl/v3/workspace.tsx:65— workspace.PBLV3WorkspaceContent has cyclomatic complexity 262 (threshold 15). Of this number, 185 points are the body's own statements and 77 belong to 28 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.
WorkspaceShell.WorkspaceShellController (cyclomatic 207) components/workbench/workspace/WorkspaceShell.tsx:187— WorkspaceShell.WorkspaceShellController has cyclomatic complexity 207 (threshold 15). Of this number, 75 points are the body's own statements and 132 belong to 50 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.
textSerializer.renderTextBody (cyclomatic 207) packages/@openmaic/importer/src/serializer/textSerializer.ts:1066— textSerializer.renderTextBody has cyclomatic complexity 207 (threshold 15). Of this number, 186 points are the body's own statements and 21 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.
page.HomePage (cyclomatic 193) app/page.tsx:161— page.HomePage has cyclomatic complexity 193 (threshold 15). Of this number, 91 points are the body's own statements and 102 belong to 56 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.
tool-presentation.presentTool (cyclomatic 189) components/workbench/chat/tool-presentation.ts:286— tool-presentation.presentTool has cyclomatic complexity 189 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-export-pptx.buildPptxBlob (cyclomatic 187) REDACTED:544— use-export-pptx.buildPptxBlob has cyclomatic complexity 187 (threshold 15). Of this number, 183 points are the body's own statements and 4 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.
transformParsedToSlides.transformParsedToSlides::parseElements (cyclomatic 177) packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:498— transformParsedToSlides.transformParsedToSlides::parseElements has cyclomatic complexity 177 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
shapeSerializer.renderShape (cyclomatic 162) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:839— shapeSerializer.renderShape has cyclomatic complexity 162 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-store.foldEvent (cyclomatic 160) lib/workbench/session-store.ts:940— session-store.foldEvent has cyclomatic complexity 160 (threshold 15). Of this number, 132 points are the body's own statements and 28 belong to 19 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.
MaterialLibraryPage.MaterialLibraryPage (cyclomatic 157) components/workbench/workspace/MaterialLibraryPage.tsx:735— MaterialLibraryPage.MaterialLibraryPage has cyclomatic complexity 157 (threshold 15). Of this number, 32 points are the body's own statements and 125 belong to 38 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.
WorkbenchChat.WorkbenchChat (cyclomatic 149) components/workbench/WorkbenchChat.tsx:123— WorkbenchChat.WorkbenchChat has cyclomatic complexity 149 (threshold 15). Of this number, 69 points are the body's own statements and 80 belong to 30 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.
application-preview.ApplicationPreviewContent (cyclomatic 146) components/scene-renderers/pbl/v3/application-preview.tsx:56— application-preview.ApplicationPreviewContent has cyclomatic complexity 146 (threshold 15). Of this number, 89 points are the body's own statements and 57 belong to 18 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.
project-package.validateProjectPackage (cyclomatic 139) lib/server/pbl-v3/project-package.ts:172— project-package.validateProjectPackage has cyclomatic complexity 139 (threshold 15). Of this number, 125 points are the body's own statements and 14 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runner-tools.teachingRunnerConfig (cyclomatic 126) lib/server/pbl-v3/runner-tools.ts:67— runner-tools.teachingRunnerConfig has cyclomatic complexity 126 (threshold 15). Of this number, 41 points are the body's own statements and 85 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.
runner.executeSession (cyclomatic 124) lib/server/agent-runtime/runner.ts:1043— runner.executeSession has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (runner.executeSession::emit) 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.
material-tools.buildMaterialTools (cyclomatic 116) lib/server/agent-runtime/material-tools.ts:555— material-tools.buildMaterialTools has cyclomatic complexity 116 (threshold 15). Most of this is not in the body itself: 5 of the 116 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 834, 624, 730, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
EditableSlideCanvas.EditableSlideCanvas (cyclomatic 114) packages/@openmaic/editor/src/react/EditableSlideCanvas.tsx:93— EditableSlideCanvas.EditableSlideCanvas has cyclomatic complexity 114 (threshold 15). Of this number, 46 points are the body's own statements and 68 belong to 21 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.
chat.PBLV2Chat (cyclomatic 108) components/scene-renderers/pbl/v2/chat.tsx:129— chat.PBLV2Chat has cyclomatic complexity 108 (threshold 15). Of this number, 39 points are the body's own statements and 69 belong to 16 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
use-application-preview.useApplicationPreview (cyclomatic 104) components/scene-renderers/pbl/v3/use-application-preview.ts:89— use-application-preview.useApplicationPreview has cyclomatic complexity 104 (threshold 15). Of this number, 30 points are the body's own statements and 74 belong to 15 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.
stage.useStageStoreBase (cyclomatic 103) lib/store/stage.ts:740— stage.useStageStoreBase has cyclomatic complexity 103 (threshold 15). Most of this is not in the body itself: 1 of the 103 points is its own statement and the rest belongs to 16 function literals inside it that branch (lines 1206, 1117, 1012, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.commandStudy::execute (cyclomatic 102) lib/server/pbl-v3/runtime.ts:539— runtime.commandStudy::execute has cyclomatic complexity 102 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
conversation.projectConversation (cyclomatic 97) lib/server/pbl-v3/conversation.ts:68— conversation.projectConversation has cyclomatic complexity 97 (threshold 15). Of this number, 80 points are the body's own statements and 17 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-workbench-session.useStageFreshnessSync (cyclomatic 95) lib/workbench/use-workbench-session.ts:444— use-workbench-session.useStageFreshnessSync has cyclomatic complexity 95 (threshold 15). Most of this is not in the body itself: 1 of the 95 points is its own statement and the rest belongs to 22 function literals inside it that branch (lines 553, 813, 857, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProsemirrorEditor.ProsemirrorEditor (cyclomatic 93) components/slide-renderer/components/element/ProsemirrorEditor.tsx:58— ProsemirrorEditor.ProsemirrorEditor has cyclomatic complexity 93 (threshold 15). Most of this is not in the body itself: 2 of the 93 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 173, 384, 435, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkspaceRail.WorkspaceRail (cyclomatic 92) components/workbench/workspace/WorkspaceRail.tsx:195— WorkspaceRail.WorkspaceRail has cyclomatic complexity 92 (threshold 15). Of this number, 24 points are the body's own statements and 68 belong to 21 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
model-settings.planModelSettingsImport (cyclomatic 91) lib/legacy-browser-import/model-settings.ts:297— model-settings.planModelSettingsImport has cyclomatic complexity 91 (threshold 15). Of this number, 90 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.
lifecycle.maintainStudy (cyclomatic 91) lib/server/pbl-v3/lifecycle.ts:193— lifecycle.maintainStudy has cyclomatic complexity 91 (threshold 15). Most of this is not in the body itself: 11 of the 91 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 260, a function literal at line 509, maintain). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runtime.learningView (cyclomatic 87) lib/server/pbl-v3/runtime.ts:988— runtime.learningView has cyclomatic complexity 87 (threshold 15). Of this number, 81 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.
workbench-panel.LearningWorkbenchPanel (cyclomatic 85) components/scene-renderers/pbl/v3/workbench-panel.tsx:51— workbench-panel.LearningWorkbenchPanel has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (workbench-panel.LearningWorkbenchPanel::run) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
providers.getCompatThinkingBodyParams (cyclomatic 83) lib/ai/providers.ts:1747— providers.getCompatThinkingBodyParams has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
material-analysis.analyzeMaterial (cyclomatic 83) lib/server/generation/steps/material-analysis.ts:193— material-analysis.analyzeMaterial has cyclomatic complexity 83 (threshold 15). Of this number, 82 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.
page.GenerationPreviewContent (cyclomatic 81) app/generation-preview/page.tsx:60— page.GenerationPreviewContent has cyclomatic complexity 81 (threshold 15). Of this number, 39 points are the body's own statements and 42 belong to 15 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.
report.buildLearningEvidence (cyclomatic 80) lib/server/pbl-v3/report.ts:30— report.buildLearningEvidence has cyclomatic complexity 80 (threshold 15). Of this number, 74 points are the body's own statements and 6 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.
model-map.ModelMap (cyclomatic 79) components/settings/models/model-map.tsx:137— model-map.ModelMap has cyclomatic complexity 79 (threshold 15). Of this number, 35 points are the body's own statements and 44 belong to 19 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.
provider-config-panel.ProviderConfigPanel (cyclomatic 74) components/settings/provider-config-panel.tsx:55— provider-config-panel.ProviderConfigPanel has cyclomatic complexity 74 (threshold 15). Of this number, 35 points are the body's own statements and 39 belong to 11 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.
project-report.ProjectReport (cyclomatic 74) components/scene-renderers/pbl/v3/project-report.tsx:28— project-report.ProjectReport has cyclomatic complexity 74 (threshold 15). Of this number, 35 points are the body's own statements and 39 belong to 16 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
classroom-actions.buildChildActionTools (cyclomatic 74) lib/chat/pi/tools/classroom-actions.ts:278— classroom-actions.buildChildActionTools has cyclomatic complexity 74 (threshold 15). Of this number, 19 points are the body's own statements and 55 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.route (cyclomatic 74) REDACTED:442— index.route has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ElementPickLayer.ElementPickLayer (cyclomatic 71) components/edit/surfaces/slide/ElementPickLayer.tsx:106— ElementPickLayer.ElementPickLayer has cyclomatic complexity 71 (threshold 15). Of this number, 19 points are the body's own statements and 52 belong to 20 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.
curriculum-tools.buildCurriculumTools (cyclomatic 71) lib/server/agent-runtime/curriculum-tools.ts:194— curriculum-tools.buildCurriculumTools has cyclomatic complexity 71 (threshold 15). Of this number, 66 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.
inline-assets.inlineHtmlAssets (cyclomatic 69) lib/export/inline-assets.ts:608— inline-assets.inlineHtmlAssets has cyclomatic complexity 69 (threshold 15). Of this number, 43 points are the body's own statements and 26 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
generation-tools.buildGenerationTools (cyclomatic 67) lib/server/agent-runtime/generation-tools.ts:274— generation-tools.buildGenerationTools has cyclomatic complexity 67 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
imagePlan (cyclomatic 67) lib/server/material-extraction/document-image-plan.mjs:74— imagePlan has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 12 of the 67 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 122, visit, a function literal at line 253, …). 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.
stage.Stage (cyclomatic 66) components/stage.tsx:52— stage.Stage has cyclomatic complexity 66 (threshold 15). Of this number, 30 points are the body's own statements and 36 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.
report-share-image.renderReportShareImage (cyclomatic 66) lib/pbl/v3/report-share-image.ts:23— report-share-image.renderReportShareImage has cyclomatic complexity 66 (threshold 15). Of this number, 39 points are the body's own statements and 27 belong to 15 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.
token-plan-settings.TokenPlanSettings (cyclomatic 65) components/settings/token-plan-settings.tsx:187— token-plan-settings.TokenPlanSettings has cyclomatic complexity 65 (threshold 15). Of this number, 18 points are the body's own statements and 47 belong to 14 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.
tts-voice-managers.VoxCPMVoiceManager (cyclomatic 65) components/settings/tts-voice-managers.tsx:49— tts-voice-managers.VoxCPMVoiceManager has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 15 of the 65 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 313, startReferenceRecording, 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.
ImageClipHandler.ImageClipHandler (cyclomatic 65) components/slide-renderer/components/element/ImageElement/ImageClipHandler.tsx:22— ImageClipHandler.ImageClipHandler has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 1 of the 65 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 266, 446, 195, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProLaunchPanel.ProLaunchPanel (cyclomatic 64) components/workbench/ProLaunchPanel.tsx:75— ProLaunchPanel.ProLaunchPanel has cyclomatic complexity 64 (threshold 15). Of this number, 24 points are the body's own statements and 40 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
generation-toolbar.GenerationToolbar (cyclomatic 63) components/generation/generation-toolbar.tsx:98— generation-toolbar.GenerationToolbar has cyclomatic complexity 63 (threshold 15). Of this number, 41 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.
slot-picker.SlotPicker (cyclomatic 63) components/settings/models/slot-picker.tsx:228— slot-picker.SlotPicker has cyclomatic complexity 63 (threshold 15). Of this number, 42 points are the body's own statements and 21 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
InteractiveIframeHost.PooledIframe (cyclomatic 63) REDACTED:235— InteractiveIframeHost.PooledIframe has cyclomatic complexity 63 (threshold 15). Of this number, 26 points are the body's own statements and 37 belong to 10 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
submission.PBLV2SubmissionPanel (cyclomatic 63) components/scene-renderers/pbl/v2/submission.tsx:295— submission.PBLV2SubmissionPanel has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 13 of the 63 points are its own statements and the rest belongs to 12 function items inside it that branch (runImmediateTaskEval::runStream, runImmediateTaskEval, a function literal at line 374, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-application-preview.useApplicationPreview.load (cyclomatic 63) components/scene-renderers/pbl/v3/use-application-preview.ts:398— use-application-preview.useApplicationPreview.load has cyclomatic complexity 63 (threshold 15). Of this number, 56 points are the body's own statements and 7 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.
scene-sidebar.SceneSidebar (cyclomatic 63) components/stage/scene-sidebar.tsx:37— scene-sidebar.SceneSidebar has cyclomatic complexity 63 (threshold 15). Of this number, 20 points are the body's own statements and 43 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
timeline-deps.createVideoTimelineDeps (cyclomatic 63) lib/video-export-app/timeline-deps.ts:191— timeline-deps.createVideoTimelineDeps has cyclomatic complexity 63 (threshold 15). Of this number, 49 points are the body's own statements and 14 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PlaybackEngine.processNext (cyclomatic 61) lib/playback/engine.ts:576— PlaybackEngine.processNext has cyclomatic complexity 61 (threshold 15). Of this number, 46 points are the body's own statements and 15 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workbench-onboarding.WorkbenchOnboarding (cyclomatic 60) components/scene-renderers/pbl/v3/workbench-onboarding.tsx:29— workbench-onboarding.WorkbenchOnboarding has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 8 of the 60 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 90, scrollReading, a function literal at line 111, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-material-library-tree.useMaterialLibraryTree (cyclomatic 60) lib/workbench/use-material-library-tree.ts:154— use-material-library-tree.useMaterialLibraryTree has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 7 of the 60 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 461, 274, 611, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
route.GET (cyclomatic 59) app/api/agent/owner-events/route.ts:40— route.GET has cyclomatic complexity 59 (threshold 15). Most of this is not in the body itself: 8 of the 59 points are its own statements and the rest belongs to 15 function items inside it that branch (poll, drainBacklog, checkAttachCursor, …). 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.
course-mention-menu.CourseMentionMenu (cyclomatic 59) components/workbench/course-mention-menu.tsx:83— course-mention-menu.CourseMentionMenu has cyclomatic complexity 59 (threshold 15). Of this number, 20 points are the body's own statements and 39 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-export-pptx.formatHTML::parse (cyclomatic 59) REDACTED:85— use-export-pptx.formatHTML::parse 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.
runResourceTask (cyclomatic 59) render-service/src/resource-systemd-runner.mjs:655— runResourceTask 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.
route.chat (cyclomatic 58) app/api/chat/pi/route.ts:65— route.chat has cyclomatic complexity 58 (threshold 15). Of this number, 46 points are the body's own statements and 12 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.
StyleResolver.resolvePatternFill (cyclomatic 58) packages/@openmaic/importer/src/serializer/StyleResolver.ts:321— StyleResolver.resolvePatternFill has cyclomatic complexity 58 (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.
mtef.renderTmpl (cyclomatic 58) packages/@openmaic/importer/src/utils/mtef.ts:753— mtef.renderTmpl has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool-card.ToolCard (cyclomatic 57) components/workbench/chat/tool-card.tsx:35— tool-card.ToolCard has cyclomatic complexity 57 (threshold 15). Of this number, 49 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.applyModelSettingsChange (cyclomatic 57) lib/server/model-config/settings.ts:663— settings.applyModelSettingsChange has cyclomatic complexity 57 (threshold 15). Of this number, 56 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.validateSvgPath (cyclomatic 57) packages/@openmaic/geometry/src/index.ts:92— index.validateSvgPath has cyclomatic complexity 57 (threshold 15). Of this number, 53 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
call-agent.buildCallAgentTool.execute (cyclomatic 56) lib/chat/pi/tools/call-agent.ts:587— call-agent.buildCallAgentTool.execute has cyclomatic complexity 56 (threshold 15). Of this number, 46 points are the body's own statements and 10 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.
page.ClassroomCard (cyclomatic 54) app/page.tsx:1986— page.ClassroomCard has cyclomatic complexity 54 (threshold 15). Of this number, 36 points are the body's own statements and 18 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.
presets.buildCircularArrowPath (cyclomatic 54) packages/@openmaic/importer/src/shapes/presets.ts:1695— presets.buildCircularArrowPath has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cover-config.resolveVideoExportCta (cyclomatic 53) lib/video-export-app/cover-config.ts:66— cover-config.resolveVideoExportCta has cyclomatic complexity 53 (threshold 15). Of this number, 47 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
prompt-input.PromptInput (cyclomatic 52) components/ai-elements/prompt-input.tsx:427— prompt-input.PromptInput has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 7 of the 52 points are its own statements and the rest belongs to 23 function items inside it that branch (a function literal at line 505, a function literal at line 485, a function literal at line 571, …). 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.
providers.fetchCustomOpenAIChat (cyclomatic 52) lib/ai/providers.ts:2177— providers.fetchCustomOpenAIChat has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workbench.workbenchCommand (cyclomatic 52) lib/server/pbl-v3/workbench.ts:100— workbench.workbenchCommand has cyclomatic complexity 52 (threshold 15). Of this number, 18 points are the body's own statements and 34 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.
teaching-prompt.buildTeachingPrompt (cyclomatic 52) lib/server/pbl-v3/teaching-prompt.ts:119— teaching-prompt.buildTeachingPrompt has cyclomatic complexity 52 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mathSerializer.normalizeMathCharToUnicode (cyclomatic 51) packages/@openmaic/importer/src/serializer/mathSerializer.ts:108— mathSerializer.normalizeMathCharToUnicode has cyclomatic complexity 51 (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.
header-controls.HeaderControls (cyclomatic 50) components/stage/header-controls.tsx:113— header-controls.HeaderControls has cyclomatic complexity 50 (threshold 15). Of this number, 46 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.
element-reference.projectElement (cyclomatic 50) lib/chat/pi/element-reference.ts:608— element-reference.projectElement 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.
video-render.useVideoRenderStore (cyclomatic 50) lib/store/video-render.ts:145— video-render.useVideoRenderStore has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 1 of the 50 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 171, 298, 281, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
element-refs.decodeElementRefs (cyclomatic 50) lib/workbench/element-refs.ts:323— element-refs.decodeElementRefs has cyclomatic complexity 50 (threshold 15). Of this number, 49 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.
main.createApp (cyclomatic 50) render-service/src/main.ts:270— main.createApp has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 1 of the 50 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 420, 302, 571, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
route.GET (cyclomatic 49) app/api/agent/sessions/[id]/events/route.ts:61— route.GET has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 8 of the 49 points are its own statements and the rest belongs to 12 function items inside it that branch (poll, writePage, drainBacklog, …). 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.
instructor.runInstructorTurn (cyclomatic 49) lib/pbl/v2/agents/instructor.ts:1301— instructor.runInstructorTurn has cyclomatic complexity 49 (threshold 15). Of this number, 43 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
application.applicationRequest (cyclomatic 49) lib/server/pbl-v3/application.ts:268— application.applicationRequest has cyclomatic complexity 49 (threshold 15). Of this number, 18 points are the body's own statements and 31 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.
tts-settings.TTSSettings (cyclomatic 48) components/settings/tts-settings.tsx:100— tts-settings.TTSSettings has cyclomatic complexity 48 (threshold 15). Of this number, 41 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
workbench-split.WorkbenchSplit (cyclomatic 48) components/scene-renderers/pbl/v3/workbench-split.tsx:6— workbench-split.WorkbenchSplit has cyclomatic complexity 48 (threshold 15). Of this number, 28 points are the body's own statements and 20 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.
runtime.recordQuizAttempt (cyclomatic 48) lib/quiz/runtime.ts:494— runtime.recordQuizAttempt has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 1 of the 48 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 505, 551). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
outline.streamOutlines (cyclomatic 48) lib/server/generation/steps/outline.ts:551— outline.streamOutlines has cyclomatic complexity 48 (threshold 15). Of this number, 42 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.
use-workbench-session.useWorkbenchStream (cyclomatic 48) lib/workbench/use-workbench-session.ts:134— use-workbench-session.useWorkbenchStream has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 1 of the 48 points is its own statement and the rest belongs to 12 function literals inside it that branch (lines 151, 193, 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.
textSerializer.mergeRunProps (cyclomatic 48) packages/@openmaic/importer/src/serializer/textSerializer.ts:530— textSerializer.mergeRunProps 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.
ClassroomSurface.ClassroomSurfaceContent (cyclomatic 47) components/classroom/ClassroomSurface.tsx:70— ClassroomSurface.ClassroomSurfaceContent has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 12 of the 47 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 100, 234, 185, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tts-voice-managers.QwenVoiceCloneManager (cyclomatic 47) components/settings/tts-voice-managers.tsx:499— tts-voice-managers.QwenVoiceCloneManager has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 13 of the 47 points are its own statements and the rest belongs to 14 function items inside it that branch (startRecording, handleSave, 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.
validators.validateAppScene (cyclomatic 47) lib/document-store/validators.ts:28— validators.validateAppScene has cyclomatic complexity 47 (threshold 15). Of this number, 38 points are the body's own statements and 9 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.
derived-state.computePlaybackView (cyclomatic 47) lib/playback/derived-state.ts:77— derived-state.computePlaybackView has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dsl-tools.buildDslCourseTools (cyclomatic 47) lib/server/agent-runtime/dsl-tools.ts:1057— dsl-tools.buildDslCourseTools has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
input.parseRunInput (cyclomatic 47) lib/server/generation/run/input.ts:95— input.parseRunInput has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stage-storage.loadFirstSlideThumbnail (cyclomatic 47) lib/utils/stage-storage.ts:1134— stage-storage.loadFirstSlideThumbnail has cyclomatic complexity 47 (threshold 15). Of this number, 45 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.
resize.computeResize (cyclomatic 47) packages/@openmaic/editor/src/react/core/resize.ts:328— resize.computeResize has cyclomatic complexity 47 (threshold 15). Of this number, 33 points are the body's own statements and 14 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.
RendererTableEditor.RendererTableEditor (cyclomatic 47) REDACTED:88— RendererTableEditor.RendererTableEditor 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 12 function items inside it that branch (getCellBackground, a function literal at line 224, getHeaderTextColor, …). 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.
route.POST (cyclomatic 46) app/api/agent/sessions/route.ts:44— route.POST has cyclomatic complexity 46 (threshold 15). Of this number, 21 points are the body's own statements and 25 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.
StaticTable.StaticTable (cyclomatic 46) components/slide-renderer/components/element/TableElement/StaticTable.tsx:17— StaticTable.StaticTable has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 5 of the 46 points are its own statements and the rest belongs to 11 function items inside it that branch (getCellBg, a function literal at line 115, getHeaderTextColor, …). 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.
css-asset-parser.collectCssAssetReferencesByRegex (cyclomatic 46) lib/export/css-asset-parser.ts:235— css-asset-parser.collectCssAssetReferencesByRegex 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.
planner.buildTools (cyclomatic 46) lib/pbl/v2/agents/planner.ts:198— planner.buildTools has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 4 of the 46 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 480, 697, 420, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
line-drag.computeLineDrag (cyclomatic 46) packages/@openmaic/editor/src/react/core/line-drag.ts:85— line-drag.computeLineDrag 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.
textSerializer.runStylesToCssString (cyclomatic 46) packages/@openmaic/importer/src/serializer/textSerializer.ts:1867— textSerializer.runStylesToCssString 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.
canvas-toolbar.CanvasToolbar (cyclomatic 45) components/canvas/canvas-toolbar.tsx:92— canvas-toolbar.CanvasToolbar has cyclomatic complexity 45 (threshold 15). Of this number, 43 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.
media.planUploads (cyclomatic 45) lib/legacy-browser-import/media.ts:176— media.planUploads has cyclomatic complexity 45 (threshold 15). Of this number, 42 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.
sandbox-preview-gateway.server (cyclomatic 45) scripts/sandbox-preview-gateway.mjs:254— sandbox-preview-gateway.server has cyclomatic complexity 45 (threshold 15). Of this number, 42 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.
createResourceHandler::handle (cyclomatic 45) render-service/src/resource-owner.mjs:48— createResourceHandler::handle 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.
canvas-area.CanvasArea (cyclomatic 44) components/canvas/canvas-area.tsx:39— canvas-area.CanvasArea has cyclomatic complexity 44 (threshold 15). Of this number, 36 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.
folder-card.FolderCard (cyclomatic 44) components/discovery/folder-card.tsx:42— folder-card.FolderCard has cyclomatic complexity 44 (threshold 15). Of this number, 22 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.
whiteboard-ledger.buildVirtualWhiteboardContext (cyclomatic 44) lib/orchestration/summarizers/whiteboard-ledger.ts:135— whiteboard-ledger.buildVirtualWhiteboardContext has cyclomatic complexity 44 (threshold 15). Of this number, 38 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.executeClaimedRun (cyclomatic 44) lib/server/generation/run/engine.ts:400— engine.executeClaimedRun has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (engine.executeClaimedRun::runStep) 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.
outlines-editor.OutlinesEditor (cyclomatic 43) components/generation/outlines-editor.tsx:111— outlines-editor.OutlinesEditor has cyclomatic complexity 43 (threshold 15). Of this number, 18 points are the body's own statements and 25 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.
asr-settings.ASRSettings (cyclomatic 43) components/settings/asr-settings.tsx:53— asr-settings.ASRSettings has cyclomatic complexity 43 (threshold 15). Of this number, 25 points are the body's own statements and 18 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.
providers.getModel::compatFetch (cyclomatic 43) lib/ai/providers.ts:2462— providers.getModel::compatFetch 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. This shape REPEATS in the file: one other method here (providers.getModel) 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.
chat-storage.syncOne (cyclomatic 43) lib/utils/chat-storage.ts:615— chat-storage.syncOne has cyclomatic complexity 43 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
request-schedule.scheduleRequestPreview (cyclomatic 43) lib/workbench/request-schedule.ts:269— request-schedule.scheduleRequestPreview has cyclomatic complexity 43 (threshold 15). Of this number, 41 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.
InProcessExecutor.execute (cyclomatic 43) render-service/src/render-executor.ts:190— InProcessExecutor.execute has cyclomatic complexity 43 (threshold 15). Of this number, 35 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
legacy-config.translateLegacyConfig (cyclomatic 42) lib/server/model-config/legacy-config.ts:120— legacy-config.translateLegacyConfig has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
interactive-library-mapper.rewriteInteractiveLibraries (cyclomatic 42) packages/@openmaic/generation/src/interactive-library-mapper.ts:130— interactive-library-mapper.rewriteInteractiveLibraries has cyclomatic complexity 42 (threshold 15). Of this number, 27 points are the body's own statements and 15 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
planner-single-call.validateLLMOutput (cyclomatic 42) packages/@openmaic/generation/src/pbl/planner-single-call.ts:173— planner-single-call.validateLLMOutput has cyclomatic complexity 42 (threshold 15). Of this number, 28 points are the body's own statements and 14 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.
chartOption.getChartOption (cyclomatic 42) packages/@openmaic/renderer/src/elements/chart/chartOption.ts:43— chartOption.getChartOption 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. This shape REPEATS in the file: one other method here (chartOption.getChartOption::axisOptions) 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.
asset.route (cyclomatic 42) packages/@openmaic/storage/src/server/asset.ts:560— asset.route 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.
agent-bar.AgentBar (cyclomatic 41) components/agent/agent-bar.tsx:605— agent-bar.AgentBar has cyclomatic complexity 41 (threshold 15). Of this number, 16 points are the body's own statements and 25 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.
ElementCreateSelection.ElementCreateSelection (cyclomatic 41) components/slide-renderer/Editor/Canvas/ElementCreateSelection.tsx:10— ElementCreateSelection.ElementCreateSelection has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 6 of the 41 points are its own statements and the rest belongs to 5 function items inside it that branch (createSelection::handleMouseMove, createSelection::handleMouseUp, a function literal at line 130, …). 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.
element-reference.compactInteractiveSourceHtml (cyclomatic 41) lib/chat/pi/element-reference.ts:302— element-reference.compactInteractiveSourceHtml has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 14 of the 41 points are its own statements and the rest belongs to 9 function items inside it that branch (containsInlineBase64, containsInlineBase64::matchesAsciiToken, isExcludedTextParent, …). 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.
project-schema.projectSchema (cyclomatic 41) lib/pbl/v3/domain/project/project-schema.ts:352— project-schema.projectSchema has cyclomatic complexity 41 (threshold 15). Of this number, 40 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.
scene-generator.generateWidgetContent (cyclomatic 41) REDACTED:1270— scene-generator.generateWidgetContent has cyclomatic complexity 41 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
route.POST (cyclomatic 40) app/api/generate/voice/route.ts:74— route.POST has cyclomatic complexity 40 (threshold 15). Of this number, 39 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActionsBar.ActionsBar (cyclomatic 40) components/edit/ActionsBar/ActionsBar.tsx:1057— ActionsBar.ActionsBar has cyclomatic complexity 40 (threshold 15). Of this number, 16 points are the body's own statements and 24 belong to 10 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
use-project-editor.useProjectEditor.load (cyclomatic 40) components/scene-renderers/pbl/v3/use-project-editor.ts:84— use-project-editor.useProjectEditor.load has cyclomatic complexity 40 (threshold 15). Of this number, 25 points are the body's own statements and 15 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
quiz-view.MultipleChoiceQuestion (cyclomatic 40) REDACTED:316— quiz-view.MultipleChoiceQuestion has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 2 of the 40 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 353, toggle). 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.
native-whiteboard.buildNativeWhiteboardTools (cyclomatic 40) lib/chat/pi/tools/native-whiteboard.ts:743— native-whiteboard.buildNativeWhiteboardTools has cyclomatic complexity 40 (threshold 15). Of this number, 16 points are the body's own statements and 24 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.
reducer.applyRunEvent (cyclomatic 40) lib/generation-run-client/reducer.ts:84— reducer.applyRunEvent has cyclomatic complexity 40 (threshold 15). Of this number, 38 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.
use-run-course.useRunCourse (cyclomatic 40) lib/generation-run-client/use-run-course.ts:89— use-run-course.useRunCourse has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 13 of the 40 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 201, 180, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
transition.completeCurrentStage (cyclomatic 40) lib/pbl/v3/domain/orchestration/transition.ts:534— transition.completeCurrentStage has cyclomatic complexity 40 (threshold 15). Of this number, 38 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.
scene-tts.synthesizeSceneNarration (cyclomatic 40) lib/server/agent-runtime/scene-tts.ts:318— scene-tts.synthesizeSceneNarration has cyclomatic complexity 40 (threshold 15). Of this number, 20 points are the body's own statements and 20 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.
validate.validateSchema (cyclomatic 40) lib/whiteboard/runtime/validate.ts:174— validate.validateSchema 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.
scene-generator.generateSlideContent (cyclomatic 40) REDACTED:635— scene-generator.generateSlideContent has cyclomatic complexity 40 (threshold 15). Of this number, 37 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.
route.POST (cyclomatic 39) app/api/materials/route.ts:170— route.POST has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 2 of the 39 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 200, context, reject, …). 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.
ActionsBar.SpeechTtsBar (cyclomatic 39) components/edit/ActionsBar/ActionsBar.tsx:276— ActionsBar.SpeechTtsBar has cyclomatic complexity 39 (threshold 15). Of this number, 16 points are the body's own statements and 23 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.
model-picker.ModelPicker (cyclomatic 39) components/settings/model-picker.tsx:312— model-picker.ModelPicker has cyclomatic complexity 39 (threshold 15). Of this number, 18 points are the body's own statements and 21 belong to 7 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.
quiz-view.SingleChoiceQuestion (cyclomatic 39) REDACTED:223— quiz-view.SingleChoiceQuestion has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 1 of the 39 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 243, 252). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useScaleElement.useScaleElement.scaleElement::handleMouseMove (cyclomatic 39) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:306— useScaleElement.useScaleElement.scaleElement::handleMouseMove 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. This shape REPEATS in the file: one other method here (useScaleElement.useScaleElement.scaleElement) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
use-tree-drag.useTreeDrag (cyclomatic 39) components/workbench/workspace/use-tree-drag.ts:72— use-tree-drag.useTreeDrag has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 1 of the 39 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 138, 170, 196, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
run-native-child.runNativeChild (cyclomatic 39) lib/agent/runtime/run-native-child.ts:189— run-native-child.runNativeChild has cyclomatic complexity 39 (threshold 15). Of this number, 23 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.
runner.executeSession::emit (cyclomatic 39) lib/server/agent-runtime/runner.ts:1169— runner.executeSession::emit 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. This shape REPEATS in the file: one other method here (runner.executeSession) 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.
request-activity.requestTrack (cyclomatic 39) lib/workbench/request-activity.ts:115— request-activity.requestTrack 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.
interactive-library-mapper.mapInteractiveLibraryUrl (cyclomatic 39) packages/@openmaic/generation/src/interactive-library-mapper.ts:29— interactive-library-mapper.mapInteractiveLibraryUrl has cyclomatic complexity 39 (threshold 15). Of this number, 32 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.
mtef.parseObjectList (cyclomatic 39) packages/@openmaic/importer/src/utils/mtef.ts:321— mtef.parseObjectList 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.
model-picker.InlineThinkingControl (cyclomatic 38) components/settings/model-picker.tsx:102— model-picker.InlineThinkingControl has cyclomatic complexity 38 (threshold 15). Of this number, 30 points are the body's own statements and 8 belong to 4 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.
index.ShapeElement (cyclomatic 38) components/slide-renderer/components/element/ShapeElement/index.tsx:33— index.ShapeElement has cyclomatic complexity 38 (threshold 15). Of this number, 28 points are the body's own statements and 10 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.
useMouseSelection.useMouseSelection.updateMouseSelection::handleMouseUp (cyclomatic 38) components/slide-renderer/Editor/Canvas/hooks/useMouseSelection.ts:84— useMouseSelection.useMouseSelection.updateMouseSelection::handleMouseUp has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.Canvas (cyclomatic 38) components/slide-renderer/Editor/Canvas/index.tsx:65— index.Canvas has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 11 of the 38 points are its own statements and the rest belongs to 9 function items inside it that branch (handleClickBlankArea, handleDblClick, contextmenus, …). 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.
llm.callLLM (cyclomatic 38) lib/ai/llm.ts:346— llm.callLLM has cyclomatic complexity 38 (threshold 15). Of this number, 30 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
call-agent.validateActionParams (cyclomatic 38) lib/chat/pi/tools/call-agent.ts:262— call-agent.validateActionParams 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.
director-loop.runPiDirectorLoop (cyclomatic 38) lib/chat/pi/director-loop.ts:30— director-loop.runPiDirectorLoop has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 13 of the 38 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 223, a function literal at line 77, isTeachingSubstantiveTurn, …). 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.
openmaic-yml.crossCheck (cyclomatic 38) lib/server/model-config/openmaic-yml.ts:314— openmaic-yml.crossCheck has cyclomatic complexity 38 (threshold 15). Of this number, 25 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
collect.resolveGeneratedMedia (cyclomatic 38) lib/video-export-app/collect.ts:199— collect.resolveGeneratedMedia 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.
chat-session.ChatSessionComponent (cyclomatic 37) components/chat/chat-session.tsx:159— chat-session.ChatSessionComponent has cyclomatic complexity 37 (threshold 15). Of this number, 17 points are the body's own statements and 20 belong to 7 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.
sandbox-settings.SandboxSettings (cyclomatic 37) components/settings/sandbox-settings.tsx:14— sandbox-settings.SandboxSettings has cyclomatic complexity 37 (threshold 15). Of this number, 21 points are the body's own statements and 16 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tool-activity.ToolCard (cyclomatic 37) components/scene-renderers/pbl/v3/tool-activity.tsx:43— tool-activity.ToolCard has cyclomatic complexity 37 (threshold 15). Of this number, 35 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.
useDragLineElement.useDragLineElement.dragLineElement::handleMouseMove (cyclomatic 37) components/slide-renderer/Editor/Canvas/hooks/useDragLineElement.ts:78— useDragLineElement.useDragLineElement.dragLineElement::handleMouseMove 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.
stream-fn.pump (cyclomatic 37) lib/agent/runtime/stream-fn.ts:275— stream-fn.pump has cyclomatic complexity 37 (threshold 15). Of this number, 19 points are the body's own statements and 18 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.
interactive-state-evidence.attachInteractiveState (cyclomatic 37) lib/chat/pi/interactive-state-evidence.ts:124— interactive-state-evidence.attachInteractiveState has cyclomatic complexity 37 (threshold 15). Of this number, 28 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
voice-clone-tools.buildVoiceCloneTools (cyclomatic 37) lib/server/agent-runtime/voice-clone-tools.ts:260— voice-clone-tools.buildVoiceCloneTools has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 6 of the 37 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 376, a function literal at line 315, recordRegisteredVoice, …). 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.
event-stream.learningEventResponse (cyclomatic 37) lib/server/pbl-v3/event-stream.ts:22— event-stream.learningEventResponse has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 2 of the 37 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 80, subscribe, a function literal at line 57, …). 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.
validate.validateWhiteboardRuntimePayload (cyclomatic 37) lib/whiteboard/runtime/validate.ts:429— validate.validateWhiteboardRuntimePayload 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.
textSerializer.mergeParagraphProps (cyclomatic 37) packages/@openmaic/importer/src/serializer/textSerializer.ts:326— textSerializer.mergeParagraphProps 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.
SlideNavRail.SlideNavRail (cyclomatic 36) components/edit/SlideNavRail/SlideNavRail.tsx:50— SlideNavRail.SlideNavRail has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 15 of the 36 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 244, 105, 139, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
narration-tts.generateAndStoreTTS (cyclomatic 36) lib/audio/narration-tts.ts:82— narration-tts.generateAndStoreTTS has cyclomatic complexity 36 (threshold 15). Of this number, 32 points are the body's own statements and 4 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.
voice-resolver.getEnabledProvidersWithVoices (cyclomatic 36) lib/audio/voice-resolver.ts:394— voice-resolver.getEnabledProvidersWithVoices has cyclomatic complexity 36 (threshold 15). Of this number, 27 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
scene-generator.generateSceneActions (cyclomatic 36) REDACTED:1771— scene-generator.generateSceneActions 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.
StyleResolver.resolveLineStyle (cyclomatic 36) packages/@openmaic/importer/src/serializer/StyleResolver.ts:560— StyleResolver.resolveLineStyle 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.
HttpAssetStore.fetchBytes (cyclomatic 36) packages/@openmaic/storage/src/asset/http.ts:469— HttpAssetStore.fetchBytes 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.
index.TextElement (cyclomatic 35) components/slide-renderer/components/element/TextElement/index.tsx:29— index.TextElement has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 11 of the 35 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 86, a function literal at line 51, a function literal at line 159, …). 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.
chartOption.getChartOption (cyclomatic 35) components/slide-renderer/components/element/ChartElement/chartOption.ts:31— chartOption.getChartOption has cyclomatic complexity 35 (threshold 15). Of this number, 29 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.
evaluation.evaluationReceipt (cyclomatic 35) lib/server/pbl-v3/evaluation.ts:228— evaluation.evaluationReceipt has cyclomatic complexity 35 (threshold 15). Of this number, 19 points are the body's own statements and 16 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.
context-projection.createTeachingContextProjection.prepare (cyclomatic 35) lib/server/pbl-v3/context-projection.ts:161— context-projection.createTeachingContextProjection.prepare 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.
tableSerializer.getStyleSections (cyclomatic 35) packages/@openmaic/importer/src/serializer/tableSerializer.ts:98— tableSerializer.getStyleSections has cyclomatic complexity 35 (threshold 15). Of this number, 30 points are the body's own statements and 5 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.
svgPathParser.getSvgPathRange (cyclomatic 35) packages/@openmaic/importer/src/openmaic/utils/svgPathParser.ts:27— svgPathParser.getSvgPathRange has cyclomatic complexity 35 (threshold 15). Of this number, 32 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
json-value.findNonJsonValue (cyclomatic 35) packages/@openmaic/storage/src/runtime/json-value.ts:81— json-value.findNonJsonValue 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.
sandbox-lab.SandboxLab (cyclomatic 34) app/sandbox-lab/sandbox-lab.tsx:24— sandbox-lab.SandboxLab has cyclomatic complexity 34 (threshold 15). Of this number, 17 points are the body's own statements and 17 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActionEngine.execute (cyclomatic 34) lib/action/engine.ts:216— ActionEngine.execute has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
qwen-voice-clone.downloadAudio (cyclomatic 34) lib/audio/qwen-voice-clone.ts:378— qwen-voice-clone.downloadAudio 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.
use-export-classroom.buildClassroomExportSnapshot (cyclomatic 34) lib/export/use-export-classroom.ts:138— use-export-classroom.buildClassroomExportSnapshot has cyclomatic complexity 34 (threshold 15). Of this number, 21 points are the body's own statements and 13 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.
package-client.readClassroomProjects (cyclomatic 34) lib/pbl/v3/package-client.ts:207— package-client.readClassroomProjects has cyclomatic complexity 34 (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.
skills.checkOutlineAgainstSkill (cyclomatic 34) lib/server/agent-runtime/skills.ts:830— skills.checkOutlineAgainstSkill has cyclomatic complexity 34 (threshold 15). Of this number, 31 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.
course-issues.collectCourseIssues (cyclomatic 34) packages/@openmaic/dsl/src/course-issues.ts:94— course-issues.collectCourseIssues 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.
ElementInteractionLayer.ElementInteractionTarget (cyclomatic 34) packages/@openmaic/editor/src/react/layers/ElementInteractionLayer.tsx:87— ElementInteractionLayer.ElementInteractionTarget has cyclomatic complexity 34 (threshold 15). Of this number, 25 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
outlines-editor.SceneRow (cyclomatic 33) components/generation/outlines-editor.tsx:454— outlines-editor.SceneRow has cyclomatic complexity 33 (threshold 15). Of this number, 18 points are the body's own statements and 15 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.
model-services.ModelServicesPanel (cyclomatic 33) components/settings/model-services.tsx:130— model-services.ModelServicesPanel has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 14 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (header, a function literal at line 149, a function literal at line 146, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.SettingsDialog (cyclomatic 33) components/settings/index.tsx:52— index.SettingsDialog 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 9 function items inside it that branch (getHeaderContent, listed, a function literal at line 104, …). 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.
classroom-complete.ClassroomCompletePage (cyclomatic 33) components/scene-renderers/classroom-complete.tsx:325— classroom-complete.ClassroomCompletePage has cyclomatic complexity 33 (threshold 15). Of this number, 24 points are the body's own statements and 9 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
audio-duration.measureMp3Duration (cyclomatic 33) lib/audio/audio-duration.ts:121— audio-duration.measureMp3Duration 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.
html-asset-inventory.analyzeHtmlAssetInventory::visit (cyclomatic 33) lib/export/html-asset-inventory.ts:188— html-asset-inventory.analyzeHtmlAssetInventory::visit 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.
use-discussion-tts.useDiscussionTTS.processQueue (cyclomatic 33) lib/hooks/use-discussion-tts.ts:305— use-discussion-tts.useDiscussionTTS.processQueue has cyclomatic complexity 33 (threshold 15). Of this number, 31 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-import-classroom.useImportClassroom.handleFileChange (cyclomatic 33) lib/import/use-import-classroom.ts:374— use-import-classroom.useImportClassroom.handleFileChange has cyclomatic complexity 33 (threshold 15). Of this number, 26 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
generate-video.patchStageVideoPlaceholder (cyclomatic 33) lib/server/agent-runtime/generate-video.ts:473— generate-video.patchStageVideoPlaceholder has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 8 of the 33 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 520, isReplaceableSrc, isReplaceablePoster). 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.
App.App (cyclomatic 33) lib/standalone-player/App.tsx:125— App.App has cyclomatic complexity 33 (threshold 15). Of this number, 20 points are the body's own statements and 13 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.
chat-storage.saveChatSessions (cyclomatic 33) lib/utils/chat-storage.ts:993— chat-storage.saveChatSessions has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 5 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 1006). 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.
stage-storage.saveStageDataIncremental (cyclomatic 33) lib/utils/stage-storage.ts:355— stage-storage.saveStageDataIncremental 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 5 function literals inside it that branch (lines 406, 377, 408, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
validate.assertLosslessJson (cyclomatic 33) lib/whiteboard/runtime/validate.ts:291— validate.assertLosslessJson 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.
ZipParser.parseZip (cyclomatic 33) packages/@openmaic/importer/src/parser/ZipParser.ts:186— ZipParser.parseZip has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 303). 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.
StaticTable.StaticTable (cyclomatic 33) packages/@openmaic/renderer/src/elements/table/StaticTable.tsx:19— StaticTable.StaticTable has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 5 function items inside it that branch (getCellBg, a function literal at line 90, getHeaderTextColor, …). 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.
route.POST (cyclomatic 32) app/api/verify-pdf-provider/route.ts:122— route.POST 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.
use-chat-sessions.useChatSessions.sendMessage (cyclomatic 32) components/chat/use-chat-sessions.ts:1654— use-chat-sessions.useChatSessions.sendMessage has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
quiz-view.QuizView (cyclomatic 32) REDACTED:693— quiz-view.QuizView has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 11 of the 32 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 795, 749, 840, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BaseCodeElement.BaseCodeElement (cyclomatic 32) REDACTED:371— BaseCodeElement.BaseCodeElement has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 6 of the 32 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 502, 539, 381, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
StreamBuffer.tick (cyclomatic 32) lib/buffer/stream-buffer.ts:495— StreamBuffer.tick 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.
use-audio-recorder.useAudioRecorder.startRecording (cyclomatic 32) lib/hooks/use-audio-recorder.ts:185— use-audio-recorder.useAudioRecorder.startRecording has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 260, 237, 303, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model-settings-import.unimportedItems (cyclomatic 32) lib/legacy-browser-import/model-settings-import.ts:140— model-settings-import.unimportedItems has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dsl-tools.validationError (cyclomatic 32) lib/server/agent-runtime/dsl-tools.ts:454— dsl-tools.validationError 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.
action-parser.parseActionsFromStructuredOutput (cyclomatic 32) packages/@openmaic/generation/src/action-parser.ts:41— action-parser.parseActionsFromStructuredOutput 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.
scene-generator.extractInteractiveElements (cyclomatic 32) REDACTED:1452— scene-generator.extractInteractiveElements 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.
shape-text-fallback.shapeToTextFallback (cyclomatic 32) packages/@openmaic/geometry/src/shape-text-fallback.ts:19— shape-text-fallback.shapeToTextFallback has cyclomatic complexity 32 (threshold 15). Of this number, 26 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StyleResolver.resolveColorUncached (cyclomatic 32) packages/@openmaic/importer/src/serializer/StyleResolver.ts:115— StyleResolver.resolveColorUncached 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.
SlideElement.SlideElementContent (cyclomatic 32) packages/@openmaic/renderer/src/SlideElement.tsx:66— SlideElement.SlideElementContent has cyclomatic complexity 32 (threshold 15). Of this number, 22 points are the body's own statements and 10 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.
state-context.summarizeElement (cyclomatic 31) lib/orchestration/summarizers/state-context.ts:32— state-context.summarizeElement 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.
fold.applyRuntimeEvent (cyclomatic 31) lib/pbl/v2/runtime/fold.ts:149— fold.applyRuntimeEvent 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.
transition.allowedStudentActions (cyclomatic 31) lib/pbl/v3/domain/orchestration/transition.ts:731— transition.allowedStudentActions 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.
import-pptx.buildImportPptxTool.execute (cyclomatic 31) lib/server/agent-runtime/import-pptx.ts:396— import-pptx.buildImportPptxTool.execute 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.
model-routes.parseRouteValue (cyclomatic 31) lib/server/model-routes.ts:151— model-routes.parseRouteValue 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.
textSerializer.autoFitLineHeight (cyclomatic 31) packages/@openmaic/importer/src/serializer/textSerializer.ts:1009— textSerializer.autoFitLineHeight 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.
agent-bar.AgentVoicePill (cyclomatic 30) components/agent/agent-bar.tsx:69— agent-bar.AgentVoicePill has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 275, 123, 98, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
task-dock.TaskDock (cyclomatic 30) components/scene-renderers/pbl/v3/task-dock.tsx:26— task-dock.TaskDock has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.Whiteboard (cyclomatic 30) components/whiteboard/index.tsx:36— index.Whiteboard has cyclomatic complexity 30 (threshold 15). Of this number, 19 points are the body's own statements and 11 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.
question-form.QuestionForm (cyclomatic 30) components/workbench/chat/question-form.tsx:47— question-form.QuestionForm has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 162, 120, 98, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
runner.runScenario (cyclomatic 30) eval/whiteboard-layout/runner.ts:142— runner.runScenario has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 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.
timeline.actionDurationMs (cyclomatic 30) lib/choreography/timeline.ts:184— timeline.actionDurationMs has cyclomatic complexity 30 (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.
migration.migrateLocked (cyclomatic 30) lib/document-store/migration.ts:391— migration.migrateLocked has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 471, 404). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
user-messages.readAgentMessageLog (cyclomatic 30) lib/server/agent-runtime/user-messages.ts:31— user-messages.readAgentMessageLog 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.
product-context.teachingProductContext (cyclomatic 30) lib/server/pbl-v3/product-context.ts:61— product-context.teachingProductContext 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.
resolve-model.resolveRequestedModel (cyclomatic 30) lib/server/resolve-model.ts:127— resolve-model.resolveRequestedModel has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
element-refs.useElementRefsStoreBase (cyclomatic 30) lib/store/element-refs.ts:58— element-refs.useElementRefsStoreBase 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 9 function literals inside it that branch (lines 140, 127, 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.
useEditGesture.useEditGesture.onElementPointerDown (cyclomatic 30) packages/@openmaic/editor/src/react/useEditGesture.ts:111— useEditGesture.useEditGesture.onElementPointerDown has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to 8 function items inside it that branch (handleUp, handleMove, compute, …). 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.
tableSerializer.tableToElement.data (cyclomatic 30) packages/@openmaic/importer/src/serializer/tableSerializer.ts:505— tableSerializer.tableToElement.data 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 506). 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.
chunk-executor.createRenderPlan (cyclomatic 30) render-service/src/chunk-executor.ts:561— chunk-executor.createRenderPlan has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
speech-button.SpeechButton (cyclomatic 29) components/audio/speech-button.tsx:31— speech-button.SpeechButton has cyclomatic complexity 29 (threshold 15). Of this number, 24 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
station-node.SlotLine (cyclomatic 29) components/settings/models/station-node.tsx:81— station-node.SlotLine has cyclomatic complexity 29 (threshold 15). Of this number, 25 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.
useMoveShapeKeypoint.useMoveShapeKeypoint.moveShapeKeypoint (cyclomatic 29) components/slide-renderer/Editor/Canvas/hooks/useMoveShapeKeypoint.ts:33— useMoveShapeKeypoint.useMoveShapeKeypoint.moveShapeKeypoint has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 69, handleMouseUp, handleMouseMove). 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.
runner.main (cyclomatic 29) eval/pbl-v2-planner/runner.ts:804— runner.main has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 856, 914). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
providers.getModel (cyclomatic 29) lib/ai/providers.ts:2341— providers.getModel has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (providers.getModel::compatFetch) 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.
structured-output.parseStructuredChunk (cyclomatic 29) lib/chat/structured-output.ts:120— structured-output.parseStructuredChunk 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.
state-context.buildStateContext (cyclomatic 29) lib/orchestration/summarizers/state-context.ts:136— state-context.buildStateContext has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 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.
owner-bound-document-store.createOwnerBoundDocumentStore::withTransaction (cyclomatic 29) lib/persistence/owner-bound-document-store.ts:597— owner-bound-document-store.createOwnerBoundDocumentStore::withTransaction 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.
sse.polledEventStream (cyclomatic 29) lib/server/generation/run/sse.ts:80— sse.polledEventStream has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 7 of the 29 points are its own statements and the rest belongs to 8 function items inside it that branch (write, read, clear, …). 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.
environment.recoveredProgress (cyclomatic 29) lib/server/pbl-v3/environment.ts:161— environment.recoveredProgress has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runner-tools.teachingRunnerConfig.tool.execute (cyclomatic 29) lib/server/pbl-v3/runner-tools.ts:226— runner-tools.teachingRunnerConfig.tool.execute has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 266, 233, 244). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ssrf-guard.tunnelEmbeddedIPv4 (cyclomatic 29) lib/server/ssrf-guard.ts:114— ssrf-guard.tunnelEmbeddedIPv4 has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.applyOperation (cyclomatic 29) packages/@openmaic/editor/src/core/index.ts:426— index.applyOperation 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.
eqFieldParser.eqToPlain (cyclomatic 29) packages/@openmaic/importer/src/utils/eqFieldParser.ts:466— eqFieldParser.eqToPlain 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.
document.route (cyclomatic 29) REDACTED:332— document.route 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.
main.parsePreviewPayload (cyclomatic 29) render-service/src/main.ts:150— main.parsePreviewPayload has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
chat-session.MessageBubble (cyclomatic 28) components/chat/chat-session.tsx:46— chat-session.MessageBubble has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 122, 66, 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.
lecture-notes-view.LectureNotesView (cyclomatic 28) components/chat/lecture-notes-view.tsx:65— lecture-notes-view.LectureNotesView has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 204, 157, 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.
submission.SubmissionModal (cyclomatic 28) components/scene-renderers/pbl/v2/submission.tsx:909— submission.SubmissionModal has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (submission.SubmissionModal::handleFile) 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.
question-card.QuestionCard (cyclomatic 28) components/workbench/chat/question-card.tsx:54— question-card.QuestionCard has cyclomatic complexity 28 (threshold 15). Of this number, 21 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.
WorkspaceRequestActivity.RequestPreview (cyclomatic 28) components/workbench/workspace/WorkspaceRequestActivity.tsx:303— WorkspaceRequestActivity.RequestPreview has cyclomatic complexity 28 (threshold 15). Of this number, 26 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.
slide-ops.applyOperationToContent (cyclomatic 28) lib/edit/slide-ops.ts:152— slide-ops.applyOperationToContent has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 156, 192). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
build-standalone-html.collectStandaloneMediaBytes (cyclomatic 28) lib/export/standalone-html/build-standalone-html.ts:198— build-standalone-html.collectStandaloneMediaBytes has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 242, a function literal at line 218, resolveRef). 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.
scene-preview-content.prepareSlide (cyclomatic 28) lib/server/agent-runtime/scene-preview-content.ts:241— scene-preview-content.prepareSlide has cyclomatic complexity 28 (threshold 15). Of this number, 20 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.
scene-content.generateSceneContent (cyclomatic 28) lib/server/generation/steps/scene-content.ts:76— scene-content.generateSceneContent has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
legacy-classroom-import.importClassroomMedia (cyclomatic 28) lib/server/legacy-classroom-import.ts:197— legacy-classroom-import.importClassroomMedia has cyclomatic complexity 28 (threshold 15). Of this number, 21 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.
chat-storage-core.planChatSync (cyclomatic 28) lib/utils/chat-storage-core.ts:504— chat-storage-core.planChatSync has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useCanvasShortcuts.handleCanvasShortcut (cyclomatic 28) packages/@openmaic/editor/src/react/useCanvasShortcuts.ts:38— useCanvasShortcuts.handleCanvasShortcut has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
copyStage (cyclomatic 28) render-service/src/resource-stage-copy.mjs:30— copyStage has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to 4 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.
agent-bar.TeacherVoicePill (cyclomatic 27) components/agent/agent-bar.tsx:350— agent-bar.TeacherVoicePill has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 404, 544, 377, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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-chat-sessions.runPiSingleRequest (cyclomatic 27) components/chat/use-chat-sessions.ts:349— use-chat-sessions.runPiSingleRequest 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.
EditShell.surfaceStateEqual (cyclomatic 27) components/edit/EditShell/EditShell.tsx:221— EditShell.surfaceStateEqual 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.
station-node.StationNode (cyclomatic 27) components/settings/models/station-node.tsx:250— station-node.StationNode has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, 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.
use-instructor-stream.useInstructorStream.run (cyclomatic 27) components/scene-renderers/pbl/v2/use-instructor-stream.ts:126— use-instructor-stream.useInstructorStream.run has cyclomatic complexity 27 (threshold 15). Of this number, 17 points are the body's own statements and 10 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.
workspace.PBLV2Workspace (cyclomatic 27) components/scene-renderers/pbl/v2/workspace.tsx:107— workspace.PBLV2Workspace has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 229, 144, 190, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-layer.PBLWorkspaceLayer (cyclomatic 27) components/scene-renderers/pbl/workspace-layer.tsx:49— workspace-layer.PBLWorkspaceLayer has cyclomatic complexity 27 (threshold 15). Of this number, 18 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.
conversation.AgentTurn (cyclomatic 27) components/scene-renderers/pbl/v3/conversation.tsx:54— conversation.AgentTurn has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 94, 67, 70, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useDragElement.useDragElement.dragElement::handleMouseMove (cyclomatic 27) components/slide-renderer/Editor/Canvas/hooks/useDragElement.ts:139— useDragElement.useDragElement.dragElement::handleMouseMove has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (useDragElement.useDragElement.dragElement) 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.
BaseCodeElement.CodeLineRow (cyclomatic 27) REDACTED:205— BaseCodeElement.CodeLineRow has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
compose-extras.SkillSlashMenu (cyclomatic 27) components/workbench/compose-extras.tsx:48— compose-extras.SkillSlashMenu 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 5 function literals inside it that branch (lines 114, 199, 77, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
load-classroom.runClassroomLoad (cyclomatic 27) lib/classroom/load-classroom.ts:117— load-classroom.runClassroomLoad 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.
index.runLocked (cyclomatic 27) lib/legacy-browser-import/index.ts:167— index.runLocked has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
completion-stats.normalizeActGoals (cyclomatic 27) lib/pbl/v2/operations/runtime/completion-stats.ts:211— completion-stats.normalizeActGoals has cyclomatic complexity 27 (threshold 15). Of this number, 23 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.commitLegacyQuizSnapshot (cyclomatic 27) lib/quiz/runtime.ts:324— runtime.commitLegacyQuizSnapshot 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.
material-library-tools.buildMaterialLibraryTools (cyclomatic 27) lib/server/agent-runtime/material-library-tools.ts:107— material-library-tools.buildMaterialLibraryTools 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 6 function items inside it that branch (a function literal at line 264, a function literal at line 174, a function literal at line 218, …). 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.
resolve-slot.resolveTarget (cyclomatic 27) lib/server/model-config/resolve-slot.ts:181— resolve-slot.resolveTarget 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.
markdown-math.isLikelySingleDollarMath (cyclomatic 27) lib/workbench/markdown-math.ts:31— markdown-math.isLikelySingleDollarMath 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.
index.compileEditorEditIntents (cyclomatic 27) packages/@openmaic/editor/src/core/index.ts:164— index.compileEditorEditIntents has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
route.POST (cyclomatic 26) app/api/verify-image-provider/route.ts:43— route.POST 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.
video-export-dialog.VideoExportDialog (cyclomatic 26) components/stage/video-export-dialog.tsx:96— video-export-dialog.VideoExportDialog has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 belong to 6 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.
stage-api-whiteboard.createWhiteboardAPI (cyclomatic 26) lib/api/stage-api-whiteboard.ts:19— stage-api-whiteboard.createWhiteboardAPI has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
call-agent.executeParsedAction (cyclomatic 26) lib/chat/pi/tools/call-agent.ts:413— call-agent.executeParsedAction has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 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.
course-timeline.applyTimelineEntry (cyclomatic 26) lib/edit/course-timeline.ts:365— course-timeline.applyTimelineEntry has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
html-asset-inventory.collectAssetRefs (cyclomatic 26) lib/export/html-asset-inventory.ts:274— html-asset-inventory.collectAssetRefs has cyclomatic complexity 26 (threshold 15). Of this number, 15 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
course.runCourse (cyclomatic 26) lib/legacy-browser-import/course.ts:395— course.runCourse 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.
mineru-cloud.parseMinerUZip (cyclomatic 26) lib/pdf/mineru-cloud.ts:318— mineru-cloud.parseMinerUZip has cyclomatic complexity 26 (threshold 15). Of this number, 17 points are the body's own statements and 9 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
plain-json.canonicalize (cyclomatic 26) lib/persistence/plain-json.ts:31— plain-json.canonicalize 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.
narration.synthesizeNarration (cyclomatic 26) lib/server/generation/steps/narration.ts:59— narration.synthesizeNarration has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
media-generation.useMediaGenerationStore (cyclomatic 26) lib/store/media-generation.ts:87— media-generation.useMediaGenerationStore 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 9 function literals inside it that branch (lines 194, 253, 90, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
course-refs.decodeCourseRefs (cyclomatic 26) lib/workbench/course-refs.ts:88— course-refs.decodeCourseRefs has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
asset-manifest.enumerateAssetManifest (cyclomatic 26) packages/@openmaic/dsl/src/asset-manifest.ts:119— asset-manifest.enumerateAssetManifest has cyclomatic complexity 26 (threshold 15). Of this number, 19 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.
VideoToolbarOverlay.VideoToolbarOverlay (cyclomatic 26) packages/@openmaic/editor/src/ui/video/VideoToolbarOverlay.tsx:28— VideoToolbarOverlay.VideoToolbarOverlay has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Presentation.buildPresentation (cyclomatic 26) packages/@openmaic/importer/src/model/Presentation.ts:114— Presentation.buildPresentation 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseCodeElement.CodeLineRow (cyclomatic 26) REDACTED:202— BaseCodeElement.CodeLineRow has cyclomatic complexity 26 (threshold 15). Of this number, 14 points are the body's own statements and 12 belong to 6 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.
BaseCodeElement.BaseCodeElement (cyclomatic 26) REDACTED:368— BaseCodeElement.BaseCodeElement has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 469, 502, 384, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
route.GET (cyclomatic 25) app/api/materials/library/route.ts:38— route.GET has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 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.
slide-element-pick-overlay.ElementPickOverlay (cyclomatic 25) components/canvas/slide-element-pick-overlay.tsx:175— slide-element-pick-overlay.ElementPickOverlay 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 10 function items inside it that branch (a function literal at line 203, a function literal at line 318, a function literal at line 225, …). 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.
presentation-speech-overlay.buildPresentationBubbleModel (cyclomatic 25) components/roundtable/presentation-speech-overlay.tsx:41— presentation-speech-overlay.buildPresentationBubbleModel 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, 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.
presentation-speech-overlay.PresentationBubbleCard (cyclomatic 25) components/roundtable/presentation-speech-overlay.tsx:191— presentation-speech-overlay.PresentationBubbleCard has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
submission.SubmissionModal::handleFile (cyclomatic 25) components/scene-renderers/pbl/v2/submission.tsx:994— submission.SubmissionModal::handleFile has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (submission.SubmissionModal) 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.
index.Operate (cyclomatic 25) components/slide-renderer/Editor/Canvas/Operate/index.tsx:56— index.Operate has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, 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.
use-resolved-slide.resolveSlideMediaState (cyclomatic 25) components/slide-renderer/use-resolved-slide.ts:53— use-resolved-slide.resolveSlideMediaState 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 one function literal inside it that branches (line 95). 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.
MaterialLibraryPage.InlineName (cyclomatic 25) components/workbench/workspace/MaterialLibraryPage.tsx:540— MaterialLibraryPage.InlineName has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 596, 614, 646, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tts-providers.generateDoubaoTTS (cyclomatic 25) lib/audio/tts-providers.ts:1377— tts-providers.generateDoubaoTTS 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.
wav-validate.validateReferenceAudio (cyclomatic 25) lib/audio/wav-validate.ts:29— wav-validate.validateReferenceAudio 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.
inline-assets-importmap.buildInlinedImportmap (cyclomatic 25) lib/export/inline-assets-importmap.ts:60— inline-assets-importmap.buildInlinedImportmap has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 89, visitSpecifier, resolveExternal, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
prepare-manifest.prepareElement (cyclomatic 25) lib/export/standalone-html/prepare-manifest.ts:209— prepare-manifest.prepareElement has cyclomatic complexity 25 (threshold 15). Of this number, 22 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.
model-settings.normalizeLegacyModelSettings (cyclomatic 25) lib/legacy-browser-import/model-settings.ts:187— model-settings.normalizeLegacyModelSettings has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
eval-prompts.formatProjectSynthesisChecks (cyclomatic 25) lib/pbl/v2/operations/runtime/eval-prompts.ts:352— eval-prompts.formatProjectSynthesisChecks has cyclomatic complexity 25 (threshold 15). Of this number, 21 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.
inline-math.liftInlineMath (cyclomatic 25) lib/sanitize/inline-math.ts:83— inline-math.liftInlineMath 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.
dsl-tools.applyPatchOp (cyclomatic 25) lib/server/agent-runtime/dsl-tools.ts:758— dsl-tools.applyPatchOp has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
deployment-layer.loadDeploymentLayer (cyclomatic 25) lib/server/model-config/deployment-layer.ts:131— deployment-layer.loadDeploymentLayer has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, 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.
builtin-extraction.fetchAndExtractUrl (cyclomatic 25) lib/web-fetch/builtin-extraction.ts:366— builtin-extraction.fetchAndExtractUrl 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.
AudioToolbarOverlay.AudioToolbarOverlay (cyclomatic 25) packages/@openmaic/editor/src/ui/audio/AudioToolbarOverlay.tsx:27— AudioToolbarOverlay.AudioToolbarOverlay has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 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.
mathSerializer.postProcessLatex (cyclomatic 25) packages/@openmaic/importer/src/serializer/mathSerializer.ts:185— mathSerializer.postProcessLatex 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.
closeoutTask (cyclomatic 25) render-service/src/resource-task-runner.mjs:282— closeoutTask 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.
slide-element-pick-overlay.getSlideElementDisplaySummary (cyclomatic 24) components/canvas/slide-element-pick-overlay.tsx:48— slide-element-pick-overlay.getSlideElementDisplaySummary has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
step-visualizers.ContentVisualizer (cyclomatic 24) components/generation/step-visualizers.tsx:523— step-visualizers.ContentVisualizer has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, 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.
conversation-history.ConversationHistory (cyclomatic 24) components/scene-renderers/pbl/v3/conversation-history.tsx:20— conversation-history.ConversationHistory has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 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.
project-entry.PBLV3Container (cyclomatic 24) components/scene-renderers/pbl/v3/project-entry.tsx:14— project-entry.PBLV3Container has cyclomatic complexity 24 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WorkspaceRequestActivity.WorkspaceRequestActivity (cyclomatic 24) components/workbench/workspace/WorkspaceRequestActivity.tsx:108— WorkspaceRequestActivity.WorkspaceRequestActivity has cyclomatic complexity 24 (threshold 15). Of this number, 22 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.
stream-fn.toModelMessages (cyclomatic 24) lib/agent/runtime/stream-fn.ts:533— stream-fn.toModelMessages has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
voice-resolver.resolveAgentVoice (cyclomatic 24) lib/audio/voice-resolver.ts:111— voice-resolver.resolveAgentVoice 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.
observation-bridge.createObservationSession.capture (cyclomatic 24) REDACTED:135— observation-bridge.createObservationSession.capture has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 186, 160, 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.
media-orchestrator.retryMediaTask (cyclomatic 24) lib/media/media-orchestrator.ts:107— media-orchestrator.retryMediaTask 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.
scene-preview.buildScenePreviewTools (cyclomatic 24) lib/server/agent-runtime/scene-preview.ts:140— scene-preview.buildScenePreviewTools has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
personal-history-tools.buildPersonalHistoryTools (cyclomatic 24) lib/server/agent-runtime/personal-history-tools.ts:403— personal-history-tools.buildPersonalHistoryTools has cyclomatic complexity 24 (threshold 15). Of this number, 16 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.
outline.prepareOutline (cyclomatic 24) lib/server/generation/steps/outline.ts:378— outline.prepareOutline has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ssrf-guard.validateUrlForSSRFWithPolicy (cyclomatic 24) lib/server/ssrf-guard.ts:485— ssrf-guard.validateUrlForSSRFWithPolicy 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.
stage.writePendingChangesForUnload (cyclomatic 24) lib/store/stage.ts:1612— stage.writePendingChangesForUnload has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 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.
interactive-iframe-pool.useInteractiveIframePool (cyclomatic 24) lib/store/interactive-iframe-pool.ts:115— interactive-iframe-pool.useInteractiveIframePool 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 5 function literals inside it that branch (lines 161, 121, 184, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Presentation.resolveNodesPlaceholders (cyclomatic 24) packages/@openmaic/importer/src/model/Presentation.ts:445— Presentation.resolveNodesPlaceholders 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.
chartSerializer.chartToElement (cyclomatic 24) packages/@openmaic/importer/src/serializer/chartSerializer.ts:421— chartSerializer.chartToElement 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.
preview-validation.findNonSelfContainedInteractiveReferences (cyclomatic 24) render-service/src/preview-validation.ts:133— preview-validation.findNonSelfContainedInteractiveReferences 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 3 function items inside it that branch (visit, rejectUnlessData, rejectUnlessSelfContainedCssUrl). 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.
check-package-version-bumps.checkDslFormatVersionRule (cyclomatic 24) scripts/check-package-version-bumps.mjs:308— check-package-version-bumps.checkDslFormatVersionRule has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sandbox-preview-policy.validatePreviewTarget (cyclomatic 24) scripts/sandbox-preview-policy.mjs:32— sandbox-preview-policy.validatePreviewTarget 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.
model-edit-dialog.ModelEditDialog (cyclomatic 23) components/settings/model-edit-dialog.tsx:29— model-edit-dialog.ModelEditDialog has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 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.
sidebar.PBLV2Sidebar (cyclomatic 23) components/scene-renderers/pbl/v2/sidebar.tsx:66— sidebar.PBLV2Sidebar has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 162, 111, 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.
quiz-view.QuestionCard (cyclomatic 23) REDACTED:501— quiz-view.QuestionCard has cyclomatic complexity 23 (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.
geometry-checks.isCurveScenarioShape (cyclomatic 23) eval/whiteboard-shapes/geometry-checks.ts:16— geometry-checks.isCurveScenarioShape has cyclomatic complexity 23 (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.
instrumentation.register (cyclomatic 23) instrumentation.ts:15— instrumentation.register has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
build-agent.buildAgent (cyclomatic 23) lib/agent/runtime/build-agent.ts:69— build-agent.buildAgent has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 95, 116, 86, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
adopt-cached-narration.adoptCachedNarrationRun (cyclomatic 23) lib/audio/adopt-cached-narration.ts:316— adopt-cached-narration.adoptCachedNarrationRun has cyclomatic complexity 23 (threshold 15). Of this number, 20 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.
use-tts-preview.useTTSPreview.startPreview (cyclomatic 23) lib/audio/use-tts-preview.ts:74— use-tts-preview.useTTSPreview.startPreview has cyclomatic complexity 23 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
classroom-zip-utils.collectLegacyAudioForExport (cyclomatic 23) lib/export/classroom-zip-utils.ts:287— classroom-zip-utils.collectLegacyAudioForExport has cyclomatic complexity 23 (threshold 15). Of this number, 19 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.
model-settings-import.runModelSettingsImport (cyclomatic 23) lib/legacy-browser-import/model-settings-import.ts:221— model-settings-import.runModelSettingsImport 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
simulator.runSimulatorTurn (cyclomatic 23) lib/pbl/v2/agents/simulator.ts:381— simulator.runSimulatorTurn has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
event-stream.readLearningStream::read (cyclomatic 23) lib/pbl/v3/event-stream.ts:36— event-stream.readLearningStream::read 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.
package-client.attachClassroomProjects (cyclomatic 23) lib/pbl/v3/package-client.ts:140— package-client.attachClassroomProjects 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.
mineru-parser.extractMinerUResult (cyclomatic 23) lib/pdf/mineru-parser.ts:14— mineru-parser.extractMinerUResult has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tools.buildCourseAudioAndDeckTools (cyclomatic 23) lib/server/agent-runtime/course-edit/tools.ts:106— tools.buildCourseAudioAndDeckTools has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
entry-tree-storage.loadSessionEntryHistory (cyclomatic 23) lib/server/agent-runtime/entry-tree-storage.ts:96— entry-tree-storage.loadSessionEntryHistory has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 150, 143, 166). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
roster-tools.buildRosterTools (cyclomatic 23) lib/server/agent-runtime/roster-tools.ts:223— roster-tools.buildRosterTools has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 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.
agent-profiles.generateAgentProfiles (cyclomatic 23) lib/server/generation/steps/agent-profiles.ts:143— agent-profiles.generateAgentProfiles has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
migrate-to-pool.migrateOwnerMaterialsToPool (cyclomatic 23) lib/server/materials/migrate-to-pool.ts:145— migrate-to-pool.migrateOwnerMaterialsToPool has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (publish, a function literal at line 209, releaseAllocation). 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.
report-analysis.reportAnalysisProjection (cyclomatic 23) lib/server/pbl-v3/report-analysis.ts:45— report-analysis.reportAnalysisProjection has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 65, a function literal at line 55, sample). 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.
teaching-prompt.teachingLiveContext (cyclomatic 23) lib/server/pbl-v3/teaching-prompt.ts:343— teaching-prompt.teachingLiveContext 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.
ssrf-guard.isPrivateIP (cyclomatic 23) lib/server/ssrf-guard.ts:408— ssrf-guard.isPrivateIP has cyclomatic complexity 23 (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.
QuizScene.QuizScene (cyclomatic 23) REDACTED:101— QuizScene.QuizScene has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 124, 112). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
AudioPlayer.play (cyclomatic 23) lib/utils/audio-player.ts:146— AudioPlayer.play 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.
chat-storage.syncSessions (cyclomatic 23) lib/utils/chat-storage.ts:851— chat-storage.syncSessions has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 900, 883). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RendererTextEditor.RendererTextEditor (cyclomatic 23) packages/@openmaic/editor/src/react/text/RendererTextEditor.tsx:31— RendererTextEditor.RendererTextEditor 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 6 function literals inside it that branch (lines 87, 103, 179, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
json-repair.parseJsonResponseCandidate (cyclomatic 23) packages/@openmaic/generation/src/json-repair.ts:85— json-repair.parseJsonResponseCandidate 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.
textSerializer.renderTextWarp (cyclomatic 23) packages/@openmaic/importer/src/serializer/textSerializer.ts:876— textSerializer.renderTextWarp 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.
chartSerializer.barStyle (cyclomatic 23) packages/@openmaic/importer/src/serializer/chartSerializer.ts:347— chartSerializer.barStyle has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, 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.
inlineMath.renderPass (cyclomatic 23) packages/@openmaic/renderer/src/utils/inlineMath.ts:168— inlineMath.renderPass 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.
PgRuntimeStore.appendRecord (cyclomatic 23) packages/@openmaic/storage/src/runtime/pg.ts:485— PgRuntimeStore.appendRecord has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 514). 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.
inspectMainPid (cyclomatic 23) render-service/src/resource-systemd-runner.mjs:144— inspectMainPid has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
route.POST (cyclomatic 22) app/api/provider/probe-models/route.ts:26— route.POST 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.
step-visualizers.ScrollingSources (cyclomatic 22) components/generation/step-visualizers.tsx:224— step-visualizers.ScrollingSources 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 6 function literals inside it that branch (lines 259, 311, 248, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
usage-dashboard.UsageDashboard (cyclomatic 22) components/settings/usage-dashboard.tsx:53— usage-dashboard.UsageDashboard has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 4 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 106, a function literal at line 87, 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.
web-search-settings.WebSearchSettings (cyclomatic 22) components/settings/web-search-settings.tsx:34— web-search-settings.WebSearchSettings has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 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.
use-application-preview.waitForApplication (cyclomatic 22) components/scene-renderers/pbl/v3/use-application-preview.ts:20— use-application-preview.waitForApplication 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 one function item inside it that branches (observe). 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.
use-project-editor.useProjectEditor.pump::run (cyclomatic 22) components/scene-renderers/pbl/v3/use-project-editor.ts:235— use-project-editor.useProjectEditor.pump::run 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.
index.ImageElement (cyclomatic 22) components/slide-renderer/components/element/ImageElement/index.tsx:31— index.ImageElement has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useScaleElement.useScaleElement.scaleElement (cyclomatic 22) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:141— useScaleElement.useScaleElement.scaleElement 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. This shape REPEATS in the file: one other method here (useScaleElement.useScaleElement.scaleElement::handleMouseMove) 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.
WorkspaceClassroomPane.WorkspaceClassroomPane (cyclomatic 22) components/workbench/workspace/WorkspaceClassroomPane.tsx:38— WorkspaceClassroomPane.WorkspaceClassroomPane 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
element-reference.buildInteractiveComponentContentHint (cyclomatic 22) lib/chat/pi/element-reference.ts:1331— element-reference.buildInteractiveComponentContentHint has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
errors.isTransientExtractionError (cyclomatic 22) lib/server/material-extraction/errors.ts:59— errors.isTransientExtractionError 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.
prepare-manifest.prepareStandaloneActions (cyclomatic 22) lib/export/standalone-html/prepare-manifest.ts:338— prepare-manifest.prepareStandaloneActions 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.
errors.classifyFailure (cyclomatic 22) lib/legacy-browser-import/errors.ts:96— errors.classifyFailure has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
reconcile-scene-media.applyKnownMediaAllocations (cyclomatic 22) lib/media/reconcile-scene-media.ts:96— reconcile-scene-media.applyKnownMediaAllocations 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 items inside it that branch (a function literal at line 131, narrationRewritesFor, rewritesFor). 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.
package-client.installClassroomProjects (cyclomatic 22) lib/pbl/v3/package-client.ts:279— package-client.installClassroomProjects has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
document-access.decideDocumentAccess (cyclomatic 22) REDACTED:62— document-access.decideDocumentAccess 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.
apply.applyStrReplace (cyclomatic 22) lib/server/agent-runtime/course-edit/apply.ts:484— apply.applyStrReplace 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.
engine.executeClaimedRun::runStep (cyclomatic 22) lib/server/generation/run/engine.ts:592— engine.executeClaimedRun::runStep 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. This shape REPEATS in the file: one other method here (engine.executeClaimedRun) 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.
resolve-slot.resolveSlot (cyclomatic 22) lib/server/model-config/resolve-slot.ts:383— resolve-slot.resolveSlot 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.
lifecycle.checkpointDirtyStudy (cyclomatic 22) lib/server/pbl-v3/lifecycle.ts:522— lifecycle.checkpointDirtyStudy 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 4 function items inside it that branch (unchanged, a function literal at line 600, a function literal at line 537, …). 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.
provider-config.loadEnvSection (cyclomatic 22) lib/server/provider-config.ts:261— provider-config.loadEnvSection has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stage.startFlushRound (cyclomatic 22) lib/store/stage.ts:1436— stage.startFlushRound has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 1452). 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.
stage-storage.writeStageChangesForUnload (cyclomatic 22) lib/utils/stage-storage.ts:584— stage-storage.writeStageChangesForUnload 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.
fold.applyWhiteboardRuntimeOperation (cyclomatic 22) lib/whiteboard/runtime/fold.ts:51— fold.applyWhiteboardRuntimeOperation 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.
progress.normalizeScenario (cyclomatic 22) packages/@openmaic/generation/src/pbl/operations/kernel/progress.ts:328— progress.normalizeScenario has cyclomatic complexity 22 (threshold 15). Of this number, 12 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.
planner-single-call.hydrateProject (cyclomatic 22) packages/@openmaic/generation/src/pbl/planner-single-call.ts:352— planner-single-call.hydrateProject has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 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.
asset.readWrite (cyclomatic 22) packages/@openmaic/storage/src/server/asset.ts:322— asset.readWrite 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.
RenderCoordinator.run (cyclomatic 22) render-service/src/render-coordinator.ts:338— RenderCoordinator.run has cyclomatic complexity 22 (threshold 15). Of this number, 18 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.
resource-reference-scan.scanExternalReferences (cyclomatic 22) render-service/src/resource-reference-scan.mjs:71— resource-reference-scan.scanExternalReferences 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.
page.GreetingBar (cyclomatic 21) app/page.tsx:1687— page.GreetingBar has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 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.
use-chat-sessions.useChatSessions.createBufferForSession (cyclomatic 21) components/chat/use-chat-sessions.ts:906— use-chat-sessions.useChatSessions.createBufferForSession has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 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.
FloatingInsertToolbar.FloatingInsertToolbar (cyclomatic 21) components/edit/EditShell/FloatingInsertToolbar.tsx:66— FloatingInsertToolbar.FloatingInsertToolbar has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (handleDragKeyDown, moveWithinBounds). 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.
ThumbItem.ThumbItemComponent (cyclomatic 21) components/edit/SlideNavRail/ThumbItem.tsx:34— ThumbItem.ThumbItemComponent has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 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.
ElementRefPinLayer.ElementRefPinLayer (cyclomatic 21) components/edit/surfaces/slide/ElementRefPinLayer.tsx:31— ElementRefPinLayer.ElementRefPinLayer has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 75, 84, 126, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pdf-settings.PDFSettings (cyclomatic 21) components/settings/pdf-settings.tsx:42— pdf-settings.PDFSettings has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, 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.
conversation.LearningConversation (cyclomatic 21) components/scene-renderers/pbl/v3/conversation.tsx:198— conversation.LearningConversation 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 3 function items inside it that branch (openReference, a function literal at line 220, a function literal at line 260). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-workbench-onboarding.useWorkbenchOnboarding (cyclomatic 21) components/scene-renderers/pbl/v3/use-workbench-onboarding.ts:6— use-workbench-onboarding.useWorkbenchOnboarding has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 65, 40, 36). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ShapeCreateCanvas.ShapeCreateCanvas (cyclomatic 21) components/slide-renderer/Editor/Canvas/ShapeCreateCanvas.tsx:13— ShapeCreateCanvas.ShapeCreateCanvas has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 7 function items inside it that branch (getPoint, updateMousePosition, a function literal at line 134, …). 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.
useRotateElement.useRotateElement.rotateElement::handleMouseMove (cyclomatic 21) components/slide-renderer/Editor/Canvas/hooks/useRotateElement.ts:71— useRotateElement.useRotateElement.rotateElement::handleMouseMove 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.
whiteboard-canvas.InteractiveWhiteboardCanvas (cyclomatic 21) components/whiteboard/whiteboard-canvas.tsx:123— whiteboard-canvas.InteractiveWhiteboardCanvas has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 298, 164, 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.
llm.buildThinkingProviderOptions (cyclomatic 21) lib/ai/llm.ts:156— llm.buildThinkingProviderOptions 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.
StreamBuffer.flushRemaining (cyclomatic 21) lib/buffer/stream-buffer.ts:369— StreamBuffer.flushRemaining 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.
pptx-scene-placeholders.planPptxDeck (cyclomatic 21) lib/export/pptx-scene-placeholders.ts:250— pptx-scene-placeholders.planPptxDeck has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
whiteboard-conflicts.elementLabel (cyclomatic 21) lib/orchestration/summarizers/whiteboard-conflicts.ts:41— whiteboard-conflicts.elementLabel has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
skill-preload.buildSkillPreload (cyclomatic 21) lib/server/agent-runtime/skill-preload.ts:224— skill-preload.buildSkillPreload 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.
media.generateItem (cyclomatic 21) lib/server/generation/run/media.ts:318— media.generateItem 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.
runner.startGenerationRunner (cyclomatic 21) lib/server/generation/run/runner.ts:111— runner.startGenerationRunner has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 3 function items inside it that branch (scan, a function literal at line 160, a function literal at line 170). 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-images.resolveDerivativeRefsAsync (cyclomatic 21) lib/server/material-extraction/document-images.ts:305— document-images.resolveDerivativeRefsAsync 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
owner-extraction.runClaimedOwnerExtraction (cyclomatic 21) lib/server/material-extraction/owner-extraction.ts:310— owner-extraction.runClaimedOwnerExtraction 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
quiz-layout.measureQuizQuestionList (cyclomatic 21) REDACTED:81— quiz-layout.measureQuizQuestionList 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.createWhiteboardRuntimeService (cyclomatic 21) lib/whiteboard/runtime/store.ts:172— store.createWhiteboardRuntimeService 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 items inside it that branch (a function literal at line 205, append, a function literal at line 295, …). 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.
TextFormatToolbar.TextFormatToolbar (cyclomatic 21) packages/@openmaic/editor/src/ui/text/TextFormatToolbar.tsx:32— TextFormatToolbar.TextFormatToolbar has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useToolbarAnchor.useToolbarAnchor (cyclomatic 21) packages/@openmaic/editor/src/ui/text/useToolbarAnchor.ts:37— useToolbarAnchor.useToolbarAnchor 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 70, 44, 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.
scene-generator.normalizeGeneratedVideoRefs (cyclomatic 21) REDACTED:420— scene-generator.normalizeGeneratedVideoRefs has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 433). 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.
ShapeNode.parseParagraph (cyclomatic 21) packages/@openmaic/importer/src/model/nodes/ShapeNode.ts:113— ShapeNode.parseParagraph 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.
Slide.parseChildNode (cyclomatic 21) packages/@openmaic/importer/src/model/Slide.ts:394— Slide.parseChildNode 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.
presets.presetShapes.set("wedgeRectCallout") (cyclomatic 21) packages/@openmaic/importer/src/shapes/presets.ts:2683— presets.presetShapes.set("wedgeRectCallout") has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (presets.presetShapes.set("wedgeRoundRectCallout")) 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.
presets.presetShapes.set("wedgeRoundRectCallout") (cyclomatic 21) packages/@openmaic/importer/src/shapes/presets.ts:2730— presets.presetShapes.set("wedgeRoundRectCallout") has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (presets.presetShapes.set("wedgeRectCallout")) 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.
imageSerializer.applyExtLstImageEffectsToFilters (cyclomatic 21) packages/@openmaic/importer/src/serializer/imageSerializer.ts:261— imageSerializer.applyExtLstImageEffectsToFilters 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.
transferCandidate (cyclomatic 21) render-service/src/resource-task-runner.mjs:61— transferCandidate has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs 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.
route.verify (cyclomatic 20) app/api/verify-model/route.ts:25— route.verify 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.
client.WorkbenchLaunchBridge (cyclomatic 20) app/workbench/new/client.tsx:45— client.WorkbenchLaunchBridge has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 53, 69, 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.
proactive-card.ProactiveCard (cyclomatic 20) components/chat/proactive-card.tsx:38— proactive-card.ProactiveCard has cyclomatic complexity 20 (threshold 15). Of this number, 14 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.
apply-instructor-event.applyInstructorEvent (cyclomatic 20) components/scene-renderers/pbl/v2/apply-instructor-event.ts:42— apply-instructor-event.applyInstructorEvent has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
scenario-stage.ScenarioStage (cyclomatic 20) components/scene-renderers/pbl/v2/scene-stage/scenario-stage.tsx:43— scenario-stage.ScenarioStage has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, 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.
RendererScreenCanvas.PlaybackVideoContent (cyclomatic 20) components/slide-renderer/Editor/RendererScreenCanvas.tsx:21— RendererScreenCanvas.PlaybackVideoContent 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseVideoElement.BaseVideoElement (cyclomatic 20) components/slide-renderer/components/element/VideoElement/BaseVideoElement.tsx:32— BaseVideoElement.BaseVideoElement has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WorkspaceRail.RailRow (cyclomatic 20) components/workbench/workspace/WorkspaceRail.tsx:2037— WorkspaceRail.RailRow has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 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.
element-reference.resolveInteractiveComponentReference (cyclomatic 20) lib/chat/pi/element-reference.ts:1445— element-reference.resolveInteractiveComponentReference 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.
lexer.lexTagAttributes (cyclomatic 20) lib/export/html-parser/lexer.ts:100— lexer.lexTagAttributes 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.
build-standalone-html.buildStandaloneHtmlExport (cyclomatic 20) lib/export/standalone-html/build-standalone-html.ts:633— build-standalone-html.buildStandaloneHtmlExport 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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-import-classroom.materializeImportedMedia (cyclomatic 20) lib/import/use-import-classroom.ts:253— use-import-classroom.materializeImportedMedia has cyclomatic complexity 20 (threshold 15). Of this number, 16 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.
observation-bridge.installObservationResponder::receive (cyclomatic 20) REDACTED:45— observation-bridge.installObservationResponder::receive 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.
sources.readLegacyCourse (cyclomatic 20) lib/legacy-browser-import/sources.ts:178— sources.readLegacyCourse 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.
collect-stage-asset-refs.collectStageAssetRefs (cyclomatic 20) lib/media/collect-stage-asset-refs.ts:55— collect-stage-asset-refs.collectStageAssetRefs has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
whiteboard-conflicts.buildWhiteboardConflicts (cyclomatic 20) lib/orchestration/summarizers/whiteboard-conflicts.ts:178— whiteboard-conflicts.buildWhiteboardConflicts 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.
instructor.runSetupFollowup (cyclomatic 20) lib/pbl/v2/agents/instructor.ts:1760— instructor.runSetupFollowup 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.
record-payloads.enrichPBLRuntimeEvent (cyclomatic 20) lib/pbl/v2/runtime/record-payloads.ts:130— record-payloads.enrichPBLRuntimeEvent has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
edit-access.projectEditAccess (cyclomatic 20) lib/pbl/v3/edit-access.ts:26— edit-access.projectEditAccess 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.
document-access.parseDocumentAction (cyclomatic 20) REDACTED:31— document-access.parseDocumentAction 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.
tool-call-integrity.repairOrphanedToolCalls (cyclomatic 20) lib/server/agent-runtime/tool-call-integrity.ts:109— tool-call-integrity.repairOrphanedToolCalls 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.
legacy-classroom-import.importLegacyClassrooms (cyclomatic 20) lib/server/legacy-classroom-import.ts:390— legacy-classroom-import.importLegacyClassrooms has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
model-routes.parseUserStageRoutes (cyclomatic 20) lib/server/model-routes.ts:233— model-routes.parseUserStageRoutes 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.
evaluation.evaluationOutcome (cyclomatic 20) lib/server/pbl-v3/evaluation.ts:313— evaluation.evaluationOutcome 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.
chat-storage.loadChatSessions (cyclomatic 20) lib/utils/chat-storage.ts:1157— chat-storage.loadChatSessions has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kimi.searchWithKimi (cyclomatic 20) lib/web-search/kimi.ts:26— kimi.searchWithKimi has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
toggleList.toggleList.<returned closure> (cyclomatic 20) packages/@openmaic/editor/src/react/text/prosemirror/commands/toggleList.ts:19— toggleList.toggleList.<returned closure> has cyclomatic complexity 20 (threshold 15). Of this number, 17 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.
LatexToolbarOverlay.LatexToolbarOverlay (cyclomatic 20) packages/@openmaic/editor/src/ui/latex/LatexToolbarOverlay.tsx:30— LatexToolbarOverlay.LatexToolbarOverlay has cyclomatic complexity 20 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
engagement.microtaskEngagement (cyclomatic 20) packages/@openmaic/generation/src/pbl/operations/kernel/engagement.ts:67— engagement.microtaskEngagement 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.
planner-core.plannerCompletionGaps (cyclomatic 20) packages/@openmaic/generation/src/pbl/planner-core.ts:323— planner-core.plannerCompletionGaps has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
scene-generator.fixElementDefaults (cyclomatic 20) REDACTED:488— scene-generator.fixElementDefaults 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 one function literal inside it that branches (line 499). 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.
customGeometry.renderCustomGeometry (cyclomatic 20) packages/@openmaic/importer/src/shapes/customGeometry.ts:45— customGeometry.renderCustomGeometry 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.
AssetCollector.collectPass (cyclomatic 20) packages/@openmaic/storage/src/asset/collector.ts:502— AssetCollector.collectPass has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
resource-task-runner.validateConfig (cyclomatic 20) render-service/src/resource-task-runner.mjs:223— resource-task-runner.validateConfig has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
route.POST (cyclomatic 19) app/api/export-video/render/route.ts:29— route.POST has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 30). 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.
access-code-modal.AccessCodeModal (cyclomatic 19) components/access-code-modal.tsx:13— access-code-modal.AccessCodeModal has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 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.
generation-toolbar.CourseMaterialChip (cyclomatic 19) components/generation/generation-toolbar.tsx:533— generation-toolbar.CourseMaterialChip 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.
image-settings.ImageSettings (cyclomatic 19) components/settings/image-settings.tsx:25— image-settings.ImageSettings has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 4 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.
sidebar.MilestoneNode (cyclomatic 19) components/scene-renderers/pbl/v2/sidebar.tsx:266— sidebar.MilestoneNode has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, 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.
use-learning-stream.useLearningStream (cyclomatic 19) components/scene-renderers/pbl/v3/use-learning-stream.ts:9— use-learning-stream.useLearningStream has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 29, 35, 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.
ResizeHandler.ResizeHandler (cyclomatic 19) components/slide-renderer/Editor/Canvas/Operate/ResizeHandler.tsx:12— ResizeHandler.ResizeHandler has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 19, 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.
useSelectElement.useSelectElement.selectElement (cyclomatic 19) components/slide-renderer/Editor/Canvas/hooks/useSelectElement.ts:29— useSelectElement.useSelectElement.selectElement has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActionEngine.executeWbEditCode (cyclomatic 19) lib/action/engine.ts:753— ActionEngine.executeWbEditCode 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.
tool-timeout.executeWithToolBound (cyclomatic 19) lib/agent/runtime/tool-timeout.ts:155— tool-timeout.executeWithToolBound 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 8 function items inside it that branch (cleanup, onTimeout, a function literal at line 258, …). 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.
tts-providers.generateTTS (cyclomatic 19) lib/audio/tts-providers.ts:301— tts-providers.generateTTS has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
native-whiteboard.settleWhiteboardMutation (cyclomatic 19) lib/chat/pi/tools/native-whiteboard.ts:527— native-whiteboard.settleWhiteboardMutation has cyclomatic complexity 19 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
classroom-zip-utils.rewriteAudioRefsToIds (cyclomatic 19) lib/export/classroom-zip-utils.ts:417— classroom-zip-utils.rewriteAudioRefsToIds has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 422). 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.
media.fillLegacyMedia (cyclomatic 19) lib/legacy-browser-import/media.ts:384— media.fillLegacyMedia has cyclomatic complexity 19 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
course.settleDocument (cyclomatic 19) lib/legacy-browser-import/course.ts:171— course.settleDocument 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.
resolve-stored-bytes.resolveStoredBytes (cyclomatic 19) lib/media/resolve-stored-bytes.ts:94— resolve-stored-bytes.resolveStoredBytes 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.
client.createModelSettingsClient.apply (cyclomatic 19) lib/model-settings/client.ts:182— client.createModelSettingsClient.apply has cyclomatic complexity 19 (threshold 15). Of this number, 16 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.
edit.providerChange (cyclomatic 19) lib/model-settings/edit.ts:360— edit.providerChange 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.
eval-prompts.buildMilestoneEvalPrompt (cyclomatic 19) lib/pbl/v2/operations/runtime/eval-prompts.ts:135— eval-prompts.buildMilestoneEvalPrompt 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.
advance-patch.applyAdvanceProjectPatch (cyclomatic 19) lib/pbl/v2/operations/runtime/advance-patch.ts:72— advance-patch.applyAdvanceProjectPatch 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.
alidocmind-client.fetchResult (cyclomatic 19) lib/pdf/alidocmind-client.ts:217— alidocmind-client.fetchResult 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.
alidocmind-client.verifyAliDocMindCredentials (cyclomatic 19) lib/pdf/alidocmind-client.ts:302— alidocmind-client.verifyAliDocMindCredentials 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.
event-notify-bus.parseRoute (cyclomatic 19) lib/server/agent-runtime/event-notify-bus.ts:120— event-notify-bus.parseRoute 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.
runner.slimEventDataForLog (cyclomatic 19) lib/server/agent-runtime/runner.ts:217— runner.slimEventDataForLog 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.
review-question.reviewReceipt (cyclomatic 19) lib/server/pbl-v3/review-question.ts:36— review-question.reviewReceipt 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.
runtime.validateCommand (cyclomatic 19) lib/server/pbl-v3/runtime.ts:407— runtime.validateCommand 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.
execution-watchdog.expireStalledTeachingTurns (cyclomatic 19) lib/server/pbl-v3/execution-watchdog.ts:60— execution-watchdog.expireStalledTeachingTurns has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 97). 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.
provider-config.applyBedrockProviderConfig (cyclomatic 19) lib/server/provider-config.ts:490— provider-config.applyBedrockProviderConfig 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.
collect.collectVideoAssets (cyclomatic 19) lib/video-export-app/collect.ts:326— collect.collectVideoAssets 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.
validate.normalizeAndValidateLegacyWhiteboard (cyclomatic 19) lib/whiteboard/runtime/validate.ts:379— validate.normalizeAndValidateLegacyWhiteboard 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.
OwnerSessionClient.runFullFetch (cyclomatic 19) lib/workbench/owner-session-client.ts:358— OwnerSessionClient.runFullFetch 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 literals inside it that branch (lines 369, 372, 413, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useMarqueeGesture.useMarqueeGesture.onCanvasPointerDown (cyclomatic 19) packages/@openmaic/editor/src/react/useMarqueeGesture.ts:97— useMarqueeGesture.useMarqueeGesture.onCanvasPointerDown 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 4 function items inside it that branch (handleUp, handleMove, rectPastThreshold, …). 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.
ElementToolbarOverlay.ElementToolbarOverlay (cyclomatic 19) packages/@openmaic/editor/src/ui/element/ElementToolbarOverlay.tsx:21— ElementToolbarOverlay.ElementToolbarOverlay has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
progress.normalizeProjectRuntime (cyclomatic 19) packages/@openmaic/generation/src/pbl/operations/kernel/progress.ts:75— progress.normalizeProjectRuntime 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.
shapeSerializer.resolveInheritedPlaceholderFill (cyclomatic 19) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:766— shapeSerializer.resolveInheritedPlaceholderFill 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.
groupSerializer.scaleSvgPath (cyclomatic 19) packages/@openmaic/importer/src/serializer/groupSerializer.ts:80— groupSerializer.scaleSvgPath 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.
groupSerializer.groupToElement (cyclomatic 19) packages/@openmaic/importer/src/serializer/groupSerializer.ts:242— groupSerializer.groupToElement 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.
index.slideToPng (cyclomatic 19) packages/@openmaic/renderer/src/snapshot/index.ts:93— index.slideToPng has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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.classifyStoreError (cyclomatic 19) REDACTED:249— document.classifyStoreError 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.
use-chat-sessions.useChatSessions.endSession (cyclomatic 18) components/chat/use-chat-sessions.ts:1339— use-chat-sessions.useChatSessions.endSession has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 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.
ElementRefLassoButton.ElementRefLassoButton (cyclomatic 18) components/edit/EditDock/ElementRefLassoButton.tsx:54— ElementRefLassoButton.ElementRefLassoButton has cyclomatic complexity 18 (threshold 15). Of this number, 13 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.
CanvasOverlayPortal.useAnchorRect (cyclomatic 18) components/edit/surfaces/slide/CanvasOverlayPortal.tsx:100— CanvasOverlayPortal.useAnchorRect 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 7 function literals inside it that branch (lines 121, 106, 131, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
step-visualizers.StreamingOutlineVisualizer (cyclomatic 18) components/generation/step-visualizers.tsx:357— step-visualizers.StreamingOutlineVisualizer has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 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.
project-hero.ProjectHero (cyclomatic 18) components/scene-renderers/pbl/project-hero.tsx:35— project-hero.ProjectHero has cyclomatic complexity 18 (threshold 15). Of this number, 15 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.
use-project-editor.useProjectEditor (cyclomatic 18) components/scene-renderers/pbl/v3/use-project-editor.ts:17— use-project-editor.useProjectEditor 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 199, 333, 78). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
code-editor.CodeEditor (cyclomatic 18) components/scene-renderers/pbl/v3/code-editor.tsx:11— code-editor.CodeEditor has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 140, 41, 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.
index.VideoElement (cyclomatic 18) components/slide-renderer/components/element/VideoElement/index.tsx:27— index.VideoElement 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MaterialLibraryPage.materialKind (cyclomatic 18) components/workbench/workspace/MaterialLibraryPage.tsx:163— MaterialLibraryPage.materialKind 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.
WorkspaceChatPane.WorkspaceChatPane (cyclomatic 18) components/workbench/workspace/WorkspaceChatPane.tsx:33— WorkspaceChatPane.WorkspaceChatPane 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.
runner.writeMarkdownReport (cyclomatic 18) eval/pbl-v2-planner/runner.ts:733— runner.writeMarkdownReport 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.
ActionEngine.executePlayVideo (cyclomatic 18) lib/action/engine.ts:360— ActionEngine.executePlayVideo 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 literals inside it that branch (lines 378, 385, 417, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
page-scroll-boundary.installPageScrollBoundary::move (cyclomatic 18) lib/adaptive/page-scroll-boundary.ts:10— page-scroll-boundary.installPageScrollBoundary::move 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.
llm.withStreamFallback (cyclomatic 18) lib/ai/llm.ts:753— llm.withStreamFallback 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 799, serveFallback, track). 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.
tts-providers.generateVoxCPMTTS (cyclomatic 18) lib/audio/tts-providers.ts:462— tts-providers.generateVoxCPMTTS 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.
css-asset-parser.parseFontSrcEntry (cyclomatic 18) lib/export/css-asset-parser.ts:150— css-asset-parser.parseFontSrcEntry 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.
parser.parse (cyclomatic 18) lib/export/html-parser/parser.ts:48— parser.parse 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.
pptx-scene-placeholders.renderScenePlaceholder (cyclomatic 18) lib/export/pptx-scene-placeholders.ts:452— pptx-scene-placeholders.renderScenePlaceholder 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.
agents-import.runAgentsImportLocked (cyclomatic 18) lib/legacy-browser-import/agents-import.ts:252— agents-import.runAgentsImportLocked 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.
comfyui-image-adapter.patchWorkflow (cyclomatic 18) lib/media/adapters/comfyui-image-adapter.ts:304— comfyui-image-adapter.patchWorkflow 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.
minimax-video-adapter.generateWithMiniMaxVideo (cyclomatic 18) lib/media/adapters/minimax-video-adapter.ts:254— minimax-video-adapter.generateWithMiniMaxVideo has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 264). 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.
media-orchestrator.generateSingleMedia (cyclomatic 18) lib/media/media-orchestrator.ts:606— media-orchestrator.generateSingleMedia 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.
resolve-media-ref.resolveMediaRef (cyclomatic 18) lib/media/resolve-media-ref.ts:43— resolve-media-ref.resolveMediaRef 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.
evaluator.runShared (cyclomatic 18) lib/pbl/v2/agents/evaluator.ts:130— evaluator.runShared 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.
instructor.buildPriorSubmissionsBlock (cyclomatic 18) lib/pbl/v2/agents/instructor.ts:251— instructor.buildPriorSubmissionsBlock 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.
event-notify-bus.connect (cyclomatic 18) lib/server/agent-runtime/event-notify-bus.ts:252— event-notify-bus.connect has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
dsl-tools.textScene (cyclomatic 18) lib/server/agent-runtime/dsl-tools.ts:335— dsl-tools.textScene has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
resume.planResume (cyclomatic 18) lib/server/agent-runtime/resume.ts:93— resume.planResume 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.
runner.elementRefsPromptBlock (cyclomatic 18) lib/server/agent-runtime/runner.ts:540— runner.elementRefsPromptBlock has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 541). 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.
runner.planRunStart (cyclomatic 18) lib/server/agent-runtime/runner.ts:867— runner.planRunStart 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.
http.parseAgentBody (cyclomatic 18) lib/server/agents/http.ts:78— http.parseAgentBody 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.
vision-images.prepareVisionImages (cyclomatic 18) lib/server/generation/vision-images.ts:24— vision-images.prepareVisionImages 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.
evaluation.evaluationFor (cyclomatic 18) lib/server/pbl-v3/evaluation.ts:37— evaluation.evaluationFor has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (compile, a function literal at line 48, sourcePath, …). 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.
provider-config.resolveServerWebSearchProviderId (cyclomatic 18) lib/server/provider-config.ts:1075— provider-config.resolveServerWebSearchProviderId 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.
PblScene.PblScene (cyclomatic 18) lib/standalone-player/scenes/PblScene.tsx:73— PblScene.PblScene 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, 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.
SceneSequencer.step (cyclomatic 18) lib/standalone-player/playback/sequencer.ts:140— SceneSequencer.step 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.
FetchEventSource.connect (cyclomatic 18) lib/utils/fetch-event-source.ts:224— FetchEventSource.connect 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.
split-cue.isWide (cyclomatic 18) lib/video-export/split-cue.ts:72— split-cue.isWide 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.
read.isUsableLegacyCoverConfig (cyclomatic 18) lib/video-export/legacy/read.ts:106— read.isUsableLegacyCoverConfig 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.
session-store.uploadWorkbenchMaterial (cyclomatic 18) lib/workbench/session-store.ts:2276— session-store.uploadWorkbenchMaterial 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.
course-discovery-sync.useGeneratedCourseDiscoverySync (cyclomatic 18) lib/workbench/course-discovery-sync.ts:76— course-discovery-sync.useGeneratedCourseDiscoverySync 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 literals inside it that branch (lines 118, 103, 133). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
request-schedule.sceneChanges (cyclomatic 18) lib/workbench/request-schedule.ts:206— request-schedule.sceneChanges 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.
interactive.isInteractiveContent (cyclomatic 18) packages/@openmaic/dsl/src/interactive.ts:60— interactive.isInteractiveContent 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.
rotate.computeRotate (cyclomatic 18) packages/@openmaic/editor/src/react/core/rotate.ts:59— rotate.computeRotate 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.
useShapeKeypointGesture.useShapeKeypointGesture.onShapeKeypointPointerDown (cyclomatic 18) packages/@openmaic/editor/src/react/useShapeKeypointGesture.ts:87— useShapeKeypointGesture.useShapeKeypointGesture.onShapeKeypointPointerDown has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, 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.
LineFormatToolbar.LineFormatToolbar (cyclomatic 18) packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:21— LineFormatToolbar.LineFormatToolbar has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
json-repair.tryParseJson (cyclomatic 18) packages/@openmaic/generation/src/json-repair.ts:177— json-repair.tryParseJson has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 3 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.
interactive-post-processor.postProcessInteractiveHtml (cyclomatic 18) packages/@openmaic/generation/src/interactive-post-processor.ts:30— interactive-post-processor.postProcessInteractiveHtml 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.
planner-single-call.hydrateScenario (cyclomatic 18) packages/@openmaic/generation/src/pbl/planner-single-call.ts:314— planner-single-call.hydrateScenario 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
emfParser.parseStretchDibits (cyclomatic 18) packages/@openmaic/importer/src/utils/emfParser.ts:210— emfParser.parseStretchDibits 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.
shapeSerializer.pickVisibleGradientStop (cyclomatic 18) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:92— shapeSerializer.pickVisibleGradientStop 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.
imageSerializer.buildImage (cyclomatic 18) packages/@openmaic/importer/src/serializer/imageSerializer.ts:571— imageSerializer.buildImage 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.
chartSerializer.extractSeriesColors (cyclomatic 18) packages/@openmaic/importer/src/serializer/chartSerializer.ts:160— chartSerializer.extractSeriesColors 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.
chartOption.getChartOption::axisOptions (cyclomatic 18) packages/@openmaic/renderer/src/elements/chart/chartOption.ts:118— chartOption.getChartOption::axisOptions 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. This shape REPEATS in the file: one other method here (chartOption.getChartOption) 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.
HttpDocumentStore.request (cyclomatic 18) packages/@openmaic/storage/src/document/http.ts:272— HttpDocumentStore.request 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.
BrowserRuntimeStore.appendRecord (cyclomatic 18) packages/@openmaic/storage/src/runtime/browser.ts:349— BrowserRuntimeStore.appendRecord 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 one function literal inside it that branches (line 369). 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.
HttpRuntimeStore.requestWithStatus (cyclomatic 18) packages/@openmaic/storage/src/runtime/http.ts:179— HttpRuntimeStore.requestWithStatus 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.
sandbox-preview-gateway.headersFor (cyclomatic 18) scripts/sandbox-preview-gateway.mjs:151— sandbox-preview-gateway.headersFor 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, 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.
skill-settings.SkillSettings (cyclomatic 17) components/settings/skill-settings.tsx:338— skill-settings.SkillSettings has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 359, 380, 414, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
media-service-panel.MediaServicePanel (cyclomatic 17) components/settings/media-service-panel.tsx:38— media-service-panel.MediaServicePanel has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, 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.
chat.StreamingDraft (cyclomatic 17) components/scene-renderers/pbl/v2/chat.tsx:807— chat.StreamingDraft 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.
learning-panels.LearningPanels (cyclomatic 17) components/scene-renderers/pbl/v3/learning-panels.tsx:8— learning-panels.LearningPanels 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 5 function literals inside it that branch (lines 74, 20, 52, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pbl-renderer.PBLV2Container (cyclomatic 17) components/scene-renderers/pbl-renderer.tsx:64— pbl-renderer.PBLV2Container has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 199, 186, 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.
useScaleElement.useScaleElement.scaleMultiElement::handleMouseMove (cyclomatic 17) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:584— useScaleElement.useScaleElement.scaleMultiElement::handleMouseMove 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.
WorkspaceCourseTabs.WorkspaceCourseTabs::onKeyDown (cyclomatic 17) components/workbench/workspace/WorkspaceCourseTabs.tsx:155— WorkspaceCourseTabs.WorkspaceCourseTabs::onKeyDown 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.
reporter.generateReport (cyclomatic 17) eval/whiteboard-layout/reporter.ts:17— reporter.generateReport 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.
apply-regenerate.planRegenerateApply (cyclomatic 17) lib/agent/client/apply-regenerate.ts:93— apply-regenerate.planRegenerateApply 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.
reasoning-sse.createReasoningContentRewriter.rewrite (cyclomatic 17) lib/ai/reasoning-sse.ts:139— reasoning-sse.createReasoningContentRewriter.rewrite 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.
local-media.extractMediaMaterial (cyclomatic 17) lib/document/extractors/local-media.ts:603— local-media.extractMediaMaterial 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.
css-asset-parser.cssImportReference (cyclomatic 17) lib/export/css-asset-parser.ts:175— css-asset-parser.cssImportReference has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
chat-observation.sampleInteractiveState (cyclomatic 17) lib/interactive/chat-observation.ts:23— chat-observation.sampleInteractiveState has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sources.legacySpeechHolders (cyclomatic 17) lib/legacy-browser-import/sources.ts:280— sources.legacySpeechHolders has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
runtime.copySession (cyclomatic 17) lib/legacy-browser-import/runtime.ts:74— runtime.copySession 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
conversation.markRecoveredTeachingTools (cyclomatic 17) lib/pbl/v3/conversation.ts:160— conversation.markRecoveredTeachingTools has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
file-reference.parseFileReference (cyclomatic 17) lib/pbl/v3/file-reference.ts:15— file-reference.parseFileReference has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mineru-cloud.parseWithMinerUCloud (cyclomatic 17) lib/pdf/mineru-cloud.ts:491— mineru-cloud.parseWithMinerUCloud 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.
pdf-providers.aliDocMindLayoutsToParsedPdf (cyclomatic 17) lib/pdf/pdf-providers.ts:620— pdf-providers.aliDocMindLayoutsToParsedPdf has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
owner-material-extraction.publishOwnerMaterialExtraction (cyclomatic 17) lib/persistence/owner-material-extraction.ts:414— owner-material-extraction.publishOwnerMaterialExtraction 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 one function literal inside it that branches (line 426). 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.
PlaybackEngine.playBrowserTTSChunk (cyclomatic 17) lib/playback/engine.ts:815— PlaybackEngine.playBrowserTTSChunk has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ask-user.buildAskUserTool.execute (cyclomatic 17) lib/server/agent-runtime/ask-user.ts:53— ask-user.buildAskUserTool.execute 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
media-byte-omission.percentDecodedUtf8Length (cyclomatic 17) lib/server/agent-runtime/course-edit/media-byte-omission.ts:86— media-byte-omission.percentDecodedUtf8Length 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 (media-byte-omission.percentDecodedUtf8Length::feedPercentByte) 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.
apply.applySlideEdit (cyclomatic 17) lib/server/agent-runtime/course-edit/apply.ts:711— apply.applySlideEdit 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.
dsl-tools.applyStrReplaceOp (cyclomatic 17) lib/server/agent-runtime/dsl-tools.ts:687— dsl-tools.applyStrReplaceOp has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.applyPatch (cyclomatic 17) lib/server/generation/run/store.ts:459— store.applyPatch 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.
settings.modelSettingsView (cyclomatic 17) lib/server/model-config/settings.ts:472— settings.modelSettingsView has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 502, 488, 558, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model-routes.parseThinking (cyclomatic 17) lib/server/model-routes.ts:71— model-routes.parseThinking has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LearningStore.reconcileIdleTurns (cyclomatic 17) lib/server/pbl-v3/store.ts:191— LearningStore.reconcileIdleTurns 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 one function literal inside it that branches (line 192). 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.
environment.touchEnvironment (cyclomatic 17) lib/server/pbl-v3/environment.ts:92— environment.touchEnvironment 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.
registry.configureAssetByteStore (cyclomatic 17) lib/server/persistence-hooks/registry.ts:161— registry.configureAssetByteStore 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.
VideoRegistry.play (cyclomatic 17) REDACTED:189— VideoRegistry.play has cyclomatic complexity 17 (threshold 15). Of this number, 10 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.
read.hasPblV2CoverContainers (cyclomatic 17) lib/video-export/legacy/read.ts:40— read.hasPblV2CoverContainers has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.planPblCover (cyclomatic 17) lib/video-export/emit-hyperframes/index.ts:981— index.planPblCover has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (degrade). 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.
deepseek.searchWithDeepSeek (cyclomatic 17) lib/web-search/deepseek.ts:17— deepseek.searchWithDeepSeek has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 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.
material-library-client.materialOf (cyclomatic 17) lib/workbench/material-library-client.ts:193— material-library-client.materialOf 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.
useResizeGesture.useResizeGesture.onResizeHandlePointerDown (cyclomatic 17) packages/@openmaic/editor/src/react/useResizeGesture.ts:114— useResizeGesture.useResizeGesture.onResizeHandlePointerDown 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 4 function items inside it that branch (handleUp, modifierOf, handleMove, …). 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.
TextAutoSize.TextAutoSize (cyclomatic 17) packages/@openmaic/editor/src/react/text/TextAutoSize.tsx:31— TextAutoSize.TextAutoSize has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 76, 53, 73, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
CanvasContextMenu.CanvasContextMenu (cyclomatic 17) packages/@openmaic/editor/src/ui/context/CanvasContextMenu.tsx:153— CanvasContextMenu.CanvasContextMenu has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
generation-retry.isRetryableGenerationError (cyclomatic 17) packages/@openmaic/generation/src/generation-retry.ts:130— generation-retry.isRetryableGenerationError 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.
outline-type.changeOutlineType (cyclomatic 17) packages/@openmaic/generation/src/outline-type.ts:13— outline-type.changeOutlineType 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.
scene-generator.processActions (cyclomatic 17) REDACTED:1984— scene-generator.processActions has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 1995). 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.
Presentation.findMatchingPlaceholder (cyclomatic 17) packages/@openmaic/importer/src/model/Presentation.ts:353— Presentation.findMatchingPlaceholder 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.
Presentation.findMatchingLayoutPlaceholder (cyclomatic 17) packages/@openmaic/importer/src/model/Presentation.ts:393— Presentation.findMatchingLayoutPlaceholder 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.
mtef.charLatex (cyclomatic 17) packages/@openmaic/importer/src/utils/mtef.ts:613— mtef.charLatex has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: mtef.bigOpLimits (cyclomatic 26) 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.
mathSerializer.mathToElement (cyclomatic 17) packages/@openmaic/importer/src/serializer/mathSerializer.ts:470— mathSerializer.mathToElement 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.
transformParsedToSlides.parseLineElement (cyclomatic 17) packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:220— transformParsedToSlides.parseLineElement 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.
pg-migrations.splitSqlStatements (cyclomatic 17) packages/@openmaic/storage/src/pg-migrations.ts:519— pg-migrations.splitSqlStatements 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.
roots.changeAssetRoots (cyclomatic 17) packages/@openmaic/storage/src/asset/roots.ts:198— roots.changeAssetRoots has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
types.applyOpsOnce (cyclomatic 17) packages/@openmaic/storage/src/skill/types.ts:339— types.applyOpsOnce 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.
sandbox-preview-gateway.resolve (cyclomatic 17) scripts/sandbox-preview-gateway.mjs:84— sandbox-preview-gateway.resolve 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.
waitForStarted (cyclomatic 17) render-service/src/resource-systemd-runner.mjs:276— waitForStarted 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.
prompt-input.PromptInputTextarea (cyclomatic 16) components/ai-elements/prompt-input.tsx:772— prompt-input.PromptInputTextarea has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (handleKeyDown, handlePaste). 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.
QuestionCard.QuestionCard (cyclomatic 16) components/edit/surfaces/quiz/QuestionCard.tsx:71— QuestionCard.QuestionCard has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
chat.MessageBubble (cyclomatic 16) components/scene-renderers/pbl/v2/chat.tsx:983— chat.MessageBubble 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.
workbench-panel.LearningWorkbenchPanel::run (cyclomatic 16) components/scene-renderers/pbl/v3/workbench-panel.tsx:176— workbench-panel.LearningWorkbenchPanel::run has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (workbench-panel.LearningWorkbenchPanel) 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.
index.LineElement (cyclomatic 16) components/slide-renderer/components/element/LineElement/index.tsx:20— index.LineElement has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 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.
useDragElement.useDragElement.dragElement (cyclomatic 16) components/slide-renderer/Editor/Canvas/hooks/useDragElement.ts:40— useDragElement.useDragElement.dragElement has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (useDragElement.useDragElement.dragElement::handleMouseMove) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
runner.main (cyclomatic 16) eval/whiteboard-shapes/runner.ts:213— runner.main 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.
asr-providers.transcribeQwenASR (cyclomatic 16) lib/audio/asr-providers.ts:467— asr-providers.transcribeQwenASR 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.
element-reference.validateInteractiveReference (cyclomatic 16) lib/chat/pi/element-reference.ts:1027— element-reference.validateInteractiveReference 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.
load-classroom.hydrateDeferredMediaTasks (cyclomatic 16) lib/classroom/load-classroom.ts:537— load-classroom.hydrateDeferredMediaTasks 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 2 function literals inside it that branch (lines 555, 546). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
media-registry.selectMediaExtractorProvider (cyclomatic 16) lib/document/extractors/media-registry.ts:26— media-registry.selectMediaExtractorProvider has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
proxied-fetch.createProxiedFetch.<returned closure> (cyclomatic 16) lib/export/proxied-fetch.ts:27— proxied-fetch.createProxiedFetch.<returned closure> has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
build-standalone-html.linkStandaloneImages (cyclomatic 16) lib/export/standalone-html/build-standalone-html.ts:367— build-standalone-html.linkStandaloneImages has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
minimax-image-adapter.generateWithMiniMaxImage (cyclomatic 16) lib/media/adapters/minimax-image-adapter.ts:19— minimax-image-adapter.generateWithMiniMaxImage 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.
instructor.buildScenarioAwarenessBlock (cyclomatic 16) lib/pbl/v2/agents/instructor.ts:683— instructor.buildScenarioAwarenessBlock has cyclomatic complexity 16 (threshold 15). Of this number, 12 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.
transition.recordArtifact (cyclomatic 16) lib/pbl/v3/domain/orchestration/transition.ts:395— transition.recordArtifact 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.
report-client.readReportResponse (cyclomatic 16) lib/pbl/v3/report-client.ts:11— report-client.readReportResponse 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.
asset-collector-schedule.startAssetCollectorSchedule (cyclomatic 16) lib/persistence/asset-collector-schedule.ts:106— asset-collector-schedule.startAssetCollectorSchedule 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 one function item inside it that branches (collectNow). 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.
media-byte-omission.percentDecodedUtf8Length::feedPercentByte (cyclomatic 16) lib/server/agent-runtime/course-edit/media-byte-omission.ts:95— media-byte-omission.percentDecodedUtf8Length::feedPercentByte has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (media-byte-omission.percentDecodedUtf8Length) 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.
generation-tools.collectUnresolvedMediaPlaceholders (cyclomatic 16) lib/server/agent-runtime/generation-tools.ts:213— generation-tools.collectUnresolvedMediaPlaceholders 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.
generate-image.buildGenerateImageTool.execute (cyclomatic 16) lib/server/agent-runtime/generate-image.ts:300— generate-image.buildGenerateImageTool.execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
openmaic-yml.interpolate (cyclomatic 16) lib/server/model-config/openmaic-yml.ts:224— openmaic-yml.interpolate has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fetch-with-redirect-validation.fetchWithRedirectValidation (cyclomatic 16) lib/server/fetch-with-redirect-validation.ts:180— fetch-with-redirect-validation.fetchWithRedirectValidation 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.
outline.extractNewOutlines (cyclomatic 16) lib/server/generation/steps/outline.ts:151— outline.extractNewOutlines 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-sizing.resolveImageSize (cyclomatic 16) lib/server/image-sizing.ts:49— image-sizing.resolveImageSize 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.
document-image-apply.applyImagePlan (cyclomatic 16) lib/server/material-extraction/document-image-apply.mjs:6— document-image-apply.applyImagePlan has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
extraction.extractOwnerMaterial (cyclomatic 16) lib/server/materials/extraction.ts:373— extraction.extractOwnerMaterial has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
extraction.startOwnerMaterialExtractor (cyclomatic 16) lib/server/materials/extraction.ts:702— extraction.startOwnerMaterialExtractor 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 2 function items inside it that branch (scan, a function literal at line 748). 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.
media.fromTarget (cyclomatic 16) lib/server/model-config/media.ts:147— media.fromTarget 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.
runtime.queueRole (cyclomatic 16) lib/server/pbl-v3/runtime.ts:285— runtime.queueRole 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.
application.inspectApplication (cyclomatic 16) lib/server/pbl-v3/application.ts:123— application.inspectApplication 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.
provider-config.ttsModelFor (cyclomatic 16) lib/server/provider-config.ts:831— provider-config.ttsModelFor 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.
web-search-config.requestedWebSearchConnection (cyclomatic 16) lib/server/web-search-config.ts:172— web-search-config.requestedWebSearchConnection 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.
doubao.searchWithDoubao (cyclomatic 16) lib/web-search/doubao.ts:70— doubao.searchWithDoubao has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OwnerSessionClient.openStream::onSessionEvent (cyclomatic 16) lib/workbench/owner-session-client.ts:231— OwnerSessionClient.openStream::onSessionEvent 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.
validate.checkInteractiveContent (cyclomatic 16) packages/@openmaic/dsl/src/validate.ts:181— validate.checkInteractiveContent 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.
Slide.buildDiagramGroup (cyclomatic 16) packages/@openmaic/importer/src/model/Slide.ts:264— Slide.buildDiagramGroup 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.
shapeSerializer.fillToJson (cyclomatic 16) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:544— shapeSerializer.fillToJson 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.
groupSerializer.detectLineOrientation (cyclomatic 16) packages/@openmaic/importer/src/serializer/groupSerializer.ts:39— groupSerializer.detectLineOrientation 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.
measure.measureSlideElementGeometry (cyclomatic 16) packages/@openmaic/renderer/src/snapshot/measure.ts:74— measure.measureSlideElementGeometry 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.
base-url.assertHttpBaseUrl (cyclomatic 16) packages/@openmaic/storage/src/http/base-url.ts:50— base-url.assertHttpBaseUrl 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.
PgAssetStore.replace (cyclomatic 16) packages/@openmaic/storage/src/asset/pg.ts:1381— PgAssetStore.replace has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
asset.createAssetHttpHandler (cyclomatic 16) packages/@openmaic/storage/src/server/asset.ts:761— asset.createAssetHttpHandler 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.
reference.createReferenceRuntimeServer (cyclomatic 16) packages/@openmaic/storage/src/server/reference.ts:91— reference.createReferenceRuntimeServer 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.
probe-mineru-cloud.probe (cyclomatic 16) scripts/probe-mineru-cloud.mjs:44— probe-mineru-cloud.probe 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.
sandbox-preview-activity.installPreviewActivity::flush (cyclomatic 16) scripts/sandbox-preview-activity.mjs:58— sandbox-preview-activity.installPreviewActivity::flush 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.
sandbox-preview-gateway.responseHeaders (cyclomatic 16) scripts/sandbox-preview-gateway.mjs:191— sandbox-preview-gateway.responseHeaders 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.
use-export-pptx.buildPptxBlob (cognitive 630) REDACTED:544— use-export-pptx.buildPptxBlob has cognitive complexity 630 (threshold 15). Drivers by points: if/else 135 (483 pts), ternaries 12 (55 pts), loops 9 (40 pts), boolean chains 30, error handling 4 (22 pts) (nesting depth added 440). Of this number, 624 points are the body's own statements and 6 belong to 3 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.
textSerializer.renderTextBody (cognitive 514) packages/@openmaic/importer/src/serializer/textSerializer.ts:1066— textSerializer.renderTextBody has cognitive complexity 514 (threshold 15). Drivers by points: if/else 95 (331 pts), ternaries 18 (78 pts), boolean chains 51, loops 11 (48 pts), error handling 1 (6 pts) (nesting depth added 338). Of this number, 470 points are the body's own statements and 44 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.
transformParsedToSlides.transformParsedToSlides::parseElements (cognitive 413) packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:498— transformParsedToSlides.transformParsedToSlides::parseElements has cognitive complexity 413 (threshold 15). Drivers by points: if/else 74 (225 pts), ternaries 26 (117 pts), boolean chains 56, loops 3 (8 pts), error handling 1 (4 pts), match/switch 1 (3 pts) (nesting depth added 252). 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.
index.Roundtable (cognitive 280) components/roundtable/index.tsx:156— index.Roundtable has cognitive complexity 280 (threshold 15). Drivers by points: boolean chains 113, ternaries 51 (94 pts), if/else 52 (72 pts), match/switch 1 (nesting depth added 63). Of this number, 171 points are the body's own statements and 109 belong to 35 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.
tool-presentation.presentTool (cognitive 276) components/workbench/chat/tool-presentation.ts:286— tool-presentation.presentTool has cognitive complexity 276 (threshold 15). Drivers by points: ternaries 72 (152 pts), if/else 54 (110 pts), boolean chains 13, match/switch 1 (nesting depth added 136). 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.
PlaybackChromeRoot.PlaybackChromeRoot (cognitive 266) components/edit/PlaybackChromeRoot.tsx:131— PlaybackChromeRoot.PlaybackChromeRoot has cognitive complexity 266 (threshold 15). Drivers by points: if/else 127 (158 pts), boolean chains 87, ternaries 15 (16 pts), error handling 2 (3 pts), match/switch 2 (nesting depth added 33). Of this number, 41 points are the body's own statements and 225 belong to 65 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.
conversation.projectConversation (cognitive 215) lib/server/pbl-v3/conversation.ts:68— conversation.projectConversation has cognitive complexity 215 (threshold 15). Drivers by points: if/else 44 (140 pts), boolean chains 23, loops 8 (23 pts), ternaries 8 (20 pts), error handling 1 (9 pts) (nesting depth added 131). Of this number, 198 points are the body's own statements and 17 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.
shapeSerializer.renderShape (cognitive 214) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:839— shapeSerializer.renderShape has cognitive complexity 214 (threshold 15). Drivers by points: if/else 58 (82 pts), ternaries 26 (72 pts), boolean chains 58, loops 1 (2 pts) (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceShell.WorkspaceShellController (cognitive 203) components/workbench/workspace/WorkspaceShell.tsx:187— WorkspaceShell.WorkspaceShellController has cognitive complexity 203 (threshold 15). Drivers by points: if/else 66 (74 pts), ternaries 47 (63 pts), boolean chains 62, loops 3, error handling 1 (nesting depth added 24). Of this number, 72 points are the body's own statements and 131 belong to 50 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.
session-store.foldEvent (cognitive 192) lib/workbench/session-store.ts:940— session-store.foldEvent has cognitive complexity 192 (threshold 15). Drivers by points: if/else 55 (116 pts), ternaries 13 (35 pts), boolean chains 31, loops 5 (9 pts), match/switch 1 (nesting depth added 87). Of this number, 171 points are the body's own statements and 21 belong to 19 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.
runner.executeSession (cognitive 187) lib/server/agent-runtime/runner.ts:1043— runner.executeSession has cognitive complexity 187 (threshold 15). Drivers by points: if/else 103 (164 pts), ternaries 51 (86 pts), boolean chains 55, error handling 5 (7 pts), loops 3 (5 pts) (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (runner.executeSession::emit) 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.
model-settings.planModelSettingsImport (cognitive 177) lib/legacy-browser-import/model-settings.ts:297— model-settings.planModelSettingsImport has cognitive complexity 177 (threshold 15). Drivers by points: ternaries 23 (77 pts), if/else 25 (63 pts), boolean chains 29, loops 6 (8 pts) (nesting depth added 94). Of this number, 176 points are the body's own statements and 1 belongs 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.
WorkbenchChat.WorkbenchChat (cognitive 176) components/workbench/WorkbenchChat.tsx:123— WorkbenchChat.WorkbenchChat has cognitive complexity 176 (threshold 15). Drivers by points: ternaries 45 (78 pts), if/else 51 (65 pts), boolean chains 30, error handling 2, loops 1 (nesting depth added 47). Of this number, 86 points are the body's own statements and 90 belong to 30 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.
MaterialLibraryPage.MaterialLibraryPage (cognitive 175) components/workbench/workspace/MaterialLibraryPage.tsx:735— MaterialLibraryPage.MaterialLibraryPage has cognitive complexity 175 (threshold 15). Drivers by points: if/else 58 (69 pts), ternaries 50 (63 pts), boolean chains 39, error handling 2, loops 2 (nesting depth added 24). Of this number, 31 points are the body's own statements and 144 belong to 38 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.
material-tools.buildMaterialTools (cognitive 172) lib/server/agent-runtime/material-tools.ts:555— material-tools.buildMaterialTools has cognitive complexity 172 (threshold 15). Drivers by points: if/else 51 (94 pts), ternaries 29 (47 pts), boolean chains 24, loops 4 (7 pts) (nesting depth added 64). Most of this is not in the body itself: 1 of the 172 points is its own statement and the rest belongs to 14 function literals inside it that branch (lines 834, 992, 624, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace.PBLV3WorkspaceContent (cognitive 166) components/scene-renderers/pbl/v3/workspace.tsx:65— workspace.PBLV3WorkspaceContent has cognitive complexity 166 (threshold 15). Drivers by points: boolean chains 112, if/else 27 (30 pts), ternaries 12 (22 pts), error handling 2 (nesting depth added 13). Of this number, 121 points are the body's own statements and 45 belong to 28 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.
runner-tools.teachingRunnerConfig (cognitive 165) lib/server/pbl-v3/runner-tools.ts:67— runner-tools.teachingRunnerConfig has cognitive complexity 165 (threshold 15). Drivers by points: if/else 46 (87 pts), boolean chains 45, ternaries 15 (31 pts), loops 1 (2 pts) (nesting depth added 58). Of this number, 30 points are the body's own statements and 135 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.
project-package.validateProjectPackage (cognitive 161) lib/server/pbl-v3/project-package.ts:172— project-package.validateProjectPackage has cognitive complexity 161 (threshold 15). Drivers by points: if/else 50 (83 pts), boolean chains 36, loops 22 (35 pts), ternaries 4 (7 pts) (nesting depth added 49). Of this number, 155 points are the body's own statements and 6 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkspaceRail.WorkspaceRail (cognitive 149) components/workbench/workspace/WorkspaceRail.tsx:195— WorkspaceRail.WorkspaceRail has cognitive complexity 149 (threshold 15). Drivers by points: ternaries 30 (69 pts), if/else 43 (59 pts), boolean chains 17, error handling 4 (nesting depth added 55). Of this number, 41 points are the body's own statements and 108 belong to 21 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.commandStudy::execute (cognitive 149) lib/server/pbl-v3/runtime.ts:539— runtime.commandStudy::execute has cognitive complexity 149 (threshold 15). Drivers by points: if/else 59 (107 pts), boolean chains 30, loops 2 (7 pts), ternaries 2 (5 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stage.useStageStoreBase (cognitive 148) lib/store/stage.ts:740— stage.useStageStoreBase has cognitive complexity 148 (threshold 15). Drivers by points: if/else 53 (93 pts), boolean chains 23, ternaries 19 (23 pts), error handling 3 (5 pts), loops 2 (4 pts) (nesting depth added 48). None of this is in the body itself: all 148 points belong to 16 function literals inside it that branch (lines 1206, 1117, 1012, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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-export-pptx.formatHTML::parse (cognitive 147) REDACTED:85— use-export-pptx.formatHTML::parse has cognitive complexity 147 (threshold 15). Drivers by points: if/else 40 (124 pts), boolean chains 14, ternaries 2 (5 pts), loops 2 (4 pts) (nesting depth added 89). 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.
lifecycle.maintainStudy (cognitive 142) lib/server/pbl-v3/lifecycle.ts:193— lifecycle.maintainStudy has cognitive complexity 142 (threshold 15). Drivers by points: if/else 47 (94 pts), boolean chains 27, error handling 6 (12 pts), ternaries 2 (5 pts), loops 2 (4 pts) (nesting depth added 58). Most of this is not in the body itself: 12 of the 142 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 260, a function literal at line 509, maintain). 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.
providers.getCompatThinkingBodyParams (cognitive 138) lib/ai/providers.ts:1747— providers.getCompatThinkingBodyParams has cognitive complexity 138 (threshold 15). Drivers by points: if/else 39 (78 pts), ternaries 15 (45 pts), boolean chains 14, match/switch 1 (nesting depth added 69). 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.
chat-storage.syncOne (cognitive 132) lib/utils/chat-storage.ts:615— chat-storage.syncOne has cognitive complexity 132 (threshold 15). Drivers by points: if/else 23 (87 pts), error handling 7 (30 pts), loops 4 (10 pts), boolean chains 5 (nesting depth added 93). Of this number, 131 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.
settings.applyModelSettingsChange (cognitive 113) lib/server/model-config/settings.ts:663— settings.applyModelSettingsChange has cognitive complexity 113 (threshold 15). Drivers by points: if/else 23 (50 pts), ternaries 15 (35 pts), loops 8 (17 pts), boolean chains 9, error handling 1 (2 pts) (nesting depth added 57). Of this number, 112 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.
report.buildLearningEvidence (cognitive 113) lib/server/pbl-v3/report.ts:30— report.buildLearningEvidence has cognitive complexity 113 (threshold 15). Drivers by points: if/else 22 (53 pts), ternaries 13 (33 pts), boolean chains 17, loops 6 (8 pts), match/switch 1 (2 pts) (nesting depth added 54). Of this number, 106 points are the body's own statements and 7 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.
use-workbench-session.useStageFreshnessSync (cognitive 113) lib/workbench/use-workbench-session.ts:444— use-workbench-session.useStageFreshnessSync has cognitive complexity 113 (threshold 15). Drivers by points: if/else 54 (77 pts), boolean chains 19, ternaries 8 (13 pts), loops 3, error handling 1 (nesting depth added 28). None of this is in the body itself: all 113 points belong to 22 function literals inside it that branch (lines 553, 813, 857, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
material-analysis.analyzeMaterial (cognitive 111) lib/server/generation/steps/material-analysis.ts:193— material-analysis.analyzeMaterial has cognitive complexity 111 (threshold 15). Drivers by points: ternaries 26 (51 pts), boolean chains 33, if/else 16 (26 pts), error handling 1 (nesting depth added 35). Of this number, 110 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.
css-asset-parser.collectCssAssetReferencesByRegex (cognitive 110) lib/export/css-asset-parser.ts:235— css-asset-parser.collectCssAssetReferencesByRegex has cognitive complexity 110 (threshold 15). Drivers by points: if/else 18 (58 pts), ternaries 5 (21 pts), loops 6 (18 pts), boolean chains 13 (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProsemirrorEditor.ProsemirrorEditor (cognitive 102) components/slide-renderer/components/element/ProsemirrorEditor.tsx:58— ProsemirrorEditor.ProsemirrorEditor has cognitive complexity 102 (threshold 15). Drivers by points: if/else 57 (71 pts), boolean chains 20, ternaries 4 (8 pts), loops 2, match/switch 1 (nesting depth added 18). Most of this is not in the body itself: 1 of the 102 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 173, 435, 527, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.route (cognitive 102) REDACTED:442— index.route has cognitive complexity 102 (threshold 15). Drivers by points: if/else 29 (59 pts), boolean chains 18, ternaries 4 (12 pts), error handling 4 (10 pts), loops 1 (3 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.
element-refs.decodeElementRefs (cognitive 101) lib/workbench/element-refs.ts:323— element-refs.decodeElementRefs has cognitive complexity 101 (threshold 15). Drivers by points: if/else 27 (71 pts), ternaries 7 (16 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 56). Of this number, 99 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
classroom-actions.buildChildActionTools (cognitive 100) lib/chat/pi/tools/classroom-actions.ts:278— classroom-actions.buildChildActionTools has cognitive complexity 100 (threshold 15). Drivers by points: if/else 47 (71 pts), boolean chains 16, ternaries 7 (13 pts) (nesting depth added 30). Of this number, 18 points are the body's own statements and 82 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.
index.validateSvgPath (cognitive 99) packages/@openmaic/geometry/src/index.ts:92— index.validateSvgPath has cognitive complexity 99 (threshold 15). Drivers by points: if/else 23 (51 pts), ternaries 8 (24 pts), boolean chains 14, loops 6 (9 pts), error handling 1 (nesting depth added 47). Of this number, 95 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
page.GenerationPreviewContent (cognitive 97) app/generation-preview/page.tsx:60— page.GenerationPreviewContent has cognitive complexity 97 (threshold 15). Drivers by points: ternaries 24 (41 pts), if/else 30 (34 pts), boolean chains 20, error handling 2 (nesting depth added 21). Of this number, 40 points are the body's own statements and 57 belong to 15 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.learningView (cognitive 96) lib/server/pbl-v3/runtime.ts:988— runtime.learningView has cognitive complexity 96 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 30, ternaries 16 (25 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 31). Of this number, 87 points are the body's own statements and 9 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.
providers.fetchCustomOpenAIChat (cognitive 94) lib/ai/providers.ts:2177— providers.fetchCustomOpenAIChat has cognitive complexity 94 (threshold 15). Drivers by points: if/else 23 (60 pts), boolean chains 14, ternaries 6 (11 pts), loops 3 (6 pts), error handling 2 (3 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.
outline.streamOutlines (cognitive 93) lib/server/generation/steps/outline.ts:551— outline.streamOutlines has cognitive complexity 93 (threshold 15). Drivers by points: if/else 28 (68 pts), boolean chains 8, ternaries 3 (8 pts), loops 3 (6 pts), error handling 2 (3 pts) (nesting depth added 49). Of this number, 88 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
application-preview.ApplicationPreviewContent (cognitive 91) components/scene-renderers/pbl/v3/application-preview.tsx:56— application-preview.ApplicationPreviewContent has cognitive complexity 91 (threshold 15). Drivers by points: boolean chains 59, if/else 17 (20 pts), ternaries 8, loops 3 (4 pts) (nesting depth added 4). Of this number, 50 points are the body's own statements and 41 belong to 18 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.
ImageClipHandler.ImageClipHandler (cognitive 91) components/slide-renderer/components/element/ImageElement/ImageClipHandler.tsx:22— ImageClipHandler.ImageClipHandler has cognitive complexity 91 (threshold 15). Drivers by points: if/else 53 (79 pts), boolean chains 11, ternaries 1 (nesting depth added 26). None of this is in the body itself: all 91 points belong to 7 function literals inside it that branch (lines 266, 446, 195, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.recordQuizAttempt (cognitive 91) lib/quiz/runtime.ts:494— runtime.recordQuizAttempt has cognitive complexity 91 (threshold 15). Drivers by points: if/else 21 (62 pts), boolean chains 12, error handling 3 (10 pts), ternaries 4 (6 pts), loops 1 (nesting depth added 50). None of this is in the body itself: all 91 points belong to 2 function literals inside it that branch (lines 505, 551). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
chat.PBLV2Chat (cognitive 90) components/scene-renderers/pbl/v2/chat.tsx:129— chat.PBLV2Chat has cognitive complexity 90 (threshold 15). Drivers by points: if/else 34 (36 pts), boolean chains 31, ternaries 18 (20 pts), loops 2, error handling 1 (nesting depth added 4). Of this number, 28 points are the body's own statements and 62 belong to 16 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
curriculum-tools.buildCurriculumTools (cognitive 90) lib/server/agent-runtime/curriculum-tools.ts:194— curriculum-tools.buildCurriculumTools has cognitive complexity 90 (threshold 15). Drivers by points: if/else 46 (60 pts), ternaries 20 (26 pts), boolean chains 2, error handling 2 (nesting depth added 20). Of this number, 84 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.
timeline-deps.createVideoTimelineDeps (cognitive 90) lib/video-export-app/timeline-deps.ts:191— timeline-deps.createVideoTimelineDeps has cognitive complexity 90 (threshold 15). Drivers by points: if/else 31 (53 pts), loops 11 (15 pts), boolean chains 11, ternaries 5 (8 pts), error handling 2 (3 pts) (nesting depth added 30). Of this number, 77 points are the body's own statements and 13 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mtef.parseObjectList (cognitive 90) packages/@openmaic/importer/src/utils/mtef.ts:321— mtef.parseObjectList has cognitive complexity 90 (threshold 15). Drivers by points: if/else 26 (76 pts), loops 4 (11 pts), match/switch 1 (2 pts), boolean chains 1 (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.
stage-storage.loadFirstSlideThumbnail (cognitive 89) lib/utils/stage-storage.ts:1134— stage-storage.loadFirstSlideThumbnail has cognitive complexity 89 (threshold 15). Drivers by points: ternaries 13 (44 pts), if/else 11 (27 pts), boolean chains 15, loops 2 (3 pts) (nesting depth added 48). Of this number, 85 points are the body's own statements and 4 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.
workbench-panel.LearningWorkbenchPanel (cognitive 88) components/scene-renderers/pbl/v3/workbench-panel.tsx:51— workbench-panel.LearningWorkbenchPanel has cognitive complexity 88 (threshold 15). Drivers by points: ternaries 24 (53 pts), boolean chains 47, if/else 15 (16 pts), error handling 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (workbench-panel.LearningWorkbenchPanel::run) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
course-mention-menu.CourseMentionMenu (cognitive 86) components/workbench/course-mention-menu.tsx:83— course-mention-menu.CourseMentionMenu has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 27 (51 pts), if/else 18 (21 pts), boolean chains 13, loops 1 (nesting depth added 27). Of this number, 29 points are the body's own statements and 57 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
report-share-image.renderReportShareImage (cognitive 86) lib/pbl/v3/report-share-image.ts:23— report-share-image.renderReportShareImage has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 35 (50 pts), if/else 18 (23 pts), loops 5 (7 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 23). Of this number, 41 points are the body's own statements and 45 belong to 15 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.
model-map.ModelMap (cognitive 85) components/settings/models/model-map.tsx:137— model-map.ModelMap has cognitive complexity 85 (threshold 15). Drivers by points: if/else 35 (41 pts), boolean chains 21, ternaries 14 (16 pts), loops 5 (7 pts) (nesting depth added 10). Of this number, 42 points are the body's own statements and 43 belong to 19 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.
interactive-library-mapper.rewriteInteractiveLibraries (cognitive 85) packages/@openmaic/generation/src/interactive-library-mapper.ts:130— interactive-library-mapper.rewriteInteractiveLibraries has cognitive complexity 85 (threshold 15). Drivers by points: if/else 14 (33 pts), ternaries 7 (23 pts), boolean chains 11, error handling 4 (10 pts), loops 3 (8 pts) (nesting depth added 46). Of this number, 65 points are the body's own statements and 20 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.
mtef.renderTmpl (cognitive 84) packages/@openmaic/importer/src/utils/mtef.ts:753— mtef.renderTmpl has cognitive complexity 84 (threshold 15). Drivers by points: ternaries 22 (46 pts), if/else 18 (24 pts), boolean chains 14 (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.
element-reference.projectElement (cognitive 82) lib/chat/pi/element-reference.ts:608— element-reference.projectElement has cognitive complexity 82 (threshold 15). Drivers by points: ternaries 23 (44 pts), if/else 10 (27 pts), loops 3 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eqFieldParser.eqToPlain (cognitive 82) packages/@openmaic/importer/src/utils/eqFieldParser.ts:466— eqFieldParser.eqToPlain has cognitive complexity 82 (threshold 15). Drivers by points: if/else 26 (59 pts), loops 5 (16 pts), boolean chains 5, ternaries 1 (2 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.
scene-sidebar.SceneSidebar (cognitive 80) components/stage/scene-sidebar.tsx:37— scene-sidebar.SceneSidebar has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 19 (57 pts), boolean chains 20, if/else 3 (nesting depth added 38). Of this number, 18 points are the body's own statements and 62 belong to 10 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditableSlideCanvas.EditableSlideCanvas (cognitive 80) packages/@openmaic/editor/src/react/EditableSlideCanvas.tsx:93— EditableSlideCanvas.EditableSlideCanvas has cognitive complexity 80 (threshold 15). Drivers by points: boolean chains 43, if/else 22 (25 pts), ternaries 11 (12 pts) (nesting depth added 4). Of this number, 36 points are the body's own statements and 44 belong to 21 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.
validate.validateSchema (cognitive 78) lib/whiteboard/runtime/validate.ts:174— validate.validateSchema has cognitive complexity 78 (threshold 15). Drivers by points: if/else 28 (57 pts), loops 5 (13 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generation-tools.buildGenerationTools (cognitive 77) lib/server/agent-runtime/generation-tools.ts:274— generation-tools.buildGenerationTools has cognitive complexity 77 (threshold 15). Drivers by points: ternaries 22 (33 pts), if/else 22 (26 pts), boolean chains 16, error handling 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media.planUploads (cognitive 76) lib/legacy-browser-import/media.ts:176— media.planUploads has cognitive complexity 76 (threshold 15). Drivers by points: if/else 16 (36 pts), ternaries 8 (22 pts), boolean chains 15, loops 3 (nesting depth added 34). Of this number, 73 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runResourceTask (cognitive 76) render-service/src/resource-systemd-runner.mjs:655— runResourceTask has cognitive complexity 76 (threshold 15). Drivers by points: ternaries 17 (34 pts), other 16, if/else 10 (13 pts), boolean chains 10, error handling 2, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generation-toolbar.GenerationToolbar (cognitive 75) components/generation/generation-toolbar.tsx:98— generation-toolbar.GenerationToolbar has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 22 (36 pts), boolean chains 20, if/else 16 (19 pts) (nesting depth added 17). Of this number, 51 points are the body's own statements and 24 belong to 11 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassroomSurface.ClassroomSurfaceContent (cognitive 74) components/classroom/ClassroomSurface.tsx:70— ClassroomSurface.ClassroomSurfaceContent has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (35 pts), ternaries 10 (28 pts), boolean chains 10, error handling 1 (nesting depth added 27). Of this number, 26 points are the body's own statements and 48 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InProcessExecutor.execute (cognitive 74) render-service/src/render-executor.ts:190— InProcessExecutor.execute has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 17 (37 pts), if/else 16 (28 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 33). Of this number, 64 points are the body's own statements and 10 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.
engine.executeClaimedRun (cognitive 73) lib/server/generation/run/engine.ts:400— engine.executeClaimedRun has cognitive complexity 73 (threshold 15). Drivers by points: if/else 98 (176 pts), ternaries 39 (61 pts), boolean chains 34, error handling 15 (25 pts), loops 15 (17 pts), match/switch 2 (nesting depth added 112). To reduce it, split the body into named stages: move each independent 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 (engine.executeClaimedRun::runStep, engine.executeClaimedRun::executeMediaOnly) 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.
line-drag.computeLineDrag (cognitive 73) packages/@openmaic/editor/src/react/core/line-drag.ts:85— line-drag.computeLineDrag has cognitive complexity 73 (threshold 15). Drivers by points: if/else 39 (68 pts), boolean chains 5 (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.
course-issues.collectCourseIssues (cognitive 72) packages/@openmaic/dsl/src/course-issues.ts:94— course-issues.collectCourseIssues has cognitive complexity 72 (threshold 15). Drivers by points: if/else 8 (27 pts), ternaries 7 (26 pts), boolean chains 11, loops 4 (8 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dsl-tools.validationError (cognitive 71) lib/server/agent-runtime/dsl-tools.ts:454— dsl-tools.validationError has cognitive complexity 71 (threshold 15). Drivers by points: if/else 19 (54 pts), loops 3 (9 pts), boolean chains 8 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tts-voice-managers.VoxCPMVoiceManager (cognitive 69) components/settings/tts-voice-managers.tsx:49— tts-voice-managers.VoxCPMVoiceManager has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 22 (37 pts), boolean chains 17, if/else 10, error handling 5 (nesting depth added 15). Most of this is not in the body itself: 11 of the 69 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 313, startReferenceRecording, handleAddPromptVoice, …). 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.
stage.Stage (cognitive 69) components/stage.tsx:52— stage.Stage has cognitive complexity 69 (threshold 15). Drivers by points: boolean chains 25, ternaries 16 (25 pts), if/else 18 (19 pts) (nesting depth added 10). Of this number, 33 points are the body's own statements and 36 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.
workbench.workbenchCommand (cognitive 69) lib/server/pbl-v3/workbench.ts:100— workbench.workbenchCommand has cognitive complexity 69 (threshold 15). Drivers by points: if/else 32 (50 pts), boolean chains 8, ternaries 4 (7 pts), loops 2 (4 pts) (nesting depth added 23). Of this number, 20 points are the body's own statements and 49 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.
legacy-config.translateLegacyConfig (cognitive 68) lib/server/model-config/legacy-config.ts:120— legacy-config.translateLegacyConfig has cognitive complexity 68 (threshold 15). Drivers by points: if/else 17 (37 pts), ternaries 8 (18 pts), boolean chains 7, loops 4 (6 pts) (nesting depth added 32). Of this number, 63 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.
use-material-library-tree.useMaterialLibraryTree (cognitive 67) lib/workbench/use-material-library-tree.ts:154— use-material-library-tree.useMaterialLibraryTree has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (30 pts), ternaries 14 (19 pts), boolean chains 13, loops 4 (5 pts) (nesting depth added 10). Most of this is not in the body itself: 5 of the 67 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 274, 461, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
page.HomePage (cognitive 66) app/page.tsx:161— page.HomePage has cognitive complexity 66 (threshold 15). Drivers by points: if/else 58 (76 pts), boolean chains 61, ternaries 25 (31 pts), error handling 13 (14 pts), loops 2 (nesting depth added 25). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 (page.HomePage::handleGenerate) 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.
validators.validateAppScene (cognitive 66) lib/document-store/validators.ts:28— validators.validateAppScene has cognitive complexity 66 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 14, ternaries 2 (7 pts), loops 1 (5 pts) (nesting depth added 26). Of this number, 38 points are the body's own statements and 28 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.
scene-generator.extractInteractiveElements (cognitive 66) REDACTED:1452— scene-generator.extractInteractiveElements has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (51 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm.callLLM (cognitive 65) lib/ai/llm.ts:346— llm.callLLM has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (42 pts), ternaries 5 (11 pts), boolean chains 10, error handling 1, loops 1 (nesting depth added 29). Of this number, 57 points are the body's own statements and 8 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.
textSerializer.mergeRunProps (cognitive 65) packages/@openmaic/importer/src/serializer/textSerializer.ts:530— textSerializer.mergeRunProps has cognitive complexity 65 (threshold 15). Drivers by points: if/else 35 (53 pts), boolean chains 8, loops 1 (2 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.
route.chat (cognitive 64) app/api/chat/pi/route.ts:65— route.chat has cognitive complexity 64 (threshold 15). Drivers by points: if/else 19 (26 pts), ternaries 9 (14 pts), boolean chains 12, error handling 8 (12 pts) (nesting depth added 16). Of this number, 49 points are the body's own statements and 15 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.
project-report.ProjectReport (cognitive 64) components/scene-renderers/pbl/v3/project-report.tsx:28— project-report.ProjectReport has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 32, if/else 18 (22 pts), ternaries 6 (8 pts), error handling 1, loops 1 (nesting depth added 6). Of this number, 30 points are the body's own statements and 34 belong to 16 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.
voice-resolver.getEnabledProvidersWithVoices (cognitive 64) lib/audio/voice-resolver.ts:394— voice-resolver.getEnabledProvidersWithVoices has cognitive complexity 64 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 7 (19 pts), boolean chains 13, loops 3 (5 pts) (nesting depth added 28). Of this number, 52 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.
provider-config-panel.ProviderConfigPanel (cognitive 63) components/settings/provider-config-panel.tsx:55— provider-config-panel.ProviderConfigPanel has cognitive complexity 63 (threshold 15). Drivers by points: boolean chains 44, if/else 13 (15 pts), error handling 2, ternaries 2 (nesting depth added 2). Of this number, 28 points are the body's own statements and 35 belong to 11 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.
inline-assets.inlineHtmlAssets (cognitive 63) lib/export/inline-assets.ts:608— inline-assets.inlineHtmlAssets has cognitive complexity 63 (threshold 15). Drivers by points: if/else 24 (44 pts), loops 16 (24 pts), boolean chains 12, ternaries 7 (12 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (inline-assets.inlineHtmlAssets::inlineAttributes) 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.
state-context.buildStateContext (cognitive 63) lib/orchestration/summarizers/state-context.ts:136— state-context.buildStateContext has cognitive complexity 63 (threshold 15). Drivers by points: if/else 13 (30 pts), ternaries 7 (25 pts), boolean chains 8 (nesting depth added 35). Of this number, 30 points are the body's own statements and 33 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.
asset.route (cognitive 63) packages/@openmaic/storage/src/server/asset.ts:560— asset.route has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (41 pts), error handling 5 (10 pts), boolean chains 9, ternaries 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.
main.createApp (cognitive 63) render-service/src/main.ts:270— main.createApp has cognitive complexity 63 (threshold 15). Drivers by points: if/else 35 (48 pts), boolean chains 6, error handling 5, ternaries 3 (4 pts) (nesting depth added 14). None of this is in the body itself: all 63 points belong to 7 function literals inside it that branch (lines 420, 302, 340, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ProLaunchPanel.ProLaunchPanel (cognitive 62) components/workbench/ProLaunchPanel.tsx:75— ProLaunchPanel.ProLaunchPanel has cognitive complexity 62 (threshold 15). Drivers by points: if/else 25 (27 pts), ternaries 19 (24 pts), boolean chains 10, error handling 1 (nesting depth added 7). Of this number, 22 points are the body's own statements and 40 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
call-agent.buildCallAgentTool.execute (cognitive 62) lib/chat/pi/tools/call-agent.ts:587— call-agent.buildCallAgentTool.execute has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (29 pts), ternaries 11 (16 pts), boolean chains 15, error handling 2 (nesting depth added 11). Of this number, 50 points are the body's own statements and 12 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, 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.
application.applicationRequest (cognitive 62) lib/server/pbl-v3/application.ts:268— application.applicationRequest has cognitive complexity 62 (threshold 15). Drivers by points: if/else 25 (37 pts), boolean chains 15, ternaries 7 (10 pts) (nesting depth added 15). Of this number, 21 points are the body's own statements and 41 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.
svgPathParser.getSvgPathRange (cognitive 62) packages/@openmaic/importer/src/openmaic/utils/svgPathParser.ts:27— svgPathParser.getSvgPathRange has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 17 (49 pts), if/else 6 (9 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 36). Of this number, 59 points are the body's own statements and 3 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.
use-application-preview.useApplicationPreview (cognitive 61) components/scene-renderers/pbl/v3/use-application-preview.ts:89— use-application-preview.useApplicationPreview has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 27, if/else 24 (25 pts), ternaries 8, error handling 1 (nesting depth added 1). Of this number, 18 points are the body's own statements and 43 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.
use-application-preview.useApplicationPreview.load (cognitive 61) components/scene-renderers/pbl/v3/use-application-preview.ts:398— use-application-preview.useApplicationPreview.load has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 21, ternaries 4 (8 pts), error handling 1 (nesting depth added 14). Of this number, 53 points are the body's own statements and 8 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.
scene-tts.synthesizeSceneNarration (cognitive 61) lib/server/agent-runtime/scene-tts.ts:318— scene-tts.synthesizeSceneNarration has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 11, ternaries 3 (7 pts), error handling 2 (5 pts), loops 2 (3 pts) (nesting depth added 29). Of this number, 28 points are the body's own statements and 33 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.
Presentation.resolveNodesPlaceholders (cognitive 61) packages/@openmaic/importer/src/model/Presentation.ts:445— Presentation.resolveNodesPlaceholders has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (56 pts), boolean chains 4, loops 1 (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.
workbench-onboarding.WorkbenchOnboarding (cognitive 60) components/scene-renderers/pbl/v3/workbench-onboarding.tsx:29— workbench-onboarding.WorkbenchOnboarding has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 23 (28 pts), if/else 15 (18 pts), boolean chains 13, loops 1 (nesting depth added 8). Most of this is not in the body itself: 7 of the 60 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 90, a function literal at line 111, scrollReading, …). 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.
providers.getModel::compatFetch (cognitive 60) lib/ai/providers.ts:2462— providers.getModel::compatFetch has cognitive complexity 60 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 12, error handling 6 (11 pts), ternaries 3 (5 pts), loops 1 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (providers.getModel) 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.
validate.validateWhiteboardRuntimePayload (cognitive 60) lib/whiteboard/runtime/validate.ts:429— validate.validateWhiteboardRuntimePayload has cognitive complexity 60 (threshold 15). Drivers by points: if/else 31 (53 pts), boolean chains 4, ternaries 1 (2 pts), error handling 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.
ElementPickLayer.ElementPickLayer (cognitive 59) components/edit/surfaces/slide/ElementPickLayer.tsx:106— ElementPickLayer.ElementPickLayer has cognitive complexity 59 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 13, ternaries 9 (10 pts), error handling 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 43 belong to 20 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.
tool-card.ToolCard (cognitive 59) components/workbench/chat/tool-card.tsx:35— tool-card.ToolCard has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 30 (43 pts), boolean chains 12, if/else 4 (nesting depth added 13). Of this number, 54 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.
dsl-tools.buildDslCourseTools (cognitive 59) lib/server/agent-runtime/dsl-tools.ts:1057— dsl-tools.buildDslCourseTools has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (40 pts), ternaries 7 (9 pts), boolean chains 5, loops 3 (4 pts), error handling 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.
video-render.useVideoRenderStore (cognitive 58) lib/store/video-render.ts:145— video-render.useVideoRenderStore has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 17, ternaries 4 (6 pts), error handling 2 (nesting depth added 12). None of this is in the body itself: all 58 points belong to 4 function literals inside it that branch (lines 171, 298, 281, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
planner-single-call.validateLLMOutput (cognitive 58) packages/@openmaic/generation/src/pbl/planner-single-call.ts:173— planner-single-call.validateLLMOutput has cognitive complexity 58 (threshold 15). Drivers by points: if/else 28 (43 pts), boolean chains 8, ternaries 4 (7 pts) (nesting depth added 18). Of this number, 40 points are the body's own statements and 18 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.
prompt-input.PromptInput (cognitive 57) components/ai-elements/prompt-input.tsx:427— prompt-input.PromptInput has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (32 pts), ternaries 10, boolean chains 9, loops 3 (4 pts), error handling 2 (nesting depth added 6). Most of this is not in the body itself: 6 of the 57 points are its own statements and the rest belongs to 23 function items inside it that branch (a function literal at line 629, a function literal at line 505, a function literal at line 706, …). 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.
useDragLineElement.useDragLineElement.dragLineElement::handleMouseMove (cognitive 57) components/slide-renderer/Editor/Canvas/hooks/useDragLineElement.ts:78— useDragLineElement.useDragLineElement.dragLineElement::handleMouseMove has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
instructor.runInstructorTurn (cognitive 57) lib/pbl/v2/agents/instructor.ts:1301— instructor.runInstructorTurn has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 9 (14 pts), boolean chains 10, loops 3 (7 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 18). Of this number, 52 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.
textSerializer.mergeParagraphProps (cognitive 57) packages/@openmaic/importer/src/serializer/textSerializer.ts:326— textSerializer.mergeParagraphProps has cognitive complexity 57 (threshold 15). Drivers by points: if/else 32 (53 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.
use-chat-sessions.useChatSessions.sendMessage (cognitive 56) components/chat/use-chat-sessions.ts:1654— use-chat-sessions.useChatSessions.sendMessage has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 3 (10 pts), boolean chains 7, ternaries 5 (7 pts), error handling 1 (nesting depth added 24). Of this number, 30 points are the body's own statements and 26 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.
openmaic-yml.crossCheck (cognitive 56) lib/server/model-config/openmaic-yml.ts:314— openmaic-yml.crossCheck has cognitive complexity 56 (threshold 15). Drivers by points: if/else 23 (42 pts), boolean chains 10, loops 2, ternaries 2 (nesting depth added 19). Of this number, 42 points are the body's own statements and 14 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resize.computeResize (cognitive 56) packages/@openmaic/editor/src/react/core/resize.ts:328— resize.computeResize has cognitive complexity 56 (threshold 15). Drivers by points: if/else 31 (39 pts), boolean chains 9, ternaries 6 (8 pts) (nesting depth added 10). Of this number, 39 points are the body's own statements and 17 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.
presets.buildCircularArrowPath (cognitive 56) packages/@openmaic/importer/src/shapes/presets.ts:1695— presets.buildCircularArrowPath has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 46 (49 pts), if/else 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
json-value.findNonJsonValue (cognitive 56) packages/@openmaic/storage/src/runtime/json-value.ts:81— json-value.findNonJsonValue has cognitive complexity 56 (threshold 15). Drivers by points: if/else 22 (41 pts), boolean chains 8, loops 3 (5 pts), ternaries 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.
route.GET (cognitive 55) app/api/agent/sessions/[id]/events/route.ts:61— route.GET has cognitive complexity 55 (threshold 15). Drivers by points: if/else 29 (40 pts), boolean chains 7, error handling 3 (4 pts), loops 2, ternaries 2 (nesting depth added 12). Most of this is not in the body itself: 7 of the 55 points are its own statements and the rest belongs to 12 function items inside it that branch (poll, drainBacklog, writePage, …). 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.
whiteboard-ledger.buildVirtualWhiteboardContext (cognitive 55) lib/orchestration/summarizers/whiteboard-ledger.ts:135— whiteboard-ledger.buildVirtualWhiteboardContext has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 9 (23 pts), if/else 9 (15 pts), boolean chains 10, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 23). Of this number, 49 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.
PlaybackEngine.processNext (cognitive 55) lib/playback/engine.ts:576— PlaybackEngine.processNext has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 10, error handling 1 (2 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 21). Of this number, 36 points are the body's own statements and 19 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runner.executeSession::emit (cognitive 55) lib/server/agent-runtime/runner.ts:1169— runner.executeSession::emit has cognitive complexity 55 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 11, loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (runner.executeSession) 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.
sandbox-preview-gateway.server (cognitive 54) scripts/sandbox-preview-gateway.mjs:254— sandbox-preview-gateway.server has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 11, ternaries 7 (11 pts), error handling 2, loops 1 (2 pts) (nesting depth added 16). Of this number, 51 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.
tool-activity.ToolCard (cognitive 53) components/scene-renderers/pbl/v3/tool-activity.tsx:43— tool-activity.ToolCard has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 21 (42 pts), boolean chains 11 (nesting depth added 21). Of this number, 51 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.
model-routes.parseRouteValue (cognitive 53) lib/server/model-routes.ts:151— model-routes.parseRouteValue has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 7 (17 pts), boolean chains 7 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 52) app/api/verify-pdf-provider/route.ts:122— route.POST has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 7, ternaries 4 (6 pts), error handling 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.
native-whiteboard.buildNativeWhiteboardTools (cognitive 52) lib/chat/pi/tools/native-whiteboard.ts:743— native-whiteboard.buildNativeWhiteboardTools has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (33 pts), ternaries 9 (13 pts), boolean chains 5, error handling 1 (nesting depth added 12). Most of this is not in the body itself: 15 of the 52 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 1162, a function literal at line 757, a function literal at line 802, …). 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.
collect.resolveGeneratedMedia (cognitive 52) lib/video-export-app/collect.ts:199— collect.resolveGeneratedMedia has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 12, ternaries 2 (5 pts), loops 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
request-activity.requestTrack (cognitive 52) lib/workbench/request-activity.ts:115— request-activity.requestTrack has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 13, ternaries 4 (8 pts), loops 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
use-workbench-session.useWorkbenchStream (cognitive 52) lib/workbench/use-workbench-session.ts:134— use-workbench-session.useWorkbenchStream has cognitive complexity 52 (threshold 15). Drivers by points: if/else 22 (28 pts), ternaries 6 (11 pts), boolean chains 9, loops 3, error handling 1 (nesting depth added 11). None of this is in the body itself: all 52 points belong to 12 function literals inside it that branch (lines 193, 151, 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.
slot-picker.SlotPicker (cognitive 51) components/settings/models/slot-picker.tsx:228— slot-picker.SlotPicker has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 23, ternaries 14 (18 pts), if/else 9 (10 pts) (nesting depth added 5). Of this number, 34 points are the body's own statements and 17 belong to 13 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
input.parseRunInput (cognitive 51) lib/server/generation/run/input.ts:95— input.parseRunInput has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 9, ternaries 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.
course-refs.decodeCourseRefs (cognitive 51) lib/workbench/course-refs.ts:88— course-refs.decodeCourseRefs has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (43 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 27). Of this number, 49 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
request-schedule.scheduleRequestPreview (cognitive 51) lib/workbench/request-schedule.ts:269— request-schedule.scheduleRequestPreview has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 14, loops 4 (8 pts), ternaries 5 (7 pts) (nesting depth added 16). Of this number, 49 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.
scene-generator.generateSlideContent (cognitive 51) REDACTED:635— scene-generator.generateSlideContent has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 17, ternaries 4 (8 pts) (nesting depth added 11). Of this number, 48 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.
HttpAssetStore.fetchBytes (cognitive 51) packages/@openmaic/storage/src/asset/http.ts:469— HttpAssetStore.fetchBytes has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 8, error handling 4 (8 pts), ternaries 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 50) app/api/materials/route.ts:170— route.POST has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (28 pts), loops 4 (6 pts), ternaries 6, boolean chains 5, error handling 5 (nesting depth added 10). Most of this is not in the body itself: 1 of the 50 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 200, context, reject, …). 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.
sandbox-settings.SandboxSettings (cognitive 50) components/settings/sandbox-settings.tsx:14— sandbox-settings.SandboxSettings has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 17 (33 pts), boolean chains 12, if/else 3, error handling 2 (nesting depth added 16). Of this number, 26 points are the body's own statements and 24 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
token-plan-settings.TokenPlanSettings (cognitive 50) components/settings/token-plan-settings.tsx:187— token-plan-settings.TokenPlanSettings has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 25, if/else 14, ternaries 9 (11 pts) (nesting depth added 2). Of this number, 17 points are the body's own statements and 33 belong to 14 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.
event-stream.readLearningStream::read (cognitive 50) lib/pbl/v3/event-stream.ts:36— event-stream.readLearningStream::read has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (41 pts), loops 3 (6 pts), boolean chains 3 (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.
legacy-classroom-import.importClassroomMedia (cognitive 50) lib/server/legacy-classroom-import.ts:197— legacy-classroom-import.importClassroomMedia has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (35 pts), loops 6 (9 pts), boolean chains 4, error handling 2 (nesting depth added 22). Of this number, 42 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
textSerializer.renderTextWarp (cognitive 50) packages/@openmaic/importer/src/serializer/textSerializer.ts:876— textSerializer.renderTextWarp has cognitive complexity 50 (threshold 15). Drivers by points: if/else 7 (22 pts), ternaries 7 (15 pts), loops 5 (11 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.
stream-fn.toModelMessages (cognitive 49) lib/agent/runtime/stream-fn.ts:533— stream-fn.toModelMessages has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 27). Of this number, 41 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent 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-messages.readAgentMessageLog (cognitive 49) lib/server/agent-runtime/user-messages.ts:31— user-messages.readAgentMessageLog has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 8 (24 pts), if/else 6 (15 pts), boolean chains 7, loops 2 (3 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.
chartOption.getChartOption (cognitive 49) packages/@openmaic/renderer/src/elements/chart/chartOption.ts:43— chartOption.getChartOption has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 41 (80 pts), if/else 16 (24 pts), boolean chains 13, loops 1 (2 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (chartOption.getChartOption::axisOptions) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
runner.runScenario (cognitive 48) eval/whiteboard-layout/runner.ts:142— runner.runScenario has cognitive complexity 48 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 5 (13 pts), loops 4 (7 pts), error handling 3 (6 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 25). Of this number, 39 points are the body's own statements and 9 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.
model-settings-import.unimportedItems (cognitive 48) lib/legacy-browser-import/model-settings-import.ts:140— model-settings-import.unimportedItems has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 14 (24 pts), if/else 7 (14 pts), boolean chains 5, loops 5 (nesting depth added 17). Of this number, 45 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
owner-bound-document-store.createOwnerBoundDocumentStore::withTransaction (cognitive 48) lib/persistence/owner-bound-document-store.ts:597— owner-bound-document-store.createOwnerBoundDocumentStore::withTransaction has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 7, ternaries 1 (2 pts), error handling 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.
imageSerializer.applyExtLstImageEffectsToFilters (cognitive 48) packages/@openmaic/importer/src/serializer/imageSerializer.ts:261— imageSerializer.applyExtLstImageEffectsToFilters has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (35 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 3 (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.
tableSerializer.getStyleSections (cognitive 48) packages/@openmaic/importer/src/serializer/tableSerializer.ts:98— tableSerializer.getStyleSections has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (36 pts), boolean chains 10, ternaries 1 (2 pts) (nesting depth added 15). Of this number, 43 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resource-reference-scan.scanExternalReferences (cognitive 48) render-service/src/resource-reference-scan.mjs:71— resource-reference-scan.scanExternalReferences has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (30 pts), ternaries 4 (9 pts), loops 3 (5 pts), error handling 2 (4 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createResourceHandler::handle (cognitive 48) render-service/src/resource-owner.mjs:48— createResourceHandler::handle has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 14 (20 pts), if/else 14 (16 pts), boolean chains 9, other 2, error handling 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.
route.POST (cognitive 47) app/api/generate/voice/route.ts:74— route.POST has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 4 (8 pts), boolean chains 6, error handling 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.
page.ClassroomCard (cognitive 47) app/page.tsx:1986— page.ClassroomCard has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 19, ternaries 12 (16 pts), if/else 9 (12 pts) (nesting depth added 7). Of this number, 30 points are the body's own statements and 17 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.
ActionsBar.SpeechTtsBar (cognitive 47) components/edit/ActionsBar/ActionsBar.tsx:276— ActionsBar.SpeechTtsBar has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 12 (18 pts), boolean chains 8, error handling 3 (nesting depth added 9). Of this number, 18 points are the body's own statements and 29 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.
InteractiveIframeHost.PooledIframe (cognitive 47) REDACTED:235— InteractiveIframeHost.PooledIframe has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 15 (17 pts), boolean chains 16, if/else 14 (nesting depth added 2). Of this number, 17 points are the body's own statements and 30 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.
submission.SubmissionModal::handleFile (cognitive 47) components/scene-renderers/pbl/v2/submission.tsx:994— submission.SubmissionModal::handleFile has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (32 pts), ternaries 3 (8 pts), error handling 3 (5 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. This shape REPEATS in the file: one other method here (submission.SubmissionModal) 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.
workbench-split.WorkbenchSplit (cognitive 47) components/scene-renderers/pbl/v3/workbench-split.tsx:6— workbench-split.WorkbenchSplit has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 13 (16 pts), boolean chains 11 (nesting depth added 5). Of this number, 24 points are the body's own statements and 23 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, 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.
chartOption.getChartOption (cognitive 47) components/slide-renderer/components/element/ChartElement/chartOption.ts:31— chartOption.getChartOption has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 13 (19 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 14). Of this number, 34 points are the body's own statements and 13 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runner.main (cognitive 47) eval/pbl-v2-planner/runner.ts:804— runner.main has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 9 (21 pts), if/else 7 (13 pts), boolean chains 9, loops 3 (4 pts) (nesting depth added 19). Of this number, 16 points are the body's own statements and 31 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.
json-repair.parseJsonResponseCandidate (cognitive 47) packages/@openmaic/generation/src/json-repair.ts:85— json-repair.parseJsonResponseCandidate has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (34 pts), boolean chains 5, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mathSerializer.normalizeMathCharToUnicode (cognitive 47) packages/@openmaic/importer/src/serializer/mathSerializer.ts:108— mathSerializer.normalizeMathCharToUnicode has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (24 pts), boolean chains 22, 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.
mathSerializer.postProcessLatex (cognitive 47) packages/@openmaic/importer/src/serializer/mathSerializer.ts:185— mathSerializer.postProcessLatex has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (41 pts), ternaries 1 (3 pts), boolean chains 2, 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.
folder-card.FolderCard (cognitive 45) components/discovery/folder-card.tsx:42— folder-card.FolderCard has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 8 (12 pts), boolean chains 11 (nesting depth added 10). Of this number, 20 points are the body's own statements and 25 belong to 11 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StaticTable.StaticTable (cognitive 45) components/slide-renderer/components/element/TableElement/StaticTable.tsx:17— StaticTable.StaticTable has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 16 (17 pts), if/else 15, boolean chains 13 (nesting depth added 1). Most of this is not in the body itself: 4 of the 45 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 115, getCellBg, getHeaderTextColor, …). 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.
textSerializer.runStylesToCssString (cognitive 45) packages/@openmaic/importer/src/serializer/textSerializer.ts:1867— textSerializer.runStylesToCssString has cognitive complexity 45 (threshold 15). Drivers by points: if/else 26 (28 pts), boolean chains 13, ternaries 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
shapeSerializer.resolveInheritedPlaceholderFill (cognitive 45) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:766— shapeSerializer.resolveInheritedPlaceholderFill has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 4 (18 pts), boolean chains 1, loops 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
groupSerializer.groupToElement (cognitive 45) packages/@openmaic/importer/src/serializer/groupSerializer.ts:242— groupSerializer.groupToElement has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (22 pts), ternaries 5 (13 pts), loops 3 (6 pts), boolean chains 4 (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.
route.POST (cognitive 44) app/api/agent/sessions/route.ts:44— route.POST has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 12, ternaries 6, error handling 3 (nesting depth added 5). Of this number, 18 points are the body's own statements and 26 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.
index.ImageElement (cognitive 44) components/slide-renderer/components/element/ImageElement/index.tsx:31— index.ImageElement has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 13 (37 pts), boolean chains 4, if/else 3 (nesting depth added 24). Of this number, 40 points are the body's own statements and 4 belong to 2 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.
StreamBuffer.tick (cognitive 44) lib/buffer/stream-buffer.ts:495— StreamBuffer.tick has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (38 pts), boolean chains 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
classroom-zip-utils.collectLegacyAudioForExport (cognitive 44) lib/export/classroom-zip-utils.ts:287— classroom-zip-utils.collectLegacyAudioForExport has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 6 (11 pts), ternaries 4 (6 pts), boolean chains 2, error handling 1 (nesting depth added 22). Of this number, 40 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.
parser.parse (cognitive 44) lib/export/html-parser/parser.ts:48— parser.parse has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 5 (12 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.
completion-stats.normalizeActGoals (cognitive 44) lib/pbl/v2/operations/runtime/completion-stats.ts:211— completion-stats.normalizeActGoals has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (23 pts), ternaries 4 (9 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 22). Of this number, 39 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.
derived-state.computePlaybackView (cognitive 44) lib/playback/derived-state.ts:77— derived-state.computePlaybackView has cognitive complexity 44 (threshold 15). Drivers by points: if/else 34, boolean chains 10. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
media-generation.useMediaGenerationStore (cognitive 44) lib/store/media-generation.ts:87— media-generation.useMediaGenerationStore has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (22 pts), ternaries 5 (16 pts), loops 4, boolean chains 1, error handling 1 (nesting depth added 18). None of this is in the body itself: all 44 points belong to 9 function literals inside it that branch (lines 194, 253, 266, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
validate.assertLosslessJson (cognitive 44) lib/whiteboard/runtime/validate.ts:291— validate.assertLosslessJson has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 8, loops 3 (5 pts), ternaries 1 (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.
RendererTableEditor.RendererTableEditor (cognitive 44) REDACTED:88— RendererTableEditor.RendererTableEditor has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20, boolean chains 12, ternaries 11 (12 pts) (nesting depth added 1). None of this is in the body itself: all 44 points belong to 12 function items inside it that branch (getCellBackground, a function literal at line 224, getHeaderTextColor, …). 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.
ActionsBar.ActionsBar (cognitive 43) components/edit/ActionsBar/ActionsBar.tsx:1057— ActionsBar.ActionsBar has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 13, if/else 9 (12 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 13 of the 43 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 1139, a function literal at line 1350, newId, …). 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.
header-controls.HeaderControls (cognitive 43) components/stage/header-controls.tsx:113— header-controls.HeaderControls has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 22, ternaries 16 (20 pts), if/else 1 (nesting depth added 4). Of this number, 39 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.
interactive-state-evidence.attachInteractiveState (cognitive 43) lib/chat/pi/interactive-state-evidence.ts:124— interactive-state-evidence.attachInteractiveState has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 9 (15 pts), boolean chains 8 (nesting depth added 14). Of this number, 30 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.runLocked (cognitive 43) lib/legacy-browser-import/index.ts:167— index.runLocked has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (28 pts), loops 5 (8 pts), ternaries 4 (5 pts), boolean chains 1, error handling 1 (nesting depth added 14). Of this number, 40 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
product-context.teachingProductContext (cognitive 43) lib/server/pbl-v3/product-context.ts:61— product-context.teachingProductContext has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 24 (39 pts), boolean chains 4 (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.
builtin-extraction.fetchAndExtractUrl (cognitive 43) lib/web-fetch/builtin-extraction.ts:366— builtin-extraction.fetchAndExtractUrl has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 6, ternaries 3 (5 pts), error handling 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tts-voice-managers.QwenVoiceCloneManager (cognitive 42) components/settings/tts-voice-managers.tsx:499— tts-voice-managers.QwenVoiceCloneManager has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 11, if/else 11, error handling 4 (nesting depth added 4). Most of this is not in the body itself: 10 of the 42 points are its own statements and the rest belongs to 14 function items inside it that branch (startRecording, handleSave, 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.
question-form.QuestionForm (cognitive 42) components/workbench/chat/question-form.tsx:47— question-form.QuestionForm has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 15 (27 pts), if/else 10, boolean chains 5 (nesting depth added 12). Most of this is not in the body itself: 8 of the 42 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 162, 120, 98, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
audio-duration.measureMp3Duration (cognitive 42) lib/audio/audio-duration.ts:121— audio-duration.measureMp3Duration has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 8 (13 pts), boolean chains 7, 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.
instructor.buildPriorSubmissionsBlock (cognitive 42) lib/pbl/v2/agents/instructor.ts:251— instructor.buildPriorSubmissionsBlock has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 6 (22 pts), if/else 8 (15 pts), loops 3 (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.
generate-video.patchStageVideoPlaceholder (cognitive 42) lib/server/agent-runtime/generate-video.ts:473— generate-video.patchStageVideoPlaceholder has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 8, ternaries 3 (6 pts), error handling 1, loops 1 (nesting depth added 13). Most of this is not in the body itself: 9 of the 42 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 520, isReplaceableSrc, isReplaceablePoster). 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.
scene-content.generateSceneContent (cognitive 42) lib/server/generation/steps/scene-content.ts:76— scene-content.generateSceneContent has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 21). Of this number, 40 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stage-storage.saveStageDataIncremental (cognitive 42) lib/utils/stage-storage.ts:355— stage-storage.saveStageDataIncremental has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 5, loops 1 (3 pts), error handling 1 (2 pts), ternaries 2 (nesting depth added 16). Most of this is not in the body itself: 10 of the 42 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 406, 377, 408, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
scene-generator.generateSceneActions (cognitive 42) REDACTED:1771— scene-generator.generateSceneActions has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 19, ternaries 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.
ZipParser.parseZip (cognitive 42) packages/@openmaic/importer/src/parser/ZipParser.ts:186— ZipParser.parseZip has cognitive complexity 42 (threshold 15). Drivers by points: if/else 29 (40 pts), boolean chains 1, loops 1 (nesting depth added 11). Of this number, 16 points are the body's own statements and 26 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.
StyleResolver.resolveLineStyle (cognitive 42) packages/@openmaic/importer/src/serializer/StyleResolver.ts:560— StyleResolver.resolveLineStyle has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 13, ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
document.route (cognitive 42) REDACTED:332— document.route has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (26 pts), error handling 4 (10 pts), boolean chains 6 (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.
sandbox-preview-activity.installPreviewActivity (cognitive 42) scripts/sandbox-preview-activity.mjs:2— sandbox-preview-activity.installPreviewActivity has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 13, ternaries 3, error handling 1 (nesting depth added 8). Most of this is not in the body itself: 7 of the 42 points are its own statements and the rest belongs to 4 function items inside it that branch (flush, a function literal at line 130, input, …). 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.
EditShell.surfaceStateEqual (cognitive 41) components/edit/EditShell/EditShell.tsx:221— EditShell.surfaceStateEqual has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (37 pts), loops 4 (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.
use-project-editor.useProjectEditor.load (cognitive 41) components/scene-renderers/pbl/v3/use-project-editor.ts:84— use-project-editor.useProjectEditor.load has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 16, ternaries 3 (6 pts), error handling 1 (nesting depth added 8). Of this number, 27 points are the body's own statements and 14 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compose-extras.SkillSlashMenu (cognitive 41) components/workbench/compose-extras.tsx:48— compose-extras.SkillSlashMenu has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 7 (20 pts), if/else 10 (14 pts), boolean chains 7 (nesting depth added 17). Most of this is not in the body itself: 10 of the 41 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 114, 199, 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.
runner.writeMarkdownReport (cognitive 41) eval/pbl-v2-planner/runner.ts:733— runner.writeMarkdownReport has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 11 (32 pts), loops 3 (4 pts), if/else 1 (3 pts), boolean chains 2 (nesting depth added 24). Of this number, 40 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.
lexer.lexTagAttributes (cognitive 41) lib/export/html-parser/lexer.ts:100— lexer.lexTagAttributes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (35 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.
use-run-course.useRunCourse (cognitive 41) lib/generation-run-client/use-run-course.ts:89— use-run-course.useRunCourse has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 12, ternaries 9, loops 1 (nesting depth added 3). Most of this is not in the body itself: 12 of the 41 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 201, 180, 125, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
event-stream.learningEventResponse (cognitive 41) lib/server/pbl-v3/event-stream.ts:22— event-stream.learningEventResponse has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 5, loops 3, ternaries 2, error handling 1 (nesting depth added 9). 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 items inside it that branch (a function literal at line 80, subscribe, a function literal at line 57, …). 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.
cover-config.resolveVideoExportCta (cognitive 41) lib/video-export-app/cover-config.ts:66— cover-config.resolveVideoExportCta has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 13, ternaries 4, error handling 2 (nesting depth added 2). Of this number, 33 points are the body's own statements and 8 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.
asset-manifest.enumerateAssetManifest (cognitive 41) packages/@openmaic/dsl/src/asset-manifest.ts:119— asset-manifest.enumerateAssetManifest has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 7 (14 pts), loops 7 (9 pts), boolean chains 2 (nesting depth added 16). Of this number, 31 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
action-parser.parseActionsFromStructuredOutput (cognitive 41) packages/@openmaic/generation/src/action-parser.ts:41— action-parser.parseActionsFromStructuredOutput has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 10, error handling 4 (9 pts), loops 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.
Presentation.buildPresentation (cognitive 41) packages/@openmaic/importer/src/model/Presentation.ts:114— Presentation.buildPresentation has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 7 (8 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 17). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chartSerializer.extractSeriesColors (cognitive 41) packages/@openmaic/importer/src/serializer/chartSerializer.ts:160— chartSerializer.extractSeriesColors has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 2 (3 pts), boolean chains 1, 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.
outlines-editor.OutlinesEditor (cognitive 40) components/generation/outlines-editor.tsx:111— outlines-editor.OutlinesEditor has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 15, ternaries 7 (9 pts) (nesting depth added 4). Most of this is not in the body itself: 14 of the 40 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 146, moveOutline, reorderOutline, …). 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.
narration-tts.generateAndStoreTTS (cognitive 40) lib/audio/narration-tts.ts:82— narration-tts.generateAndStoreTTS has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 4 (9 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 14). Of this number, 38 points are the body's own statements and 2 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.
course-timeline.applyTimelineEntry (cognitive 40) lib/edit/course-timeline.ts:365— course-timeline.applyTimelineEntry has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 7 (9 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 15). Of this number, 38 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.
html-asset-inventory.analyzeHtmlAssetInventory::visit (cognitive 40) lib/export/html-asset-inventory.ts:188— html-asset-inventory.analyzeHtmlAssetInventory::visit has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 5, loops 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
sources.legacySpeechHolders (cognitive 40) lib/legacy-browser-import/sources.ts:280— sources.legacySpeechHolders has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 4 (10 pts), error handling 2 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 24). Of this number, 24 points are the body's own statements and 16 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.
planner.buildTools (cognitive 40) lib/pbl/v2/agents/planner.ts:198— planner.buildTools has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 23, if/else 13, boolean chains 4. Most of this is not in the body itself: 3 of the 40 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 480, 420, 638, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mineru-cloud.parseMinerUZip (cognitive 40) lib/pdf/mineru-cloud.ts:318— mineru-cloud.parseMinerUZip has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 3 (4 pts), ternaries 3 (4 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 15). Of this number, 30 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat-storage.saveChatSessions (cognitive 40) lib/utils/chat-storage.ts:993— chat-storage.saveChatSessions has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 7, loops 2 (4 pts), ternaries 3, error handling 1 (nesting depth added 11). Most of this is not in the body itself: 4 of the 40 points are its own statements and the rest belongs to one function literal inside it that branches (line 1006). 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.
interactive-library-mapper.mapInteractiveLibraryUrl (cognitive 40) packages/@openmaic/generation/src/interactive-library-mapper.ts:29— interactive-library-mapper.mapInteractiveLibraryUrl has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 12, ternaries 1 (2 pts), error handling 1 (nesting depth added 8). Of this number, 36 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tableSerializer.tableToElement.data (cognitive 40) packages/@openmaic/importer/src/serializer/tableSerializer.ts:505— tableSerializer.tableToElement.data has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 4 (6 pts), ternaries 4, boolean chains 2 (nesting depth added 11). None of this is in the body itself: all 40 points belong to one function literal inside it that branches (line 506). 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.
sandbox-lab.SandboxLab (cognitive 39) app/sandbox-lab/sandbox-lab.tsx:24— sandbox-lab.SandboxLab has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (14 pts), loops 3 (4 pts), ternaries 2 (4 pts), error handling 2 (nesting depth added 9). Most of this is not in the body itself: 13 of the 39 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 130, perform, a function literal at line 64, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent-bar.AgentBar (cognitive 39) components/agent/agent-bar.tsx:605— agent-bar.AgentBar has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 16, if/else 11 (12 pts), ternaries 10 (11 pts) (nesting depth added 2). Most of this is not in the body itself: 12 of the 39 points are its own statements and the rest belongs to 8 function items inside it that branch (handleModeChange, renderAgentRow, a function literal at line 647, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-tree-drag.useTreeDrag (cognitive 39) components/workbench/workspace/use-tree-drag.ts:72— use-tree-drag.useTreeDrag has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 8, ternaries 5 (8 pts) (nesting depth added 6). None of this is in the body itself: all 39 points belong to 8 function literals inside it that branch (lines 170, 138, 196, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
prepare-manifest.collectMediaSlots (cognitive 39) lib/export/standalone-html/prepare-manifest.ts:160— prepare-manifest.collectMediaSlots has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 5 (17 pts), boolean chains 1 (nesting depth added 26). Of this number, 36 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plain-json.canonicalize (cognitive 39) lib/persistence/plain-json.ts:31— plain-json.canonicalize has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 6, loops 4 (6 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.
index.compileEditorEditIntents (cognitive 39) packages/@openmaic/editor/src/core/index.ts:164— index.compileEditorEditIntents has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (26 pts), ternaries 2 (7 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 22). Of this number, 38 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.
chartSerializer.chartToElement (cognitive 39) packages/@openmaic/importer/src/serializer/chartSerializer.ts:421— chartSerializer.chartToElement has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 4, loops 1 (4 pts), ternaries 3 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pg-migrations.splitSqlStatements (cognitive 39) packages/@openmaic/storage/src/pg-migrations.ts:519— pg-migrations.splitSqlStatements has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (26 pts), ternaries 2 (6 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
use-chat-sessions.runPiSingleRequest (cognitive 38) components/chat/use-chat-sessions.ts:349— use-chat-sessions.runPiSingleRequest has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 6, loops 2 (3 pts), ternaries 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.
index.ShapeElement (cognitive 38) components/slide-renderer/components/element/ShapeElement/index.tsx:33— index.ShapeElement has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 12, if/else 8 (9 pts) (nesting depth added 4). Of this number, 27 points are the body's own statements and 11 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.
BaseCodeElement.BaseCodeElement (cognitive 38) REDACTED:371— BaseCodeElement.BaseCodeElement has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 8, loops 3 (5 pts), error handling 2, ternaries 2 (nesting depth added 7). Most of this is not in the body itself: 5 of the 38 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 502, 539, 576, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
call-agent.validateActionParams (cognitive 38) lib/chat/pi/tools/call-agent.ts:262— call-agent.validateActionParams has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 10, ternaries 2 (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.
director-loop.runPiDirectorLoop (cognitive 38) lib/chat/pi/director-loop.ts:30— director-loop.runPiDirectorLoop has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 14, if/else 13 (14 pts), ternaries 8 (9 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 13 of the 38 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 223, a function literal at line 77, isTeachingSubstantiveTurn, …). 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.
eval-prompts.buildMilestoneEvalPrompt (cognitive 38) lib/pbl/v2/operations/runtime/eval-prompts.ts:135— eval-prompts.buildMilestoneEvalPrompt has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (33 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills.checkOutlineAgainstSkill (cognitive 38) lib/server/agent-runtime/skills.ts:830— skills.checkOutlineAgainstSkill has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 9, loops 4 (5 pts) (nesting depth added 10). Of this number, 36 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.
collect.collectVideoAssets (cognitive 38) lib/video-export-app/collect.ts:326— collect.collectVideoAssets has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 2 (nesting depth added 15). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
closeoutTask (cognitive 38) render-service/src/resource-task-runner.mjs:282— closeoutTask has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 4 (12 pts), error handling 3 (7 pts), other 5, 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.
model-picker.ModelPicker (cognitive 37) components/settings/model-picker.tsx:312— model-picker.ModelPicker has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 18, ternaries 8 (11 pts), if/else 5 (7 pts), loops 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 20 belong to 7 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.
run-native-child.runNativeChild (cognitive 37) lib/agent/runtime/run-native-child.ts:189— run-native-child.runNativeChild has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23 (24 pts), boolean chains 13 (nesting depth added 1). Of this number, 23 points are the body's own statements and 14 belong to 6 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
migration.migrateLocked (cognitive 37) lib/document-store/migration.ts:391— migration.migrateLocked has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 8, error handling 4 (7 pts), ternaries 2 (nesting depth added 9). Most of this is not in the body itself: 5 of the 37 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 471, 404). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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-discussion-tts.useDiscussionTTS.processQueue (cognitive 37) lib/hooks/use-discussion-tts.ts:305— use-discussion-tts.useDiscussionTTS.processQueue has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 6, ternaries 2, error handling 1 (nesting depth added 9). Of this number, 35 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collect-stage-asset-refs.collectStageAssetRefs (cognitive 37) lib/media/collect-stage-asset-refs.ts:55— collect-stage-asset-refs.collectStageAssetRefs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 6 (13 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 17). Of this number, 22 points are the body's own statements and 15 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.
fold.applyRuntimeEvent (cognitive 37) lib/pbl/v2/runtime/fold.ts:149— fold.applyRuntimeEvent has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 1 (nesting depth added 18). 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.
transition.allowedStudentActions (cognitive 37) lib/pbl/v3/domain/orchestration/transition.ts:731— transition.allowedStudentActions has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 5 (11 pts), boolean chains 8 (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.
legacy-classroom-import.importLegacyClassrooms (cognitive 37) lib/server/legacy-classroom-import.ts:390— legacy-classroom-import.importLegacyClassrooms has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (25 pts), error handling 3 (6 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 17). Of this number, 30 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.
context-projection.createTeachingContextProjection.prepare (cognitive 37) lib/server/pbl-v3/context-projection.ts:161— context-projection.createTeachingContextProjection.prepare has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 5, loops 3 (4 pts), ternaries 3, 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.
PgRuntimeStore.appendRecord (cognitive 37) packages/@openmaic/storage/src/runtime/pg.ts:485— PgRuntimeStore.appendRecord has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 16). Most of this is not in the body itself: 11 of the 37 points are its own statements and the rest belongs to one function literal inside it that branches (line 514). 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.
check-package-version-bumps.checkDslFormatVersionRule (cognitive 37) scripts/check-package-version-bumps.mjs:308— check-package-version-bumps.checkDslFormatVersionRule has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 9 (13 pts), error handling 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 14). Of this number, 29 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tts-settings.TTSSettings (cognitive 36) components/settings/tts-settings.tsx:100— tts-settings.TTSSettings has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 26, ternaries 6 (8 pts), error handling 1, if/else 1 (nesting depth added 2). Of this number, 27 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
use-project-editor.useProjectEditor.pump::run (cognitive 36) components/scene-renderers/pbl/v3/use-project-editor.ts:235— use-project-editor.useProjectEditor.pump::run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task-dock.TaskDock (cognitive 36) components/scene-renderers/pbl/v3/task-dock.tsx:26— task-dock.TaskDock has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 9, if/else 6 (nesting depth added 7). Of this number, 22 points are the body's own statements and 14 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.TextElement (cognitive 36) components/slide-renderer/components/element/TextElement/index.tsx:29— index.TextElement has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 8, ternaries 7 (nesting depth added 4). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 86, a function literal at line 51, a function literal at line 169, …). 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.
tableUtils.getHiddenCells (cognitive 36) components/slide-renderer/components/element/TableElement/tableUtils.ts:46— tableUtils.getHiddenCells has cognitive complexity 36 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 3 (11 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.Canvas (cognitive 36) components/slide-renderer/Editor/Canvas/index.tsx:65— index.Canvas has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 17, ternaries 9 (10 pts), if/else 9 (nesting depth added 1). Most of this is not in the body itself: 10 of the 36 points are its own statements and the rest belongs to 9 function items inside it that branch (handleClickBlankArea, contextmenus, a function literal at line 377, …). 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.
BaseVideoElement.BaseVideoElement (cognitive 36) components/slide-renderer/components/element/VideoElement/BaseVideoElement.tsx:32— BaseVideoElement.BaseVideoElement has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 7 (12 pts), boolean chains 5 (nesting depth added 17). Of this number, 22 points are the body's own statements and 14 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.
stream-fn.pump (cognitive 36) lib/agent/runtime/stream-fn.ts:275— stream-fn.pump has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 5 (7 pts), boolean chains 5, error handling 1, loops 1, match/switch 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 14 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.
adopt-cached-narration.adoptCachedNarrationRun (cognitive 36) lib/audio/adopt-cached-narration.ts:316— adopt-cached-narration.adoptCachedNarrationRun has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 14). Of this number, 30 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.
qwen-voice-clone.downloadAudio (cognitive 36) lib/audio/qwen-voice-clone.ts:378— qwen-voice-clone.downloadAudio has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 7, ternaries 3 (5 pts), error handling 3 (4 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
structured-output.parseStructuredChunk (cognitive 36) lib/chat/structured-output.ts:120— structured-output.parseStructuredChunk has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 8, error handling 2 (3 pts), loops 2, 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.
use-export-classroom.buildClassroomExportSnapshot (cognitive 36) lib/export/use-export-classroom.ts:138— use-export-classroom.buildClassroomExportSnapshot has cognitive complexity 36 (threshold 15). Drivers by points: loops 11, if/else 5 (9 pts), boolean chains 8, ternaries 8 (nesting depth added 4). Of this number, 22 points are the body's own statements and 14 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.
use-import-classroom.useImportClassroom.handleFileChange (cognitive 36) lib/import/use-import-classroom.ts:374— use-import-classroom.useImportClassroom.handleFileChange has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 11 (16 pts), if/else 7 (8 pts), boolean chains 6, error handling 5 (6 pts) (nesting depth added 7). Of this number, 27 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.
whiteboard-conflicts.buildWhiteboardConflicts (cognitive 36) lib/orchestration/summarizers/whiteboard-conflicts.ts:178— whiteboard-conflicts.buildWhiteboardConflicts has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 6 (8 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.
package-client.readClassroomProjects (cognitive 36) lib/pbl/v3/package-client.ts:207— package-client.readClassroomProjects has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 11, loops 4 (6 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.
scene-preview-content.prepareSlide (cognitive 36) lib/server/agent-runtime/scene-preview-content.ts:241— scene-preview-content.prepareSlide has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 8, ternaries 5 (7 pts), loops 2 (nesting depth added 10). Of this number, 28 points are the body's own statements and 8 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.
import-pptx.buildImportPptxTool.execute (cognitive 36) lib/server/agent-runtime/import-pptx.ts:396— import-pptx.buildImportPptxTool.execute has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 13 (16 pts), boolean chains 2, error handling 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.
runner-tools.teachingRunnerConfig.tool.execute (cognitive 36) lib/server/pbl-v3/runner-tools.ts:226— runner-tools.teachingRunnerConfig.tool.execute has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 11 (12 pts), boolean chains 8 (nesting depth added 9). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 266, 244, 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.
Slide.parseDiagramFrame (cognitive 36) packages/@openmaic/importer/src/model/Slide.ts:172— Slide.parseDiagramFrame has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 3 (11 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 24). Of this number, 24 points are the body's own statements and 12 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.
route.POST (cognitive 35) app/api/provider/probe-models/route.ts:26— route.POST has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat-session.ChatSessionComponent (cognitive 35) components/chat/chat-session.tsx:159— chat-session.ChatSessionComponent has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 19, if/else 7 (8 pts), ternaries 7 (8 pts) (nesting depth added 2). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 239, 306, 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.
index.SettingsDialog (cognitive 35) components/settings/index.tsx:52— index.SettingsDialog has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 9, if/else 8 (9 pts), match/switch 1 (nesting depth added 7). Most of this is not in the body itself: 12 of the 35 points are its own statements and the rest belongs to 9 function items inside it that branch (listed, a function literal at line 104, a function literal at line 63, …). 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.VideoElement (cognitive 35) components/slide-renderer/components/element/VideoElement/index.tsx:27— index.VideoElement has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 12 (31 pts), boolean chains 3, if/else 1 (nesting depth added 19). Of this number, 34 points are the body's own statements and 1 belongs 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.
useDragElement.useDragElement.dragElement::handleMouseMove (cognitive 35) components/slide-renderer/Editor/Canvas/hooks/useDragElement.ts:139— useDragElement.useDragElement.dragElement::handleMouseMove has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 10, loops 2, 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. This shape REPEATS in the file: one other method here (useDragElement.useDragElement.dragElement) 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.
useSelectElement.useSelectElement.selectElement (cognitive 35) components/slide-renderer/Editor/Canvas/hooks/useSelectElement.ts:29— useSelectElement.useSelectElement.selectElement has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (24 pts), ternaries 4 (10 pts), boolean chains 1 (nesting depth added 15). Of this number, 26 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.
question-card.QuestionCard (cognitive 35) components/workbench/chat/question-card.tsx:54— question-card.QuestionCard has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 16 (23 pts), boolean chains 8, if/else 3 (4 pts) (nesting depth added 8). Of this number, 23 points are the body's own statements and 12 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.
html-asset-inventory.collectAssetRefs (cognitive 35) lib/export/html-asset-inventory.ts:274— html-asset-inventory.collectAssetRefs has cognitive complexity 35 (threshold 15). Drivers by points: loops 12 (19 pts), if/else 9 (11 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 10). Of this number, 24 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
media.fillLegacyMedia (cognitive 35) lib/legacy-browser-import/media.ts:384— media.fillLegacyMedia has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 2 (5 pts), boolean chains 3, loops 3, error handling 1 (2 pts) (nesting depth added 15). Of this number, 33 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.applyOperation (cognitive 35) packages/@openmaic/editor/src/core/index.ts:426— index.applyOperation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 19). Of this number, 33 points are the body's own statements and 2 belong 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.
scene-generator.generateWidgetContent (cognitive 35) REDACTED:1270— scene-generator.generateWidgetContent has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 28, if/else 5 (6 pts), match/switch 1 (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.
canvas-toolbar.CanvasToolbar (cognitive 34) components/canvas/canvas-toolbar.tsx:92— canvas-toolbar.CanvasToolbar has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 17, ternaries 10 (17 pts) (nesting depth added 7). Of this number, 33 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.
use-chat-sessions.useChatSessions.endSession (cognitive 34) components/chat/use-chat-sessions.ts:1339— use-chat-sessions.useChatSessions.endSession has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 6, loops 2 (6 pts), ternaries 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 11 of the 34 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1376, 1420). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
useMoveShapeKeypoint.useMoveShapeKeypoint.moveShapeKeypoint (cognitive 34) components/slide-renderer/Editor/Canvas/hooks/useMoveShapeKeypoint.ts:33— useMoveShapeKeypoint.useMoveShapeKeypoint.moveShapeKeypoint has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (24 pts), ternaries 6, boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 69, handleMouseUp, handleMouseMove). 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.
providers.getModel (cognitive 34) lib/ai/providers.ts:2341— providers.getModel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 32 (80 pts), error handling 7 (24 pts), boolean chains 22, ternaries 5 (17 pts), loops 1 (6 pts), match/switch 1 (nesting depth added 82). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (providers.getModel::compatFetch) 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.
StreamBuffer.flushRemaining (cognitive 34) lib/buffer/stream-buffer.ts:369— StreamBuffer.flushRemaining has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (31 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resolve-slot.resolveSlot (cognitive 34) lib/server/model-config/resolve-slot.ts:383— resolve-slot.resolveSlot has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 12 (23 pts), if/else 4 (6 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stage.writePendingChangesForUnload (cognitive 34) lib/store/stage.ts:1612— stage.writePendingChangesForUnload has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, loops 3 (6 pts), ternaries 1 (nesting depth added 11). Of this number, 17 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
customGeometry.renderCustomGeometry (cognitive 34) packages/@openmaic/importer/src/shapes/customGeometry.ts:45— customGeometry.renderCustomGeometry has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 4 (12 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 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.
agent-bar.AgentVoicePill (cognitive 33) components/agent/agent-bar.tsx:69— agent-bar.AgentVoicePill has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 5 (8 pts), error handling 2 (3 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 98, 123, 275, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model-services.ModelServicesPanel (cognitive 33) components/settings/model-services.tsx:130— model-services.ModelServicesPanel has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 17, ternaries 11 (14 pts), if/else 2 (nesting depth added 3). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (header, a function literal at line 149, a function literal at line 146, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
load-classroom.runClassroomLoad (cognitive 33) lib/classroom/load-classroom.ts:117— load-classroom.runClassroomLoad has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (24 pts), ternaries 4 (7 pts), boolean chains 1, error handling 1 (nesting depth added 8). 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.
course.runCourse (cognitive 33) lib/legacy-browser-import/course.ts:395— course.runCourse has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
evaluator.runShared (cognitive 33) lib/pbl/v2/agents/evaluator.ts:130— evaluator.runShared has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 6 (10 pts), match/switch 1 (2 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
simulator.runSimulatorTurn (cognitive 33) lib/pbl/v2/agents/simulator.ts:381— simulator.runSimulatorTurn has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 5 (8 pts), loops 3 (5 pts), boolean chains 3, error handling 1 (nesting depth added 9). Of this number, 26 points are the body's own statements and 7 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.
media.generateItem (cognitive 33) lib/server/generation/run/media.ts:318— media.generateItem has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 3 (6 pts), ternaries 3 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). Of this number, 21 points are the body's own statements and 12 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.
StyleResolver.resolveColorUncached (cognitive 33) packages/@openmaic/importer/src/serializer/StyleResolver.ts:115— StyleResolver.resolveColorUncached has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (11 pts), ternaries 2 (7 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
shapeSerializer.pickVisibleGradientStop (cognitive 33) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:92— shapeSerializer.pickVisibleGradientStop has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseCodeElement.BaseCodeElement (cognitive 33) REDACTED:368— BaseCodeElement.BaseCodeElement has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 7, loops 2 (4 pts), error handling 2 (nesting depth added 7). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 469, 502, 539, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
speech-button.SpeechButton (cognitive 32) components/audio/speech-button.tsx:31— speech-button.SpeechButton has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 10, if/else 5 (nesting depth added 5). Of this number, 25 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
asr-settings.ASRSettings (cognitive 32) components/settings/asr-settings.tsx:53— asr-settings.ASRSettings has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 25, if/else 4 (6 pts), error handling 1 (nesting depth added 2). Of this number, 19 points are the body's own statements and 13 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.
useScaleElement.useScaleElement.scaleElement (cognitive 32) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:141— useScaleElement.useScaleElement.scaleElement has cognitive complexity 32 (threshold 15). Drivers by points: if/else 61 (107 pts), boolean chains 23, ternaries 12 (15 pts), loops 3 (6 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent 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 (useScaleElement.useScaleElement.scaleElement::alignedAdsorption, useScaleElement.useScaleElement.scaleElement::handleMouseMove) 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.
reporter.generateReport (cognitive 32) eval/whiteboard-layout/reporter.ts:17— reporter.generateReport has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 7 (11 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.
voice-resolver.resolveAgentVoice (cognitive 32) lib/audio/voice-resolver.ts:111— voice-resolver.resolveAgentVoice has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 4 (9 pts), boolean chains 6, 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.
native-whiteboard.settleWhiteboardMutation (cognitive 32) lib/chat/pi/tools/native-whiteboard.ts:527— native-whiteboard.settleWhiteboardMutation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), error handling 3 (4 pts), boolean chains 1 (nesting depth added 14). 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.
local-media.extractMediaMaterial (cognitive 32) lib/document/extractors/local-media.ts:603— local-media.extractMediaMaterial has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 2 (5 pts), ternaries 2 (5 pts), loops 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.
pptx-scene-placeholders.planPptxDeck (cognitive 32) lib/export/pptx-scene-placeholders.ts:250— pptx-scene-placeholders.planPptxDeck has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 5 (8 pts), boolean chains 7, loops 1 (nesting depth added 13). Of this number, 29 points are the body's own statements and 3 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.
comfyui-image-adapter.patchWorkflow (cognitive 32) lib/media/adapters/comfyui-image-adapter.ts:304— comfyui-image-adapter.patchWorkflow has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 5, 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.
reconcile-scene-media.applyKnownMediaAllocations (cognitive 32) lib/media/reconcile-scene-media.ts:96— reconcile-scene-media.applyKnownMediaAllocations has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 5 (6 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 11). Most of this is not in the body itself: 10 of the 32 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 131, narrationRewritesFor, rewritesFor). 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.
mineru-parser.extractMinerUResult (cognitive 32) lib/pdf/mineru-parser.ts:14— mineru-parser.extractMinerUResult has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 4 (9 pts), boolean chains 6, loops 1 (2 pts), error handling 1 (nesting depth added 13). Of this number, 25 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.
tool-call-integrity.repairOrphanedToolCalls (cognitive 32) lib/server/agent-runtime/tool-call-integrity.ts:109— tool-call-integrity.repairOrphanedToolCalls has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 7 (12 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat-storage.loadChatSessions (cognitive 32) lib/utils/chat-storage.ts:1157— chat-storage.loadChatSessions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 10 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.
planner-core.plannerCompletionGaps (cognitive 32) packages/@openmaic/generation/src/pbl/planner-core.ts:323— planner-core.plannerCompletionGaps has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 2, loops 1 (nesting depth added 12). Of this number, 27 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.
ShapeNode.parseParagraph (cognitive 32) packages/@openmaic/importer/src/model/nodes/ShapeNode.ts:113— ShapeNode.parseParagraph has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 6 (10 pts), loops 3, 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.
AssetCollector.collectPass (cognitive 32) packages/@openmaic/storage/src/asset/collector.ts:502— AssetCollector.collectPass has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (23 pts), error handling 4 (6 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 7 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.
agent-bar.TeacherVoicePill (cognitive 31) components/agent/agent-bar.tsx:350— agent-bar.TeacherVoicePill has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (8 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 377, 404, 544, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
SlideNavRail.SlideNavRail (cognitive 31) components/edit/SlideNavRail/SlideNavRail.tsx:50— SlideNavRail.SlideNavRail has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12, boolean chains 9, ternaries 7 (8 pts), error handling 2 (nesting depth added 1). Most of this is not in the body itself: 11 of the 31 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 244, 105, 139, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model-picker.InlineThinkingControl (cognitive 31) components/settings/model-picker.tsx:102— model-picker.InlineThinkingControl has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 18, ternaries 8 (11 pts), if/else 2 (nesting depth added 3). 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, 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.
runner.renderRows (cognitive 31) eval/pbl-v2-planner/runner.ts:601— runner.renderRows has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (23 pts), if/else 1 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm.buildThinkingProviderOptions (cognitive 31) lib/ai/llm.ts:156— llm.buildThinkingProviderOptions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 6 (12 pts), boolean chains 2, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
slide-ops.applyOperationToContent (cognitive 31) lib/edit/slide-ops.ts:152— slide-ops.applyOperationToContent has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 14). None of this is in the body itself: all 31 points belong to 2 function literals inside it that branch (lines 156, 192). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
prepare-manifest.prepareStandaloneActions (cognitive 31) lib/export/standalone-html/prepare-manifest.ts:338— prepare-manifest.prepareStandaloneActions has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (21 pts), if/else 2 (5 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reducer.applyRunEvent (cognitive 31) lib/generation-run-client/reducer.ts:84— reducer.applyRunEvent has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 3 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model-settings-import.runModelSettingsImport (cognitive 31) lib/legacy-browser-import/model-settings-import.ts:221— model-settings-import.runModelSettingsImport has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 5 (7 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 10). 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 into named stages: move each independent 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-orchestrator.retryMediaTask (cognitive 31) lib/media/media-orchestrator.ts:107— media-orchestrator.retryMediaTask has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, ternaries 2 (6 pts), error handling 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.
document-access.decideDocumentAccess (cognitive 31) REDACTED:62— document-access.decideDocumentAccess has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 4 (9 pts), boolean chains 1, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inline-math.liftInlineMath (cognitive 31) lib/sanitize/inline-math.ts:83— inline-math.liftInlineMath has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 2 (7 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply.applyStrReplace (cognitive 31) lib/server/agent-runtime/course-edit/apply.ts:484— apply.applyStrReplace has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 2, boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dsl-tools.textScene (cognitive 31) lib/server/agent-runtime/dsl-tools.ts:335— dsl-tools.textScene has cognitive complexity 31 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 7 (11 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 14). Of this number, 23 points are the body's own statements and 8 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.
scene-preview.buildScenePreviewTools (cognitive 31) lib/server/agent-runtime/scene-preview.ts:140— scene-preview.buildScenePreviewTools has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (15 pts), if/else 12 (14 pts), error handling 2 (nesting depth added 8). Of this number, 28 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
voice-clone-tools.buildVoiceCloneTools (cognitive 31) lib/server/agent-runtime/voice-clone-tools.ts:260— voice-clone-tools.buildVoiceCloneTools has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14, boolean chains 10, ternaries 5, error handling 2. Most of this is not in the body itself: 3 of the 31 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 376, a function literal at line 315, recordRegisteredVoice, …). 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.
environment.recoveredProgress (cognitive 31) lib/server/pbl-v3/environment.ts:161— environment.recoveredProgress has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 13, loops 1 (2 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.
provider-config.loadEnvSection (cognitive 31) lib/server/provider-config.ts:261— provider-config.loadEnvSection has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 9, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 12). Of this number, 30 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.
stage-storage.writeStageChangesForUnload (cognitive 31) lib/utils/stage-storage.ts:584— stage-storage.writeStageChangesForUnload has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElementInteractionLayer.ElementInteractionTarget (cognitive 31) packages/@openmaic/editor/src/react/layers/ElementInteractionLayer.tsx:87— ElementInteractionLayer.ElementInteractionTarget has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 9 (10 pts), boolean chains 8, error handling 1 (nesting depth added 7). Of this number, 22 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.
useEditGesture.useEditGesture.onElementPointerDown (cognitive 31) packages/@openmaic/editor/src/react/useEditGesture.ts:111— useEditGesture.useEditGesture.onElementPointerDown has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18, boolean chains 6, ternaries 4 (6 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 31 points are its own statements and the rest belongs to 8 function items inside it that branch (handleUp, compute, handleMove, …). 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.
scene-generator.fixElementDefaults (cognitive 31) REDACTED:488— scene-generator.fixElementDefaults has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 6 (10 pts), boolean chains 5, error handling 1 (nesting depth added 14). None of this is in the body itself: all 31 points belong to one function literal inside it that branches (line 499). 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.
inlineMath.renderPass (cognitive 31) packages/@openmaic/renderer/src/utils/inlineMath.ts:168— inlineMath.renderPass has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 8, 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.
StaticTable.StaticTable (cognitive 31) packages/@openmaic/renderer/src/elements/table/StaticTable.tsx:19— StaticTable.StaticTable has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13, boolean chains 10, ternaries 7 (8 pts) (nesting depth added 1). None of this is in the body itself: all 31 points belong to 5 function items inside it that branch (getCellBg, a function literal at line 90, getHeaderTextColor, …). 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.
types.applyOpsOnce (cognitive 31) packages/@openmaic/storage/src/skill/types.ts:339— types.applyOpsOnce has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
lecture-notes-view.LectureNotesView (cognitive 30) components/chat/lecture-notes-view.tsx:65— lecture-notes-view.LectureNotesView has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 8 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 204, 157, 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.
ShapeCreateCanvas.ShapeCreateCanvas (cognitive 30) components/slide-renderer/Editor/Canvas/ShapeCreateCanvas.tsx:13— ShapeCreateCanvas.ShapeCreateCanvas has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 7 function items inside it that branch (updateMousePosition, getPoint, a function literal at line 134, …). 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.
build-standalone-html.collectStandaloneMediaBytes (cognitive 30) lib/export/standalone-html/build-standalone-html.ts:198— build-standalone-html.collectStandaloneMediaBytes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5, ternaries 1 (4 pts), loops 2 (nesting depth added 10). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 242, resolveRef, a function literal at line 218). 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.
agents-import.runAgentsImportLocked (cognitive 30) lib/legacy-browser-import/agents-import.ts:252— agents-import.runAgentsImportLocked has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 4 (7 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
alidocmind-client.fetchResult (cognitive 30) lib/pdf/alidocmind-client.ts:217— alidocmind-client.fetchResult has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pdf-providers.aliDocMindLayoutsToParsedPdf (cognitive 30) lib/pdf/pdf-providers.ts:620— pdf-providers.aliDocMindLayoutsToParsedPdf has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 5 (9 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dsl-tools.applyPatchOp (cognitive 30) lib/server/agent-runtime/dsl-tools.ts:758— dsl-tools.applyPatchOp has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (21 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 6). Of this number, 28 points are the body's own statements and 2 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.
outline.extractNewOutlines (cognitive 30) lib/server/generation/steps/outline.ts:151— outline.extractNewOutlines has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), error handling 1 (4 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
execution-watchdog.expireStalledTeachingTurns (cognitive 30) lib/server/pbl-v3/execution-watchdog.ts:60— execution-watchdog.expireStalledTeachingTurns has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (10 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 13). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 97). 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.
resolve-model.resolveRequestedModel (cognitive 30) lib/server/resolve-model.ts:127— resolve-model.resolveRequestedModel has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (11 pts), ternaries 7 (8 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.
AudioPlayer.play (cognitive 30) lib/utils/audio-player.ts:146— AudioPlayer.play has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 5, error handling 2 (3 pts), ternaries 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.
toggleList.toggleList.<returned closure> (cognitive 30) packages/@openmaic/editor/src/react/text/prosemirror/commands/toggleList.ts:19— toggleList.toggleList.<returned closure> has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 12). Of this number, 24 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
shape-text-fallback.shapeToTextFallback (cognitive 30) packages/@openmaic/geometry/src/shape-text-fallback.ts:19— shape-text-fallback.shapeToTextFallback has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 16 (17 pts), boolean chains 11, if/else 2 (nesting depth added 1). Of this number, 24 points are the body's own statements and 6 belong to 3 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.
runTask (cognitive 30) render-service/src/resource-task-runner.mjs:405— runTask has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 3 (10 pts), error handling 4 (9 pts), if/else 6 (9 pts), loops 2 (nesting depth added 15). Of this number, 27 points are the body's own statements and 3 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.verify (cognitive 29) app/api/verify-model/route.ts:25— route.verify has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 2 (5 pts), boolean chains 4, error handling 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
use-chat-sessions.useChatSessions.softPauseSession (cognitive 29) components/chat/use-chat-sessions.ts:1497— use-chat-sessions.useChatSessions.softPauseSession has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 14). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 1521). 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.
chat-session.MessageBubble (cognitive 29) components/chat/chat-session.tsx:46— chat-session.MessageBubble has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 11, if/else 5 (6 pts) (nesting depth added 6). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 122, 66, 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.
css-asset-parser.parseFontSrcEntry (cognitive 29) lib/export/css-asset-parser.ts:150— css-asset-parser.parseFontSrcEntry has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, loops 2 (4 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.
inline-assets.inlineImportmaps (cognitive 29) lib/export/inline-assets.ts:473— inline-assets.inlineImportmaps has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (6 pts), error handling 1 (2 pts), ternaries 1 (2 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.
folders.importFolders (cognitive 29) lib/legacy-browser-import/folders.ts:27— folders.importFolders has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
state-context.summarizeElement (cognitive 29) lib/orchestration/summarizers/state-context.ts:32— state-context.summarizeElement has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (18 pts), boolean chains 10, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project-schema.projectSchema (cognitive 29) lib/pbl/v3/domain/project/project-schema.ts:352— project-schema.projectSchema has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 8, loops 3 (4 pts), ternaries 1 (nesting depth added 10). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
migrate-to-pool.migrateOwnerMaterialsToPool (cognitive 29) lib/server/materials/migrate-to-pool.ts:145— migrate-to-pool.migrateOwnerMaterialsToPool has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 4 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). Of this number, 19 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.
evaluation.evaluationReceipt (cognitive 29) lib/server/pbl-v3/evaluation.ts:228— evaluation.evaluationReceipt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 12, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
quiz-layout.measureQuizQuestionList (cognitive 29) REDACTED:81— quiz-layout.measureQuizQuestionList has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, loops 2, error handling 1, ternaries 1 (nesting depth added 9). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fold.applyWhiteboardRuntimeOperation (cognitive 29) lib/whiteboard/runtime/fold.ts:51— fold.applyWhiteboardRuntimeOperation has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 7). 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 into named stages: move each independent 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.classifyStoreError (cognitive 29) REDACTED:249— document.classifyStoreError has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 2 (5 pts), boolean chains 2, 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.
RenderCoordinator.run (cognitive 29) render-service/src/render-coordinator.ts:338— RenderCoordinator.run has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (16 pts), if/else 7 (9 pts), boolean chains 3, error handling 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tts-providers.generateDoubaoTTS (cognitive 28) lib/audio/tts-providers.ts:1377— tts-providers.generateDoubaoTTS has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, ternaries 3, error handling 1 (2 pts), loops 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.
element-reference.compactInteractiveSourceHtml (cognitive 28) lib/chat/pi/element-reference.ts:302— element-reference.compactInteractiveSourceHtml has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 10 (18 pts), boolean chains 6, ternaries 3 (6 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. This shape REPEATS in the file: one other method here (element-reference.compactInteractiveSourceHtml::containsInlineBase64) 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.
classroom-zip-utils.rewriteAudioRefsToIds (cognitive 28) lib/export/classroom-zip-utils.ts:417— classroom-zip-utils.rewriteAudioRefsToIds has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (21 pts), boolean chains 5, if/else 2 (nesting depth added 12). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 422). 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.
inline-assets-importmap.buildInlinedImportmap (cognitive 28) lib/export/inline-assets-importmap.ts:60— inline-assets-importmap.buildInlinedImportmap has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 4 (5 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 89, visitSpecifier, resolveExternal, …). 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.
sources.readLegacyCourse (cognitive 28) lib/legacy-browser-import/sources.ts:178— sources.readLegacyCourse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 4 (5 pts), error handling 3 (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.
course.settleDocument (cognitive 28) lib/legacy-browser-import/course.ts:171— course.settleDocument has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
instructor.runSetupFollowup (cognitive 28) lib/pbl/v2/agents/instructor.ts:1760— instructor.runSetupFollowup has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 3 (6 pts), boolean chains 4, match/switch 1 (2 pts), error handling 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.
conversation.markRecoveredTeachingTools (cognitive 28) lib/pbl/v3/conversation.ts:160— conversation.markRecoveredTeachingTools has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 14). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills.skillReadsInTranscript (cognitive 28) lib/server/agent-runtime/skills.ts:488— skills.skillReadsInTranscript has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (4 pts), ternaries 1 (4 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.
material-library-tools.buildMaterialLibraryTools (cognitive 28) lib/server/agent-runtime/material-library-tools.ts:107— material-library-tools.buildMaterialLibraryTools has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 7 (10 pts), match/switch 3, error handling 1 (nesting depth added 8). None of this is in the body itself: all 28 points belong to 6 function items inside it that branch (a function literal at line 264, a function literal at line 174, a function literal at line 218, …). 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.
skill-preload.buildSkillPreload (cognitive 28) lib/server/agent-runtime/skill-preload.ts:224— skill-preload.buildSkillPreload has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), boolean chains 4, loops 3, error handling 1 (2 pts) (nesting depth added 8). Of this number, 26 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.
runner.slimEventDataForLog (cognitive 28) lib/server/agent-runtime/runner.ts:217— runner.slimEventDataForLog has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, error handling 1 (4 pts), ternaries 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
outline.prepareOutline (cognitive 28) lib/server/generation/steps/outline.ts:378— outline.prepareOutline has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 10, if/else 5 (6 pts) (nesting depth added 7). Of this number, 22 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.
environment.touchEnvironment (cognitive 28) lib/server/pbl-v3/environment.ts:92— environment.touchEnvironment has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (22 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.
App.App (cognitive 28) lib/standalone-player/App.tsx:125— App.App has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 10, if/else 6, error handling 1 (nesting depth added 1). Of this number, 17 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
copyStage (cognitive 28) render-service/src/resource-stage-copy.mjs:30— copyStage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, error handling 2 (4 pts), loops 2 (3 pts), other 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.
route.POST (cognitive 27) app/api/pbl/v3/packages/route.ts:14— route.POST has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 9). None of this is in the body itself: all 27 points belong to 3 function literals inside it that branch (lines 15, 78, 62). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
outlines-editor.SceneRow (cognitive 27) components/generation/outlines-editor.tsx:454— outlines-editor.SceneRow has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 19, if/else 8. Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 551, handleKeyPointKeyDown, addKeyPoint, …). 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.
step-visualizers.ScrollingSources (cognitive 27) components/generation/step-visualizers.tsx:224— step-visualizers.ScrollingSources has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 8 (9 pts), boolean chains 5 (nesting depth added 6). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 259, 311, 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.
useMouseSelection.useMouseSelection.updateMouseSelection::handleMouseUp (cognitive 27) components/slide-renderer/Editor/Canvas/hooks/useMouseSelection.ts:84— useMouseSelection.useMouseSelection.updateMouseSelection::handleMouseUp has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 9, 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.
WorkspaceRequestActivity.RequestPreview (cognitive 27) components/workbench/workspace/WorkspaceRequestActivity.tsx:303— WorkspaceRequestActivity.RequestPreview has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 16 (19 pts), boolean chains 8 (nesting depth added 3). Of this number, 25 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.
use-tts-preview.useTTSPreview.startPreview (cognitive 27) lib/audio/use-tts-preview.ts:74— use-tts-preview.useTTSPreview.startPreview has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
element-reference.buildInteractiveComponentContentHint (cognitive 27) lib/chat/pi/element-reference.ts:1331— element-reference.buildInteractiveComponentContentHint has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 9, ternaries 3 (5 pts), loops 2 (3 pts) (nesting depth added 5). Of this number, 26 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prepare-manifest.prepareElement (cognitive 27) lib/export/standalone-html/prepare-manifest.ts:209— prepare-manifest.prepareElement has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (6 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 11). Of this number, 20 points are the body's own statements and 7 belong 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.
use-import-classroom.materializeImportedMedia (cognitive 27) lib/import/use-import-classroom.ts:253— use-import-classroom.materializeImportedMedia has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), ternaries 3 (6 pts), loops 3 (4 pts) (nesting depth added 8). Of this number, 23 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.
eval-prompts.formatProjectSynthesisChecks (cognitive 27) lib/pbl/v2/operations/runtime/eval-prompts.ts:352— eval-prompts.formatProjectSynthesisChecks has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (13 pts), boolean chains 10, if/else 2 (3 pts), loops 1 (nesting depth added 8). Of this number, 23 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.
edit-access.projectEditAccess (cognitive 27) lib/pbl/v3/edit-access.ts:26— edit-access.projectEditAccess has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (11 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.
media-byte-omission.percentDecodedUtf8Length (cognitive 27) lib/server/agent-runtime/course-edit/media-byte-omission.ts:86— media-byte-omission.percentDecodedUtf8Length has cognitive complexity 27 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 8, 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. This shape REPEATS in the file: one other method here (media-byte-omission.percentDecodedUtf8Length::feedPercentByte) 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.
tools.buildCourseAudioAndDeckTools (cognitive 27) lib/server/agent-runtime/course-edit/tools.ts:106— tools.buildCourseAudioAndDeckTools has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 5 (8 pts), boolean chains 6 (nesting depth added 5). Of this number, 19 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
extract.runSourceExtraction (cognitive 27) lib/server/material-extraction/extract.ts:251— extract.runSourceExtraction has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 4 (9 pts), error handling 2 (4 pts), loops 2 (3 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.
Slide.spHasVisibleFillOrLine (cognitive 27) packages/@openmaic/importer/src/model/Slide.ts:365— Slide.spHasVisibleFillOrLine has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Slide.parseChildNode (cognitive 27) packages/@openmaic/importer/src/model/Slide.ts:394— Slide.parseChildNode has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
groupSerializer.scaleSvgPath (cognitive 27) packages/@openmaic/importer/src/serializer/groupSerializer.ts:80— groupSerializer.scaleSvgPath has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 3, 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.
slideSerializer.getNoteForSlide (cognitive 27) packages/@openmaic/importer/src/serializer/slideSerializer.ts:125— slideSerializer.getNoteForSlide has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (10 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.
HttpAssetStore.resolveFresh (cognitive 27) packages/@openmaic/storage/src/asset/http.ts:686— HttpAssetStore.resolveFresh has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElementRefPinLayer.ElementRefPinLayer (cognitive 26) components/edit/surfaces/slide/ElementRefPinLayer.tsx:31— ElementRefPinLayer.ElementRefPinLayer has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 6 (9 pts), boolean chains 4, loops 2 (nesting depth added 7). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 75, 84, 126, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace.PBLV2Workspace (cognitive 26) components/scene-renderers/pbl/v2/workspace.tsx:107— workspace.PBLV2Workspace has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13, boolean chains 6, ternaries 4 (5 pts), error handling 2 (nesting depth added 1). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 229, 144, 190, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
workspace-layer.PBLWorkspaceLayer (cognitive 26) components/scene-renderers/pbl/workspace-layer.tsx:49— workspace-layer.PBLWorkspaceLayer has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 7, if/else 6 (nesting depth added 2). Of this number, 17 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.
quiz-view.QuizView (cognitive 26) REDACTED:693— quiz-view.QuizView has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 7, error handling 1, loops 1, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 795, 749, 840, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RendererScreenCanvas.PlaybackVideoContent (cognitive 26) components/slide-renderer/Editor/RendererScreenCanvas.tsx:21— RendererScreenCanvas.PlaybackVideoContent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, ternaries 3 (6 pts) (nesting depth added 7). Of this number, 14 points are the body's own statements and 12 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.
request-device.identifyRequestDevice (cognitive 26) lib/adaptive/request-device.ts:10— request-device.identifyRequestDevice has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (24 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
use-export-html.useExportHtml.exportStandaloneHtml (cognitive 26) lib/export/use-export-html.ts:69— use-export-html.useExportHtml.exportStandaloneHtml has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 6 (7 pts), boolean chains 1, 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.
advance-patch.applyAdvanceProjectPatch (cognitive 26) lib/pbl/v2/operations/runtime/advance-patch.ts:72— advance-patch.applyAdvanceProjectPatch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (5 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
instructor.buildRoadmapBlock (cognitive 26) lib/pbl/v2/agents/instructor.ts:376— instructor.buildRoadmapBlock has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (9 pts), loops 2 (3 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.
grapheme.splitGraphemeText (cognitive 26) lib/rag/chunking/grapheme.ts:22— grapheme.splitGraphemeText has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts), boolean chains 2, 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.
apply.applyPointer (cognitive 26) lib/server/agent-runtime/course-edit/apply.ts:219— apply.applyPointer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
document-image-apply.applyImagePlan (cognitive 26) lib/server/material-extraction/document-image-apply.mjs:6— document-image-apply.applyImagePlan has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 5 (10 pts), loops 4, boolean chains 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
document-images.resolveDerivativeRefsAsync (cognitive 26) lib/server/material-extraction/document-images.ts:305— document-images.resolveDerivativeRefsAsync has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (6 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model-routes.parseUserStageRoutes (cognitive 26) lib/server/model-routes.ts:233— model-routes.parseUserStageRoutes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat-storage-core.planChatSync (cognitive 26) lib/utils/chat-storage-core.ts:504— chat-storage-core.planChatSync has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 10, ternaries 8 (9 pts), if/else 6 (7 pts) (nesting depth added 2). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
chat-storage.syncSessions (cognitive 26) lib/utils/chat-storage.ts:851— chat-storage.syncSessions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (9 pts), boolean chains 7, loops 1 (nesting depth added 9). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 900, 883). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
builtin-extraction.readWithTruncation (cognitive 26) lib/web-fetch/builtin-extraction.ts:141— builtin-extraction.readWithTruncation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 12). 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.
markdown-math.isLikelySingleDollarMath (cognitive 26) lib/workbench/markdown-math.ts:31— markdown-math.isLikelySingleDollarMath has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15, boolean chains 11. 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.
scene-generator.findQuizOptionsContractFailure (cognitive 26) REDACTED:989— scene-generator.findQuizOptionsContractFailure has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (5 pts), boolean chains 4, 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.
tableUtils.getHiddenCells (cognitive 26) packages/@openmaic/renderer/src/elements/table/tableUtils.ts:28— tableUtils.getHiddenCells has cognitive complexity 26 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 2 (9 pts), boolean chains 2 (nesting depth added 17). 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.
BaseCodeElement.CodeLineRow (cognitive 25) REDACTED:205— BaseCodeElement.CodeLineRow has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13, boolean chains 11, ternaries 1. Of this number, 13 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, split the body: 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.
stage-api-whiteboard.createWhiteboardAPI (cognitive 25) lib/api/stage-api-whiteboard.ts:19— stage-api-whiteboard.createWhiteboardAPI has cognitive complexity 25 (threshold 15). Drivers by points: error handling 10, if/else 7, ternaries 6, boolean chains 2. Of this number, 20 points are the body's own statements and 5 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.
load-classroom.hydrateDeferredMediaTasks (cognitive 25) lib/classroom/load-classroom.ts:537— load-classroom.hydrateDeferredMediaTasks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 4 (8 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 555, 546). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
model-settings.normalizeLegacyModelSettings (cognitive 25) lib/legacy-browser-import/model-settings.ts:187— model-settings.normalizeLegacyModelSettings has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, ternaries 3 (5 pts), loops 2 (nesting depth added 5). Of this number, 20 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.
edit.providerChange (cognitive 25) lib/model-settings/edit.ts:360— edit.providerChange has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, ternaries 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.
transition.completeCurrentStage (cognitive 25) lib/pbl/v3/domain/orchestration/transition.ts:534— transition.completeCurrentStage has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 12, ternaries 1. Of this number, 24 points are the body's own statements and 1 belongs 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.
document-access.parseDocumentAction (cognitive 25) REDACTED:31— document-access.parseDocumentAction has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, ternaries 2 (4 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.
agent-profiles.generateAgentProfiles (cognitive 25) lib/server/generation/steps/agent-profiles.ts:143— agent-profiles.generateAgentProfiles has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 5, if/else 2, error handling 1 (nesting depth added 4). Of this number, 19 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.
provider-config.ttsModelFor (cognitive 25) lib/server/provider-config.ts:831— provider-config.ttsModelFor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4, 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.
builtin-extraction.extractPdfToMarkdown (cognitive 25) lib/web-fetch/builtin-extraction.ts:267— builtin-extraction.extractPdfToMarkdown has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 3 (7 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VideoToolbarOverlay.VideoToolbarOverlay (cognitive 25) packages/@openmaic/editor/src/ui/video/VideoToolbarOverlay.tsx:28— VideoToolbarOverlay.VideoToolbarOverlay has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 6, if/else 6 (nesting depth added 1). Of this number, 14 points are the body's own statements and 11 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.
scene-generator.resolveImageIds (cognitive 25) REDACTED:360— scene-generator.resolveImageIds has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4 (nesting depth added 11). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 367). 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.
ShapeNode.parseShapeNode (cognitive 25) packages/@openmaic/importer/src/model/nodes/ShapeNode.ts:247— ShapeNode.parseShapeNode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 4 (8 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.
backgroundSerializer.renderBgPr (cognitive 25) packages/@openmaic/importer/src/serializer/backgroundSerializer.ts:70— backgroundSerializer.renderBgPr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (23 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.
route.GET (cognitive 24) app/api/materials/library/route.ts:38— route.GET has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 7, if/else 3 (nesting depth added 1). Of this number, 12 points are the body's own statements and 12 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.
route.POST (cognitive 24) app/api/parse-pdf/route.ts:27— route.POST has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 6 (7 pts), boolean chains 4, 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.
use-chat-sessions.useChatSessions.createBufferForSession (cognitive 24) components/chat/use-chat-sessions.ts:906— use-chat-sessions.useChatSessions.createBufferForSession has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, boolean chains 4, ternaries 4, error handling 1. Of this number, 14 points are the body's own statements and 10 belong to 7 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.
presentation-speech-overlay.PresentationBubbleCard (cognitive 24) components/roundtable/presentation-speech-overlay.tsx:191— presentation-speech-overlay.PresentationBubbleCard has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (18 pts), boolean chains 6 (nesting depth added 7). Of this number, 19 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.
index.Operate (cognitive 24) components/slide-renderer/Editor/Canvas/Operate/index.tsx:56— index.Operate has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), ternaries 3, loops 2 (nesting depth added 2). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 79, 126, 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.
SlideThumbnail.renderThumbnailVideo (cognitive 24) components/slide-renderer/SlideThumbnail.tsx:50— SlideThumbnail.renderThumbnailVideo has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (21 pts), boolean chains 3 (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.
adopt-cached-narration.derivedNarrationRefs (cognitive 24) lib/audio/adopt-cached-narration.ts:111— adopt-cached-narration.derivedNarrationRefs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
css-asset-parser.cssImportReference (cognitive 24) lib/export/css-asset-parser.ts:175— css-asset-parser.cssImportReference has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 6 (nesting depth added 7). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inline-assets.inlineCssUrls (cognitive 24) lib/export/inline-assets.ts:347— inline-assets.inlineCssUrls has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 11). 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.
runtime.copySession (cognitive 24) lib/legacy-browser-import/runtime.ts:74— runtime.copySession has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 10). 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.
comfyui-image-adapter.loadWorkflow (cognitive 24) lib/media/adapters/comfyui-image-adapter.ts:110— comfyui-image-adapter.loadWorkflow has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (24 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.
resolve-stored-bytes.resolveStoredBytes (cognitive 24) lib/media/resolve-stored-bytes.ts:94— resolve-stored-bytes.resolveStoredBytes has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 9 (12 pts), if/else 5 (8 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.commitLegacyQuizSnapshot (cognitive 24) lib/quiz/runtime.ts:324— runtime.commitLegacyQuizSnapshot has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (6 pts), ternaries 3 (6 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
apply.applySlideEdit (cognitive 24) lib/server/agent-runtime/course-edit/apply.ts:711— apply.applySlideEdit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
dsl-tools.applyStrReplaceOp (cognitive 24) lib/server/agent-runtime/dsl-tools.ts:687— dsl-tools.applyStrReplaceOp has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 2, ternaries 1 (nesting depth added 8). 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.
entry-tree-storage.loadSessionEntryHistory (cognitive 24) lib/server/agent-runtime/entry-tree-storage.ts:96— entry-tree-storage.loadSessionEntryHistory has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (8 pts), ternaries 3 (5 pts), error handling 1, loops 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 10 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.
vision-images.prepareVisionImages (cognitive 24) lib/server/generation/vision-images.ts:24— vision-images.prepareVisionImages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (5 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.
ssrf-guard.validateUrlForSSRFWithPolicy (cognitive 24) lib/server/ssrf-guard.ts:485— ssrf-guard.validateUrlForSSRFWithPolicy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), error handling 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
element-refs.useElementRefsStoreBase (cognitive 24) lib/store/element-refs.ts:58— element-refs.useElementRefsStoreBase has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, ternaries 7, loops 1 (nesting depth added 2). None of this is in the body itself: all 24 points belong to 9 function literals inside it that branch (lines 92, 140, 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.
store.createWhiteboardRuntimeService (cognitive 24) lib/whiteboard/runtime/store.ts:172— store.createWhiteboardRuntimeService has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, error handling 3 (4 pts), ternaries 2 (nesting depth added 4). 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 205, append, a function literal at line 295, …). 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.
AudioToolbarOverlay.AudioToolbarOverlay (cognitive 24) packages/@openmaic/editor/src/ui/audio/AudioToolbarOverlay.tsx:27— AudioToolbarOverlay.AudioToolbarOverlay has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 5, if/else 5, error handling 1 (nesting depth added 1). Of this number, 13 points are the body's own statements and 11 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.
CanvasContextMenu.CanvasContextMenu (cognitive 24) packages/@openmaic/editor/src/ui/context/CanvasContextMenu.tsx:153— CanvasContextMenu.CanvasContextMenu has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 5, boolean chains 3 (nesting depth added 9). Of this number, 17 points are the body's own statements and 7 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.
interactive-post-processor.postProcessInteractiveHtml (cognitive 24) packages/@openmaic/generation/src/interactive-post-processor.ts:30— interactive-post-processor.postProcessInteractiveHtml has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, loops 2 (3 pts), 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.
scene-generator.processActions (cognitive 24) REDACTED:1984— scene-generator.processActions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 8, ternaries 1 (3 pts) (nesting depth added 8). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 1995). 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.
presets.presetShapes.set("wedgeRectCallout") (cognitive 24) packages/@openmaic/importer/src/shapes/presets.ts:2683— presets.presetShapes.set("wedgeRectCallout") has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 16 (24 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (presets.presetShapes.set("wedgeRoundRectCallout")) 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.
presets.presetShapes.set("wedgeRoundRectCallout") (cognitive 24) packages/@openmaic/importer/src/shapes/presets.ts:2730— presets.presetShapes.set("wedgeRoundRectCallout") has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 16 (24 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (presets.presetShapes.set("wedgeRectCallout")) 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.
tableSerializer.applyStyleBorders (cognitive 24) packages/@openmaic/importer/src/serializer/tableSerializer.ts:320— tableSerializer.applyStyleBorders has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (23 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.
BaseCodeElement.CodeLineRow (cognitive 24) REDACTED:202— BaseCodeElement.CodeLineRow has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12, boolean chains 11, ternaries 1. Of this number, 13 points are the body's own statements and 11 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.
asset.readWrite (cognitive 24) packages/@openmaic/storage/src/server/asset.ts:322— asset.readWrite has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, ternaries 3, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.createStorageHttpHandler (cognitive 24) REDACTED:779— index.createStorageHttpHandler has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 13 (24 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.
chunk-executor.renderOne (cognitive 24) render-service/src/chunk-executor.ts:742— chunk-executor.renderOne has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), ternaries 3 (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.
resource-task-runner.drain (cognitive 24) render-service/src/resource-task-runner.mjs:188— resource-task-runner.drain has cognitive complexity 24 (threshold 15). Drivers by points: error handling 2 (8 pts), if/else 4 (7 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.
canvas-area.CanvasArea (cognitive 23) components/canvas/canvas-area.tsx:39— canvas-area.CanvasArea has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 17, if/else 2 (3 pts), ternaries 2, loops 1 (nesting depth added 1). Of this number, 17 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
usage-dashboard.UsageDashboard (cognitive 23) components/settings/usage-dashboard.tsx:53— usage-dashboard.UsageDashboard has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 11, if/else 5 (7 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 3 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 106, a function literal at line 87, 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.
station-node.SlotLine (cognitive 23) components/settings/models/station-node.tsx:81— station-node.SlotLine has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 17, ternaries 5, if/else 1. Of this number, 21 points are the body's own statements and 2 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.
classroom-complete.ClassroomCompletePage (cognitive 23) components/scene-renderers/classroom-complete.tsx:325— classroom-complete.ClassroomCompletePage has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 11, boolean chains 8, error handling 2, if/else 2. Of this number, 18 points are the body's own statements and 5 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.
use-resolved-slide.resolveSlideMediaState (cognitive 23) components/slide-renderer/use-resolved-slide.ts:53— use-resolved-slide.resolveSlideMediaState has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 7, boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 95). 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.
BaseImageElement.BaseImageElement (cognitive 23) components/slide-renderer/components/element/ImageElement/BaseImageElement.tsx:25— BaseImageElement.BaseImageElement has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (20 pts), boolean chains 3 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
scene-thumbnail-content.SceneThumbnailContent (cognitive 23) components/stage/scene-thumbnail-content.tsx:39— scene-thumbnail-content.SceneThumbnailContent has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 5 (6 pts), boolean chains 1 (nesting depth added 10). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 142, 64). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
geometry-checks.isPentagon (cognitive 23) eval/whiteboard-shapes/geometry-checks.ts:194— geometry-checks.isPentagon has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (7 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 11). Of this number, 16 points are the body's own statements and 7 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.
runner.main (cognitive 23) eval/whiteboard-shapes/runner.ts:213— runner.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (6 pts), ternaries 2 (5 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.
qwen-voice-clone-registration.registerVoice (cognitive 23) lib/audio/qwen-voice-clone-registration.ts:68— qwen-voice-clone-registration.registerVoice has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 2, loops 1 (nesting depth added 8). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 115, a function literal at line 105, release). 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.
build-standalone-html.buildStandaloneHtmlExport (cognitive 23) lib/export/standalone-html/build-standalone-html.ts:633— build-standalone-html.buildStandaloneHtmlExport has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 7, boolean chains 4, loops 1 (2 pts) (nesting depth added 4). Of this number, 22 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
minimax-video-adapter.generateWithMiniMaxVideo (cognitive 23) lib/media/adapters/minimax-video-adapter.ts:254— minimax-video-adapter.generateWithMiniMaxVideo has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 8, ternaries 1 (3 pts) (nesting depth added 7). None of this is in the body itself: all 23 points belong to one function literal inside it that branches (line 264). 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.
media-orchestrator.generateSingleMedia (cognitive 23) lib/media/media-orchestrator.ts:606— media-orchestrator.generateSingleMedia has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 4 (5 pts), boolean chains 4, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.createModelSettingsClient.apply (cognitive 23) lib/model-settings/client.ts:182— client.createModelSettingsClient.apply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 6 (9 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 5). Of this number, 20 points are the body's own statements and 3 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.
fold.foldPBLRuntime (cognitive 23) lib/pbl/v2/runtime/fold.ts:323— fold.foldPBLRuntime has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetch-with-redirect-validation.fetchWithRedirectValidation (cognitive 23) lib/server/fetch-with-redirect-validation.ts:180— fetch-with-redirect-validation.fetchWithRedirectValidation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, error handling 1 (2 pts), 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.
sse.polledEventStream (cognitive 23) lib/server/generation/run/sse.ts:80— sse.polledEventStream has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, boolean chains 4, error handling 3. Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 8 function items inside it that branch (write, read, clear, …). 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.
resolve.assertPrincipal (cognitive 23) lib/server/identity/resolve.ts:48— resolve.assertPrincipal has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (21 pts), boolean chains 1, if/else 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.
resolve-slot.resolveTarget (cognitive 23) lib/server/model-config/resolve-slot.ts:181— resolve-slot.resolveTarget has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 6, boolean chains 5, 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.
review-question.reviewReceipt (cognitive 23) lib/server/pbl-v3/review-question.ts:36— review-question.reviewReceipt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, error handling 1 (2 pts), ternaries 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.
FetchEventSource.connect (cognitive 23) lib/utils/fetch-event-source.ts:224— FetchEventSource.connect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2, error handling 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.
progress.normalizeProjectRuntime (cognitive 23) packages/@openmaic/generation/src/pbl/operations/kernel/progress.ts:75— progress.normalizeProjectRuntime has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8 (nesting depth added 5). 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.
scene-generator.normalizeGeneratedVideoRefs (cognitive 23) REDACTED:420— scene-generator.normalizeGeneratedVideoRefs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8, ternaries 3 (nesting depth added 3). 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 433). 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.
mathSerializer.mathToElement (cognitive 23) packages/@openmaic/importer/src/serializer/mathSerializer.ts:470— mathSerializer.mathToElement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (7 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.
slideSerializer.slideToSlide (cognitive 23) packages/@openmaic/importer/src/serializer/slideSerializer.ts:193— slideSerializer.slideToSlide has cognitive complexity 23 (threshold 15). Drivers by points: error handling 3 (8 pts), loops 4 (7 pts), if/else 3 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-package-version-bumps.comparePrerelease (cognitive 23) scripts/check-package-version-bumps.mjs:136— check-package-version-bumps.comparePrerelease has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
probe-mineru-cloud.probe (cognitive 23) scripts/probe-mineru-cloud.mjs:44— probe-mineru-cloud.probe has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (5 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inspectMainPid (cognitive 23) render-service/src/resource-systemd-runner.mjs:144— inspectMainPid has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7, ternaries 4 (6 pts), boolean chains 4, other 4, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
waitForStarted (cognitive 23) render-service/src/resource-systemd-runner.mjs:276— waitForStarted has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), other 7, boolean chains 2, 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.
imagePlan::visit (cognitive 23) lib/server/material-extraction/document-image-plan.mjs:200— imagePlan::visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (7 pts), boolean chains 2, loops 1 (2 pts), other 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.
folder-dialogs.NewFolderDialog::submit (cognitive 22) components/discovery/folder-dialogs.tsx:52— folder-dialogs.NewFolderDialog::submit has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 6 (7 pts), error handling 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.
FloatingInsertToolbar.FloatingInsertToolbar (cognitive 22) components/edit/EditShell/FloatingInsertToolbar.tsx:66— FloatingInsertToolbar.FloatingInsertToolbar has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 5, if/else 5 (nesting depth added 2). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (handleDragKeyDown, moveWithinBounds). 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.
model-edit-dialog.ModelEditDialog (cognitive 22) components/settings/model-edit-dialog.tsx:29— model-edit-dialog.ModelEditDialog has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 5, ternaries 3, error handling 1. Of this number, 14 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.
use-instructor-stream.runOneStream (cognitive 22) components/scene-renderers/pbl/v2/use-instructor-stream.ts:287— use-instructor-stream.runOneStream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), boolean chains 1, 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.
submission.PBLV2SubmissionPanel::runImmediateTaskEval::runStream (cognitive 22) components/scene-renderers/pbl/v2/submission.tsx:441— submission.PBLV2SubmissionPanel::runImmediateTaskEval::runStream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), error handling 1, 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.
quiz-view.MultipleChoiceQuestion (cognitive 22) REDACTED:316— quiz-view.MultipleChoiceQuestion has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 18, if/else 3, ternaries 1. Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 353, toggle). 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.
WorkspaceRail.InlineNewFolderRow::submit (cognitive 22) components/workbench/workspace/WorkspaceRail.tsx:1588— WorkspaceRail.InlineNewFolderRow::submit has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 6 (7 pts), error handling 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.
compare-html.collectRunData (cognitive 22) eval/pbl-v2-planner/compare-html.ts:40— compare-html.collectRunData has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tts-providers.generateQwenTTS (cognitive 22) lib/audio/tts-providers.ts:957— tts-providers.generateQwenTTS has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (6 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 8). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prepare-manifest.stripMediaPayloads (cognitive 22) lib/export/standalone-html/prepare-manifest.ts:421— prepare-manifest.stripMediaPayloads has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 4, loops 1, 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.
resolve-media-ref.resolveMediaRef (cognitive 22) lib/media/resolve-media-ref.ts:43— resolve-media-ref.resolveMediaRef has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 6 (9 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.
mineru-cloud.parseWithMinerUCloud (cognitive 22) lib/pdf/mineru-cloud.ts:491— mineru-cloud.parseWithMinerUCloud has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (6 pts), boolean chains 4, 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.
personal-history-tools.buildPersonalHistoryTools (cognitive 22) lib/server/agent-runtime/personal-history-tools.ts:403— personal-history-tools.buildPersonalHistoryTools has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10, boolean chains 7, error handling 4, ternaries 1. Of this number, 15 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.
resume.planResume (cognitive 22) lib/server/agent-runtime/resume.ts:93— resume.planResume has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 5). 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.
runner.planRunStart (cognitive 22) lib/server/agent-runtime/runner.ts:867— runner.planRunStart has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (6 pts), 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.
narration.synthesizeNarration (cognitive 22) lib/server/generation/steps/narration.ts:59— narration.synthesizeNarration has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 7 (8 pts), if/else 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
owner-extraction.runClaimedOwnerExtraction (cognitive 22) lib/server/material-extraction/owner-extraction.ts:310— owner-extraction.runClaimedOwnerExtraction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 6 (9 pts), error handling 2, boolean chains 1, loops 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
runtime.queueRole (cognitive 22) lib/server/pbl-v3/runtime.ts:285— runtime.queueRole has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (9 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runner-tools.withTeachingTurnBoundary.<returned closure> (cognitive 22) lib/server/pbl-v3/runner-tools.ts:1030— runner-tools.withTeachingTurnBoundary.<returned closure> has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 3 (7 pts), boolean chains 3 (nesting depth added 11). Of this number, 19 points are the body's own statements and 3 belong to 2 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.
validate.normalizeAndValidateLegacyWhiteboard (cognitive 22) lib/whiteboard/runtime/validate.ts:379— validate.normalizeAndValidateLegacyWhiteboard has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 5). 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.
RendererTextEditor.RendererTextEditor (cognitive 22) packages/@openmaic/editor/src/react/text/RendererTextEditor.tsx:31— RendererTextEditor.RendererTextEditor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 2). None of this is in the body itself: all 22 points belong to 6 function literals inside it that branch (lines 87, 103, 207, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
eqFieldParser.parseDocxMathContent (cognitive 22) packages/@openmaic/importer/src/utils/eqFieldParser.ts:355— eqFieldParser.parseDocxMathContent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (21 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.
shapeSerializer.resolveShapeShadow (cognitive 22) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:653— shapeSerializer.resolveShapeShadow has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 4 (5 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.
toPptxtojson.collectOmml (cognitive 22) packages/@openmaic/importer/src/adapter/toPptxtojson.ts:36— toPptxtojson.collectOmml has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (8 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.
index.slideToPng (cognitive 22) packages/@openmaic/renderer/src/snapshot/index.ts:93— index.slideToPng has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 7 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.
chunk-executor.createRenderPlan (cognitive 22) render-service/src/chunk-executor.ts:561— chunk-executor.createRenderPlan has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 6, boolean chains 4, error handling 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
preview-validation.findNonSelfContainedInteractiveReferences::visit (cognitive 22) render-service/src/preview-validation.ts:142— preview-validation.findNonSelfContainedInteractiveReferences::visit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 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: one other method here (preview-validation.findNonSelfContainedInteractiveReferences) 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.
route.GET (cognitive 21) app/api/pbl/v3/route.ts:27— route.GET has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 28). 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.
prompt-input.PromptInputTextarea (cognitive 21) components/ai-elements/prompt-input.tsx:772— prompt-input.PromptInputTextarea has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function items inside it that branch (handleKeyDown, handlePaste). 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.
video-export-dialog.VideoExportDialog (cognitive 21) components/stage/video-export-dialog.tsx:96— video-export-dialog.VideoExportDialog has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (8 pts), ternaries 2 (nesting depth added 1). Of this number, 15 points are the body's own statements and 6 belong to 6 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.
sidebar.PBLV2Sidebar (cognitive 21) components/scene-renderers/pbl/v2/sidebar.tsx:66— sidebar.PBLV2Sidebar has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, loops 2, ternaries 2 (nesting depth added 2). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 162, 111, 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.
use-instructor-stream.useInstructorStream.run (cognitive 21) components/scene-renderers/pbl/v2/use-instructor-stream.ts:126— use-instructor-stream.useInstructorStream.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chat.StreamingDraft (cognitive 21) components/scene-renderers/pbl/v2/chat.tsx:807— chat.StreamingDraft has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 6, if/else 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.
conversation.AgentTurn (cognitive 21) components/scene-renderers/pbl/v3/conversation.tsx:54— conversation.AgentTurn has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, ternaries 6 (9 pts), if/else 1 (nesting depth added 3). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 94, 67, 70, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.Whiteboard (cognitive 21) components/whiteboard/index.tsx:36— index.Whiteboard has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 7, ternaries 1. Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 3 function items inside it that branch (handleClear, a function literal at line 67, a function literal at line 83). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
answer-content-runner.writeReport (cognitive 21) eval/orchestration/answer-content-runner.ts:322— answer-content-runner.writeReport has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActionEngine.executeWbEditCode (cognitive 21) lib/action/engine.ts:753— ActionEngine.executeWbEditCode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply-regenerate.planRegenerateApply (cognitive 21) lib/agent/client/apply-regenerate.ts:93— apply-regenerate.planRegenerateApply has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tool-timeout.executeWithToolBound (cognitive 21) lib/agent/runtime/tool-timeout.ts:155— tool-timeout.executeWithToolBound has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 8 function items inside it that branch (cleanup, onTimeout, a function literal at line 258, …). 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.
tts-providers.extractGoogleInteractionsAudio (cognitive 21) lib/audio/tts-providers.ts:1274— tts-providers.extractGoogleInteractionsAudio has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (3 pts), ternaries 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.
wav-validate.validateReferenceAudio (cognitive 21) lib/audio/wav-validate.ts:29— wav-validate.validateReferenceAudio has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, 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.
call-agent.executeParsedAction (cognitive 21) lib/chat/pi/tools/call-agent.ts:413— call-agent.executeParsedAction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 5). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bundle.allocateDocumentTextBudgets (cognitive 21) lib/document/bundle.ts:72— bundle.allocateDocumentTextBudgets has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media-registry.selectMediaExtractorProvider (cognitive 21) lib/document/extractors/media-registry.ts:26— media-registry.selectMediaExtractorProvider has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, ternaries 2, loops 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inline-assets.createAssetFetcher.fetchAsset (cognitive 21) lib/export/inline-assets.ts:148— inline-assets.createAssetFetcher.fetchAsset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 10). 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 151). 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.
report-share-text.wrapShareText (cognitive 21) lib/pbl/v3/report-share-text.ts:6— report-share-text.wrapShareText has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (4 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.
generate-video.runVideoGenerationJob (cognitive 21) lib/server/agent-runtime/generate-video.ts:605— generate-video.runVideoGenerationJob has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 5 (7 pts), error handling 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.
roster-tools.agentVoiceCatalog (cognitive 21) lib/server/agent-runtime/roster-tools.ts:100— roster-tools.agentVoiceCatalog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, ternaries 2 (3 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.
store.claimNextGenerationRun (cognitive 21) lib/server/generation/run/store.ts:814— store.claimNextGenerationRun has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (7 pts), boolean chains 3, loops 1 (nesting depth added 8). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 832). 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.
services.resolveExtractionServices (cognitive 21) lib/server/material-extraction/services.ts:72— services.resolveExtractionServices has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 2 (nesting depth added 9). 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, split the body into named stages: move each independent 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-images.keptImages (cognitive 21) lib/server/material-extraction/document-images.ts:105— document-images.keptImages has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 3 (6 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 9). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent 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-images.imagePathIndex (cognitive 21) lib/server/material-extraction/document-images.ts:163— document-images.imagePathIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
owner-extraction.runNextOwnerExtraction (cognitive 21) lib/server/material-extraction/owner-extraction.ts:583— owner-extraction.runNextOwnerExtraction has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (14 pts), if/else 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 10). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inline-images.inlineRemoteImages.worker (cognitive 21) lib/server/materials/inline-images.ts:231— inline-images.inlineRemoteImages.worker has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model-routes.parseThinking (cognitive 21) lib/server/model-routes.ts:71— model-routes.parseThinking has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 2, ternaries 1 (nesting depth added 3). Of this number, 18 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
teaching-prompt.teachingLiveContext (cognitive 21) lib/server/pbl-v3/teaching-prompt.ts:343— teaching-prompt.teachingLiveContext has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 9 (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.
thinking-timing.createThinkingTimingTracker.<returned closure> (cognitive 21) lib/server/pbl-v3/thinking-timing.ts:9— thinking-timing.createThinkingTimingTracker.<returned closure> has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (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.
OwnerSessionClient.runFullFetch (cognitive 21) lib/workbench/owner-session-client.ts:358— OwnerSessionClient.runFullFetch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, loops 2 (nesting depth added 3). None of this is in the body itself: all 21 points belong to 4 function literals inside it that branch (lines 369, 372, 413, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
request-schedule.sceneChanges (cognitive 21) lib/workbench/request-schedule.ts:206— request-schedule.sceneChanges has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, loops 4, 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.
emfParser.parseEmfContent (cognitive 21) packages/@openmaic/importer/src/utils/emfParser.ts:51— emfParser.parseEmfContent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 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.
tableSerializer.getEffectiveTableStyleTextProps (cognitive 21) packages/@openmaic/importer/src/serializer/tableSerializer.ts:192— tableSerializer.getEffectiveTableStyleTextProps has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (4 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.
transformParsedToSlides.parseLineElement (cognitive 21) packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:220— transformParsedToSlides.parseLineElement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, ternaries 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.
preview-validation.srcsetUrls (cognitive 21) render-service/src/preview-validation.ts:105— preview-validation.srcsetUrls has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (7 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.
main.parsePreviewPayload (cognitive 21) render-service/src/main.ts:150— main.parsePreviewPayload has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 6, 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.
check-package-version-bumps.runReleaseMode (cognitive 21) scripts/check-package-version-bumps.mjs:589— check-package-version-bumps.runReleaseMode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 20) app/api/agents/import/route.ts:39— route.POST has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (5 pts), boolean chains 3, error handling 1, loops 1 (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 one function literal inside it that branches (line 41). 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.
slide-element-pick-overlay.ElementPickOverlay (cognitive 20) components/canvas/slide-element-pick-overlay.tsx:175— slide-element-pick-overlay.ElementPickOverlay has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 2, loops 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 10 function items inside it that branch (a function literal at line 203, a function literal at line 318, a function literal at line 225, …). 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.
ThumbItem.ThumbItemComponent (cognitive 20) components/edit/SlideNavRail/ThumbItem.tsx:34— ThumbItem.ThumbItemComponent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 6 (7 pts), boolean chains 6 (nesting depth added 2). Of this number, 11 points are the body's own statements and 9 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.
station-text.lineText (cognitive 20) components/settings/models/station-text.ts:17— station-text.lineText has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 4 (5 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.
pdf-settings.PDFSettings (cognitive 20) components/settings/pdf-settings.tsx:42— pdf-settings.PDFSettings has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, if/else 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 1). Of this number, 15 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
submission.SubmissionModal (cognitive 20) components/scene-renderers/pbl/v2/submission.tsx:909— submission.SubmissionModal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 27 (47 pts), boolean chains 23, ternaries 12 (19 pts), error handling 4 (6 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (submission.SubmissionModal::handleFile) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
use-application-preview.waitForApplication (cognitive 20) components/scene-renderers/pbl/v3/use-application-preview.ts:20— use-application-preview.waitForApplication has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 2 (6 pts), error handling 1 (2 pts), loops 2, ternaries 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 one function item inside it that branches (observe). 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.
conversation.LearningConversation (cognitive 20) components/scene-renderers/pbl/v3/conversation.tsx:198— conversation.LearningConversation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (openReference, a function literal at line 260, a function literal at line 220). 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.
useRotateElement.useRotateElement.rotateElement::handleMouseMove (cognitive 20) components/slide-renderer/Editor/Canvas/hooks/useRotateElement.ts:71— useRotateElement.useRotateElement.rotateElement::handleMouseMove has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, boolean chains 8, ternaries 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.
chat-timeline.rowsForRender (cognitive 20) components/workbench/chat/chat-timeline.tsx:136— chat-timeline.rowsForRender has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MaterialLibraryPage.InlineName (cognitive 20) components/workbench/workspace/MaterialLibraryPage.tsx:540— MaterialLibraryPage.InlineName has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 7, ternaries 2. Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 596, 614, 646, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WorkspaceClassroomPane.WorkspaceClassroomPane (cognitive 20) components/workbench/workspace/WorkspaceClassroomPane.tsx:38— WorkspaceClassroomPane.WorkspaceClassroomPane has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (13 pts), boolean chains 5, if/else 1 (2 pts) (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.
json-stream.splitConcatenatedJsonObjects (cognitive 20) lib/audio/json-stream.ts:11— json-stream.splitConcatenatedJsonObjects has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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.
bundle.pickVisionImageIds (cognitive 20) lib/document/bundle.ts:127— bundle.pickVisionImageIds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (5 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.
use-audio-recorder.useAudioRecorder.startRecording (cognitive 20) lib/hooks/use-audio-recorder.ts:185— use-audio-recorder.useAudioRecorder.startRecording has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media.collectDocumentMediaRefs (cognitive 20) lib/legacy-browser-import/media.ts:73— media.collectDocumentMediaRefs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 9). Of this number, 15 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
services.serviceEntries (cognitive 20) lib/model-settings/services.ts:78— services.serviceEntries has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 4, if/else 2 (4 pts), loops 1 (nesting depth added 7). Of this number, 15 points are the body's own statements and 5 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.
instructor.buildScenarioAwarenessBlock (cognitive 20) lib/pbl/v2/agents/instructor.ts:683— instructor.buildScenarioAwarenessBlock has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 8 (9 pts), boolean chains 1 (nesting depth added 3). Of this number, 16 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, 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.
package-client.installClassroomProjects (cognitive 20) lib/pbl/v3/package-client.ts:279— package-client.installClassroomProjects has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, 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.
document-image-parser.inputBudget (cognitive 20) lib/server/material-extraction/document-image-parser.ts:62— document-image-parser.inputBudget has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 7). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (charge). 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.
extraction.extractOwnerMaterial (cognitive 20) lib/server/materials/extraction.ts:373— extraction.extractOwnerMaterial has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 6, error handling 2 (3 pts), boolean chains 1 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
extraction.startOwnerMaterialExtractor (cognitive 20) lib/server/materials/extraction.ts:702— extraction.startOwnerMaterialExtractor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 3 (4 pts), error handling 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (scan, a function literal at line 748). 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.
deployment-layer.loadDeploymentLayer (cognitive 20) lib/server/model-config/deployment-layer.ts:131— deployment-layer.loadDeploymentLayer has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 3 (4 pts) (nesting depth added 2). Of this number, 14 points are the body's own statements and 6 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.
teaching-prompt.buildTeachingPrompt (cognitive 20) lib/server/pbl-v3/teaching-prompt.ts:119— teaching-prompt.buildTeachingPrompt has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 5 (9 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
provider-config.collectDisabledProviders (cognitive 20) lib/server/provider-config.ts:346— provider-config.collectDisabledProviders has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (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.
timeline.dispatchSegment (cognitive 20) lib/video-export/passes/timeline.ts:148— timeline.dispatchSegment has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
visuals.applyVisuals.scenes (cognitive 20) lib/video-export/passes/visuals.ts:222— visuals.applyVisuals.scenes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (4 pts), boolean chains 3, 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.
TextFormatToolbar.TextFormatToolbar (cognitive 20) packages/@openmaic/editor/src/ui/text/TextFormatToolbar.tsx:32— TextFormatToolbar.TextFormatToolbar has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 7, if/else 4 (nesting depth added 3). Of this number, 15 points are the body's own statements and 5 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.
LineFormatToolbar.LineFormatToolbar (cognitive 20) packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:21— LineFormatToolbar.LineFormatToolbar has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 4, if/else 4 (nesting depth added 4). Of this number, 10 points are the body's own statements and 10 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engagement.microtaskEngagement (cognitive 20) packages/@openmaic/generation/src/pbl/operations/kernel/engagement.ts:67— engagement.microtaskEngagement has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
progress.normalizeScenario (cognitive 20) packages/@openmaic/generation/src/pbl/operations/kernel/progress.ts:328— progress.normalizeScenario has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 5). Of this number, 16 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
planner-single-call.hydrateScenario (cognitive 20) packages/@openmaic/generation/src/pbl/planner-single-call.ts:314— planner-single-call.hydrateScenario has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, ternaries 4 (nesting depth added 3). Of this number, 16 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.
Presentation.findMatchingPlaceholder (cognitive 20) packages/@openmaic/importer/src/model/Presentation.ts:353— Presentation.findMatchingPlaceholder 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.
groupSerializer.detectLineOrientation (cognitive 20) packages/@openmaic/importer/src/serializer/groupSerializer.ts:39— groupSerializer.detectLineOrientation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, 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.
HttpDocumentStore.request (cognitive 20) packages/@openmaic/storage/src/document/http.ts:272— HttpDocumentStore.request has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5 (7 pts), error handling 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.
HttpRuntimeStore.requestWithStatus (cognitive 20) packages/@openmaic/storage/src/runtime/http.ts:179— HttpRuntimeStore.requestWithStatus has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 3 (5 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
preview-validation.previewabilityError (cognitive 20) render-service/src/preview-validation.ts:211— preview-validation.previewabilityError has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, error handling 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.
imagePlan (cognitive 20) lib/server/material-extraction/document-image-plan.mjs:74— imagePlan has cognitive complexity 20 (threshold 15). Drivers by points: if/else 31 (56 pts), loops 8 (17 pts), boolean chains 14, ternaries 4 (14 pts), other 7 (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.
route.PATCH (cognitive 19) app/api/folders/[id]/route.ts:41— route.PATCH has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (4 pts), loops 1 (3 pts), error handling 2, boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 64, 71). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
route.GET (cognitive 19) app/api/generation-runs/[id]/events/route.ts:42— route.GET has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 68). 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.
use-learning-stream.useLearningStream (cognitive 19) components/scene-renderers/pbl/v3/use-learning-stream.ts:9— use-learning-stream.useLearningStream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 2, error handling 1 (nesting depth added 2). None of this is in the body itself: all 19 points belong to 5 function literals inside it that branch (lines 29, 35, 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.
conversation-history.ConversationHistory (cognitive 19) components/scene-renderers/pbl/v3/conversation-history.tsx:20— conversation-history.ConversationHistory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 6 function items inside it that branch (load, a function literal at line 60, select, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useDragElement.useDragElement.dragElement (cognitive 19) components/slide-renderer/Editor/Canvas/hooks/useDragElement.ts:40— useDragElement.useDragElement.dragElement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 15, ternaries 7, 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. This shape REPEATS in the file: one other method here (useDragElement.useDragElement.dragElement::handleMouseMove) 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.
WorkspaceRail.RailRow (cognitive 19) components/workbench/workspace/WorkspaceRail.tsx:2037— WorkspaceRail.RailRow has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, ternaries 7, if/else 2. Of this number, 14 points are the body's own statements and 5 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.
runner.printReport (cognitive 19) eval/pbl-v2-planner/runner.ts:643— runner.printReport has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (12 pts), loops 3 (5 pts), boolean chains 1, if/else 1 (nesting depth added 11). 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, 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.
geometry-checks.isCircle (cognitive 19) eval/whiteboard-shapes/geometry-checks.ts:221— geometry-checks.isCircle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 3, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActionEngine.executePlayVideo (cognitive 19) lib/action/engine.ts:360— ActionEngine.executePlayVideo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). Of this number, 11 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
page-scroll-boundary.installPageScrollBoundary::move (cognitive 19) lib/adaptive/page-scroll-boundary.ts:10— page-scroll-boundary.installPageScrollBoundary::move has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (7 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.
stream-fn.createPartMapper.handle (cognitive 19) lib/agent/runtime/stream-fn.ts:201— stream-fn.createPartMapper.handle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reasoning-sse.createReasoningContentRewriter.rewrite (cognitive 19) lib/ai/reasoning-sse.ts:139— reasoning-sse.createReasoningContentRewriter.rewrite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm.withStreamFallback (cognitive 19) lib/ai/llm.ts:753— llm.withStreamFallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, error handling 2, ternaries 1 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 3 function items inside it that branch (a function literal at line 799, serveFallback, track). 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.
tts-utils.splitLongSpeechText (cognitive 19) lib/audio/tts-utils.ts:21— tts-utils.splitLongSpeechText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 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 3 function items inside it that branch (hardSplitUnit, appendUnit, pushChunk). 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.
agent-ops.applyOperationToRoster (cognitive 19) lib/edit/agent-ops.ts:110— agent-ops.applyOperationToRoster has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, match/switch 1 (nesting depth added 8). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 111). 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.
pptx-rich-text.proseToPlainText::walk (cognitive 19) lib/export/pptx-rich-text.ts:103— pptx-rich-text.proseToPlainText::walk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build-standalone-html.linkStandaloneImages (cognitive 19) lib/export/standalone-html/build-standalone-html.ts:367— build-standalone-html.linkStandaloneImages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5 (7 pts), loops 3, boolean chains 2 (nesting depth added 5). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
svg-path-parser.toPoints (cognitive 19) lib/export/svg-path-parser.ts:47— svg-path-parser.toPoints has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
use-import-classroom.materializeImportedAudio (cognitive 19) lib/import/use-import-classroom.ts:204— use-import-classroom.materializeImportedAudio has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 7). 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.
observation-bridge.createObservationSession.capture (cognitive 19) REDACTED:135— observation-bridge.createObservationSession.capture has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 6, error handling 2, ternaries 1. Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 186, 160, 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.
errors.classifyFailure (cognitive 19) lib/legacy-browser-import/errors.ts:96— errors.classifyFailure has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, ternaries 3 (4 pts), boolean chains 3 (nesting depth added 1). 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: 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.
minimax-image-adapter.generateWithMiniMaxImage (cognitive 19) lib/media/adapters/minimax-image-adapter.ts:19— minimax-image-adapter.generateWithMiniMaxImage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9 (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.
generated-media-references.rewriteSlideMediaReference (cognitive 19) lib/media/generated-media-references.ts:44— generated-media-references.rewriteSlideMediaReference has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 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.
quiz-snapshot.buildQuizSnapshot (cognitive 19) lib/pbl/v2/operations/runtime/quiz-snapshot.ts:42— quiz-snapshot.buildQuizSnapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
package-client.attachClassroomProjects (cognitive 19) lib/pbl/v3/package-client.ts:140— package-client.attachClassroomProjects has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 4, loops 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.
math-text.parseQuizMathText (cognitive 19) lib/quiz/math-text.ts:87— math-text.parseQuizMathText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (3 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.
ask-user.buildAskUserTool.execute (cognitive 19) lib/server/agent-runtime/ask-user.ts:53— ask-user.buildAskUserTool.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 3, loops 1 (2 pts) (nesting depth added 4). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
generate-image.buildGenerateImageTool.execute (cognitive 19) lib/server/agent-runtime/generate-image.ts:300— generate-image.buildGenerateImageTool.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (4 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.
personal-history-tools.visibleChatMessages (cognitive 19) lib/server/agent-runtime/personal-history-tools.ts:216— personal-history-tools.visibleChatMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 218). 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.
roster-tools.buildRosterTools (cognitive 19) lib/server/agent-runtime/roster-tools.ts:223— roster-tools.buildRosterTools has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 5. Of this number, 10 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runtime.classifyHostFailure (cognitive 19) lib/server/generation-run-hooks/runtime.ts:175— runtime.classifyHostFailure has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resolve-slot.withoutAssignmentsNaming (cognitive 19) lib/server/model-config/resolve-slot.ts:309— resolve-slot.withoutAssignmentsNaming has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 8). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.checkProvider (cognitive 19) lib/server/model-config/settings.ts:589— settings.checkProvider has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.importModelSettings (cognitive 19) lib/server/model-config/settings.ts:941— settings.importModelSettings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (3 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
conversation.boundConversation (cognitive 19) lib/server/pbl-v3/conversation.ts:374— conversation.boundConversation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
application.inspectApplication (cognitive 19) lib/server/pbl-v3/application.ts:123— application.inspectApplication has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (5 pts), boolean chains 3, loops 1 (2 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, 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.
lifecycle.checkpointDirtyStudy (cognitive 19) lib/server/pbl-v3/lifecycle.ts:522— lifecycle.checkpointDirtyStudy has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (6 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 600, unchanged, a function literal at line 537, …). 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.
stage.startFlushRound (cognitive 19) lib/store/stage.ts:1436— stage.startFlushRound has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 1452). 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.
useMarqueeGesture.useMarqueeGesture.onCanvasPointerDown (cognitive 19) packages/@openmaic/editor/src/react/useMarqueeGesture.ts:97— useMarqueeGesture.useMarqueeGesture.onCanvasPointerDown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, ternaries 2, error handling 1 (nesting depth added 2). 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 items inside it that branch (handleUp, handleMove, rectPastThreshold, …). 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.
useCanvasShortcuts.handleCanvasShortcut (cognitive 19) packages/@openmaic/editor/src/react/useCanvasShortcuts.ts:38— useCanvasShortcuts.handleCanvasShortcut has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
useToolbarAnchor.useToolbarAnchor (cognitive 19) packages/@openmaic/editor/src/ui/text/useToolbarAnchor.ts:37— useToolbarAnchor.useToolbarAnchor has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 4 (6 pts) (nesting depth added 2). None of this is in the body itself: all 19 points belong to 8 function literals inside it that branch (lines 70, 44, 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.
LatexToolbarOverlay.LatexToolbarOverlay (cognitive 19) packages/@openmaic/editor/src/ui/latex/LatexToolbarOverlay.tsx:30— LatexToolbarOverlay.LatexToolbarOverlay has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 5, if/else 3 (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, 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.
generation-retry.isRetryableGenerationError (cognitive 19) packages/@openmaic/generation/src/generation-retry.ts:130— generation-retry.isRetryableGenerationError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6 (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.
Layout.extractPlaceholdersRecursive (cognitive 19) packages/@openmaic/importer/src/model/Layout.ts:106— Layout.extractPlaceholdersRecursive has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
measure.measureSlideElementGeometry (cognitive 19) packages/@openmaic/renderer/src/snapshot/measure.ts:74— measure.measureSlideElementGeometry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, loops 1 (nesting depth added 4). Of this number, 14 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.
PgAssetStore.replace (cognitive 19) packages/@openmaic/storage/src/asset/pg.ts:1381— PgAssetStore.replace has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (3 pts), ternaries 3, boolean chains 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
check-i18n-keys.main (cognitive 19) scripts/check-i18n-keys.mjs:59— check-i18n-keys.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
showUnit (cognitive 19) render-service/src/resource-systemd-runner.mjs:61— showUnit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (9 pts), boolean chains 5, if/else 2 (4 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.
route.GET::poll (cognitive 18) app/api/agent/owner-events/route.ts:229— route.GET::poll has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, 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.
route.PUT (cognitive 18) app/api/model-config/route.ts:82— route.PUT has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 1 (3 pts), error handling 2 (nesting depth added 7). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 103). 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.
route.createPersistenceHandler (cognitive 18) app/api/persistence/[...path]/route.ts:221— route.createPersistenceHandler has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (7 pts) (nesting depth added 8). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 286, 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.
client.WorkbenchLaunchBridge (cognitive 18) app/workbench/new/client.tsx:45— client.WorkbenchLaunchBridge has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 7, error handling 2, boolean chains 1 (nesting depth added 1). 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 53, 69, 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.
proactive-card.ProactiveCard (cognitive 18) components/chat/proactive-card.tsx:38— proactive-card.ProactiveCard has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7, boolean chains 6, if/else 5. Of this number, 13 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CanvasOverlayPortal.useAnchorRect (cognitive 18) components/edit/surfaces/slide/CanvasOverlayPortal.tsx:100— CanvasOverlayPortal.useAnchorRect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 1. None of this is in the body itself: all 18 points belong to 7 function literals inside it that branch (lines 121, 131, 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.
presentation-speech-overlay.buildPresentationBubbleModel (cognitive 18) components/roundtable/presentation-speech-overlay.tsx:41— presentation-speech-overlay.buildPresentationBubbleModel has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 5, ternaries 1. 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, 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.
apply-instructor-event.applyInstructorEvent (cognitive 18) components/scene-renderers/pbl/v2/apply-instructor-event.ts:42— apply-instructor-event.applyInstructorEvent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 2 (7 pts), if/else 2 (6 pts), match/switch 2 (3 pts), boolean chains 2 (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.
workbench-panel.LearningWorkbenchPanel::run (cognitive 18) components/scene-renderers/pbl/v3/workbench-panel.tsx:176— workbench-panel.LearningWorkbenchPanel::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (workbench-panel.LearningWorkbenchPanel) 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.
ResizeHandler.ResizeHandler (cognitive 18) components/slide-renderer/Editor/Canvas/Operate/ResizeHandler.tsx:12— ResizeHandler.ResizeHandler has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 8. Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 19, 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.
useScaleElement.useScaleElement.scaleMultiElement::handleMouseMove (cognitive 18) components/slide-renderer/Editor/Canvas/hooks/useScaleElement.ts:584— useScaleElement.useScaleElement.scaleMultiElement::handleMouseMove has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 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.
motion-descriptor-adapter.resolveMotionLayer (cognitive 18) components/slide-renderer/Editor/motion-descriptor-adapter.ts:115— motion-descriptor-adapter.resolveMotionLayer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4, ternaries 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.
whiteboard-canvas.InteractiveWhiteboardCanvas (cognitive 18) components/whiteboard/whiteboard-canvas.tsx:123— whiteboard-canvas.InteractiveWhiteboardCanvas has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 5, ternaries 3. Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 298, 164, 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.
WorkspaceChatPane.WorkspaceChatPane (cognitive 18) components/workbench/workspace/WorkspaceChatPane.tsx:33— WorkspaceChatPane.WorkspaceChatPane has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WorkspaceCourseTabs.WorkspaceCourseTabs::onKeyDown (cognitive 18) components/workbench/workspace/WorkspaceCourseTabs.tsx:155— WorkspaceCourseTabs.WorkspaceCourseTabs::onKeyDown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, 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.
thinking-config.getThinkingDisplayValue (cognitive 18) lib/ai/thinking-config.ts:191— thinking-config.getThinkingDisplayValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 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.
element-reference.compactInteractiveSourceHtml::containsInlineBase64 (cognitive 18) lib/chat/pi/element-reference.ts:364— element-reference.compactInteractiveSourceHtml::containsInlineBase64 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (element-reference.compactInteractiveSourceHtml) 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.
element-reference.resolveInteractiveComponentReference (cognitive 18) lib/chat/pi/element-reference.ts:1445— element-reference.resolveInteractiveComponentReference has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, ternaries 5, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
errors.isTransientExtractionError (cognitive 18) lib/server/material-extraction/errors.ts:59— errors.isTransientExtractionError has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 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.
inline-assets.inlineHtmlAssets::inlineAttributes (cognitive 18) lib/export/inline-assets.ts:664— inline-assets.inlineHtmlAssets::inlineAttributes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (6 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (inline-assets.inlineHtmlAssets) 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.
proxied-fetch.createProxiedFetch.<returned closure> (cognitive 18) lib/export/proxied-fetch.ts:27— proxied-fetch.createProxiedFetch.<returned closure> has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (5 pts), boolean chains 4, error handling 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.
use-export-pptx.getShadowOption (cognitive 18) REDACTED:293— use-export-pptx.getShadowOption has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
use-course-materials.useCourseMaterials (cognitive 18) lib/generation-run-client/use-course-materials.ts:212— use-course-materials.useCourseMaterials has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (5 pts), boolean chains 3, loops 2 (nesting depth added 5). None of this is in the body itself: all 18 points belong to 9 function literals inside it that branch (lines 370, 377, 364, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
observation-bridge.installObservationResponder::receive (cognitive 18) REDACTED:45— observation-bridge.installObservationResponder::receive has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5 (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.
comfyui-image-adapter.generateWithComfyuiImage (cognitive 18) lib/media/adapters/comfyui-image-adapter.ts:585— comfyui-image-adapter.generateWithComfyuiImage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media-orchestrator.commitPooledMedia (cognitive 18) lib/media/media-orchestrator.ts:357— media-orchestrator.commitPooledMedia has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 5 (7 pts), boolean chains 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 372). 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.
whiteboard-conflicts.elementLabel (cognitive 18) lib/orchestration/summarizers/whiteboard-conflicts.ts:41— whiteboard-conflicts.elementLabel has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 7, match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
alidocmind-client.parseWithAliDocMindClient (cognitive 18) lib/pdf/alidocmind-client.ts:123— alidocmind-client.parseWithAliDocMindClient has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, 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.
runner.startAgentRunner.scan (cognitive 18) lib/server/agent-runtime/runner.ts:2393— runner.startAgentRunner.scan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 6). Of this number, 10 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.
openmaic-yml.interpolate (cognitive 18) lib/server/model-config/openmaic-yml.ts:224— openmaic-yml.interpolate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 5). Of this number, 11 points are the body's own statements and 7 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.
store.applyPatch (cognitive 18) lib/server/generation/run/store.ts:459— store.applyPatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, ternaries 2 (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.
runner.startGenerationRunner::scan (cognitive 18) lib/server/generation/run/runner.ts:121— runner.startGenerationRunner::scan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media.fromTarget (cognitive 18) lib/server/model-config/media.ts:147— media.fromTarget has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 8, 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.
model-fetch.fetchModels (cognitive 18) lib/server/model-fetch.ts:137— model-fetch.fetchModels has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 3, 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.
model-fetch.fetchModelsCandidate (cognitive 18) lib/server/model-fetch.ts:191— model-fetch.fetchModelsCandidate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (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.
evaluation.evaluationFor (cognitive 18) lib/server/pbl-v3/evaluation.ts:37— evaluation.evaluationFor has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 2). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (compile, a function literal at line 48, sourcePath, …). 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.
evaluation.evaluationOutcome (cognitive 18) lib/server/pbl-v3/evaluation.ts:313— evaluation.evaluationOutcome has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 6, if/else 1 (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
chat-storage.loadRuntimeSessions (cognitive 18) lib/utils/chat-storage.ts:951— chat-storage.loadRuntimeSessions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 6). 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.
scene-generator.generatePBLSceneContent (cognitive 18) REDACTED:1141— scene-generator.generatePBLSceneContent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (8 pts), error handling 2 (4 pts), boolean chains 3, if/else 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.
Slide.buildDiagramGroup (cognitive 18) packages/@openmaic/importer/src/model/Slide.ts:264— Slide.buildDiagramGroup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 7, 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.
emfParser.parseStretchDibits (cognitive 18) packages/@openmaic/importer/src/utils/emfParser.ts:210— emfParser.parseStretchDibits has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, loops 2 (3 pts), 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.
textSerializer.findPlaceholderNode (cognitive 18) packages/@openmaic/importer/src/serializer/textSerializer.ts:198— textSerializer.findPlaceholderNode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, 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.
textSerializer.autoFitLineHeight (cognitive 18) packages/@openmaic/importer/src/serializer/textSerializer.ts:1009— textSerializer.autoFitLineHeight has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (7 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
base-url.assertHttpBaseUrl (cognitive 18) packages/@openmaic/storage/src/http/base-url.ts:50— base-url.assertHttpBaseUrl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, 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.
asset.createAssetHttpHandler (cognitive 18) packages/@openmaic/storage/src/server/asset.ts:761— asset.createAssetHttpHandler has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 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.
preview-validation.findNonSelfContainedInteractiveReferences (cognitive 18) render-service/src/preview-validation.ts:133— preview-validation.findNonSelfContainedInteractiveReferences has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 4 (7 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. This shape REPEATS in the file: one other method here (preview-validation.findNonSelfContainedInteractiveReferences::visit) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
check-package-version-bumps.registryVersions (cognitive 18) scripts/check-package-version-bumps.mjs:515— check-package-version-bumps.registryVersions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.POST (cognitive 17) app/api/model-config/import/route.ts:43— route.POST has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (4 pts), boolean chains 1, loops 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 57). 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.
route.handlePersistenceRequestInner (cognitive 17) app/api/persistence/[...path]/route.ts:501— route.handlePersistenceRequestInner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (2 pts), error handling 1 (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 one function literal inside it that branches (line 510). 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.
page.HomePage::handleGenerate (cognitive 17) app/page.tsx:637— page.HomePage::handleGenerate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 2 (4 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. This shape REPEATS in the file: one other method here (page.HomePage) 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.
step-visualizers.ContentVisualizer (cognitive 17) components/generation/step-visualizers.tsx:523— step-visualizers.ContentVisualizer has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 16, match/switch 1. Of this number, 12 points are the body's own statements and 5 belong to 3 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
skill-settings.SkillSettings (cognitive 17) components/settings/skill-settings.tsx:338— skill-settings.SkillSettings has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (7 pts), if/else 6, boolean chains 2, error handling 2 (nesting depth added 1). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 359, 380, 414, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
project-hero.ProjectHero (cognitive 17) components/scene-renderers/pbl/project-hero.tsx:35— project-hero.ProjectHero has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 5, if/else 1 (nesting depth added 2). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
quiz-view.SingleChoiceQuestion (cognitive 17) REDACTED:223— quiz-view.SingleChoiceQuestion has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 17. None of this is in the body itself: all 17 points belong to 2 function literals inside it that branch (lines 243, 252). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.LineElement (cognitive 17) components/slide-renderer/components/element/LineElement/index.tsx:20— index.LineElement has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 3, boolean chains 2 (nesting depth added 2). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 42, handleSelectElement, a function literal at line 31, …). 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.
ElementCreateSelection.ElementCreateSelection::createSelection::handleMouseMove (cognitive 17) components/slide-renderer/Editor/Canvas/ElementCreateSelection.tsx:35— ElementCreateSelection.ElementCreateSelection::createSelection::handleMouseMove has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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.
instrumentation.register (cognitive 17) instrumentation.ts:15— instrumentation.register has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 4, boolean chains 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs 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.
reasoning-sse.wrapJsonResponseWithReasoning (cognitive 17) lib/ai/reasoning-sse.ts:226— reasoning-sse.wrapJsonResponseWithReasoning has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qwen-voice-clone.postJson (cognitive 17) lib/audio/qwen-voice-clone.ts:214— qwen-voice-clone.postJson has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (7 pts), error handling 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.
course.importLegacyCourse (cognitive 17) lib/legacy-browser-import/course.ts:496— course.importLegacyCourse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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.
index.runLegacyBrowserImport (cognitive 17) lib/legacy-browser-import/index.ts:401— index.runLegacyBrowserImport has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (4 pts), boolean chains 3, error handling 1 (nesting depth added 3). Of this number, 11 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.
eval-prompts.formatProjectEngagementRollup (cognitive 17) lib/pbl/v2/operations/runtime/eval-prompts.ts:224— eval-prompts.formatProjectEngagementRollup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 8). 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.
instructor.stripPrematureNextTaskSetup (cognitive 17) lib/pbl/v2/agents/instructor.ts:1191— instructor.stripPrematureNextTaskSetup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
event-notify-bus.connect (cognitive 17) lib/server/agent-runtime/event-notify-bus.ts:252— event-notify-bus.connect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, error handling 2 (nesting depth added 1). Of this number, 11 points are the body's own statements and 6 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.
media-byte-omission.percentDecodedUtf8Length::feedPercentByte (cognitive 17) lib/server/agent-runtime/course-edit/media-byte-omission.ts:95— media-byte-omission.percentDecodedUtf8Length::feedPercentByte has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 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. This shape REPEATS in the file: one other method here (media-byte-omission.percentDecodedUtf8Length) 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.
settings.capabilityModels (cognitive 17) lib/server/model-config/settings.ts:280— settings.capabilityModels has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (6 pts), boolean chains 5, if/else 3 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.modelSettingsView (cognitive 17) lib/server/model-config/settings.ts:472— settings.modelSettingsView has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 502, 488, 558, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
report-analysis.reportAnalysisProjection (cognitive 17) lib/server/pbl-v3/report-analysis.ts:45— report-analysis.reportAnalysisProjection has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 6, if/else 2, loops 1 (nesting depth added 1). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 65, a function literal at line 55, sample). 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.
ssrf-guard.tunnelEmbeddedIPv4 (cognitive 17) lib/server/ssrf-guard.ts:114— ssrf-guard.tunnelEmbeddedIPv4 has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, 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.
VideoRegistry.play (cognitive 17) REDACTED:189— VideoRegistry.play has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (start, a function literal at line 225). 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.
CourseThumbnailLoader.run (cognitive 17) lib/utils/course-thumbnail-loader.ts:133— CourseThumbnailLoader.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prepare-interactive-html.prepareInteractiveHtmlScenes (cognitive 17) lib/video-export-app/prepare-interactive-html.ts:213— prepare-interactive-html.prepareInteractiveHtmlScenes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.emitHyperframes (cognitive 17) lib/video-export/emit-hyperframes/index.ts:1229— index.emitHyperframes has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 1 (3 pts), loops 2 (3 pts), boolean chains 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.
kimi.searchWithKimi (cognitive 17) lib/web-search/kimi.ts:26— kimi.searchWithKimi has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 3, ternaries 3, error handling 1 (2 pts) (nesting depth added 1). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, 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.
fold.foldWhiteboardRuntimeRecords (cognitive 17) lib/whiteboard/runtime/fold.ts:170— fold.foldWhiteboardRuntimeRecords has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 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.
OwnerSessionClient.openStream::onSessionEvent (cognitive 17) lib/workbench/owner-session-client.ts:231— OwnerSessionClient.openStream::onSessionEvent 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.
interactive.isInteractiveContent (cognitive 17) packages/@openmaic/dsl/src/interactive.ts:60— interactive.isInteractiveContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 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.
validate.checkScene (cognitive 17) packages/@openmaic/dsl/src/validate.ts:253— validate.checkScene has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
rotate.computeRotate (cognitive 17) packages/@openmaic/editor/src/react/core/rotate.ts:59— rotate.computeRotate 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.
ElementToolbarOverlay.ElementToolbarOverlay (cognitive 17) packages/@openmaic/editor/src/ui/element/ElementToolbarOverlay.tsx:21— ElementToolbarOverlay.ElementToolbarOverlay has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, boolean chains 5, if/else 3. Of this number, 12 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.
Presentation.findMatchingLayoutPlaceholder (cognitive 17) packages/@openmaic/importer/src/model/Presentation.ts:393— Presentation.findMatchingLayoutPlaceholder has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
emfParser.parseGdiComment (cognitive 17) packages/@openmaic/importer/src/utils/emfParser.ts:101— emfParser.parseGdiComment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 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.
shapeSerializer.fillToJson (cognitive 17) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:544— shapeSerializer.fillToJson has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
chartOption.getChartOption::axisOptions (cognitive 17) packages/@openmaic/renderer/src/elements/chart/chartOption.ts:118— chartOption.getChartOption::axisOptions has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12 (14 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (chartOption.getChartOption) 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.
AssetCollector.releaseEntries (cognitive 17) packages/@openmaic/storage/src/asset/collector.ts:1230— AssetCollector.releaseEntries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (3 pts), loops 1 (nesting depth added 8). Of this number, 11 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.
BrowserRuntimeStore.appendRecord (cognitive 17) packages/@openmaic/storage/src/runtime/browser.ts:349— BrowserRuntimeStore.appendRecord has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, ternaries 4 (5 pts), boolean chains 3 (nesting depth added 1). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 369). 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.
readTaskAccounting (cognitive 17) render-service/src/resource-task-runner.mjs:157— readTaskAccounting has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 2 (4 pts), boolean chains 2, error handling 1 (2 pts), loops 1, other 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
use-chat-sessions.useChatSessions.startLecture (cognitive 16) components/chat/use-chat-sessions.ts:1978— use-chat-sessions.useChatSessions.startLecture has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 7). Of this number, 11 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generation-toolbar.CourseMaterialChip (cognitive 16) components/generation/generation-toolbar.tsx:533— generation-toolbar.CourseMaterialChip has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, ternaries 6. 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.
step-visualizers.StreamingOutlineVisualizer (cognitive 16) components/generation/step-visualizers.tsx:357— step-visualizers.StreamingOutlineVisualizer has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9, boolean chains 5, if/else 2. Of this number, 12 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.
station-node.StationNode (cognitive 16) components/settings/models/station-node.tsx:250— station-node.StationNode has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, if/else 2. 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.
media-service-panel.MediaServicePanel (cognitive 16) components/settings/media-service-panel.tsx:38— media-service-panel.MediaServicePanel has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 2, ternaries 2, error handling 1. Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, 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.
chat.MessageBubble (cognitive 16) components/scene-renderers/pbl/v2/chat.tsx:983— chat.MessageBubble has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, 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.
scenario-stage.ScenarioStage (cognitive 16) components/scene-renderers/pbl/v2/scene-stage/scenario-stage.tsx:43— scenario-stage.ScenarioStage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5, ternaries 2. Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
tool-activity.ToolActivity (cognitive 16) components/scene-renderers/pbl/v3/tool-activity.tsx:171— tool-activity.ToolActivity has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 2 (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
quiz-view.QuestionCard (cognitive 16) REDACTED:501— quiz-view.QuestionCard has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, ternaries 2 (3 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.
agent-settings.AgentSettings (cognitive 16) components/settings/agent-settings.tsx:27— agent-settings.AgentSettings has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 4 (nesting depth added 4). Of this number, 11 points are the body's own statements and 5 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.
useInsertFromCreateSelection.useInsertFromCreateSelection.insertElementFromCreateSelection (cognitive 16) components/slide-renderer/Editor/Canvas/hooks/useInsertFromCreateSelection.ts:82— useInsertFromCreateSelection.useInsertFromCreateSelection.insertElementFromCreateSelection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MaterialLibraryPage.StatusLabel (cognitive 16) components/workbench/workspace/MaterialLibraryPage.tsx:238— MaterialLibraryPage.StatusLabel has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 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.
build-compare.latestRunDir (cognitive 16) eval/pbl-v2-planner/build-compare.ts:23— build-compare.latestRunDir has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 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.
geometry-checks.polygonContours (cognitive 16) eval/whiteboard-shapes/geometry-checks.ts:58— geometry-checks.polygonContours has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
asr-providers.transcribeQwenASR (cognitive 16) lib/audio/asr-providers.ts:467— asr-providers.transcribeQwenASR has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
timeline.actionDurationMs (cognitive 16) lib/choreography/timeline.ts:184— timeline.actionDurationMs has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 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.
load-classroom.outstandingMediaRetryTasks (cognitive 16) lib/classroom/load-classroom.ts:440— load-classroom.outstandingMediaRetryTasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-media.uniformKeyframeTimes (cognitive 16) lib/document/extractors/local-media.ts:356— local-media.uniformKeyframeTimes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4, boolean chains 3, ternaries 1 (nesting depth added 3). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RunCourseSceneSync.pass (cognitive 16) lib/generation-run-client/run-course.ts:182— RunCourseSceneSync.pass has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4, 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.
use-import-classroom.rewriteImportedSlideMediaRefs.elements (cognitive 16) lib/import/use-import-classroom.ts:149— use-import-classroom.rewriteImportedSlideMediaRefs.elements has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 7, 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.
ledger.mergeStoredLedger (cognitive 16) lib/legacy-browser-import/ledger.ts:203— ledger.mergeStoredLedger has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 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.
video-providers.normalizeVideoOptions (cognitive 16) lib/media/video-providers.ts:165— video-providers.normalizeVideoOptions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 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.
edit.wizardAssignments (cognitive 16) lib/model-settings/edit.ts:184— edit.wizardAssignments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
whiteboard-ledger.getInitialWhiteboardElements (cognitive 16) lib/orchestration/summarizers/whiteboard-ledger.ts:33— whiteboard-ledger.getInitialWhiteboardElements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 5 (6 pts), boolean chains 4 (nesting depth added 2). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 41, 68). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
whiteboard-ledger.applyCodeEdit (cognitive 16) lib/orchestration/summarizers/whiteboard-ledger.ts:84— whiteboard-ledger.applyCodeEdit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 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.
completion-stats.buildStageDetails (cognitive 16) lib/pbl/v2/operations/runtime/completion-stats.ts:432— completion-stats.buildStageDetails has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 7). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 436). 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.
eval-prompts.buildFinalEvalPrompt (cognitive 16) lib/pbl/v2/operations/runtime/eval-prompts.ts:536— eval-prompts.buildFinalEvalPrompt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 6). 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.
simulator.buildSimulatorSystemPrompt (cognitive 16) lib/pbl/v2/agents/simulator.ts:123— simulator.buildSimulatorSystemPrompt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
alidocmind-client.verifyAliDocMindCredentials (cognitive 16) lib/pdf/alidocmind-client.ts:302— alidocmind-client.verifyAliDocMindCredentials has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 4 (6 pts), if/else 2 (3 pts), 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.
pdf-providers.fetchAliDocMindImageAsBase64 (cognitive 16) lib/pdf/pdf-providers.ts:530— pdf-providers.fetchAliDocMindImageAsBase64 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (2 pts), boolean chains 1, 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.
toggleList.toggleList.<returned closure> (cognitive 16) lib/prosemirror/commands/toggleList.ts:19— toggleList.toggleList.<returned closure> has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 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.
skill-edit-tools.buildSkillEditTools (cognitive 16) lib/server/agent-runtime/skill-edit-tools.ts:263— skill-edit-tools.buildSkillEditTools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (4 pts), boolean chains 3, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
openmaic-yml.parseModelConfig (cognitive 16) lib/server/model-config/openmaic-yml.ts:459— openmaic-yml.parseModelConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model-authorization.deploymentAuthorizedModels (cognitive 16) lib/server/model-config/model-authorization.ts:69— model-authorization.deploymentAuthorizedModels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 4). Of this number, 12 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.
image-sizing.resolveImageSize (cognitive 16) lib/server/image-sizing.ts:49— image-sizing.resolveImageSize has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 pts) (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.
GuidedSkillReview.advance (cognitive 16) lib/server/pbl-v3/guided-review.ts:225— GuidedSkillReview.advance has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider-config.resolveServerWebSearchProviderId (cognitive 16) lib/server/provider-config.ts:1075— provider-config.resolveServerWebSearchProviderId 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.
ssrf-guard.expandIPv6 (cognitive 16) lib/server/ssrf-guard.ts:373— ssrf-guard.expandIPv6 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (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.
usage-storage.readUsageRecords (cognitive 16) lib/server/usage-storage.ts:178— usage-storage.readUsageRecords has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media-library.firstLinkedImage (cognitive 16) lib/standalone-player/playback/media-library.ts:185— media-library.firstLinkedImage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 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.
QuizScene.QuizScene (cognitive 16) REDACTED:101— QuizScene.QuizScene has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 7 (8 pts) (nesting depth added 1). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 124, 112). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into 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.planPblCover (cognitive 16) lib/video-export/emit-hyperframes/index.ts:981— index.planPblCover has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 4, loops 1. Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (degrade). 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.
deepseek.searchWithDeepSeek (cognitive 16) lib/web-search/deepseek.ts:17— deepseek.searchWithDeepSeek has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 4, ternaries 3, error handling 1 (2 pts) (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session-store.compactReplayEvents (cognitive 16) lib/workbench/session-store.ts:1811— session-store.compactReplayEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (flush). 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.
stage-freshness.mergeFetchedScenes (cognitive 16) lib/workbench/stage-freshness.ts:172— stage-freshness.mergeFetchedScenes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
material-library-client.materialOf (cognitive 16) lib/workbench/material-library-client.ts:193— material-library-client.materialOf has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 11, boolean chains 3, if/else 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.
validate.checkInteractiveContent (cognitive 16) packages/@openmaic/dsl/src/validate.ts:181— validate.checkInteractiveContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BackgroundInsertPicker.BackgroundInsertPicker (cognitive 16) packages/@openmaic/editor/src/ui/insert/BackgroundInsertPicker.tsx:29— BackgroundInsertPicker.BackgroundInsertPicker has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 5 (6 pts), boolean chains 4 (nesting depth added 3). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
text.useTextEditorAdapter (cognitive 16) packages/@openmaic/editor/src/ui/adapters/text.tsx:39— text.useTextEditorAdapter has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 5, boolean chains 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 60, 55, 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.
scene-generator.buildPBLProjectSummary (cognitive 16) REDACTED:1729— scene-generator.buildPBLProjectSummary has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 5 (nesting depth added 2). Of this number, 10 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
mtef.charLatex (cognitive 16) packages/@openmaic/importer/src/utils/mtef.ts:613— mtef.charLatex has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, loops 1, 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.
textSerializer.resolveThemeFont (cognitive 16) packages/@openmaic/importer/src/serializer/textSerializer.ts:697— textSerializer.resolveThemeFont has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
slideSerializer.parseTemplateShapes (cognitive 16) packages/@openmaic/importer/src/serializer/slideSerializer.ts:60— slideSerializer.parseTemplateShapes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, error handling 1 (2 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AssetCollector.backfillChunk (cognitive 16) packages/@openmaic/storage/src/asset/collector.ts:956— AssetCollector.backfillChunk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (5 pts), ternaries 2 (5 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 7). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 976). 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.
check-package-version-bumps.runDiffMode (cognitive 16) scripts/check-package-version-bumps.mjs:441— check-package-version-bumps.runDiffMode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 1 (3 pts), 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.
sandbox-preview-activity.installPreviewReadiness (cognitive 16) scripts/sandbox-preview-activity.mjs:172— sandbox-preview-activity.installPreviewReadiness has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function items inside it that branch (inspect, a function literal at line 209). 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.
sandbox-preview-gateway.resolve (cognitive 16) scripts/sandbox-preview-gateway.mjs:84— sandbox-preview-gateway.resolve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), ternaries 4 (5 pts), boolean chains 4, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
removeAndVerify (cognitive 16) render-service/src/resource-systemd-runner.mjs:492— removeAndVerify has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 3 (4 pts), other 3, error handling 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.
Off the main sequence: @openmaic/geometry — @openmaic/geometry: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Low cohesion: Slide (LCOM4 8) packages/pptxgenjs/src/slide.ts:33— Slide's methods fall into 8 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 8 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.
IC1 · Incompleteness & stubs· Empty method body · ×1
Empty method body — does nothing with its inputs lib/server/agent-runtime/node-xhr.ts:52— `overrideMimeType` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
Duplication concentrated across 8 sibling directories (198 clone groups) configs/shapes.ts:3— 198 duplicated blocks under the repository root have copies in at least two of the sibling directories app, components, configs, eval, lib, packages (+2 more sibling(s) not listed) — 142 of them are reported below, and 56 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 198 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 198 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 198 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 33 sibling directories (79 clone groups) lib/document-store/current-scene.ts:10— 79 duplicated blocks under lib/ have copies in at least two of the sibling directories agent, audio, buffer, chat, choreography, classroom (+27 more sibling(s) not listed) — 42 of them are reported below, and 37 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 79 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 79 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 79 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 (33 clone groups) components/discovery/folder-dialogs.tsx:36— 33 duplicated blocks under components/ have copies in at least two of the sibling directories agent, canvas, chat, discovery, edit, generation (+8 more sibling(s) not listed) — 17 of them are reported below, and 16 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 33 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 33 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 33 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 (26 clone groups) packages/@openmaic/storage/src/material/pg.ts:98— 26 duplicated blocks under packages/@openmaic/storage/src/ have copies in at least two of the sibling directories agent-session, asset, document, kv, material, runtime (+2 more sibling(s) not listed) — 22 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 26 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 26 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 26 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 15 sibling directories (17 clone groups) app/api/verify-image-provider/route.ts:41— 17 duplicated blocks under app/api/ have copies in at least two of the sibling directories agent, agents, folders, generate, generate-classroom, generation-runs (+9 more sibling(s) not listed) — 16 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 17 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 17 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 17 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 9 sibling directories (14 clone groups) lib/server/generation-run-hooks/registry.ts:52— 14 duplicated blocks under lib/server/ have copies in at least two of the sibling directories agent-runtime, generation, generation-run-hooks, identity, material-extraction, materials (+3 more sibling(s) not listed) — 10 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 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 6 sibling directories (11 clone groups) packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:32— 11 of the duplicated blocks reported below have copies in at least two of the sibling directories audio, element, latex, line, text, video under packages/@openmaic/editor/src/ui/. 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 7 sibling directories (8 clone groups) components/slide-renderer/components/element/ImageElement/BaseImageElement.tsx:72— 8 duplicated blocks under components/slide-renderer/components/element/ have copies in at least two of the sibling directories ChartElement, ImageElement, LatexElement, LineElement, TableElement, TextElement (+1 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) components/slide-renderer/Editor/RendererScreenCanvas.tsx:32— 7 duplicated blocks under components/slide-renderer/ have copies in at least two of the sibling directories Editor, components — 5 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 7 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 5 sibling directories (6 clone groups) REDACTED:20— 6 duplicated blocks under packages/@openmaic/ have copies in at least two of the sibling directories dsl, editor, generation, importer, renderer — 2 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 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 4 sibling directories (6 clone groups) packages/@openmaic/importer/src/model/Slide.ts:40— 6 duplicated blocks under packages/@openmaic/importer/src/ have copies in at least two of the sibling directories export, model, serializer, utils — 3 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 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.
Wholesale file copy (655 identical lines × 2 files) configs/shapes.ts:3— configs/shapes.ts:3 · packages/@openmaic/importer/src/openmaic/configs/shapes.ts:3 — these 2 files are line-for-line copies of one another — 655 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 (418 identical lines × 2 files) REDACTED:3— REDACTED:3 · REDACTED:3 — these 2 files are line-for-line copies of one another — 418 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 (282 identical lines × 2 files) lib/pbl/v2/types.ts:8— lib/pbl/v2/types.ts:8 · packages/@openmaic/generation/src/pbl/types.ts:8 — these 2 files are line-for-line copies of one another — 282 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 (186 identical lines × 2 files) lib/prosemirror/utils.ts:1— lib/prosemirror/utils.ts:1 · packages/@openmaic/editor/src/react/text/prosemirror/utils.ts:1 — these 2 files are line-for-line copies of one another — 186 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 (145 matched lines × 2 locations) · ×1
Duplicated block with local edits (145 matched lines × 2 locations) app/page.tsx:1723— app/page.tsx:1723 · components/user-profile.tsx:50 — the two spans are one implementation copied and then locally edited — 799 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 (142 matched lines × 2 locations) · ×1
Duplicated block with local edits (142 matched lines × 2 locations) packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:32— packages/@openmaic/editor/src/ui/line/LineFormatToolbar.tsx:32 · packages/@openmaic/editor/src/ui/text/TextFormatToolbar.tsx:53 — the two spans are one implementation copied and then locally edited — 724 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 (141 matched lines × 2 locations) · ×1
Duplicated block with local edits (141 matched lines × 2 locations) app/api/agent/owner-events/route.ts:73— app/api/agent/owner-events/route.ts:73 · app/api/agent/sessions/[id]/events/route.ts:90 — the two spans are one implementation copied and then locally edited — 763 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 (139 matched lines × 2 locations) · ×1
Duplicated block with local edits (139 matched lines × 2 locations) eval/orchestration/answer-content-runner.ts:193— eval/orchestration/answer-content-runner.ts:193 · eval/orchestration/answering-runner.ts:158 — the two spans are one implementation copied and then locally edited — 1117 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 (122 lines × 2 locations) lib/prosemirror/schema/nodes.ts:11— lib/prosemirror/schema/nodes.ts:11 · packages/@openmaic/editor/src/react/text/prosemirror/schema/nodes.ts:182 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of MODULE-LEVEL DECLARATIONS — bindings the module declares and exports — rather than statements with a call site. Do not read this as an extract-a-helper row: a call expression cannot stand where a declaration was, and putting one there would delete the names themselves, which are what the rest of the codebase imports. What actually repeats here is the INITIALISER — the same expression shape written once per binding. So give that expression one name (a small helper the initialisers call, or a shared base value they are each derived from) and keep every binding under the name it already has. Where the run is an enumeration — one binding per distinct thing, differing precisely in the thing each one names — the repetition IS the enumeration and collapsing it would delete entries; consider instead whether the set belongs in one exported table the individual names are read out of. Reported because the copies drift apart the first time only one of them is edited.
Duplicated block (121 lines × 3 locations) configs/shapes.ts:39— configs/shapes.ts:39 · packages/@openmaic/editor/src/ui/adapters/shapeFormulas.ts:13 · packages/@openmaic/importer/src/openmaic/configs/shapes.ts:39 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Wholesale file copy (111 identical lines × 2 files) lib/prosemirror/schema/marks.ts:1— lib/prosemirror/schema/marks.ts:1 · packages/@openmaic/editor/src/react/text/prosemirror/schema/marks.ts:1 — these 2 files are line-for-line copies of one another — 111 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 (98 matched lines × 2 locations) · ×1
Duplicated block with local edits (98 matched lines × 2 locations) components/ui/context-menu.tsx:119— components/ui/context-menu.tsx:119 · components/ui/dropdown-menu.tsx:77 — the two spans are one implementation copied and then locally edited — 348 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) lib/web-fetch/providers/deepseek.ts:8— lib/web-fetch/providers/deepseek.ts:8 · lib/web-fetch/providers/kimi.ts:18 — the two spans are one implementation copied and then locally edited — 546 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 (87 matched lines × 2 locations) · ×1
Duplicated block with local edits (87 matched lines × 2 locations) components/workbench/compose-extras.tsx:88— components/workbench/compose-extras.tsx:88 · components/workbench/course-mention-menu.tsx:199 — the two spans are one implementation copied and then locally edited — 533 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 (85 identical lines × 2 files) components/slide-renderer/components/element/LineElement/BaseLineElement.tsx:3— components/slide-renderer/components/element/LineElement/BaseLineElement.tsx:3 · packages/@openmaic/renderer/src/elements/line/BaseLineElement.tsx:3 — these 2 files are line-for-line copies of one another — 85 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
Duplicated block (82 lines × 2 locations) app/api/generate/image/route.ts:42— app/api/generate/image/route.ts:42 · app/api/generate/video/route.ts:44 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication· Duplicated block with local edits (76 matched lines × 2 locations) · ×1
Duplicated block with local edits (76 matched lines × 2 locations) app/api/verify-image-provider/route.ts:41— app/api/verify-image-provider/route.ts:41 · app/api/verify-video-provider/route.ts:41 — the two spans are one implementation copied and then locally edited — 592 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 (75 lines × 2 locations) components/agent/agent-bar.tsx:196— components/agent/agent-bar.tsx:196 · components/agent/agent-bar.tsx:466 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (74 matched lines × 2 locations) · ×1
Duplicated block with local edits (74 matched lines × 2 locations) packages/@openmaic/storage/src/material/pg.ts:98— packages/@openmaic/storage/src/material/pg.ts:98 · packages/@openmaic/storage/src/skill/pg.ts:98 — the two spans are one implementation copied and then locally edited — 430 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 (73 lines × 2 locations) components/agent/agent-bar.tsx:106— components/agent/agent-bar.tsx:106 · components/agent/agent-bar.tsx:387 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (73 matched lines × 2 locations) · ×1
Duplicated block with local edits (73 matched lines × 2 locations) components/stage/scene-sidebar.tsx:219— components/stage/scene-sidebar.tsx:219 · components/stage/scene-thumbnail-content.tsx:64 — the two spans are one implementation copied and then locally edited — 292 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 (71 matched lines × 2 locations) · ×1
Duplicated block with local edits (71 matched lines × 2 locations) lib/workbench/course-refs.ts:81— lib/workbench/course-refs.ts:81 · lib/workbench/element-refs.ts:315 — the two spans are one implementation copied and then locally edited — 504 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (66 matched lines × 2 locations) · ×1
Duplicated block with local edits (66 matched lines × 2 locations) components/edit/surfaces/slide/CanvasOverlayPortal.tsx:79— components/edit/surfaces/slide/CanvasOverlayPortal.tsx:79 · components/edit/surfaces/slide/use-tracked-rect.ts:6 — the two spans are one implementation copied and then locally edited — 447 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 (65 matched lines × 2 locations) · ×1
Duplicated block with local edits (65 matched lines × 2 locations) components/settings/asr-settings.tsx:208— components/settings/asr-settings.tsx:208 · components/settings/tts-settings.tsx:239 — the two spans are one implementation copied and then locally edited — 324 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 (64 matched lines × 2 locations) · ×1
Duplicated block with local edits (64 matched lines × 2 locations) REDACTED:20— REDACTED:20 · packages/@openmaic/renderer/src/elements/table/StaticTable.tsx:9 — the two spans are one implementation copied and then locally edited — 490 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 (62 matched lines × 2 locations) · ×1
Duplicated block with local edits (62 matched lines × 2 locations) packages/@openmaic/editor/src/react/useLineHandleGesture.ts:65— packages/@openmaic/editor/src/react/useLineHandleGesture.ts:65 · packages/@openmaic/editor/src/react/useResizeGesture.ts:107 — the two spans are one implementation copied and then locally edited — 357 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 presentTool (cyclomatic 232, cognitive 325) components/workbench/chat/tool-presentation.ts:286— presentTool has cyclomatic complexity 232 and cognitive complexity 325; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 Roundtable (cyclomatic 225, cognitive 205) components/roundtable/index.tsx:156— Roundtable has cyclomatic complexity 225 and cognitive complexity 205; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 renderTextBody (cyclomatic 222, cognitive 509) packages/@openmaic/importer/src/serializer/textSerializer.ts:1066— renderTextBody has cyclomatic complexity 222 and cognitive complexity 509; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 parseElements (cyclomatic 186, cognitive 444) packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:498— parseElements has cyclomatic complexity 186 and cognitive complexity 444; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 PBLV3WorkspaceContent (cyclomatic 185, cognitive 151) components/scene-renderers/pbl/v3/workspace.tsx:65— PBLV3WorkspaceContent has cyclomatic complexity 185 and cognitive complexity 151; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 buildPptxBlob (cyclomatic 183, cognitive 640) REDACTED:544— buildPptxBlob has cyclomatic complexity 183 and cognitive complexity 640; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 renderShape (cyclomatic 173, cognitive 210) packages/@openmaic/importer/src/serializer/shapeSerializer.ts:839— renderShape has cyclomatic complexity 173 and cognitive complexity 210; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 foldEvent (cyclomatic 143, cognitive 201) lib/workbench/session-store.ts:940— foldEvent has cyclomatic complexity 143 and cognitive complexity 201; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 executeSession (cyclomatic 136, cognitive 203) lib/server/agent-runtime/runner.ts:1043— executeSession has cyclomatic complexity 136 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 validateProjectPackage (cyclomatic 122, cognitive 158) lib/server/pbl-v3/project-package.ts:172— validateProjectPackage has cyclomatic complexity 122 and cognitive complexity 158; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 execute (cyclomatic 106, cognitive 170) lib/server/pbl-v3/runtime.ts:539— execute has cyclomatic complexity 106 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 learningView (cyclomatic 99, cognitive 133) lib/server/pbl-v3/runtime.ts:988— learningView has cyclomatic complexity 99 and cognitive complexity 133; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 planModelSettingsImport (cyclomatic 97, cognitive 188) lib/legacy-browser-import/model-settings.ts:297— planModelSettingsImport has cyclomatic complexity 97 and cognitive complexity 188; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 buildLearningEvidence (cyclomatic 92, cognitive 135) lib/server/pbl-v3/report.ts:30— buildLearningEvidence has cyclomatic complexity 92 and cognitive complexity 135; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 HomePage (cyclomatic 91, cognitive 83) app/page.tsx:161— HomePage has cyclomatic complexity 91 and cognitive complexity 83; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function renderTmpl (cyclomatic 89, cognitive 114) packages/@openmaic/importer/src/utils/mtef.ts:753— renderTmpl has cyclomatic complexity 89 and cognitive complexity 114; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 LearningWorkbenchPanel (cyclomatic 88, cognitive 67) components/scene-renderers/pbl/v3/workbench-panel.tsx:51— LearningWorkbenchPanel has cyclomatic complexity 88 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function projectConversation (cyclomatic 87, cognitive 233) lib/server/pbl-v3/conversation.ts:68— projectConversation has cyclomatic complexity 87 and cognitive complexity 233; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 analyzeMaterial (cyclomatic 85, cognitive 108) lib/server/generation/steps/material-analysis.ts:193— analyzeMaterial has cyclomatic complexity 85 and cognitive complexity 108; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 84, cognitive 145) lib/server/pbl-v3/lifecycle.ts:260— (anonymous) has cyclomatic complexity 84 and cognitive complexity 145; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· packages/@openmaic/importer/src/shapes/presets.ts · ×1
packages/@openmaic/importer/src/shapes/presets.ts: 6087 lines of code packages/@openmaic/importer/src/shapes/presets.ts:1— packages/@openmaic/importer/src/shapes/presets.ts has 6087 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
lib/ai/providers.ts: 2814 lines of code lib/ai/providers.ts:1— lib/ai/providers.ts has 2814 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· lib/server/agent-runtime/runner.ts · ×1
lib/server/agent-runtime/runner.ts: 2379 lines of code lib/server/agent-runtime/runner.ts:1— lib/server/agent-runtime/runner.ts has 2379 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· components/workbench/workspace/WorkspaceRail.tsx · ×1
components/workbench/workspace/WorkspaceRail.tsx: 2362 lines of code components/workbench/workspace/WorkspaceRail.tsx:1— components/workbench/workspace/WorkspaceRail.tsx has 2362 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
app/page.tsx: 2292 lines of code app/page.tsx:1— app/page.tsx has 2292 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· lib/workbench/session-store.ts · ×1
lib/workbench/session-store.ts: 2276 lines of code lib/workbench/session-store.ts:1— lib/workbench/session-store.ts has 2276 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· components/roundtable/index.tsx · ×1
components/roundtable/index.tsx: 2227 lines of code components/roundtable/index.tsx:1— components/roundtable/index.tsx has 2227 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· components/chat/use-chat-sessions.ts · ×1
components/chat/use-chat-sessions.ts: 1998 lines of code components/chat/use-chat-sessions.ts:1— components/chat/use-chat-sessions.ts has 1998 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· components/edit/PlaybackChromeRoot.tsx · ×1
components/edit/PlaybackChromeRoot.tsx: 1987 lines of code components/edit/PlaybackChromeRoot.tsx:1— components/edit/PlaybackChromeRoot.tsx has 1987 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· components/workbench/workspace/WorkspaceShell.tsx · ×1
components/workbench/workspace/WorkspaceShell.tsx: 1945 lines of code components/workbench/workspace/WorkspaceShell.tsx:1— components/workbench/workspace/WorkspaceShell.tsx has 1945 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· components/workbench/workspace/MaterialLibraryPage.tsx · ×1
components/workbench/workspace/MaterialLibraryPage.tsx: 1908 lines of code components/workbench/workspace/MaterialLibraryPage.tsx:1— components/workbench/workspace/MaterialLibraryPage.tsx has 1908 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: 1895 lines of code REDACTED:1— REDACTED has 1895 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/@openmaic/importer/src/serializer/textSerializer.ts · ×1
packages/@openmaic/importer/src/serializer/textSerializer.ts: 1884 lines of code packages/@openmaic/importer/src/serializer/textSerializer.ts:1— packages/@openmaic/importer/src/serializer/textSerializer.ts has 1884 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· lib/server/generation/run/engine.ts · ×1
lib/server/generation/run/engine.ts: 1815 lines of code lib/server/generation/run/engine.ts:1— lib/server/generation/run/engine.ts has 1815 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/@openmaic/storage/src/agent-session/pg.ts · ×1
packages/@openmaic/storage/src/agent-session/pg.ts: 1814 lines of code packages/@openmaic/storage/src/agent-session/pg.ts:1— packages/@openmaic/storage/src/agent-session/pg.ts has 1814 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· lib/pbl/v2/agents/instructor.ts · ×1
lib/pbl/v2/agents/instructor.ts: 1741 lines of code lib/pbl/v2/agents/instructor.ts:1— lib/pbl/v2/agents/instructor.ts has 1741 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
lib/audio/constants.ts: 1722 lines of code lib/audio/constants.ts:1— lib/audio/constants.ts has 1722 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· lib/server/generation/run/store.ts · ×1
lib/server/generation/run/store.ts: 1635 lines of code lib/server/generation/run/store.ts:1— lib/server/generation/run/store.ts has 1635 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/@openmaic/storage/src/document/pg.ts · ×1
packages/@openmaic/storage/src/document/pg.ts: 1592 lines of code packages/@openmaic/storage/src/document/pg.ts:1— packages/@openmaic/storage/src/document/pg.ts has 1592 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
lib/store/stage.ts: 1590 lines of code lib/store/stage.ts:1— lib/store/stage.ts has 1590 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· lib/chat/pi/element-reference.ts · ×1
lib/chat/pi/element-reference.ts: 1567 lines of code lib/chat/pi/element-reference.ts:1— lib/chat/pi/element-reference.ts has 1567 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts · ×1
packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts: 1487 lines of code packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts:1— packages/@openmaic/importer/src/import-pipeline/transformParsedToSlides.ts has 1487 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/@openmaic/storage/src/asset/pg.ts · ×1
packages/@openmaic/storage/src/asset/pg.ts: 1482 lines of code packages/@openmaic/storage/src/asset/pg.ts:1— packages/@openmaic/storage/src/asset/pg.ts has 1482 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· components/scene-renderers/pbl/v2/chat.tsx · ×1
components/scene-renderers/pbl/v2/chat.tsx: 1474 lines of code components/scene-renderers/pbl/v2/chat.tsx:1— components/scene-renderers/pbl/v2/chat.tsx has 1474 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: 1469 lines of code REDACTED:1— REDACTED has 1469 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· components/generation/outlines-editor.tsx · ×1
components/generation/outlines-editor.tsx: 1453 lines of code components/generation/outlines-editor.tsx:1— components/generation/outlines-editor.tsx has 1453 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· components/edit/ActionsBar/ActionsBar.tsx · ×1
components/edit/ActionsBar/ActionsBar.tsx: 1452 lines of code components/edit/ActionsBar/ActionsBar.tsx:1— components/edit/ActionsBar/ActionsBar.tsx has 1452 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
lib/audio/tts-providers.ts: 1449 lines of code lib/audio/tts-providers.ts:1— lib/audio/tts-providers.ts has 1449 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
lib/utils/stage-storage.ts: 1399 lines of code lib/utils/stage-storage.ts:1— lib/utils/stage-storage.ts has 1399 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· lib/server/pbl-v3/runtime.ts · ×1
lib/server/pbl-v3/runtime.ts: 1373 lines of code lib/server/pbl-v3/runtime.ts:1— lib/server/pbl-v3/runtime.ts has 1373 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· components/workbench/WorkbenchChat.tsx · ×1
components/workbench/WorkbenchChat.tsx: 1370 lines of code components/workbench/WorkbenchChat.tsx:1— components/workbench/WorkbenchChat.tsx has 1370 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· components/scene-renderers/pbl/v2/submission.tsx · ×1
components/scene-renderers/pbl/v2/submission.tsx: 1341 lines of code components/scene-renderers/pbl/v2/submission.tsx:1— components/scene-renderers/pbl/v2/submission.tsx has 1341 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· lib/video-export/emit-hyperframes/index.ts · ×1
lib/video-export/emit-hyperframes/index.ts: 1320 lines of code lib/video-export/emit-hyperframes/index.ts:1— lib/video-export/emit-hyperframes/index.ts has 1320 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· lib/persistence/owner-materials.ts · ×1
lib/persistence/owner-materials.ts: 1316 lines of code lib/persistence/owner-materials.ts:1— lib/persistence/owner-materials.ts 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· packages/@openmaic/storage/src/asset/collector.ts · ×1
packages/@openmaic/storage/src/asset/collector.ts: 1292 lines of code packages/@openmaic/storage/src/asset/collector.ts:1— packages/@openmaic/storage/src/asset/collector.ts has 1292 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· lib/server/agent-runtime/dsl-tools.ts · ×1
lib/server/agent-runtime/dsl-tools.ts: 1284 lines of code lib/server/agent-runtime/dsl-tools.ts:1— lib/server/agent-runtime/dsl-tools.ts has 1284 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· components/scene-renderers/pbl/v3/workspace.tsx · ×1
components/scene-renderers/pbl/v3/workspace.tsx: 1252 lines of code components/scene-renderers/pbl/v3/workspace.tsx:1— components/scene-renderers/pbl/v3/workspace.tsx has 1252 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
lib/utils/chat-storage.ts: 1239 lines of code lib/utils/chat-storage.ts:1— lib/utils/chat-storage.ts has 1239 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/@openmaic/importer/src/serializer/shapeSerializer.ts · ×1
packages/@openmaic/importer/src/serializer/shapeSerializer.ts: 1211 lines of code packages/@openmaic/importer/src/serializer/shapeSerializer.ts:1— packages/@openmaic/importer/src/serializer/shapeSerializer.ts has 1211 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· lib/server/agent-runtime/material-tools.ts · ×1
lib/server/agent-runtime/material-tools.ts: 1157 lines of code lib/server/agent-runtime/material-tools.ts:1— lib/server/agent-runtime/material-tools.ts has 1157 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling· The declared test suite includes a file that cannot be loaded · ×1
The declared test suite includes a file that cannot be loaded packages/@openmaic/generation/test/interactive-library-mapper.test.ts:99— This repository declares test tooling, and the ✓ above records that declaration — but packages/@openmaic/generation/test/interactive-library-mapper.test.ts and 1 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to.
Dead file (~1670 LoC) configs/symbol.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~1262 LoC) components/ai-elements/prompt-input.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~374 LoC) components/ai-elements/message.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~354 LoC) components/ai-elements/context.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~335 LoC) components/ai-elements/open-in-chat.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~299 LoC) eval/whiteboard-shapes/runner.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~275 LoC) components/ui/combobox.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~274 LoC) configs/latex.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~255 LoC) components/ai-elements/inline-citation.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~234 LoC) configs/animation.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~233 LoC) components/ai-elements/web-preview.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~230 LoC) components/user-profile.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~224 LoC) components/ui/field.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~200 LoC) packages/@openmaic/importer/src/export/serializePresentation.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~198 LoC) components/ai-elements/chain-of-thought.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~180 LoC) components/ui/command.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (components/ai-elements/model-selector.tsx, components/ai-elements/prompt-input.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~174 LoC) components/ai-elements/code-block.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (components/ai-elements/tool.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~173 LoC) components/ai-elements/reasoning.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~170 LoC) components/ai-elements/model-selector.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~147 LoC) components/ai-elements/confirmation.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~136 LoC) components/ai-elements/tool.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~131 LoC) components/ai-elements/edge.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~129 LoC) lib/hooks/use-streaming-text.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~126 LoC) configs/theme.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~123 LoC) components/ai-elements/plan.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~118 LoC) components/ai-elements/artifact.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~91 LoC) lib/chat/action-translations.ts— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~88 LoC) configs/chart.ts— no import path from any entry point (583 application, 46 tooling, 1573 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 (~87 LoC) components/ai-elements/conversation.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~85 LoC) components/ai-elements/loader.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~83 LoC) components/scene-renderers/quiz-renderer.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~78 LoC) components/ui/button-group.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (components/ai-elements/message.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~75 LoC) components/classroom/CourseGeneratingPlaceholder.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~67 LoC) components/ai-elements/shimmer.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (components/ai-elements/plan.tsx, components/ai-elements/reasoning.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~64 LoC) components/ai-elements/task.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~63 LoC) components/ai-elements/node.tsx— no import path from any entry point (583 application, 46 tooling, 1573 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 (~55 LoC) components/ui/scroll-area.tsx— no import path from any entry point (583 application, 46 tooling, 1573 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (components/ai-elements/queue.tsx, components/ai-elements/suggestion.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Unused dependency '@ai-sdk/react' — Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@alicloud/credentials' — Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@copilotkit/backend' — Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Third-party script without Subresource Integrity packages/@openmaic/importer/index.html:24— `https://cdn.jsdelivr.net/npm/jsoneditor@9.9.2/dist/jsoneditor.min.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. 2 such include(s) across the repository's markup.
Mock-dominated test: waits while the gate has not answered, holding the composer, then stages it tests/workbench/material-seed.test.ts:294— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 6 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: ends the hand-over, staging nothing, when the gate answers no tests/workbench/material-seed.test.ts:313— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does not hold a composer the hand-over is not for tests/workbench/material-seed.test.ts:326— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: publishes a title event even when the attached row has not reached the list yet tests/workbench/owner-session-client.test.ts:492— 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: wires an unknown session event to a full fetch tests/workbench/owner-session-client.test.ts:560— 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: reports a stream stuck connecting, and does so on samples rather than wall clock tests/workbench/owner-session-client.test.ts:850— This test sets up 4 test doubles (for example `vi.fn`) against 2 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: does not report a dead stream after a long gap with no samples tests/workbench/owner-session-client.test.ts:887— This test sets up 4 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: returns the list to ready on a successful fetch even while the stream is degraded tests/workbench/owner-session-client.test.ts:912— This test sets up 4 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: forces one reconciliation after five consecutive malformed events tests/workbench/owner-session-client.test.ts:1010— 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: makes one steady-state full request per minute with per-tab jitter tests/workbench/owner-session-client.test.ts:1064— This test sets up 3 test doubles (for example `vi.fn`) against 2 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: reorders a row at the hit-tested insertion edge tests/workbench/use-tree-drag.test.ts:85— This test sets up 4 test doubles (for example `vi.fn`) against 3 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: threads the caller AbortSignal through every registered provider adapter tests/web-search/index.test.ts:382— This test sets up 12 test doubles (for example `a double assigned in a shared setup`) 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: ignores unrelated database writes and current-scene selection tests/video-export/video-render-cache.test.ts:247— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 0 real object(s) of its own, and its only verification is 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: invalidates when the asset pool reports a same-id replacement tests/video-export/video-render-cache.test.ts:256— 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 repopulate a cache invalidated during compilation: %s tests/video-export/video-render-cache.test.ts:306— This test sets up 3 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: releases change listeners when idle, but keeps them across retries tests/video-export/video-render-cache.test.ts:368— This test sets up 4 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 6 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: re-checks immediately before the aggregate write (delete lands inside the runtime-lock window) tests/utils/stage-storage-deletion.test.ts:531— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: deletes the stage media cache rows without touching registry entries or the audio cache tests/utils/stage-storage-deletion.test.ts:559— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 2 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: moves a user-set preset selection aside for the roster and keeps it tests/store/stage-agents.test.ts:211— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 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: restores the kept preset choice when the roster it stepped aside for empties tests/store/stage-agents.test.ts:235— This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 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: drains and exits when the first scan refuses the schema before registration completes tests/server/runtime-schema-startup.test.ts:77— This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: tracks input before iframe load, follows document replacement and does not duplicate listeners tests/sandbox/preview-activity.test.ts:71— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: promotes parsed HTML at %s without waiting for pending images or the iframe load event tests/sandbox/preview-readiness.test.ts:13— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does not promote an unparsed or blank document, and reports non-HTML as an error tests/sandbox/preview-readiness.test.ts:33— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: cancels a busy retry when disposed and never retries a permission rejection tests/sandbox/terminal-input.test.ts:79— This test sets up 4 test doubles (for example `vi
.fn`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
+ 41 more in this group — see findings.md.
P2 · Observability· Console output used as the logging channel · ×39
Console output used as the logging channel instrumentation.ts:121— `instrumentation.ts` reports through `console.*` at line 121 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 instrumentation.ts:132— `instrumentation.ts` reports through `console.*` at line 132 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 instrumentation.ts:137— `instrumentation.ts` reports through `console.*` at line 137 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 instrumentation.ts:149— `instrumentation.ts` reports through `console.*` at line 149 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 instrumentation.ts:154— `instrumentation.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 instrumentation.ts:159— `instrumentation.ts` reports through `console.*` at line 159 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 instrumentation.ts:172— `instrumentation.ts` reports through `console.*` at line 172 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 instrumentation.ts:184— `instrumentation.ts` reports through `console.*` at line 184 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 instrumentation.ts:195— `instrumentation.ts` reports through `console.*` at line 195 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 instrumentation.ts:213— `instrumentation.ts` reports through `console.*` at line 213 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 instrumentation.ts:224— `instrumentation.ts` reports through `console.*` at line 224 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 instrumentation.ts:259— `instrumentation.ts` reports through `console.*` at line 259 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 instrumentation.ts:260— `instrumentation.ts` reports through `console.*` at line 260 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 instrumentation.ts:267— `instrumentation.ts` reports through `console.*` at line 267 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 instrumentation.ts:268— `instrumentation.ts` reports through `console.*` at line 268 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 instrumentation.ts:272— `instrumentation.ts` reports through `console.*` at line 272 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 lib/workbench/use-workbench-session.ts:566— `lib/workbench/use-workbench-session.ts` reports through `console.*` at line 566 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 lib/workbench/use-workbench-session.ts:585— `lib/workbench/use-workbench-session.ts` reports through `console.*` at line 585 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 lib/workbench/use-workbench-session.ts:687— `lib/workbench/use-workbench-session.ts` reports through `console.*` at line 687 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 lib/workbench/use-workbench-session.ts:820— `lib/workbench/use-workbench-session.ts` reports through `console.*` at line 820 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 lib/workbench/use-workbench-session.ts:869— `lib/workbench/use-workbench-session.ts` reports through `console.*` at line 869 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 lib/video-export-app/build-export-zip.ts:59— `lib/video-export-app/build-export-zip.ts` reports through `console.*` at line 59 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 lib/utils/chat-storage.ts:201— `lib/utils/chat-storage.ts` reports through `console.*` at line 201 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 lib/utils/chat-storage.ts:542— `lib/utils/chat-storage.ts` reports through `console.*` at line 542 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 lib/utils/chat-storage.ts:1256— `lib/utils/chat-storage.ts` reports through `console.*` at line 1256 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
redundant comment app/api/azure-voices/route.ts:44— "Validate baseUrl against SSRF" repeats the code it sits on: 4 of its 5 words (validate, base, url, ssrf) are already in `const ssrfError = await validateClientBaseUrl(baseUrl);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/ai-elements/queue.tsx:191— "QueueSectionLabel - label content with icon and count" repeats the code it sits on: 5 of its 6 words (queue, section, label, icon, count) are already in `export type QueueSectionLabelProps = ComponentProps<'span'> & {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/ai-elements/queue.tsx:214— "QueueSectionContent - collapsible content area" repeats the code it sits on: 4 of its 5 words (queue, section, content, collapsible) are already in `export type QueueSectionContentProps = ComponentProps<typeof CollapsibleContent>;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/chat/chat-area.tsx:159— "Filter out lecture sessions for the Chat tab" repeats the code it sits on: 4 of its 5 words (filter, lecture, sessions, chat) are already in `const chatSessions = useMemo(() => sessions.filter((s) => s.type !== 'lecture'), [sessions]);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/chat/use-chat-sessions.ts:1979— "Check for existing lecture session with same sceneId (active or completed)" repeats the code it sits on: 8 of its 8 words (check, existing, lecture, session, scene, id, active, completed) are already in `const existing = sessions.find(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/chat/use-chat-sessions.ts:2074— "Update lastActionIndex in session" repeats the code it sits on: 4 of its 5 words (last, action, index, session) are already in `setSessions((prev) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/edit/PlaybackChromeRoot.tsx:254— "Selected agents from settings store (Zustand)" repeats the code it sits on: 4 of its 5 words (selected, agents, settings, store) are already in `const selectedAgentIds = useSettingsStore((s) => s.selectedAgentIds);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/edit/PlaybackChromeRoot.tsx:805— "Create new PlaybackEngine" repeats the code it sits on: 4 of its 4 words (create, new, playback, engine) are already in `const engine = new PlaybackEngine([currentScene], actionEngine, audioPlayerRef.current, {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/slide-renderer/Editor/Canvas/hooks/useCommonOperate.ts:40— "Text element resize handlers" repeats the code it sits on: 4 of its 4 words (text, element, resize, handlers) are already in `const textElementResizeHandlers = useMemo(() =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/slide-renderer/components/element/ImageElement/ImageClipHandler.tsx:445— "Rotate class name" repeats the code it sits on: 3 of its 3 words (rotate, class, name) are already in `const rotateClassName = useMemo(() =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/slide-renderer/components/element/ProsemirrorEditor.tsx:89— "Handle input with debounce" repeats the code it sits on: 3 of its 3 words (handle, input, debounce) are already in `const handleInput = useMemo(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/slide-renderer/components/element/ProsemirrorEditor.tsx:450— "Sync attrs to store" repeats the code it sits on: 3 of its 3 words (sync, attrs, store) are already in `const syncAttrsToStore = useCallback(() =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/slide-renderer/components/element/ShapeElement/index.tsx:99— "Update text content" repeats the code it sits on: 3 of its 3 words (update, text, content) are already in `const updateText = useCallback(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment components/workbench/workspace/WorkspaceShell.tsx:1002— "This request is creating a course of its own (its create_stage has started)." repeats the code it sits on: 5 of its 6 words (request, creating, create, stage, started) are already in `const creatingInRequest = useWorkbenchStore((s) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment e2e/tests/slide-editor-double-click-insert.spec.ts:56— "Get initial count of editable elements" repeats the code it sits on: 4 of its 5 words (initial, count, editable, elements) are already in `const initialElementCount = await page.locator('.editable-element').count();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/audio/voice-resolver.ts:373— "voices grouped by model" repeats the code it sits on: 3 of its 3 words (voices, grouped, model) are already in `modelGroups: ModelVoiceGroup[];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/hooks/use-audio-recorder.ts:331— "Create MediaRecorder" repeats the code it sits on: 3 of its 3 words (create, media, recorder) are already in `const mediaRecorder = new MediaRecorder(stream, {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/hooks/use-slide-background-style.ts:31— "Solid color background" repeats the code it sits on: 3 of its 3 words (solid, color, background) are already in `if (type === 'solid') return { backgroundColor: color };`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/persistence/owner-materials.ts:612— "An extraction's stored result counts as the owner's bytes too." repeats the code it sits on: 5 of its 6 words (extraction, result, counts, owner, bytes) are already in `const usage = await tx.query<{ count: number | string; total_bytes: number | string }>(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/server/generation/steps/scene-actions.ts:171— "── Build complete scene ──" repeats the code it sits on: 3 of its 3 words (build, complete, scene) are already in `const scene = buildCompleteScene(outline, generationContent, actions, stageId);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/server/model-config/runtime.ts:282— "A deployment's provider of the same id outranks the workspace's." repeats the code it sits on: 4 of its 5 words (deployment, provider, id, workspace) are already in `if (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/store/canvas.ts:73— "Spotlight mode: pixel or percentage" repeats the code it sits on: 4 of its 4 words (spotlight, mode, pixel, percentage) are already in `spotlightMode: 'pixel' | 'percentage';`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/store/canvas.ts:112— "Text format painter" repeats the code it sits on: 3 of its 3 words (text, format, painter) are already in `textFormatPainter: TextFormatPainter | null;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/store/canvas.ts:113— "Shape format painter" repeats the code it sits on: 3 of its 3 words (shape, format, painter) are already in `shapeFormatPainter: ShapeFormatPainter | null;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment lib/store/canvas.ts:133— "Selected table cells" repeats the code it sits on: 3 of its 3 words (selected, table, cells) are already in `selectedTableCells: string[];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
Duplicated predicate packages/@openmaic/dsl/src/course-issues.ts:62— `!!value && /^gen_(img|vid)_[\w-]+$/i.test(value)` appears character-identically in 2 files — packages/@openmaic/dsl/src/course-issues.ts, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/utils/geometry.ts:17— `!('left' in element) || !('top' in element) || !('width' in element) || !('height' in element)` appears character-identically in 3 files — lib/utils/geometry.ts, lib/video-export/geometry.ts, packages/@openmaic/renderer/src/utils/geometry.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 components/slide-renderer/components/element/ChartElement/chartOption.ts:74— `!Array.isArray(data?.series) || data.series.length === 0 || !Array.isArray(data.labels)` appears character-identically in 2 files — components/slide-renderer/components/element/ChartElement/chartOption.ts, packages/@openmaic/renderer/src/elements/chart/chartOption.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 lib/chat/pi/tools/call-agent.ts:219— `!Array.isArray(value) || value.length === 0` appears character-identically in 3 files — lib/chat/pi/tools/call-agent.ts, lib/chat/pi/tools/classroom-actions.ts, lib/whiteboard/runtime/validate.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 lib/persistence/owner-material-extraction.ts:260— `!Number.isSafeInteger(options.leaseTtlMs) || options.leaseTtlMs <= 0` appears character-identically in 2 files — lib/persistence/owner-material-extraction.ts, packages/@openmaic/storage/src/material/pg.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 lib/persistence/asset-collection-grace.ts:21— `!Number.isSafeInteger(parsed) || parsed < 0` appears character-identically in 2 files — lib/persistence/asset-collection-grace.ts, lib/persistence/asset-quota.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 lib/web-search/deepseek-endpoint.ts:5— `!['http:', 'https:'].includes(base.protocol) || base.search || base.hash || base.username || base.password` appears character-identically in 2 files — lib/web-search/deepseek-endpoint.ts, lib/web-search/firecrawl-endpoint.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/@openmaic/editor/src/react/useLineCreateGesture.ts:60— `!active || !onCreate || event.button !== 0 || activePointerRef.current !== null` appears character-identically in 2 files — packages/@openmaic/editor/src/react/useLineCreateGesture.ts, packages/@openmaic/editor/src/react/useTextCreateGesture.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/@openmaic/editor/src/ui/audio/AudioToolbarOverlay.tsx:89— `!anchor || typeof document === 'undefined'` appears character-identically in 6 files — packages/@openmaic/editor/src/ui/audio/AudioToolbarOverlay.tsx, packages/@openmaic/editor/src/ui/element/ElementToolbarOverlay.tsx, packages/@openmaic/editor/src/ui/latex/LatexToolbarOverlay.tsx, packages/@openmaic/editor/src/ui/line/LineToolbarOverlay.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 lib/document/transforms/noise-removal.ts:69— `!citation.blockId || !removedBlockIds.has(citation.blockId)` appears character-identically in 2 files — lib/document/transforms/noise-removal.ts, lib/document/transforms/normalize.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 lib/chat/pi/tools/call-agent.ts:234— `!data || typeof data !== 'object' || Array.isArray(data)` appears character-identically in 4 files — lib/chat/pi/tools/call-agent.ts, lib/persistence/owner-bound-document-store.ts, lib/server/agent-runtime/runner.ts, lib/workbench/media-lifecycle.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 lib/server/pbl-v3/conversation.ts:164— `!data.pblOpening && typeof data.text === 'string'` appears character-identically in 2 files — lib/server/pbl-v3/conversation.ts, lib/server/pbl-v3/report.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 lib/persistence/plain-json.ts:65— `!descriptor?.enumerable || descriptor.get || descriptor.set` appears character-identically in 2 files — lib/persistence/plain-json.ts, lib/whiteboard/runtime/validate.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 REDACTED:426— `!dragging || e.pointerId !== activePointer` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/model-settings/capabilities.ts:54— `!effective || effective.status !== 'assigned'` appears character-identically in 2 files — lib/model-settings/capabilities.ts, lib/model-settings/services.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/@openmaic/renderer/src/snapshot/index.ts:174— `!el.textContent || !el.textContent.trim()` appears character-identically in 2 files — packages/@openmaic/renderer/src/snapshot/index.ts, packages/@openmaic/renderer/src/snapshot/measure.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 lib/chat/pi/element-reference.ts:601— `!element || typeof element !== 'object' || Array.isArray(element)` appears character-identically in 2 files — lib/chat/pi/element-reference.ts, lib/server/agent-runtime/course-edit/element-schema.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 lib/workbench/course-refs.ts:102— `!entry || typeof entry !== 'object' || Array.isArray(entry)` appears character-identically in 2 files — lib/workbench/course-refs.ts, lib/workbench/element-refs.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 components/slide-renderer/Editor/Canvas/hooks/useDragElement.ts:86— `!isActiveGroupElement && activeElementIdList.includes(el.id)` appears character-identically in 2 files — components/slide-renderer/Editor/Canvas/hooks/useDragElement.ts, components/slide-renderer/Editor/Canvas/hooks/useScaleElement.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 lib/pbl/v2/types.ts:629— `!isObjectArray(value.milestones) || !isObjectArray(value.roles) || !isObjectArray(value.submissions) || !isObjectArray(value.evaluations) ||…` appears character-identically in 2 files — lib/pbl/v2/types.ts, packages/@openmaic/generation/src/pbl/types.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 lib/server/agent-runtime/scene-preview-content.ts:249— `!isRecord(canvas) || !Array.isArray(canvas.elements)` appears character-identically in 2 files — lib/server/agent-runtime/scene-preview-content.ts, render-service/src/preview-validation.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 components/workbench/ProLaunchPanel.tsx:413— `!materials.enabled || !composerTransferHasImages(event.dataTransfer)` appears character-identically in 2 files — components/workbench/ProLaunchPanel.tsx, components/workbench/WorkbenchChat.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 app/api/verify-image-provider/route.ts:114— `!model && provider?.models && provider.models.length > 0` appears character-identically in 2 files — app/api/verify-image-provider/route.ts, lib/server/generation/steps/image.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/@openmaic/storage/src/document/browser.ts:113— `!needsMigration(versioned) && dslVersionOf(versioned) !== DSL_VERSION` appears character-identically in 2 files — packages/@openmaic/storage/src/document/browser.ts, packages/@openmaic/storage/src/document/pg.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate packages/@openmaic/storage/src/runtime/browser.ts:119— `!needsRuntimeMigration(row) && runtimeDslVersionOf(row) !== RUNTIME_DSL_VERSION` appears character-identically in 2 files — packages/@openmaic/storage/src/runtime/browser.ts, packages/@openmaic/storage/src/runtime/pg.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 lib/config/app-attribution.ts:37— `hostnameOf` 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 lib/legacy-browser-import/agents-import.ts:110— `readLegacyCustomAgents` 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 lib/model-settings/client.ts:74— `errorBody` 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 lib/server/agent-runtime/session-materials.ts:125— `rawObjectMime` swallows every exception into `return 'application/octet-stream'` — 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 lib/server/materials/inline-images.ts:141— `pixelSize` 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 lib/server/usage-storage.ts:183— `readUsageRecords` 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 lib/standalone-player/playback/media-library.ts:50— `readTable` 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 lib/workbench/session-store.ts:605— `readPanelPreference` 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 lib/workbench/material-mention.ts:136— `fetchMaterialMentionListing` 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 lib/workbench/preview-tab.ts:27— `readAll` 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 render-service/src/chunk-executor.ts:361— `readPlanCaptureMode` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch render-service/src/preview-renderer.ts:392— `requestProtocol` 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.
Hand-rolled JSON/XML parsing via regex REDACTED:1432— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex REDACTED:1578— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex REDACTED:90— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex REDACTED:93— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex lib/server/generation/steps/outline.ts:74— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex lib/server/generation/steps/outline.ts:89— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex REDACTED:26— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex REDACTED:50— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
X7 · Silent fallback defaults· Pending state with no failure state · ×7
Pending state with no failure state components/stage/video-export-dialog.tsx:212— The view draws `<Loader2 class="w-3 h-3 animate-spin"/>` under `downloading`, but `downloading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state components/stage/video-export-dialog.tsx:222— The view draws `<div>` under `rendering`, but `rendering` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state components/stage/video-export-dialog.tsx:243— The view draws `<Loader2 class="w-3.5 h-3.5 animate-spin"/>` under `rendering`, but `rendering` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state components/stage/video-export-dialog.tsx:267— The view draws `<Loader2 class="w-3.5 h-3.5 animate-spin"/>` under `isExportingVideo`, but `isExportingVideo` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state components/settings/general-settings.tsx:211— The view draws `<Loader2 class="w-4 h-4 mr-1.5 animate-spin"/>` under `clearing`, but `clearing` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state components/settings/usage-dashboard.tsx:183— The view draws `<Loader2 class="h-3.5 w-3.5 animate-spin"/>` under `loading`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state components/audio/speech-button.tsx:130— The view draws `<Loader2 className= />` under `isProcessing || isStarting`, but `isProcessing` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Fat interface: ChatAreaRef (19 required operations) components/chat/chat-area.tsx:61— `ChatAreaRef` declares 19 required operations: `createSession`, `endSession`, `endActiveSession`, `stopActiveSession`, `continueActiveSoftClosingSession`, `softPauseActiveSession`, `resumeActiveSession`, `sendMessage`, `startDiscussion`, `startLecture`, `addLectureMessage`, `getIsStreaming`, `getActiveSessionType`, `getLectureMessageId`, `pauseBuffer`, `resumeBuffer`, `pauseActiveLiveBuffer`, `resumeActiveLiveBuffer`, `switchToTab`. 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: SandboxProvider (25 required operations) lib/sandbox/types.ts:64— `SandboxProvider` declares 25 required operations: `exportWorkspace`, `importWorkspace`, `initializeWorkspace`, `listWorkspace`, `renew`, `nativePreview`, `previewLifetime`, `openPreviewConnection`, `create`, `find`, `inspect`, `destroy`, `readText`, `writeText`, `startCommand`, `readCommand`, `cancelCommand`, `desktopScreenshot`, `desktopAction`, `createTerminal`, `findTerminal`, `terminalInput`, `resizeTerminal`, `closeTerminal`, `terminalStream`. 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: RunStepServices (17 required operations) lib/server/generation/run/services.ts:166— `RunStepServices` declares 17 required operations: `materialKinds`, `materialsReady`, `analyzeMaterials`, `research`, `outline`, `agentProfiles`, `presetAgents`, `sceneContent`, `sceneActions`, `narrationTarget`, `narrateClip`, `releaseAssets`, `mediaConnections`, `generateImage`, `generateVideo`, `parallelSceneConcurrency`, `sleep`. 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: SettingsState (19 required operations) lib/store/settings.ts:90— `SettingsState` declares 19 required operations: `setTTSVoice`, `setTTSSpeed`, `setASRLanguage`, `setReviewOutlineEnabled`, `setTTSMuted`, `setTTSVolume`, `setAutoPlayLecture`, `setPlaybackSpeed`, `setSelectedAgentIds`, `setAgentMode`, `setAutoAgentCount`, `setAgentVoiceOverride`, `setAgentSelectionIsUserSet`, `setPresetAgentChoice`, `setSidebarCollapsed`, `setChatAreaCollapsed`, `setChatAreaWidth`, `setEditRailCollapsed`, `setEditRailWidth`. 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: AgentSessionStore (18 required operations) packages/@openmaic/storage/src/agent-session/types.ts:282— `AgentSessionStore` declares 18 required operations: `createSession`, `getSession`, `listSessionsByOwner`, `softDeleteSession`, `claimNextSession`, `heartbeat`, `markUserMessageDelivered`, `assertActiveLease`, `finishSession`, `releaseLease`, `requestCancel`, `getCancelRequestedAt`, `isCancelRequested`, `clearCancel`, `requeueSession`, `requeueForRetry`, `postUserMessage`, `mergeOwner`. 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 124 significant file(s) lose their only recent owner: packages/@openmaic/storage/src/document/pg.ts, packages/@openmaic/storage/src/asset/pg.ts, components/edit/ActionsBar/ActionsBar.tsx, components/generation/outlines-editor.tsx, lib/persistence/owner-materials.ts, lib/utils/chat-storage.ts, components/generation/step-visualizers.tsx, components/ai-elements/prompt-input.tsx (+116 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 8 significant file(s) lose their only recent owner: packages/@openmaic/importer/src/shapes/presets.ts, packages/@openmaic/importer/src/serializer/shapeSerializer.ts, packages/@openmaic/importer/src/serializer/tableSerializer.ts, packages/@openmaic/importer/src/serializer/chartSerializer.ts, packages/@openmaic/editor/src/react/text/prosemirror/schema/nodes.ts, packages/@openmaic/renderer/src/SlideElement.tsx, packages/@openmaic/importer/src/model/nodes/PicNode.ts, packages/@openmaic/renderer/src/styles.ts. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 6 significant file(s) lose their only recent owner: lib/chat/pi/element-reference.ts, lib/chat/pi/interactive-state-evidence.ts, lib/whiteboard/runtime/store.ts, lib/chat/pi/tools/read-scene.ts, lib/chat/pi/tools/web-search.ts, lib/whiteboard/runtime/types.ts. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 6 significant file(s) lose their only recent owner: lib/workbench/pro-home-data.ts, components/workbench/chat/course-link.tsx, REDACTED, lib/video-export/emit-hyperframes/quiz-question-list.ts, lib/workbench/session-title.ts, lib/workbench/markdown-math.ts. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 4 significant file(s) lose their only recent owner: eval/pbl-v2-planner/compare-html.ts, lib/audio/audio-duration.ts, lib/video-export/passes/geometry.ts, lib/workbench/material-upload-policy.ts. Pair on, review, or document these before any departure.
Disabled test tests/document-store/migration.test.ts:658— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Disabled test tests/document-store/migration.test.ts:854— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Disabled test tests/document-store/migration.test.ts:984— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Disabled test tests/document-store/migration.test.ts:1044— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Disabled test tests/document-store/migration.test.ts:1092— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×4
Diagnostic log message is built whether or not it is wanted REDACTED:758— `debug` at line 758 is called with an argument built by `assignedImages.map((img) => img.id)` (line 758), 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 REDACTED:761— `debug` at line 761 is called with an argument built by `visionImages.map((img) => img.id)` (line 761), 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 REDACTED:822— `debug` at line 822 is called with an argument built by `imageElements.map((el) => ({ type : el.type, src : (el as Record < string, unknown >).src && String((el as Record < s...` (line 824), 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 REDACTED:831— `debug` at line 831 is called with an argument built by `Object.keys(imageMapping)` (line 831), 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.
Orphaned file lib/media/comfyui-workflows.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 lib/playback/action-resume.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 lib/server/search-query-builder.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.
No app-layer HTTPS enforcement detected eval/pbl-v2-planner/serve.ts:137— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
No app-layer HTTPS enforcement detected scripts/sandbox-preview-gateway.mjs:517— `server.listen(…)` serves plain HTTP on a network address, and nothing in its package enforces HTTPS: no TLS served (`https.createServer`, Fastify `https`, Nest `httpsOptions`), no redirect of plain requests to `https://`, no `Strict-Transport-Security` (helmet sends it by default), and no TLS-terminating proxy configuration committed beside it — so a browser may talk to it in clear text. (−2.0 on this card.)
C2 · Access Controls· No named authorization policies · ×1
No named authorization policies lib/chat/pi/tools/native-spotlight.ts:71— Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 8 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 (156 single-owned of 1316 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1316 of the 1974 production source files in this repository met that bar). They are anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)), anonymized user #11 (1 file(s)) (+2 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: lib/workbench/composer-skills.ts, lib/utils/element.ts, components/workbench/chat/autoscroll.ts, components/slide-renderer/components/element/LineElement/BaseLineElement.tsx, lib/server/image-sizing.ts, lib/generation-run-client/course-card.ts, lib/export/narration.ts, lib/config/app-attribution.ts.
Documentation: no build, run or usage example packages/@openmaic/generation/README.md:1— `generation` is a published package (`REDACTED` without `"private": true`) and neither `packages/@openmaic/generation/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
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/`.
D21 · Naming Consistency· `baseURL` spells `URL` where 374 names in the project spell it `Url` · ×1
`baseURL` spells `URL` where 374 names in the project spell it `Url` eval/pbl-v2-planner/runner.ts:145— 374 of 376 names in project openmaic spell the token `Url` (374 of 376; unit: names in project openmaic containing `Url`). Peers: route.requestedTTSProvider(clientBaseUrl) (app/api/generate/tts/route.ts:173); route.requestedTTSProvider(clientBaseUrl) (app/api/generate/voice/route.ts:306); route.requestedDocumentProvider(clientBaseUrl) (app/api/parse-pdf/route.ts:130); route.requestedASRProvider(clientBaseUrl) (app/api/transcription/route.ts:118); route.probeSelfHosted(baseUrl) (app/api/verify-pdf-provider/route.ts:69). Rename to `baseUrl`. [rule N6]
D21 · Naming Consistency· `UseExportPPTXOptions` spells `PPTX` where 22 names in the project spell it `Pptx` · ×1
`UseExportPPTXOptions` spells `PPTX` where 22 names in the project spell it `Pptx` REDACTED:1407— 22 of 24 names in project openmaic spell the token `Pptx` (22 of 24; unit: names in project openmaic containing `Pptx`). Peers: feature-flags.isPptxImportEnabled (lib/config/feature-flags.ts:146); lib.export.pptx-scene-placeholders.PlanPptxDeckOptions (lib/export/pptx-scene-placeholders.ts:109); pptx-scene-placeholders.planPptxDeck (lib/export/pptx-scene-placeholders.ts:250); use-export-pptx.resolvePptxMediaBinding (REDACTED:418); use-export-pptx.resolvePptxEmbeddableSrc (REDACTED:439). Rename to `UseExportPptxOptions`. [rule N6]
D21 · Naming Consistency· `useExportPPTX` spells `PPTX` where 22 names in the project spell it `Pptx` · ×1
`useExportPPTX` spells `PPTX` where 22 names in the project spell it `Pptx` REDACTED:1425— 22 of 24 names in project openmaic spell the token `Pptx` (22 of 24; unit: names in project openmaic containing `Pptx`). Peers: feature-flags.isPptxImportEnabled (lib/config/feature-flags.ts:146); lib.export.pptx-scene-placeholders.PlanPptxDeckOptions (lib/export/pptx-scene-placeholders.ts:109); pptx-scene-placeholders.planPptxDeck (lib/export/pptx-scene-placeholders.ts:250); use-export-pptx.resolvePptxMediaBinding (REDACTED:418); use-export-pptx.resolvePptxEmbeddableSrc (REDACTED:439). Rename to `useExportPptx`. [rule N6]
D21 · Naming Consistency· `NodeXMLHttpRequest` spells `XML` where 46 names in the project spell it `Xml` · ×1
`NodeXMLHttpRequest` spells `XML` where 46 names in the project spell it `Xml` lib/server/agent-runtime/node-xhr.ts:9— 46 of 47 names in project openmaic spell the token `Xml` (46 of 47; unit: names in project openmaic containing `Xml`). Peers: tts-providers.escapeXml (lib/audio/tts-providers.ts:1482); node-xhr.installNodeXmlHttpRequest (lib/server/agent-runtime/node-xhr.ts:118); serializePresentation.parseGroupChild(childXml) (packages/@openmaic/importer/src/export/serializePresentation.ts:108); Presentation.detectWps(presentationXml) (packages/@openmaic/importer/src/model/Presentation.ts:71); Slide.buildDiagramGroup(drawingXml) (packages/@openmaic/importer/src/model/Slide.ts:264). Rename to `NodeXmlHttpRequest`. [rule N6]
D21 · Naming Consistency· `responseURL` spells `URL` where 374 names in the project spell it `Url` · ×1
`responseURL` spells `URL` where 374 names in the project spell it `Url` lib/server/agent-runtime/node-xhr.ts:28— 374 of 376 names in project openmaic spell the token `Url` (374 of 376; unit: names in project openmaic containing `Url`). Peers: route.requestedTTSProvider(clientBaseUrl) (app/api/generate/tts/route.ts:173); route.requestedTTSProvider(clientBaseUrl) (app/api/generate/voice/route.ts:306); route.requestedDocumentProvider(clientBaseUrl) (app/api/parse-pdf/route.ts:130); route.requestedASRProvider(clientBaseUrl) (app/api/transcription/route.ts:118); route.probeSelfHosted(baseUrl) (app/api/verify-pdf-provider/route.ts:69). Rename to `responseUrl`. [rule N6]
D21 · Naming Consistency· `fontEmbedCSS` spells `CSS` where 35 names in the project spell it `Css` · ×1
`fontEmbedCSS` spells `CSS` where 35 names in the project spell it `Css` packages/@openmaic/renderer/src/snapshot/index.ts:376— 35 of 36 names in project openmaic spell the token `Css` (35 of 36; unit: names in project openmaic containing `Css`). Peers: useFilter.imageFiltersToCss (components/slide-renderer/components/element/ImageElement/useFilter.ts:16); css-asset-parser.scanCssString (lib/export/css-asset-parser.ts:46); css-asset-parser.rewriteCssValue (lib/export/css-asset-parser.ts:96); css-asset-parser.splitCssCommaList (lib/export/css-asset-parser.ts:115); css-asset-parser.parseCss (lib/export/css-asset-parser.ts:217). Rename to `fontEmbedCss`. [rule N6]
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 4 of 9 project(s) overshoot their size bounds, lowering Project Cohesion to 1.1/10. The most over is `(repository root)` (318712 LoC, 3353 module-visible types across 301 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· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 3 of 1316 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1316 of the 1974 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: lib/media/comfyui-workflows.ts, lib/playback/action-resume.ts, lib/server/search-query-builder.ts. 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.
README/code drift lib/pdf/README.md:161— lib/pdf/README.md links to `images/img_1.png`, but `lib/pdf/images/img_1.png` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, 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.
Logging is not universal — Only 3/4 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `render-service`.
No SAST REDACTED:18— No static application security testing detected. For this repository's stack, add CodeQL's javascript-typescript pack, `semgrep --config=p/typescript`, or eslint-plugin-security as a CI step. What was searched, so you can tell an absence from a miss: the 79464 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
No dependency-update automation REDACTED:40— `REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
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 83/146 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types· Strict null checking is not enabled everywhere the repository type-checks · ×1
Strict null checking is not enabled everywhere the repository type-checks — 12/13 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.8 `!` null assertions per 1k TypeScript source lines — 747 assertion(s) across the 419647 source line(s) of the 1939 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: lib/legacy-browser-import/digest.ts (44), lib/pbl/v3/report-share-image.ts (28), lib/server/pbl-v3/runtime.ts (26). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Skipped (documented): (unnamed test) tests/video-export/cover-card-layout.browser.test.ts:751— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): (unnamed test) tests/server/instance-secret-check.test.ts:52— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/sandbox/checkpoint-schema.pg.test.ts:9— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/sandbox/e2b-compatible-cloud.acceptance.test.ts:11— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/pbl/v3/build-command.test.ts:127— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/pbl/v3/build-command.test.ts:178— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/pbl/v3/evaluation.test.ts:182— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/pbl/v3/evaluation.test.ts:236— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/pbl/v3/minimal-project-package.test.ts:74— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/pbl/v3/preparation-cloud.acceptance.test.ts:142— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/pbl/v3/preparation-cloud.acceptance.test.ts:211— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/pbl/v3/preparation-cloud.acceptance.test.ts:318— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/pbl/v3/preparation-cloud.acceptance.test.ts:350— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) tests/pbl/v3/project-package.test.ts:824— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) tests/agent-runtime/voice-clone-tools.test.ts:813— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) packages/@openmaic/storage/test/agent-session-automatic-title-contract.ts:249— Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
Skipped (documented): (unnamed test) packages/@openmaic/storage/test/agent-session-concurrency-contract.ts:103— Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
Skipped (documented): (unnamed test) packages/@openmaic/storage/test/agent-session-concurrency-contract.ts:117— Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
Skipped (documented): (unnamed test) packages/@openmaic/storage/test/agent-session-concurrency-contract.ts:130— Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
doc comments repeat the names packages/@openmaic/dsl/src/runtime.ts:161— 0 of 0 documented parameters and 2 of 259 summaries in `@openmaic/dsl` only repeat the member or parameter name (e.g. "All core runtime kinds." for `CORE_RUNTIME_KINDS`). Delete the restating tags, or add what the name does not say.
doc comments repeat the names REDACTED:633— 0 of 0 documented parameters and 2 of 249 summaries in `@openmaic/generation` only repeat the member or parameter name (e.g. "Generate slide content" for `generateSlideContent`). Delete the restating tags, or add what the name does not say.
doc comments repeat the names packages/@openmaic/storage/src/document/pg.ts:579— 0 of 0 documented parameters and 1 of 733 summaries in `@openmaic/storage` only repeat the member or parameter name (e.g. "Input of ." for `ReassignDocumentFoldersInput`). Delete the restating tags, or add what the name does not say.
doc comments repeat the names components/workbench/workspace/MaterialLibraryDialogs.tsx:47— 50 of 163 documented parameters and 34 of 8428 summaries in `openmaic` only repeat the member or parameter name (e.g. "One item of a ⋯ menu." for `LibraryMenuItem`). Delete the restating tags, or add what the name does not say.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 65 file(s) — `app/api/persistence/[...path]/route.ts`, `components/scene-renderers/pbl/v2/chat.tsx`, `components/scene-renderers/pbl/v2/workspace.tsx`, `components/settings/model-services.tsx`, `components/settings/use-llm-picker-groups.ts`, … (+60 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 01a1b72e-b3d0-78fb-88a6-0f0ec87691eb · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 194 · Warnings: 2653 · Recommendations: 255 · Info: 23 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 07-11-2026 @ 18:04 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.