Public report — protean, published 21 Sep 2026.
Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches,
dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase surveyMeasured under the Code Assurance Index · rubric rubric-2026.09.15 (frozen) · verify this surveyFiledcd_5c44138281fc48ca9715cddd79d1b088
Filed 25 September 2026, 05:10 UTC
Public
Large · 107,189 LoC · rebuild ~2.8 person-years · weakest lens: Code Health (30%)
Findings by grade
43 critical759 serious6 minor40 could not be resolved — could be critical — see Limitations
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
21 September 2026, 18:12 UTC
A measurement, not a certificate. The Code Assurance Index does not certify,
approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The
standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said
here so the number is checked rather than believed.
Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸
796findings with an exact file:lineof 808 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
57/137dimensions across the health lenses107189 LoC — wide & deep
Band capped at Weak: the weakest category (Dependencies, 10%) reads Critical — the cover never out-promises the category table.
Preview (pre-1.0). This repo hasn't declared a stable release, so it's judged against a relaxed, pre-production bar.
This system is a large, valuable asset carrying significant operational risk due to fragile code quality. With a health score of 50%, the platform is stable but increasingly difficult and expensive to maintain. The sheer scale—over 100,000 lines of production code—means that even small inefficiencies compound into substantial delays and costs for the business.
The primary concern is code complexity, which severely hampers maintainability. The codebase is dense and difficult to navigate, creating a hidden tax on every change. This complexity slows down development velocity by an estimated 5–12%, meaning the team spends more time understanding and fixing code than building new features. If left unaddressed, this drag will continue to grow as the system expands, leading to higher long-term costs and increased risk of defects in critical areas.
Despite these challenges, the system’s architecture and domain modeling are strong. The underlying structure is sound, with high scores in architectural integrity and domain representation, suggesting that the core business logic is well-understood and correctly implemented. This provides a solid foundation for improvement. However, the lack of modern tooling in the frontend, specifically the absence of TypeScript, leaves the user-facing layer vulnerable to runtime errors and makes it harder for new engineers to contribute effectively.
The most impactful first step is to introduce TypeScript to the frontend. This is not a cleanup effort but a foundational adoption that will immediately improve code safety and developer experience. The investment is modest, costing roughly three to ten engineer-days, and it pays for itself within one to two months by reducing the time spent debugging and refactoring. This action offers the highest return on investment, addressing the most pressing risk while leveraging the system’s strong architectural base. By focusing here, the business can stabilize development velocity and reduce long-term maintenance costs without disrupting the core system.
While the current picture is comprehensive, some areas like event-driven patterns and performance metrics were not measured, so the assessment is partial. Nevertheless, the immediate path is clear: prioritize frontend modernization to unlock the value of the robust backend architecture.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
0.7× (at 50% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~2.8 person-years of build effort (about ~€410,000 to rebuild). Its weakest lens is Code Health at 30% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain REDACTED (×1.4) — DDD/clean architecture, domain model × a 0.7× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Value concentrated against a weak lens · REDACTED · Value at risk
This is a Large asset (~2.8 person-years to rebuild), and its weakest lens is Code Health at 30%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Code Health first — highest risk-reduction per euro on an asset this size.
The top fix pays for itself · REDACTED · Economics
The top-ranked fix costs roughly 3–10 engineer-days once. Not doing it costs about 139.8–838.6 engineer-days every year, paid as drag on the ~1,061,379 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 5–12% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 261,710 line(s) changed over a 90-day window ⇒ ~1,061,379/year · D1/D2/D4 code quality: averaging 5.9/10 ⇒ a 5–12% drag on each change · top-ranked remediation: REDACTED effort ⇒ about 3–10 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Highest-leverage move · REDACTED · Leverage
Of everything flagged, the best return on effort is: Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
A velocity tax on every change · REDACTED · Economics
The code-quality signals (complexity, duplication, cohesion) average 5.9/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 5–12% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 5.9/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency matrix
Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
442 modules, 33 dependencies. 1 dependency cycle across 2 modules, marked above the diagonal.
Showing the 40 most-connected modules; 402 more are not drawn.
Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
docs_src.guides.getting-started.tutorial uses docs_src.guides.getting-started.tutorial.ch10. Changing docs_src.guides.getting-started.tutorial.ch10 can break docs_src.guides.getting-started.tutorial, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→3 src.protean.cli depends on src.protean.cli.test✕
Type pairs
1 distinct (type in src.protean.cli → type in src.protean.cli.test) reference.
src.protean.dx uses src.protean.dx.managed_files. Changing src.protean.dx.managed_files can break src.protean.dx, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→8 src.protean.dx.pack.skills.api-endpoint.assets depends on src.protean.dx.pack.skills.api-endpoint.assets.api_endpoint_with_pydantic✕
Type pairs
2 distinct (type in src.protean.dx.pack.skills.api-endpoint.assets → type in src.protean.dx.pack.skills.api-endpoint.assets.api_endpoint_with_pydantic) references.
src.protean.dx.pack.skills.api-endpoint.assets uses src.protean.dx.pack.skills.api-endpoint.assets.api_endpoint_with_pydantic. Changing src.protean.dx.pack.skills.api-endpoint.assets.api_endpoint_with_pydantic can break src.protean.dx.pack.skills.api-endpoint.assets, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→9 src.protean.fields.association depends on src.protean.fields.base✕
Type pairs
3 distinct (type in src.protean.fields.association → type in src.protean.fields.base) references.
src.protean.fields.association uses src.protean.fields.base. Changing src.protean.fields.base can break src.protean.fields.association, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→10 src.protean.fields.association depends on src.protean.fields.mixins✕
Type pairs
3 distinct (type in src.protean.fields.association → type in src.protean.fields.mixins) references.
src.protean.fields.association uses src.protean.fields.mixins. Changing src.protean.fields.mixins can break src.protean.fields.association, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
32→14 src.protean.ir depends on src.protean.ir.config✕
Type pairs
1 distinct (type in src.protean.ir → type in src.protean.ir.config) reference.
src.protean.ir.analysis uses src.protean.ir.analysis.dataflow. Changing src.protean.ir.analysis.dataflow can break src.protean.ir.analysis, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→12 src.protean.ir.analysis depends on src.protean.ir.analysis.element_index✕
Type pairs
1 distinct (type in src.protean.ir.analysis → type in src.protean.ir.analysis.element_index) reference.
src.protean.ir.analysis uses src.protean.ir.analysis.element_index. Changing src.protean.ir.analysis.element_index can break src.protean.ir.analysis, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→13 src.protean.ir.analysis depends on src.protean.ir.analysis.facts✕
Type pairs
1 distinct (type in src.protean.ir.analysis → type in src.protean.ir.analysis.facts) reference.
src.protean.ir.generators uses src.protean.ir.generators.event_model. Changing src.protean.ir.generators.event_model can break src.protean.ir.generators, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→19 src.protean.mcp depends on src.protean.mcp.tools✕
Type pairs
2 distinct (type in src.protean.mcp → type in src.protean.mcp.tools) references.
src.protean.scaffold uses src.protean.scaffold.model_parser. Changing src.protean.scaffold.model_parser can break src.protean.scaffold, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→22 src.protean.scaffold depends on src.protean.scaffold.slice_generator✕
Type pairs
4 distinct (type in src.protean.scaffold → type in src.protean.scaffold.slice_generator) references.
src.protean.scaffold uses src.protean.scaffold.slice_generator. Changing src.protean.scaffold.slice_generator can break src.protean.scaffold, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→38 src.protean.server.subscription.event_store_subscription depends on src.protean.server.subscriptioncycle✕
Type pairs
1 distinct (type in src.protean.server.subscription.event_store_subscription → type in src.protean.server.subscription) reference.
src.protean.server.subscription.event_store_subscription uses src.protean.server.subscription. Changing src.protean.server.subscription can break src.protean.server.subscription.event_store_subscription, not the reverse.
Position
Above the diagonal — a cycle. Neither module can be changed, tested or deployed independently until one of these dependencies goes.
38→37 src.protean.server.subscription depends on src.protean.server.subscription.event_store_subscription✕
Type pairs
1 distinct (type in src.protean.server.subscription → type in src.protean.server.subscription.event_store_subscription) reference.
src.protean.server.subscription uses src.protean.server.subscription.event_store_subscription. Changing src.protean.server.subscription.event_store_subscription can break src.protean.server.subscription, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→38 src.protean.server.outbox_processor depends on src.protean.server.subscription✕
Type pairs
1 distinct (type in src.protean.server.outbox_processor → type in src.protean.server.subscription) reference.
src.protean.server.outbox_processor uses src.protean.server.subscription. Changing src.protean.server.subscription can break src.protean.server.outbox_processor, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→38 src.protean.server.subscription.stream_subscription depends on src.protean.server.subscription✕
Type pairs
1 distinct (type in src.protean.server.subscription.stream_subscription → type in src.protean.server.subscription) reference.
src.protean.server.subscription.stream_subscription uses src.protean.server.subscription. Changing src.protean.server.subscription can break src.protean.server.subscription.stream_subscription, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
At a glance — Code Health · 30% · Weak · gated by D2, R1, R2, R3 ·
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:2021 — Injection
32
REDACTED / Critical
A05:2021 — Security Misconfiguration
7
REDACTED / Critical
A04:2021 — Insecure Design
4
REDACTED
Roadmap
Begin by introducing type safety to the frontend through a build-time check or incremental conversion of high-traffic modules to prevent runtime errors. Simultaneously, reduce technical debt by breaking down complex functions and splitting large files into smaller, focused modules to improve maintainability. Address code duplication by extracting shared logic into common utilities or types where appropriate, ensuring each instance is handled based on its specific context. Finally, integrate static analysis security scanning into the CI pipeline to automatically block regressions and ensure code quality standards are met.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
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.
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Enforce accessibility in the test suite you already have: assert the accessibility invariants over the HTML your app renders — parse the rendered output in an existing test, or drive a real browser from one — and gate that test in CI so a regression blocks the merge.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 43
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 — 759
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 — 6
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 40
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 51 of 57 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 6 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 57 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, 796 of 808 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a Codecov configuration (codecov.yml, target 96%) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.py) and this repository declares a Python test suite (repository root, 965 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (12 contributor(s) across 2101 commit(s) sampled, automation and bot accounts excluded). One of them holds 86% of the history; the other 11 hold 1.3% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
AX3 Project dependency cycles — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which project references which — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX4 Dependency direction — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the direction each project reference points — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX8 Test isolation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which projects are test projects, and what they reference — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
DM9 Scattered domain decisions — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not measured — scattered-decision detection needs expression-level symbol resolution: a comparison operand bound to the member it judges (arm one) and a construction bound to the type it produces (arm two). A Roslyn compilation carries both; arm two alone also runs on any frontend that declares whether a construction is produced or passed, and this target loaded neither.
ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2 further occurrence(s) are not listed individually; the score already reflects all 42.
X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
D25 ADR Conformance: ADR conformance is the LLM-scored fraction of sampled code that follows recorded decisions — it checks the decisions that were written down and the slices it sampled, not unrecorded rules or the whole tree.
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.
D32 Data Compliance (PII/GDPR): PII/GDPR signals are heuristic pattern matches in code — they flag likely handling concerns, not legal compliance, and cannot trace where data actually flows at runtime.
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.
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.
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.
DM4 Rich vs anemic model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
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.
The LLM boundary
LLM-set scores this run (6): D19, D20, D21, D22, D25, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
+ 108 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 12 (anonymous) finding(s) in Cyclomatic Complexity — start with timeline.js (10), messages.js, overview.js. — One of this dimension's main actionable groups (12 warning-level).
Resolve the 1 (anonymous) (cyclomatic 142) finding(s) in Cyclomatic Complexity — start with handlers.js. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 (anonymous) (cyclomatic 135) finding(s) in Cyclomatic Complexity — start with causation-graph.js. — One of this dimension's main actionable groups (1 warning-level).
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.
+ 198 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 18 (anonymous) finding(s) in Cognitive Complexity — start with timeline.js (11), causation-graph.js (2), overview.js (2). — One of this dimension's main actionable groups (18 warning-level).
Resolve the 1 SqlalchemyModel.__init_subclass__ (cognitive 119) finding(s) in Cognitive Complexity — start with sqlalchemy.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 (anonymous) (cognitive 113) finding(s) in Cognitive Complexity — start with processes.js. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.7 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 28 FileTooLong finding(s) in God Classes — start with builder.py, __init__.py, sqlalchemy.py. — One of this dimension's main actionable groups (28 warning-level).
Resolve the 7 TooManyMethods finding(s) in God Classes — start with __init__.py, builder.py, redis.py. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 1 FunctionTooLong finding(s) in God Classes — start with timeline.js. — One of this dimension's main actionable groups (1 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
177 duplicated block group(s) detected. A further 8 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 185 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 96 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 11 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with clusters.py, handlers.py, 002.py. — One of this dimension's main actionable groups (11 warning-level).
Resolve the 10 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with builder.py (2), ch22.py, entity.py. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 8 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mypy_plugin.py (2), validation.py, api.py. — One of this dimension's main actionable groups (8 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
All 60 mechanizable ADR(s) are enforced: 38 by analyzers, 22 by tests. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
✓ On the Gold path — maintain.
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
14313 test methods: 14035 unit, 253 integration, 0 BDD, 25 e2e. The Python suite contributes 14313 test function(s) across 960 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
0 outdated, 0 yanked pinned Python distributions. 1 of 10 shipped distributions were graded against pypi.org (0 not published there, 9 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.
What to do
Maintain Dependency Hygiene — already on the Gold path. — No findings, and enforcement is at this dimension's ceiling.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 63 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 10 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (53 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. 8 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Resolve the 51 Hotspot finding(s) in Churn × Complexity Hotspots — start with __init__.py (4), projection.py (2), builder.py. — One of this dimension's main actionable groups (51 warning-level).
Detailed fixes: d15_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.
5 deducted task-comment markers across 107189 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 3 TodoComment finding(s) in Explicit Debt — start with message_db.py, diff.py, builder.py. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 FixmeComment finding(s) in Explicit Debt — start with generate.py, test_generate_docker_compose.py. — One of this dimension's main actionable groups (2 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
Protean's documentation is clear, complete, and well-structured. It includes a strong README with installation, quick start, and an overview of the roadmap, plus architecture/decision records (ADRs), comparison-eval harness, changelog fragments, test-domain directories, and a dedicated Why Protean? guide that explains domain compiler, always-valid domain, progressive architecture, and infrastructure portability. The formal specs directory is also present and well-organized around correctness claims. A clipped summary ends with the full outline (Protean; Installation; Quick Start; Write: publish a post through the command.; Read: the projector has already filled the feed inline.) for each section named in the body, so no sections are omitted. Protean's documentation is clear and complete for a framework project. It begins with an excellent overview (Your whiteboard, shipped.) that explains what it does and the ideal audience ('the ones whose shape you can't fully see on day one'), then dives into Why Protean? and How Do I...?, covering installation, modeling domain elements, building bookshelf, and a troubleshooting guide. The architecture is documented in depth: glossaries of terms grouped by category (Domain-Driven Design, Aggregate, Aggregate Root), an outline of every page in the documentation, and a versioning policy that enforces the warning-free-on-1.N contract with CI enforcement. There are no clipped sections to flag as missing; all outlined content is present.
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR QualityAdequate◐ Sampled · advisory
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
Evaluated 139 ADR(s) individually; mean quality 6.4/10 (mixed — many ADRs miss context or consequences). 58 flagged with a specific gap.
No context/problem and no consequences/trade-offs; only the decision is stated · ×2changes/1327.added.md
No consequences/trade-offs: over-reporting/under-reporting and receiver-blind matching are stated but no negative impact is noted · ×2changes/1433.added.md
No context/problem statement; the only content is a one-line decision with no consequenceschanges/1270.added.md
No context/problem framing or consequences; only the specs and TLC claim is statedchanges/1271.added.md
Consequences/trade-offs are absent despite a strong context (shared test suite asserting shared adapter behaviour across memory and Redis) and an explicit rationale for failing fastchanges/1310.added.md
+ 51 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 No context/problem and no consequences/trade-offs; only the decision is… finding(s) in ADR Quality — start with 1327.added.md, 1358.added.md. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 No consequences/trade-offs finding(s) in ADR Quality — start with 1433.added.md, 1509.added.md. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 No context/problem statement; the only content is a one-line decision… finding(s) in ADR Quality — start with 1270.added.md. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
0 naming inconsistencies across 0 sampled symbols.
✓ On the Gold path — maintain.
Detailed fixes: d21_recommendation.md.
Do you agree with this assessment?
D22 · Internal API ConsistencyWeak◐ Sampled · advisory
What it measures: Whether the internal API surface is consistent and coherent.
Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.
4 API inconsistencies across a 400-member sample of 1199 exposed types.
Duplicate function definition. The same function signature and likely implementation exist in two different internal modules (`_helpers` and `_ir_utils`).
Inconsistent DLQ (Dead Letter Queue) API surface across broker implementations. `InlineBroker` exposes message retrieval (`get_dlq_messages`), while `RedisBroker` exposes management operations (`dlq_depth`, `dlq_trim`) but lacks a direct message retrieval method in the signature list. This forces consumers to use different methods or rely on underlying client instances to inspect DLQs depending on the broker.
Inconsistent method naming for lookup evaluation/generation. Elasticsearch lookups use `as_expression`, Memory lookups use `evaluate`, and SQLAlchemy lookups primarily expose `lookup_name` (with some having `as_expression` or `process_target`). This inconsistency makes it difficult to write generic code that iterates over lookup types.
Duplicate CLI commands for DLQ management. Both `eventstore` and `dlq` subcommands expose a `list_dlq` (and likely `inspect`, `replay`, `purge`) functionality. This creates user confusion about which command to use.
What to do
Resolve the 1 Duplicate function definition. The same function signature and likely… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Inconsistent DLQ (Dead Letter Queue) API surface across broker… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Inconsistent method naming for lookup evaluation/generation.… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d22_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code actually follows the decisions recorded in the project's ADRs.
Method: Judged by language model at low temperature against ADRs plus a deterministic structural code summary; findings linked to repo-rooted ADR paths for traceability. Advisory.
ADR not followed: 1391.fixed · ×3changes/1391.fixed.md
What to do
Resolve the 3 ADR not followed finding(s) in ADR Conformance — start with 1391.fixed.md, 1455.changed.md, 1473.changed.md. — One of this dimension's main actionable groups (3 issue-level).
Enforce ADR Conformance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d25_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 REDACTED. 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.
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).
32 finding(s): 0 critical, 30 high, 2 medium, 0 low. 26 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 2 file(s) — `src/protean/fields/spec.py` (line 466), `src/protean/server/observatory/templates/overview.html` (lines 1–5, lines 169–171, line 173) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
What to do
Resolve the 4 REDACTED finding(s) charged to Static Analysis (SAST) — the other 26 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (30 issue-level, 4 of them charged here).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-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/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, Go, Java and Kotlin via Maven/Gradle, npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 1 REDACTED IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 5 REDACTED IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (5 warning-level).
Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D32 · Data Compliance (PII/GDPR)6.6 / 10Adequate✓ Tool-verified
What it measures: Likely personal-data (PII / GDPR) handling concerns — logging or storing data without safeguards.
Method: Heuristic PII/GDPR LEAK scan via semgrep across the repo, using Watchdog's own ruleset: personal data crossing a boundary it should not — reaching a log/console sink, a URL or query string, or unprotected browser storage. Matches map to severity and a 0-10 wide normalizer. A clean sweep is unscored rather than an unearned 10, and is a statement about the leak paths checked only — this dimension does not inventory the personal data a repository holds (the personal-data map and the C1-C5 compliance cards do that), so it never reports that a repository has no personal-data surface. Reported LOUDLY as a measurement gap if the ruleset is missing from the analyzer image. Exhaustive over the leak paths, advisory-leaning; degrades on parse failure.
Resolve the 4 REDACTED finding(s) in Data Compliance (PII/GDPR) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d32_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.
1 of 352 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/protean/utils/inflection.py. Counted over 352 of the 529 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned files with no living knowledge
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 10 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, 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.
AC2 · Forms & labels5.3 / 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.
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). — src/protean/server/observatory/static/js/domain-detail.js:405
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×4) — src/protean/server/observatory/templates/eventstore.html:37, src/protean/server/observatory/templates/messages.html:53, src/protean/server/observatory/templates/timeline.html:51, …
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×4) — src/protean/server/observatory/templates/handlers.html:66, src/protean/server/observatory/templates/processes.html:45, src/protean/server/observatory/templates/timeline.html:46, …
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.
Do you agree with this assessment?
AC3 · Page structure6.8 / 10Strong✓ Tool-verified
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.
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — src/protean/server/observatory/templates/timeline.html:326
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 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.
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 automated accessibility check runs over the HTML your app renders. Assert the accessibility invariants over that HTML in the test suite you already have (parse the output and assert, or drive a browser), and gate that test in CI so a regression blocks the merge. What was searched, so you can tell an absence from a miss: the 22 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the test suite you already have: assert the accessibility invariants over the HTML your app renders — parse the rendered output in an existing test, or drive a real browser from one — and gate that test in CI so a regression blocks the merge.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether 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 · Domain Modelling — Whether aggregates reference each other by identity (id) rather than by direct object reference — the core DDD consistency-boundary rule.
Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.
Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.
Other · Domain Modelling — Whether an aggregate can be constructed in a state its own rules forbid — a public constructor that takes a raw primitive, stores it, and validates nothing, with no factory beside it. A constructor taking only value objects is not counted: each parameter has already validated itself.
Method: Neutral surface (DDD-gated): each non-abstract entity/aggregate checked for a PUBLIC constructor taking at least one RAW PRIMITIVE parameter whose body contains no guard token (throw / Guard. / Ensure. / ArgumentException / CheckRule), on a type that also offers no static Create/Of/From/New factory. A constructor taking only value objects is never charged -- measured: 64 of 87 unguarded public constructors on the C# corpus take value objects only, so ignoring parameter types would be 73% false positives. One finding per entity. Deterministic.
Do you agree with this assessment?
DM12 · Ambient inputs in the domain10.0 / 10Exemplary○ Nothing flagged
Other · Domain Modelling — Whether domain types receive the time and randomness their rules depend on, rather than reading the process clock or a global random source directly — an ambient read makes the rule it feeds untestable at the instant that matters and lets two reads inside one operation disagree.
Method: Roslyn (DDD-gated, C#/VB only): domain-layer types scanned for ambient reads — DateTime/DateTimeOffset.Now/UtcNow/Today, Random.Shared, new Random(), Stopwatch.GetTimestamp — resolved against the semantic model, with a comment/string-stripped token fallback only where resolution fails. Body reads are scored; field/property initialisers are surfaced unscored. Apply/When folds excluded (ES1 owns them). Deterministic, symbol-resolved.
Do you agree with this assessment?
DM4 · Rich vs anemic model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether aggregates/entities carry the behaviour that protects their invariants, rather than being data bags driven by external services.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
Other · Domain Modelling — Whether entities protect their state — private/init-only setters, and collections handed out as read-only views rather than the mutable backing collection — instead of exposing writable state that bypasses invariants. Softened when a rehydration framework (Marten/EF) is present.
Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies (EF/Marten/HTTP/ASP.NET) — the clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Other · Domain Modelling — Whether clusters of primitives that travel together (a missing value object) are extracted — a low-weight suggestion, LLM-confirmed when configured.
Method: Roslyn (DDD-gated): primitive parameter clusters recurring three or more times across signatures extracted, then confirmed by language model when configured. Advisory, low-weight.
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 'Testing' section to the root README — how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 20543 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
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 releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ 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.
0 typed · 15 plain JS — the untyped files are src/protean/server/observatory/static/js/causation-graph.js, src/protean/server/observatory/static/js/charts.js, src/protean/server/observatory/static/js/core.js, src/protean/server/observatory/static/js/domain-detail.js, src/protean/server/observatory/static/js/domain-flows.js, src/protean/server/observatory/static/js/domain-processes.js (+9 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
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.
src/protean/server/observatory/static/js/handlers.js:121 · src/protean/server/observatory/static/js/processes.js:94 — the two spans are one implementation copied and then locally edited — 1433 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. — src/protean/server/observatory/static/js/handlers.js:121
src/protean/server/observatory/static/js/eventstore.js:32 · src/protean/server/observatory/static/js/processes.js:40 — the two spans are one implementation copied and then locally edited — 714 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. — src/protean/server/observatory/static/js/eventstore.js:32
src/protean/server/observatory/static/js/handlers.js:34 · src/protean/server/observatory/static/js/processes.js:30 — the two spans are one implementation copied and then locally edited — 421 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. — src/protean/server/observatory/static/js/handlers.js:34
src/protean/server/observatory/static/js/causation-graph.js:799 · src/protean/server/observatory/static/js/domain-topology.js:640 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/causation-graph.js:799
src/protean/server/observatory/static/js/causation-graph.js:750 · src/protean/server/observatory/static/js/domain-topology.js:586 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — src/protean/server/observatory/static/js/causation-graph.js:750
src/protean/server/observatory/static/js/charts.js:84 · src/protean/server/observatory/static/js/charts.js:189 — 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. — src/protean/server/observatory/static/js/charts.js:84
src/protean/server/observatory/static/js/causation-graph.js:645 · src/protean/server/observatory/static/js/domain-topology.js:530 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/causation-graph.js:645
src/protean/server/observatory/static/js/causation-graph.js:965 · src/protean/server/observatory/static/js/timeline.js:953 — the two spans are one implementation copied and then locally edited — 95 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. — src/protean/server/observatory/static/js/causation-graph.js:965
src/protean/server/observatory/static/js/domain-flows.js:737 · src/protean/server/observatory/static/js/domain-processes.js:382 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/domain-flows.js:737
src/protean/server/observatory/static/js/messages.js:433 · src/protean/server/observatory/static/js/messages.js:452 — 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. — src/protean/server/observatory/static/js/messages.js:433
src/protean/server/observatory/static/js/causation-graph.js:93 · src/protean/server/observatory/static/js/domain-topology.js:119 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — src/protean/server/observatory/static/js/causation-graph.js:93
src/protean/server/observatory/static/js/eventstore.js:60 · src/protean/server/observatory/static/js/handlers.js:121 · src/protean/server/observatory/static/js/processes.js:94 — 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. — src/protean/server/observatory/static/js/eventstore.js:60
src/protean/server/observatory/static/js/messages.js:51 · src/protean/server/observatory/static/js/messages.js:68 — 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. — src/protean/server/observatory/static/js/messages.js:51
src/protean/server/observatory/static/js/overview.js:373 · src/protean/server/observatory/static/js/timeline.js:1553 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/overview.js:373
src/protean/server/observatory/static/js/timeline.js:1092 · src/protean/server/observatory/static/js/timeline.js:1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/timeline.js:1092
src/protean/server/observatory/static/js/domain-detail.js:117 · src/protean/server/observatory/static/js/domain-detail.js:129 — 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. — src/protean/server/observatory/static/js/domain-detail.js:117
src/protean/server/observatory/static/js/domain-flows.js:608 · src/protean/server/observatory/static/js/domain-flows.js:792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/domain-flows.js:608
src/protean/server/observatory/static/js/timeline.js:288 · src/protean/server/observatory/static/js/timeline.js:772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/timeline.js:288
src/protean/server/observatory/static/js/causation-graph.js:206 · src/protean/server/observatory/static/js/causation-graph.js:1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/causation-graph.js:206
src/protean/server/observatory/static/js/causation-graph.js:349 · src/protean/server/observatory/static/js/causation-graph.js:364 — 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. — src/protean/server/observatory/static/js/causation-graph.js:349
src/protean/server/observatory/static/js/causation-graph.js:410 · src/protean/server/observatory/static/js/causation-graph.js:429 — 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. — src/protean/server/observatory/static/js/causation-graph.js:410
src/protean/server/observatory/static/js/causation-graph.js:690 · src/protean/server/observatory/static/js/causation-graph.js:703 · src/protean/server/observatory/static/js/causation-graph.js:718 · src/protean/server/observatory/static/js/domain-topology.js:560 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — src/protean/server/observatory/static/js/causation-graph.js:690
src/protean/server/observatory/static/js/domain-detail.js:192 · src/protean/server/observatory/static/js/domain-detail.js:214 · src/protean/server/observatory/static/js/domain-detail.js:319 — all 3 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. — src/protean/server/observatory/static/js/domain-detail.js:192
src/protean/server/observatory/static/js/domain-detail.js:208 · src/protean/server/observatory/static/js/domain-detail.js:309 — 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. — src/protean/server/observatory/static/js/domain-detail.js:208
src/protean/server/observatory/static/js/domain-flows.js:659 · src/protean/server/observatory/static/js/domain-topology.js:528 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/domain-flows.js:659
src/protean/server/observatory/static/js/domain-topology.js:557 · src/protean/server/observatory/static/js/domain-topology.js:570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/domain-topology.js:557
src/protean/server/observatory/static/js/domain-detail.js:284 · src/protean/server/observatory/static/js/domain-detail.js:294 — 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. — src/protean/server/observatory/static/js/domain-detail.js:284
src/protean/server/observatory/static/js/domain-topology.js:343 · src/protean/server/observatory/static/js/domain-topology.js:356 — 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. — src/protean/server/observatory/static/js/domain-topology.js:343
src/protean/server/observatory/static/js/eventstore.js:101 · src/protean/server/observatory/static/js/handlers.js:188 · src/protean/server/observatory/static/js/processes.js:147 — 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. — src/protean/server/observatory/static/js/eventstore.js:101
src/protean/server/observatory/static/js/handlers.js:62 · src/protean/server/observatory/static/js/handlers.js:70 · src/protean/server/observatory/static/js/processes.js:59 · src/protean/server/observatory/static/js/processes.js:67 — the 4 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/handlers.js:62
src/protean/server/observatory/static/js/messages.js:297 · src/protean/server/observatory/static/js/messages.js:355 — 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. — src/protean/server/observatory/static/js/messages.js:297
src/protean/server/observatory/static/js/timeline.js:244 · src/protean/server/observatory/static/js/timeline.js:726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/timeline.js:244
src/protean/server/observatory/static/js/causation-graph.js:678 · src/protean/server/observatory/static/js/causation-graph.js:689 · src/protean/server/observatory/static/js/causation-graph.js:702 · src/protean/server/observatory/static/js/causation-graph.js:717 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — src/protean/server/observatory/static/js/causation-graph.js:678
src/protean/server/observatory/static/js/domain-flows.js:519 · src/protean/server/observatory/static/js/timeline.js:262 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — src/protean/server/observatory/static/js/domain-flows.js:519
src/protean/server/observatory/static/js/timeline.js:692 · src/protean/server/observatory/static/js/timeline.js:708 · src/protean/server/observatory/static/js/timeline.js:770 — all 3 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. — src/protean/server/observatory/static/js/timeline.js:692
src/protean/server/observatory/static/js/causation-graph.js:394 · src/protean/server/observatory/static/js/causation-graph.js:420 — 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. — src/protean/server/observatory/static/js/causation-graph.js:394
src/protean/server/observatory/static/js/causation-graph.js:937 · src/protean/server/observatory/static/js/domain-topology.js:682 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/causation-graph.js:937
src/protean/server/observatory/static/js/domain-topology.js:373 · src/protean/server/observatory/static/js/domain-topology.js:399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/protean/server/observatory/static/js/domain-topology.js:373
src/protean/server/observatory/static/js/timeline.js:1000 · src/protean/server/observatory/static/js/timeline.js:1258 — 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. — src/protean/server/observatory/static/js/timeline.js:1000
src/protean/server/observatory/static/js/eventstore.js:27 · src/protean/server/observatory/static/js/handlers.js:40 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/protean/server/observatory/static/js/eventstore.js:27
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
(anonymous) has cyclomatic complexity 31 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/handlers.js:56
(anonymous) has cyclomatic complexity 29 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/processes.js:49
_renderCausationTree has cyclomatic complexity 27 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/timeline.js:502
_showEventDetail has cyclomatic complexity 26 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:830
(anonymous) has cyclomatic complexity 24 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/protean/server/observatory/static/js/core.js:396
_readURL has cyclomatic complexity 23 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:986
showTraceDetail has cyclomatic complexity 23 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/protean/server/observatory/static/js/messages.js:290
_switchCausationView has cyclomatic complexity 21 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/timeline.js:450
searchTraces has cyclomatic complexity 21 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:200
_fetchLatestEvent has cyclomatic complexity 18 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:1320
_showCorrelationView has cyclomatic complexity 18 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/timeline.js:337
_showAggregateView has cyclomatic complexity 18 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/timeline.js:596
(anonymous) has cyclomatic complexity 17 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/processes.js:108
updateHealthBanner has cyclomatic complexity 16 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/overview.js:311
fetchEvents has cyclomatic complexity 16 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/timeline.js:118
_bindEvents has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:1081
_updateCorrelationDisplay has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:400
_renderAggregateTimeline has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/timeline.js:645
_transferCollapseState has cyclomatic complexity 15 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — src/protean/server/observatory/static/js/causation-graph.js:1112
(anonymous) has cyclomatic complexity 15 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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. — src/protean/server/observatory/static/js/handlers.js:135
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ 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.
7 file(s) over 400 lines (counted as significant lines — blank lines excluded — over production source only, tests excluded), largest first: src/protean/server/observatory/static/js/timeline.js (1365), src/protean/server/observatory/static/js/causation-graph.js (992), src/protean/server/observatory/static/js/domain-flows.js (702), src/protean/server/observatory/static/js/messages.js (619), src/protean/server/observatory/static/js/domain-topology.js (617), src/protean/server/observatory/static/js/core.js (518) (+1 more).
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?
R7 · Dead Code10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
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 — Only what this repository's own non-C# files could be read for was assessed — and because this repository commits the configuration that serves its own HTTP surface, that configuration could be read in full for the security response headers it sets. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
No Content-Security-Policy / X-Frame-Options / X-Content-Type-Options configuration found — defense in depth, even when a reverse proxy could set them. This is reported because `nginx.conf` is committed to this repository and declares the server that serves it, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.) — src/protean/template/domain_template/nginx.conf:10
What to do
Set security response headers on the surface this repository serves: an `add_header` directive per header in the nginx/Caddy/Apache config, a `_headers` / `vercel.json` / `netlify.toml` entry for a static host, or `helmet()` in the HTTP server. `Content-Security-Policy` is the one that pays for itself first — it is what contains an injected script once one reaches the page — followed by `X-Content-Type-Options: nosniff` and a frame policy (`X-Frame-Options: DENY`, or CSP `frame-ancestors`). Where the app is served from a build container, the header configuration belongs in the image beside the built assets, so it ships with them rather than depending on where it lands.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 10 of 55 WCAG 2.2 Level A/AA success criteria (18%; ≈20% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 45 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.
Not evidenced — 3 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 77 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.
AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AX1 Captive dependencies — no DI registrations detected
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over a project-reference graph 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
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface 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
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) 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
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.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D10 Test Quality — ~218987 lines of test source are present (.py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included — no .py test runner
D16 Bus Factor — single-maintainer repository — bus factor is not applicable
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D23 Boundary Type-Coupling — Production source is present (.py) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — symbol resolution incomplete — navigability not assessed
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a CS/VB/GO/SCALA/SWIFT/DART class graph, and this repository's production source is .py, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM10 One transaction, one aggregate — no repository writes detected — no operation to judge against the one-aggregate rule
DM2 Strongly-typed ids — no id-bearing domain types detected — strongly-typed-id adoption not assessable
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
DM9 Scattered domain decisions — not measured — scattered-decision detection needs expression-level symbol resolution: a comparison operand bound to the member it judges (arm one) and a construction bound to the type it produces (arm two). A Roslyn compilation carries both; arm two alone also runs on any frontend that declares whether a construction is produced or passed, and this target loaded neither
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — not assessed — schema-migration practice is read from 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
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R4 Test Coverage — the JS/TS workspace (15 production file(s)) has no JavaScript/TypeScript test, but it is 6.67% of this repository's production source and the other 93.33% carries 218,987 line(s) of test code this pass cannot read — an incidental frontend's reachability is not the repository's test posture, so it is not scored as one
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, 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
X5 Nullable reference types — 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.
AC2 · Forms & labels· <input> without a programmatic label · ×4
<input> without a programmatic label src/protean/server/observatory/templates/eventstore.html:37— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/protean/server/observatory/templates/messages.html:53— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/protean/server/observatory/templates/timeline.html:51— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/protean/server/observatory/templates/timeline.html:55— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC2 · Forms & labels· <select> without a programmatic label · ×4
<select> without a programmatic label src/protean/server/observatory/templates/handlers.html:66— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label src/protean/server/observatory/templates/processes.html:45— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label src/protean/server/observatory/templates/timeline.html:46— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label src/protean/server/observatory/templates/timeline.html:59— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
ADR not followed: 1391.fixed changes/1391.fixed.md— The summary shows only Protean types, so the presence-check behavior of remove/keys and set_ttl is not observable, leaving whether the KeyError branch was dropped in favor of a silent absence check unverifiable. (changes/1391.fixed.md)
ADR not followed: 1455.changed changes/1455.changed.md— The summary shows no String or Text type, so the mandated sanitization default flip and new [field_defaults] sanitize config key cannot be verified. (changes/1455.changed.md)
ADR not followed: 1473.changed changes/1473.changed.md— --pretend and its -p short form are deprecated in favor of --dry-run, so the code must not expose either. (changes/1473.changed.md)
AC2 · Forms & labels· <button> with no accessible text · ×1
<button> with no accessible text src/protean/server/observatory/static/js/domain-detail.js:405— 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).
Hotspot: src/protean/ir/builder.py src/protean/ir/builder.py:424— src/protean/ir/builder.py changed 39 times in last 90 days, max cyclomatic complexity 33 in IRBuilder._extract_resolved_field at line 424. 1 of those changes was a fix/bug commit, and the other 38 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/ir/builder.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/adapters/repository/sqlalchemy.py src/protean/adapters/repository/sqlalchemy.py:595— src/protean/adapters/repository/sqlalchemy.py changed 24 times in last 90 days, max cyclomatic complexity 46 in SqlalchemyModel.__init_subclass__ at line 595. 3 of those changes were fix/bug commits, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/adapters/repository/sqlalchemy.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/fields/spec.py src/protean/fields/spec.py:232— src/protean/fields/spec.py changed 15 times in last 90 days, max cyclomatic complexity 38 in FieldSpec.resolve_field_kwargs at line 232. 1 of those changes was a fix/bug commit, and the other 14 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/fields/spec.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/unit_of_work.py src/protean/core/unit_of_work.py:258— src/protean/core/unit_of_work.py changed 17 times in last 90 days, max cyclomatic complexity 32 in UnitOfWork._do_commit at line 258. 3 of those changes were fix/bug commits, and the other 14 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/unit_of_work.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/utils/__init__.py src/protean/utils/__init__.py:309— src/protean/utils/__init__.py changed 17 times in last 90 days, max cyclomatic complexity 31 in utils._prepare_pydantic_namespace at line 309. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/utils/__init__.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/domain/__init__.py src/protean/domain/__init__.py:1046— src/protean/domain/__init__.py changed 20 times in last 90 days, max cyclomatic complexity 23 in Domain._register_element at line 1046. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/domain/__init__.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/entity.py src/protean/core/entity.py:534— src/protean/core/entity.py changed 15 times in last 90 days, max cyclomatic complexity 26 in BaseEntity.model_post_init at line 534. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/entity.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/repository.py src/protean/core/repository.py:370— src/protean/core/repository.py changed 12 times in last 90 days, max cyclomatic complexity 27 in BaseRepository._sync_children at line 370. 1 of those changes was a fix/bug commit, 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/repository.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/utils/eventing.py src/protean/utils/eventing.py:1223— src/protean/utils/eventing.py changed 17 times in last 90 days, max cyclomatic complexity 19 in Message.to_cloudevent at line 1223. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/utils/eventing.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/server/engine.py src/protean/server/engine.py:815— src/protean/server/engine.py changed 11 times in last 90 days, max cyclomatic complexity 28 in Engine.handle_message at line 815. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/server/engine.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/server/outbox_processor.py src/protean/server/outbox_processor.py:358— src/protean/server/outbox_processor.py changed 13 times in last 90 days, max cyclomatic complexity 22 in OutboxProcessor._process_single_message at line 358. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/server/outbox_processor.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/server/subscription/event_store_subscription.py src/protean/server/subscription/event_store_subscription.py:862— src/protean/server/subscription/event_store_subscription.py changed 13 times in last 90 days, max cyclomatic complexity 21 in EventStoreSubscription.process_batch at line 862. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/server/subscription/event_store_subscription.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/cli/__init__.py src/protean/cli/__init__.py:174— src/protean/cli/__init__.py changed 16 times in last 90 days, max cyclomatic complexity 17 in cli.server at line 174. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/cli/__init__.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/command.py src/protean/core/command.py:143— src/protean/core/command.py changed 9 times in last 90 days, max cyclomatic complexity 29 in BaseCommand._build_metadata at line 143. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/command.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/cli/ir.py src/protean/cli/ir.py:111— src/protean/cli/ir.py changed 8 times in last 90 days, max cyclomatic complexity 32 in ir.diff at line 111. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/cli/ir.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/cli/docs.py src/protean/cli/docs.py:101— src/protean/cli/docs.py changed 9 times in last 90 days, max cyclomatic complexity 26 in docs.generate at line 101. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/cli/docs.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/server/observatory/metrics.py src/protean/server/observatory/metrics.py:527— src/protean/server/observatory/metrics.py changed 6 times in last 90 days, max cyclomatic complexity 39 in metrics._hand_rolled_metrics at line 527. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/server/observatory/metrics.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/aggregate.py src/protean/core/aggregate.py:174— src/protean/core/aggregate.py changed 12 times in last 90 days, max cyclomatic complexity 18 in BaseAggregate.raise_ at line 174. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/aggregate.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/event.py src/protean/core/event.py:135— src/protean/core/event.py changed 8 times in last 90 days, max cyclomatic complexity 25 in BaseEvent._build_metadata at line 135. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/event.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/fields/resolved.py src/protean/fields/resolved.py:58— src/protean/fields/resolved.py changed 11 times in last 90 days, max cyclomatic complexity 18 in ResolvedField.__init__ at line 58. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/fields/resolved.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/projection.py src/protean/core/projection.py:224— src/protean/core/projection.py changed 12 times in last 90 days, max cyclomatic complexity 16 in BaseProjection.__init__ at line 224. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/projection.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/core/value_object.py src/protean/core/value_object.py:389— src/protean/core/value_object.py changed 10 times in last 90 days, max cyclomatic complexity 19 in value_object.value_object_from_entity at line 389. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/core/value_object.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/ext/mypy_plugin.py src/protean/ext/mypy_plugin.py:631— src/protean/ext/mypy_plugin.py changed 5 times in last 90 days, max cyclomatic complexity 38 in mypy_plugin._synthesize_init at line 631. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/ext/mypy_plugin.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/domain/command_processor.py src/protean/domain/command_processor.py:278— src/protean/domain/command_processor.py changed 6 times in last 90 days, max cyclomatic complexity 31 in CommandProcessor.process at line 278. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/domain/command_processor.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/protean/cli/check.py src/protean/cli/check.py:306— src/protean/cli/check.py changed 8 times in last 90 days, max cyclomatic complexity 19 in check._print_rich at line 306. 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-06-22..2026-09-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-22 14:53:19 -07:00' --until='2026-09-20 14:53:19 -07:00' --full-history --no-merges -- src/protean/cli/check.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
FileTooLong: ir/builder.py src/protean/ir/builder.py— FileTooLong — 2388 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1888 over it, 4.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: domain/__init__.py src/protean/domain/__init__.py— FileTooLong — 1526 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1026 over it, 3.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: repository/sqlalchemy.py src/protean/adapters/repository/sqlalchemy.py— FileTooLong — 1302 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 802 over it, 2.60× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: js/timeline.js src/protean/server/observatory/static/js/timeline.js— FileTooLong — 976 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 476 over it, 1.95× 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: broker/redis.py src/protean/adapters/broker/redis.py— FileTooLong — 950 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 450 over it, 1.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: observatory/api.py src/protean/server/observatory/api.py— FileTooLong — 930 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 430 over it, 1.86× 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: scaffold/slice_generator.py src/protean/scaffold/slice_generator.py— FileTooLong — 891 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 391 over it, 1.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ir/diff.py src/protean/ir/diff.py— FileTooLong — 880 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 380 over it, 1.76× 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: server/engine.py src/protean/server/engine.py— FileTooLong — 843 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 343 over it, 1.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: utils/eventing.py src/protean/utils/eventing.py— FileTooLong — 811 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 311 over it, 1.62× 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: server/subscription_status.py src/protean/server/subscription_status.py— FileTooLong — 790 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 290 over it, 1.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/entity.py src/protean/core/entity.py— FileTooLong — 776 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 276 over it, 1.55× 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: ir/diagnostics.py src/protean/ir/diagnostics.py— FileTooLong — 757 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 257 over it, 1.51× 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: subscription/event_store_subscription.py src/protean/server/subscription/event_store_subscription.py— FileTooLong — 711 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 211 over it, 1.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: broker/inline.py src/protean/adapters/broker/inline.py— FileTooLong — 709 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 209 over it, 1.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: port/event_store.py src/protean/port/event_store.py— FileTooLong — 686 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 186 over it, 1.37× 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: routes/timeline.py src/protean/server/observatory/routes/timeline.py— FileTooLong — 672 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 172 over it, 1.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: scaffold/model_parser.py src/protean/scaffold/model_parser.py— FileTooLong — 635 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 135 over it, 1.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: ext/mypy_plugin.py src/protean/ext/mypy_plugin.py— FileTooLong — 628 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 128 over it, 1.26× 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: repository/memory.py src/protean/adapters/repository/memory.py— FileTooLong — 598 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 98 over it, 1.20× 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: protean/testing.py src/protean/testing.py— FileTooLong — 597 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 97 over it, 1.19× 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: observatory/metrics.py src/protean/server/observatory/metrics.py— FileTooLong — 563 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 63 over it, 1.13× 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: utils/logging.py src/protean/utils/logging.py— FileTooLong — 548 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 48 over it, 1.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: generators/event_model.py src/protean/ir/generators/event_model.py— FileTooLong — 545 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 45 over it, 1.09× 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: dx/managed_files.py src/protean/dx/managed_files.py— FileTooLong — 533 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 33 over it, 1.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
(anonymous)::_switchCausationView (cognitive 31) src/protean/server/observatory/static/js/timeline.js:450— (anonymous)::_switchCausationView has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 5, ternaries 3 (5 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.
(anonymous)::_showEventDetail (cognitive 29) src/protean/server/observatory/static/js/timeline.js:830— (anonymous)::_showEventDetail has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 6 (8 pts), boolean chains 5, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous)::_readURL (cognitive 27) src/protean/server/observatory/static/js/timeline.js:986— (anonymous)::_readURL has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::_renderCausationTree (cognitive 25) src/protean/server/observatory/static/js/timeline.js:502— (anonymous)::_renderCausationTree has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 9, ternaries 9, if/else 5, loops 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.
(anonymous)::_updateCorrelationDisplay (cognitive 24) src/protean/server/observatory/static/js/timeline.js:400— (anonymous)::_updateCorrelationDisplay has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::_renderAggregateTimeline (cognitive 24) src/protean/server/observatory/static/js/timeline.js:645— (anonymous)::_renderAggregateTimeline has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 10 (20 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::_fetchLatestEvent (cognitive 24) src/protean/server/observatory/static/js/timeline.js:1320— (anonymous)::_fetchLatestEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::_renderSwimlanes (cognitive 24) src/protean/server/observatory/static/js/causation-graph.js:484— (anonymous)::_renderSwimlanes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (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.
(anonymous)::updateHealthBanner (cognitive 23) src/protean/server/observatory/static/js/overview.js:311— (anonymous)::updateHealthBanner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, ternaries 1 (3 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.
(anonymous)::_showCorrelationView (cognitive 21) src/protean/server/observatory/static/js/timeline.js:337— (anonymous)::_showCorrelationView has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (17 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, 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.
(anonymous)::_showAggregateView (cognitive 21) src/protean/server/observatory/static/js/timeline.js:596— (anonymous)::_showAggregateView has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous)::fetchEvents (cognitive 20) src/protean/server/observatory/static/js/timeline.js:118— (anonymous)::fetchEvents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous)::_transferCollapseState (cognitive 20) src/protean/server/observatory/static/js/causation-graph.js:1112— (anonymous)::_transferCollapseState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, 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.
(anonymous)::searchTraces (cognitive 19) src/protean/server/observatory/static/js/timeline.js:200— (anonymous)::searchTraces has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (8 pts), error handling 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.
(anonymous)::updateSubscriptions (cognitive 18) src/protean/server/observatory/static/js/overview.js:112— (anonymous)::updateSubscriptions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::showTraceDetail (cognitive 16) src/protean/server/observatory/static/js/messages.js:290— (anonymous)::showTraceDetail has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5, ternaries 3, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::_renderTable (cognitive 16) src/protean/server/observatory/static/js/handlers.js:124— (anonymous)::_renderTable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::_zoomToConnected (cognitive 16) src/protean/server/observatory/static/js/domain-flows.js:597— (anonymous)::_zoomToConnected has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::_renderCausationTree (cyclomatic 27) src/protean/server/observatory/static/js/timeline.js:502— (anonymous)::_renderCausationTree 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.
(anonymous)::_showEventDetail (cyclomatic 26) src/protean/server/observatory/static/js/timeline.js:830— (anonymous)::_showEventDetail has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::_readURL (cyclomatic 23) src/protean/server/observatory/static/js/timeline.js:986— (anonymous)::_readURL 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.
(anonymous)::showTraceDetail (cyclomatic 23) src/protean/server/observatory/static/js/messages.js:290— (anonymous)::showTraceDetail 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.
(anonymous)::searchTraces (cyclomatic 21) src/protean/server/observatory/static/js/timeline.js:200— (anonymous)::searchTraces has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
(anonymous)::_switchCausationView (cyclomatic 21) src/protean/server/observatory/static/js/timeline.js:450— (anonymous)::_switchCausationView 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.
(anonymous)::_showCorrelationView (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:337— (anonymous)::_showCorrelationView 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.
(anonymous)::_showAggregateView (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:596— (anonymous)::_showAggregateView 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.
(anonymous)::_fetchLatestEvent (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:1320— (anonymous)::_fetchLatestEvent 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.
(anonymous)::fetchEvents (cyclomatic 16) src/protean/server/observatory/static/js/timeline.js:118— (anonymous)::fetchEvents 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.
(anonymous)::_bindEvents (cyclomatic 16) src/protean/server/observatory/static/js/timeline.js:1081— (anonymous)::_bindEvents 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.
(anonymous)::updateHealthBanner (cyclomatic 16) src/protean/server/observatory/static/js/overview.js:311— (anonymous)::updateHealthBanner 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.
Duplicated block (5 lines × 2) src/protean/ir/generators/clusters.py:92— src/protean/ir/generators/clusters.py:92-96 | src/protean/ir/generators/clusters.py:105-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) src/protean/ir/generators/handlers.py:81— src/protean/ir/generators/handlers.py:81-89 | src/protean/ir/generators/handlers.py:125-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) docs_src/guides/consume-state/002.py:142— docs_src/guides/consume-state/002.py:142-148 | src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py:174-178 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) docs_src/guides/getting-started/es-tutorial/ch09.py:205— docs_src/guides/getting-started/es-tutorial/ch09.py:205-209 | docs_src/guides/getting-started/es-tutorial/ch22.py:252-256 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch09.py` and `docs_src/guides/getting-started/es-tutorial/ch22.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) src/protean/core/email.py:145— src/protean/core/email.py:145-149 | src/protean/core/value_object.py:325-329 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) src/protean/core/entity.py:662— src/protean/core/entity.py:662-666 | src/protean/core/value_object.py:238-242 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) src/protean/core/query.py:254— src/protean/core/query.py:254-258 | src/protean/utils/eventing.py:489-493 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:146— src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:146-150 | src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py:100-104 — before extracting anything, compare `src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py` and `src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) src/protean/dx/pack/skills/add-event/assets/add_event_cross_aggregate.py:120— src/protean/dx/pack/skills/add-event/assets/add_event_cross_aggregate.py:120-128 | src/protean/dx/pack/skills/event-handler/assets/cross_sync_order_inventory.py:89-93 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) src/protean/dx/pack/skills/entity/assets/entity_with_hasmany.py:73— src/protean/dx/pack/skills/entity/assets/entity_with_hasmany.py:73-77 | src/protean/dx/pack/skills/generate-test-scaffold/assets/scaffold_aggregate_unit.py:127-131 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:129— src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:129-133 | src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py:145-149 — before extracting anything, compare `src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py` and `src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) docs_src/guides/getting-started/es-tutorial/ch22.py:470— docs_src/guides/getting-started/es-tutorial/ch22.py:470-478 | docs_src/guides/getting-started/es-tutorial/ch22.py:482-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `DepositMade` in one and `WithdrawalMade` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) src/protean/core/entity.py:940— src/protean/core/entity.py:940-948 | src/protean/core/projection.py:369-377 — before extracting anything, compare `src/protean/core/entity.py` and `src/protean/core/projection.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src/protean/ir/builder.py:796— src/protean/ir/builder.py:796-804 | src/protean/ir/builder.py:1158-1166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ir/builder.py:792` calls `getattr`, `sorted` and `src/protean/ir/builder.py:1156` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) src/protean/ir/builder.py:1225— src/protean/ir/builder.py:1225-1233 | src/protean/ir/builder.py:1236-1244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/ir/builder.py:1225` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) src/protean/server/observatory/api.py:817— src/protean/server/observatory/api.py:817-825 | src/protean/server/observatory/api.py:944-952 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) docs_src/guides/getting-started/es-tutorial/ch09.py:298— docs_src/guides/getting-started/es-tutorial/ch09.py:298-307 | docs_src/guides/getting-started/es-tutorial/ch22.py:535-543 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch09.py` and `docs_src/guides/getting-started/es-tutorial/ch22.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src/protean/adapters/broker/redis.py:1563— src/protean/adapters/broker/redis.py:1563-1571 | src/protean/adapters/broker/redis_pubsub.py:294-306 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:80— src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:80-88 | src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py:77-85 — before extracting anything, compare `src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py` and `src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) src/protean/dx/pack/skills/value-object/assets/value_object_in_aggregate.py:102— src/protean/dx/pack/skills/value-object/assets/value_object_in_aggregate.py:102-115 | src/protean/dx/pack/skills/value-object/assets/value_object_in_entity.py:138-146 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) src/protean/scaffold/add_plan.py:242— src/protean/scaffold/add_plan.py:242-256 | src/protean/upgrade_uow.py:44-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) src/protean/domain/validation.py:330— src/protean/domain/validation.py:330-337 | src/protean/domain/validation.py:343-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) src/protean/ext/mypy_plugin.py:676— src/protean/ext/mypy_plugin.py:676-686 | src/protean/ext/mypy_plugin.py:924-931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ext/mypy_plugin.py:923` calls `isinstance` and `src/protean/ext/mypy_plugin.py:673` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src/protean/ext/mypy_plugin.py:968— src/protean/ext/mypy_plugin.py:968-975 | src/protean/ext/mypy_plugin.py:990-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/ext/mypy_plugin.py:968` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) src/protean/server/observatory/api.py:468— src/protean/server/observatory/api.py:468-475 | src/protean/server/observatory/routes/timeline.py:555-562 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/server/observatory/routes/timeline.py:552` calls `debug` and `src/protean/server/observatory/api.py:467` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) src/protean/core/entity.py:1042— src/protean/core/entity.py:1042-1049 | src/protean/core/projection.py:400-407 — before extracting anything, compare `src/protean/core/entity.py` and `src/protean/core/projection.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_with_pydantic.py:76— src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_with_pydantic.py:76-83 | src/protean/dx/pack/skills/command-handler/assets/command_handler_multiple_commands.py:90-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) src/protean/adapters/broker/redis.py:1322— src/protean/adapters/broker/redis.py:1322-1329 | src/protean/adapters/cache/redis.py:63-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) src/protean/core/application_service.py:77— src/protean/core/application_service.py:77-84 | src/protean/core/query_handler.py:88-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
TooManyMethods: Domain src/protean/domain/__init__.py:210— TooManyMethods — 131 methods. The bar is 30 methods; this is 101 over it, 4.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: IRBuilder src/protean/ir/builder.py:205— TooManyMethods — 95 methods. The bar is 30 methods; this is 65 over it, 3.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RedisBroker src/protean/adapters/broker/redis.py:143— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseBroker src/protean/port/broker.py:121— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InlineBroker src/protean/adapters/broker/inline.py:36— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseEventStore src/protean/port/event_store.py:115— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseDAO src/protean/port/dao.py:62— 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.
Duplicated block (10 lines × 2) docs_src/guides/getting-started/tutorial/ch06.py:202— docs_src/guides/getting-started/tutorial/ch06.py:202-211 | docs_src/guides/getting-started/tutorial/ch09.py:201-210 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) src/protean/core/entity.py:1252— src/protean/core/entity.py:1252-1261 | src/protean/core/value_object.py:374-383 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) docs_src/guides/consume-state/002.py:127— docs_src/guides/consume-state/002.py:127-138 | src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py:161-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) docs_src/guides/getting-started/es-tutorial/ch09.py:186— docs_src/guides/getting-started/es-tutorial/ch09.py:186-195 | docs_src/guides/getting-started/es-tutorial/ch22.py:233-242 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch09.py` and `docs_src/guides/getting-started/es-tutorial/ch22.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) src/protean/cli/check.py:270— src/protean/cli/check.py:270-283 | src/protean/cli/verify.py:328-337 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `counts` to `dict[str, int]` in one and `dict[str, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) src/protean/core/projection.py:205— src/protean/core/projection.py:205-214 | src/protean/utils/eventing.py:473-485 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:116— src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:116-125 | src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py:132-141 — before extracting anything, compare `src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py` and `src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) src/protean/core/domain_service.py:97— src/protean/core/domain_service.py:97-109 | src/protean/core/domain_service.py:113-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src/protean/core/unit_of_work.py:365— src/protean/core/unit_of_work.py:365-377 | src/protean/core/unit_of_work.py:386-398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src/protean/ir/generators/base.py:253— src/protean/ir/generators/base.py:253-265 | src/protean/ir/generators/base.py:269-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) src/protean/server/engine.py:576— src/protean/server/engine.py:576-588 | src/protean/server/engine.py:614-626 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) src/protean/server/subscription/broker_subscription.py:116— src/protean/server/subscription/broker_subscription.py:116-128 | src/protean/server/subscription/event_store_subscription.py:459-471 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 2) src/protean/adapters/broker/inline.py:134— src/protean/adapters/broker/inline.py:134-146 | src/protean/adapters/broker/redis_pubsub.py:81-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) src/protean/port/dao.py:450— src/protean/port/dao.py:450-461 | src/protean/port/dao.py:515-526 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) src/protean/server/observatory/routes/handlers.py:516— src/protean/server/observatory/routes/handlers.py:516-527 | src/protean/server/observatory/routes/processes.py:455-466 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/routes/handlers.py:516` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/protean/server/observatory/routes/handlers.py:522— src/protean/server/observatory/routes/handlers.py:522-533 | src/protean/server/observatory/routes/handlers.py:567-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/routes/handlers.py:522` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) src/protean/utils/health.py:31— src/protean/utils/health.py:31-42 | src/protean/utils/health.py:53-64 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) docs_src/guides/getting-started/tutorial/ch06.py:222— docs_src/guides/getting-started/tutorial/ch06.py:222-233 | docs_src/guides/getting-started/tutorial/ch09.py:217-228 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) src/protean/port/broker.py:1103— src/protean/port/broker.py:1103-1114 | src/protean/port/provider.py:482-493 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) src/protean/core/entity.py:444— src/protean/core/entity.py:444-450 | src/protean/core/projection.py:243-249 — before extracting anything, compare `src/protean/core/entity.py` and `src/protean/core/projection.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) src/protean/ir/builder.py:938— src/protean/ir/builder.py:938-944 | src/protean/ir/builder.py:975-981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ir/builder.py:974` calls `getattr` and `src/protean/ir/builder.py:936` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) src/protean/server/observatory/api.py:267— src/protean/server/observatory/api.py:267-273 | src/protean/server/observatory/api.py:579-585 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) docs_src/guides/getting-started/es-tutorial/ch09.py:246— docs_src/guides/getting-started/es-tutorial/ch09.py:246-252 | docs_src/guides/getting-started/es-tutorial/ch22.py:289-295 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch09.py` and `docs_src/guides/getting-started/es-tutorial/ch22.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) src/protean/adapters/broker/inline.py:989— src/protean/adapters/broker/inline.py:989-995 | src/protean/adapters/broker/redis_pubsub.py:110-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `stream` to `str | None = None` in one and `str | None = ""` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 2) src/protean/core/projection.py:168— src/protean/core/projection.py:168-178 | src/protean/utils/eventing.py:440-446 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:206— src/protean/server/observatory/static/js/causation-graph.js:206 · src/protean/server/observatory/static/js/causation-graph.js:1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:349— src/protean/server/observatory/static/js/causation-graph.js:349 · src/protean/server/observatory/static/js/causation-graph.js:364 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:410— src/protean/server/observatory/static/js/causation-graph.js:410 · src/protean/server/observatory/static/js/causation-graph.js:429 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) src/protean/server/observatory/static/js/domain-detail.js:208— src/protean/server/observatory/static/js/domain-detail.js:208 · src/protean/server/observatory/static/js/domain-detail.js:309 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) src/protean/server/observatory/static/js/domain-flows.js:659— src/protean/server/observatory/static/js/domain-flows.js:659 · src/protean/server/observatory/static/js/domain-topology.js:528 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) src/protean/server/observatory/static/js/domain-topology.js:557— src/protean/server/observatory/static/js/domain-topology.js:557 · src/protean/server/observatory/static/js/domain-topology.js:570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) src/protean/ir/builder.py:921— src/protean/ir/builder.py:921-938 | src/protean/ir/builder.py:957-974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/ir/builder.py:975` calls `getattr` and `src/protean/ir/builder.py:939` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 2) src/protean/ir/generators/handlers.py:135— src/protean/ir/generators/handlers.py:135-152 | src/protean/ir/generators/handlers.py:244-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) src/protean/port/broker.py:1082— src/protean/port/broker.py:1082-1099 | src/protean/port/provider.py:461-478 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) src/protean/server/observatory/api.py:707— src/protean/server/observatory/api.py:707-727 | src/protean/server/observatory/api.py:731-748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/api.py:707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) src/protean/adapters/broker/redis.py:1296— src/protean/adapters/broker/redis.py:1296-1310 | src/protean/adapters/broker/redis_pubsub.py:239-252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–15 lines × 2) src/protean/core/aggregate.py:586— src/protean/core/aggregate.py:586-600 | src/protean/core/value_object.py:459-472 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14–15 lines × 2) src/protean/core/queryset.py:355— src/protean/core/queryset.py:355-369 | src/protean/core/queryset.py:463-476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) src/protean/server/observatory/api.py:1166— src/protean/server/observatory/api.py:1166-1179 | src/protean/server/observatory/api.py:1212-1226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/api.py:1166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 2) src/protean/ir/builder.py:3432— src/protean/ir/builder.py:3432-3442 | src/protean/ir/builder.py:3444-3454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/protean/ir/generators/events.py:130— src/protean/ir/generators/events.py:130-140 | src/protean/ir/generators/events.py:292-302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) src/protean/dx/pack/skills/add-event/assets/add_event_multiple_events.py:69— src/protean/dx/pack/skills/add-event/assets/add_event_multiple_events.py:69-80 | src/protean/dx/pack/skills/event-handler/assets/event_handler_error_handling.py:53-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/dx/pack/skills/add-event/assets/add_event_multiple_events.py:65` calls `String`, `DateTime` and `src/protean/dx/pack/skills/event-handler/assets/event_handler_error_handling.py:50` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) src/protean/dx/pack/skills/subscriber/assets/subscriber_domain_interaction.py:61— src/protean/dx/pack/skills/subscriber/assets/subscriber_domain_interaction.py:61-76 | src/protean/dx/pack/skills/subscriber/assets/subscriber_multiple_streams.py:62-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 3) src/protean/core/aggregate.py:675— src/protean/core/aggregate.py:675-682 | src/protean/core/entity.py:1252-1259 | src/protean/core/value_object.py:374-381 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) src/protean/port/event_store.py:1069— src/protean/port/event_store.py:1069-1076 | src/protean/server/observatory/routes/timeline.py:106-113 | src/protean/server/observatory/routes/timeline.py:460-467 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) src/protean/core/email.py:89— src/protean/core/email.py:89-96 | src/protean/core/query.py:189-196 | src/protean/core/value_object.py:185-192 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) src/protean/adapters/broker/__init__.py:38— src/protean/adapters/broker/__init__.py:38-45 | src/protean/adapters/cache/__init__.py:52-59 | src/protean/adapters/repository/__init__.py:102-109 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 2) src/protean/ir/generators/events.py:138— src/protean/ir/generators/events.py:138-143 | src/protean/ir/generators/events.py:221-226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) src/protean/ir/generators/events.py:263— src/protean/ir/generators/events.py:263-268 | src/protean/ir/generators/events.py:276-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) src/protean/dx/pack/skills/value-object/assets/value_object_nested.py:84— src/protean/dx/pack/skills/value-object/assets/value_object_nested.py:84-89 | src/protean/dx/pack/skills/value-object/assets/value_object_with_methods.py:34-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) src/protean/server/reloader.py:310— src/protean/server/reloader.py:310-315 | src/protean/server/supervisor.py:234-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2 locations) src/protean/server/observatory/static/js/domain-detail.js:284— src/protean/server/observatory/static/js/domain-detail.js:284 · src/protean/server/observatory/static/js/domain-detail.js:294 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) src/protean/server/observatory/static/js/domain-topology.js:343— src/protean/server/observatory/static/js/domain-topology.js:343 · src/protean/server/observatory/static/js/domain-topology.js:356 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) src/protean/server/observatory/static/js/messages.js:297— src/protean/server/observatory/static/js/messages.js:297 · src/protean/server/observatory/static/js/messages.js:355 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 2 locations) src/protean/server/observatory/static/js/timeline.js:244— src/protean/server/observatory/static/js/timeline.js:244 · src/protean/server/observatory/static/js/timeline.js:726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:394— src/protean/server/observatory/static/js/causation-graph.js:394 · src/protean/server/observatory/static/js/causation-graph.js:420 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (6 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:937— src/protean/server/observatory/static/js/causation-graph.js:937 · src/protean/server/observatory/static/js/domain-topology.js:682 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (6 lines × 2 locations) src/protean/server/observatory/static/js/domain-topology.js:373— src/protean/server/observatory/static/js/domain-topology.js:373 · src/protean/server/observatory/static/js/domain-topology.js:399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2 locations) src/protean/server/observatory/static/js/timeline.js:1000— src/protean/server/observatory/static/js/timeline.js:1000 · src/protean/server/observatory/static/js/timeline.js:1258 — 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.
TodoComment src/protean/adapters/event_store/message_db.py:146— # TODO: page-in the whole stream only because the message-db client has — 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 src/protean/ir/diff.py:1046— # TODO(3.4.6): key by the qualified type string once available in the IR. — 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 src/protean/ir/builder.py:2983— # pre-existing limitation of the name-based type string; TODO(3.4.6): — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (20 lines × 2) src/protean/core/command.py:105— src/protean/core/command.py:105-124 | src/protean/core/event.py:91-110 — before extracting anything, compare `src/protean/core/command.py` and `src/protean/core/event.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/core/event.py:111` calls `pop` and `src/protean/core/command.py:125` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20 lines × 2) src/protean/server/observatory/api.py:1128— src/protean/server/observatory/api.py:1128-1147 | src/protean/server/observatory/api.py:1180-1199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) src/protean/server/subscription/config_resolver.py:462— src/protean/server/subscription/config_resolver.py:462-481 | src/protean/server/subscription/profiles.py:560-579 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–19 lines × 2) src/protean/cli/projection.py:181— src/protean/cli/projection.py:181-198 | src/protean/cli/subscriptions.py:74-92 — before extracting anything, compare `src/protean/cli/projection.py` and `src/protean/cli/subscriptions.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/cli/subscriptions.py:93` calls `add_column` and `src/protean/cli/projection.py:199` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18–19 lines × 2) src/protean/port/event_store.py:1044— src/protean/port/event_store.py:1044-1062 | src/protean/server/observatory/routes/timeline.py:420-437 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (18–19 lines × 2) src/protean/server/observatory/routes/handlers.py:349— src/protean/server/observatory/routes/handlers.py:349-367 | src/protean/server/observatory/routes/processes.py:218-235 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) src/protean/ir/diff.py:292— src/protean/ir/diff.py:292-306 | src/protean/ir/diff.py:316-330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) src/protean/server/observatory/metrics.py:565— src/protean/server/observatory/metrics.py:565-581 | src/protean/server/observatory/metrics.py:595-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/metrics.py:565` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/server/observatory/metrics.py:594` calls `get` and `src/protean/server/observatory/metrics.py:565` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) src/protean/server/observatory/routes/eventstore.py:41— src/protean/server/observatory/routes/eventstore.py:41-55 | src/protean/server/observatory/routes/processes.py:99-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14 lines × 2) src/protean/ir/generators/events.py:300— src/protean/ir/generators/events.py:300-313 | src/protean/ir/generators/events.py:398-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) src/protean/server/outbox_processor.py:422— src/protean/server/outbox_processor.py:422-435 | src/protean/server/outbox_processor.py:735-748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) src/protean/server/subscription/broker_subscription.py:385— src/protean/server/subscription/broker_subscription.py:385-399 | src/protean/server/subscription/stream_subscription.py:981-994 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/subscription/broker_subscription.py:385` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 3) src/protean/cli/eventstore.py:535— src/protean/cli/eventstore.py:535-546 | src/protean/cli/projection.py:185-196 | src/protean/cli/subscriptions.py:78-90 — before extracting anything, compare `src/protean/cli/projection.py` and `src/protean/cli/subscriptions.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/cli/eventstore.py:535` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/cli/subscriptions.py:93` calls `add_column` and `src/protean/cli/projection.py:199` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–13 lines × 3) src/protean/server/observatory/api.py:1082— src/protean/server/observatory/api.py:1082-1093 | src/protean/server/observatory/api.py:1244-1256 | src/protean/server/observatory/api.py:1295-1307 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `subscription` to `str | None = Query(None, description="Filter by stream category")` in one and `str = Query(..., description="Stream category (required)")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12–13 lines × 3) src/protean/server/observatory/routes/timeline.py:227— src/protean/server/observatory/routes/timeline.py:227-239 | src/protean/server/observatory/routes/timeline.py:329-341 | src/protean/server/observatory/routes/timeline.py:749-760 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 3) src/protean/ir/builder.py:1217— src/protean/ir/builder.py:1217-1222 | src/protean/ir/builder.py:1228-1233 | src/protean/ir/builder.py:1239-1244 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) src/protean/ir/generators/events.py:290— src/protean/ir/generators/events.py:290-295 | src/protean/ir/generators/events.py:379-386 | src/protean/ir/generators/handlers.py:225-232 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 3) src/protean/server/engine.py:1362— src/protean/server/engine.py:1362-1367 | src/protean/server/engine.py:1369-1376 | src/protean/server/engine.py:1377-1384 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/server/engine.py:1362` calls `create_task`, `start` and `src/protean/server/engine.py:1377` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 5) docs_src/guides/domain-behavior/006.py:106— docs_src/guides/domain-behavior/006.py:106-111 | docs_src/guides/domain-behavior/007.py:105-110 | src/protean/dx/pack/skills/domain-service/assets/domain_service_callable.py:119-124 | src/protean/dx/pack/skills/domain-service/assets/domain_service_instance_methods.py:117-122 | src/protean/dx/pack/skills/domain-service/assets/domain_service_with_invariants.py:121-126 — before extracting anything, compare `docs_src/guides/domain-behavior/006.py` and `docs_src/guides/domain-behavior/007.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 5) docs_src/guides/getting-started/es-tutorial/ch06.py:227— docs_src/guides/getting-started/es-tutorial/ch06.py:227-232 | docs_src/guides/getting-started/es-tutorial/ch08.py:253-258 | docs_src/guides/getting-started/es-tutorial/ch18.py:198-203 | docs_src/guides/getting-started/es-tutorial/ch20.py:192-197 | docs_src/guides/getting-started/es-tutorial/ch22.py:377-382 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch06.py` and `docs_src/guides/getting-started/es-tutorial/ch18.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 5) docs_src/guides/getting-started/es-tutorial/ch06.py:236— docs_src/guides/getting-started/es-tutorial/ch06.py:236-241 | docs_src/guides/getting-started/es-tutorial/ch08.py:262-267 | docs_src/guides/getting-started/es-tutorial/ch18.py:207-212 | docs_src/guides/getting-started/es-tutorial/ch20.py:201-206 | docs_src/guides/getting-started/es-tutorial/ch22.py:386-391 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch06.py` and `docs_src/guides/getting-started/es-tutorial/ch18.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2 locations) src/protean/server/observatory/static/js/domain-detail.js:117— src/protean/server/observatory/static/js/domain-detail.js:117 · src/protean/server/observatory/static/js/domain-detail.js:129 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) src/protean/server/observatory/static/js/domain-flows.js:608— src/protean/server/observatory/static/js/domain-flows.js:608 · src/protean/server/observatory/static/js/domain-flows.js:792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2 locations) src/protean/server/observatory/static/js/timeline.js:288— src/protean/server/observatory/static/js/timeline.js:288 · src/protean/server/observatory/static/js/timeline.js:772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
FixmeComment src/protean/cli/generate.py:4— # FIXME`` — so it was removed outright during the 1.0 CLI — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/cli/test_generate_docker_compose.py:4— # FIXME``); it was removed outright in the 1.0 CLI surface — 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.
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only the decision is stated · ×2
No context/problem and no consequences/trade-offs; only the decision is stated changes/1327.added.md— Add why versioned ChangePlans matter (e.g. managing change proposals before committing) and what trade-offs exist (version drift when changes are reverted or merged)
No context/problem and no consequences/trade-offs; only the decision is stated changes/1358.added.md— Add a Context section explaining why batching past the read cap silently truncates (e.g. projection rebuilds failing on a store larger than the old cap) and a Consequences section noting trade-offs such as batch-size overhead, replay cost, or increased memory usage
D20 · ADR Quality· No consequences/trade-offs · ×2
No consequences/trade-offs: over-reporting/under-reporting and receiver-blind matching are stated but no negative impact is noted changes/1433.added.md— Add a Consequences section noting that `raises` can falsely claim an event is raised when it isn't (false positive) and that `invokes` may wrongly record a call where none exists (false positive), plus the trade-off of needing to re-run diffs after schema changes
No consequences/trade-offs: the ADR describes only what the harness does without stating when it should or shouldn't be used changes/1509.added.md— Add a Consequences section covering trade-offs such as CI cost for the replay lane and how the transcript format interacts with existing scoring tools
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) docs_src/guides/getting-started/es-tutorial/ch06.py:214— docs_src/guides/getting-started/es-tutorial/ch06.py:214-223 | docs_src/guides/getting-started/es-tutorial/ch08.py:240-249 | docs_src/guides/getting-started/es-tutorial/ch18.py:185-194 | docs_src/guides/getting-started/es-tutorial/ch20.py:179-188 | docs_src/guides/getting-started/es-tutorial/ch22.py:364-373 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) src/protean/core/command.py:80— src/protean/core/command.py:80-135 | src/protean/core/email.py:101-117 | src/protean/core/event.py:62-127 | src/protean/core/query.py:199-240 | src/protean/core/value_object.py:197-212 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (17–19 lines × 2) src/protean/server/observatory/metrics.py:633— src/protean/server/observatory/metrics.py:633-651 | src/protean/server/observatory/metrics.py:776-792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/metrics.py:633` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–19 lines × 2) src/protean/server/subscription/__init__.py:120— src/protean/server/subscription/__init__.py:120-138 | src/protean/server/subscription/partitioned_stream_subscription.py:247-263 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–18 lines × 2) src/protean/server/subscription/broker_subscription.py:366— src/protean/server/subscription/broker_subscription.py:366-383 | src/protean/server/subscription/stream_subscription.py:964-979 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/subscription/broker_subscription.py:366` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–18 lines × 2) src/protean/upgrade.py:198— src/protean/upgrade.py:198-215 | src/protean/upgrade.py:484-499 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/upgrade.py:500` calls `get_indexes` and `src/protean/upgrade.py:216` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) src/protean/core/entity.py:452— src/protean/core/entity.py:452-468 | src/protean/core/projection.py:251-267 — before extracting anything, compare `src/protean/core/entity.py` and `src/protean/core/projection.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) src/protean/upgrade.py:635— src/protean/upgrade.py:635-651 | src/protean/upgrade_opportunities.py:968-984 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 3) docs_src/guides/consume-state/002.py:32— docs_src/guides/consume-state/002.py:32-47 | src/protean/dx/pack/skills/projector/assets/projector_multiple_events.py:62-77 | src/protean/dx/pack/skills/projector/assets/projector_multiple_projectors.py:59-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 3) src/protean/server/observatory/routes/infrastructure.py:108— src/protean/server/observatory/routes/infrastructure.py:108-123 | src/protean/server/observatory/routes/infrastructure.py:137-152 | src/protean/server/observatory/routes/infrastructure.py:216-231 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 2) src/protean/ir/diff.py:225— src/protean/ir/diff.py:225-240 | src/protean/ir/diff.py:262-277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:211— src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:211-226 | src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py:140-158 — before extracting anything, compare `src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py` and `src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 3) src/protean/ir/builder.py:990— src/protean/ir/builder.py:990-1000 | src/protean/ir/builder.py:1049-1059 | src/protean/ir/builder.py:1354-1364 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ir/builder.py:1351` calls `getattr` and `src/protean/ir/builder.py:987` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 3) docs_src/guides/domain-behavior/006.py:138— docs_src/guides/domain-behavior/006.py:138-148 | docs_src/guides/domain-behavior/007.py:137-147 | src/protean/dx/pack/skills/domain-service/assets/domain_service_with_invariants.py:153-163 — before extracting anything, compare `docs_src/guides/domain-behavior/006.py` and `docs_src/guides/domain-behavior/007.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) src/protean/server/observatory/api.py:816— src/protean/server/observatory/api.py:816-823 | src/protean/server/observatory/api.py:943-950 | src/protean/server/observatory/routes/handlers.py:358-365 | src/protean/server/observatory/routes/processes.py:226-233 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/server/observatory/routes/handlers.py:367` calls `get` and `src/protean/server/observatory/api.py:952` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 4) src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:127— src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:127-134 | src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py:89-96 | src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_simple.py:66-73 | src/protean/dx/pack/skills/command-handler/assets/command_handler_simple.py:68-82 — before extracting anything, compare `src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py` and `src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15 lines × 2 locations) src/protean/server/observatory/static/js/domain-flows.js:737— src/protean/server/observatory/static/js/domain-flows.js:737 · src/protean/server/observatory/static/js/domain-processes.js:382 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (15 lines × 2 locations) src/protean/server/observatory/static/js/messages.js:433— src/protean/server/observatory/static/js/messages.js:433 · src/protean/server/observatory/static/js/messages.js:452 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) src/protean/server/observatory/static/js/overview.js:373— src/protean/server/observatory/static/js/overview.js:373 · src/protean/server/observatory/static/js/timeline.js:1553 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) src/protean/server/observatory/static/js/timeline.js:1092— src/protean/server/observatory/static/js/timeline.js:1092 · src/protean/server/observatory/static/js/timeline.js:1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC3 · Page structure· Heading level jumps from h1 to h3 · ×1
Heading level jumps from h1 to h3 src/protean/server/observatory/templates/timeline.html:326— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no automated accessibility check runs over the HTML your app renders. Assert the accessibility invariants over that HTML in the test suite you already have (parse the output and assert, or drive a browser), and gate that test in CI so a regression blocks the merge. What was searched, so you can tell an absence from a miss: the 22 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.
(anonymous) (cyclomatic 142) src/protean/server/observatory/static/js/handlers.js:7— (anonymous) has cyclomatic complexity 142 (threshold 15). Most of this is not in the body itself: 2 of the 142 points are its own statements and the rest belongs to 35 function items inside it that branch (_sorted::(anonymous), _renderTable::(anonymous), _filtered::(anonymous), …). 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.
(anonymous) (cyclomatic 135) src/protean/server/observatory/static/js/causation-graph.js:14— (anonymous) has cyclomatic complexity 135 (threshold 15). Most of this is not in the body itself: 1 of the 135 points is its own statement and the rest belongs to 97 function items inside it that branch (_transferCollapseState, _renderSwimlanes, _renderTimelineAxis, …). 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.
(anonymous) (cyclomatic 125) src/protean/server/observatory/static/js/domain-flows.js:15— (anonymous) has cyclomatic complexity 125 (threshold 15). Most of this is not in the body itself: 1 of the 125 points is its own statement and the rest belongs to 74 function items inside it that branch (_zoomToConnected, _computeLayout, _computeLayout::(anonymous), …). 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.
(anonymous) (cyclomatic 114) src/protean/server/observatory/static/js/processes.js:7— (anonymous) has cyclomatic complexity 114 (threshold 15). Most of this is not in the body itself: 2 of the 114 points are its own statements and the rest belongs to 28 function items inside it that branch (_sorted::(anonymous), _renderTable::(anonymous), _exportCSV::(anonymous), …). 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.
(anonymous) (cyclomatic 106) src/protean/server/observatory/static/js/core.js:7— (anonymous) has cyclomatic complexity 106 (threshold 15). Most of this is not in the body itself: 3 of the 106 points are its own statements and the rest belongs to 48 function items inside it that branch (_initKeyboard::(anonymous), timeAgo, statusClass, …). 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.
(anonymous) (cyclomatic 83) src/protean/server/observatory/static/js/domain-detail.js:15— (anonymous) has cyclomatic complexity 83 (threshold 15). Most of this is not in the body itself: 2 of the 83 points are its own statements and the rest belongs to 29 function items inside it that branch (_fieldTypeLabel, _fieldConstraints, show, …). 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.
(anonymous) (cyclomatic 74) src/protean/server/observatory/static/js/domain-topology.js:12— (anonymous) has cyclomatic complexity 74 (threshold 15). Most of this is not in the body itself: 1 of the 74 points is its own statement and the rest belongs to 58 function items inside it that branch (render, _buildBadgeText, _renderSingleNode, …). 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.
(anonymous) (cyclomatic 73) src/protean/server/observatory/static/js/eventstore.js:7— (anonymous) has cyclomatic complexity 73 (threshold 15). Most of this is not in the body itself: 2 of the 73 points are its own statements and the rest belongs to 22 function items inside it that branch (_sorted::(anonymous), _renderOutbox::(anonymous), _updateSummary, …). 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.
(anonymous) (cyclomatic 69) src/protean/server/observatory/static/js/domain.js:8— (anonymous) has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 2 of the 69 points are its own statements and the rest belongs to 37 function items inside it that branch (_wireSearch::(anonymous), _switchTab, _wireSearch, …). 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.
recover.recover (cyclomatic 48) src/protean/cli/recover.py:223— recover.recover 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.
SqlalchemyModel.__init_subclass__ (cyclomatic 46) src/protean/adapters/repository/sqlalchemy.py:595— SqlalchemyModel.__init_subclass__ 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.
slice_generator._validate (cyclomatic 44) src/protean/scaffold/slice_generator.py:648— slice_generator._validate 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.
(anonymous) (cyclomatic 40) src/protean/server/observatory/static/js/charts.js:7— (anonymous) has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to 32 function items inside it that branch (areaChart, sparkline, barChart, …). 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.
metrics._hand_rolled_metrics (cyclomatic 39) src/protean/server/observatory/metrics.py:527— metrics._hand_rolled_metrics 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.
(anonymous) (cyclomatic 39) src/protean/server/observatory/static/js/domain-processes.js:15— (anonymous) has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 3 of the 39 points are its own statements and the rest belongs to 21 function items inside it that branch (_buildHeaderHTML, _renderTransitions::(anonymous), _toggleExpand, …). 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.
mypy_plugin._synthesize_init (cyclomatic 38) src/protean/ext/mypy_plugin.py:631— mypy_plugin._synthesize_init 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.
(anonymous) (cyclomatic 36) src/protean/server/observatory/static/js/infrastructure.js:7— (anonymous) has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 2 of the 36 points are its own statements and the rest belongs to 13 function items inside it that branch (_onDataLoaded, _formatUptime, _updateTile, …). 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.
timeline._bindEvents (cyclomatic 35) src/protean/server/observatory/static/js/timeline.js:1081— timeline._bindEvents has cyclomatic complexity 35 (threshold 15). Of this number, 16 points are the body's own statements and 19 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.
IRBuilder._extract_resolved_field (cyclomatic 33) src/protean/ir/builder.py:424— IRBuilder._extract_resolved_field 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.
ir.diff (cyclomatic 32) src/protean/cli/ir.py:111— ir.diff has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UnitOfWork._do_commit (cyclomatic 32) src/protean/core/unit_of_work.py:258— UnitOfWork._do_commit 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.
CommandProcessor.process (cyclomatic 31) src/protean/domain/command_processor.py:278— CommandProcessor.process 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.
utils._prepare_pydantic_namespace (cyclomatic 31) src/protean/utils/__init__.py:309— utils._prepare_pydantic_namespace 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.
handlers._sorted (cyclomatic 31) src/protean/server/observatory/static/js/handlers.js:54— handlers._sorted has cyclomatic complexity 31 (threshold 15). 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 56). 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.
timeline._showEventDetail (cyclomatic 31) src/protean/server/observatory/static/js/timeline.js:830— timeline._showEventDetail has cyclomatic complexity 31 (threshold 15). Of this number, 26 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.
domain._build_flow_graph (cyclomatic 30) src/protean/server/observatory/routes/domain.py:202— domain._build_flow_graph has cyclomatic complexity 30 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
BaseCommand._build_metadata (cyclomatic 29) src/protean/core/command.py:143— BaseCommand._build_metadata 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.
processes._sorted (cyclomatic 29) src/protean/server/observatory/static/js/processes.js:47— processes._sorted has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to one function literal inside it that branches (line 49). 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.
timeline._renderCausationTree (cyclomatic 29) src/protean/server/observatory/static/js/timeline.js:502— timeline._renderCausationTree has cyclomatic complexity 29 (threshold 15). Of this number, 27 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.
Engine.handle_message (cyclomatic 28) src/protean/server/engine.py:815— Engine.handle_message has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BaseRepository._sync_children (cyclomatic 27) src/protean/core/repository.py:370— BaseRepository._sync_children 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.
docs.generate (cyclomatic 26) src/protean/cli/docs.py:101— docs.generate has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BaseEntity.model_post_init (cyclomatic 26) src/protean/core/entity.py:534— BaseEntity.model_post_init 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.
timeline.collect_all_events (cyclomatic 26) src/protean/server/observatory/routes/timeline.py:208— timeline.collect_all_events 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.
BaseEvent._build_metadata (cyclomatic 25) src/protean/core/event.py:135— BaseEvent._build_metadata 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.
mypy_plugin._synthesize_has_many_methods (cyclomatic 25) src/protean/ext/mypy_plugin.py:894— mypy_plugin._synthesize_has_many_methods 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.
IRBuilder._diagnose_unsourced_projection_field (cyclomatic 25) src/protean/ir/builder.py:2481— IRBuilder._diagnose_unsourced_projection_field 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.
IRBuilder._find_deprecated_import_uses (cyclomatic 25) src/protean/ir/builder.py:3807— IRBuilder._find_deprecated_import_uses 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.
domain._wireSearch (cyclomatic 25) src/protean/server/observatory/static/js/domain.js:154— domain._wireSearch has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 256, 247, 169, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BaseEntity.__init__ (cyclomatic 24) src/protean/core/entity.py:419— BaseEntity.__init__ 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.
handlers._renderTable (cyclomatic 24) src/protean/server/observatory/static/js/handlers.js:124— handlers._renderTable 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 one function literal inside it that branches (line 135). 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.
Domain._register_element (cyclomatic 23) src/protean/domain/__init__.py:1046— Domain._register_element 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.
CommandProcessor.enrich (cyclomatic 23) src/protean/domain/command_processor.py:146— CommandProcessor.enrich 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.
upgrade_uow._http_names (cyclomatic 23) src/protean/upgrade_uow.py:80— upgrade_uow._http_names 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.
messages.showTraceDetail (cyclomatic 23) src/protean/server/observatory/static/js/messages.js:290— messages.showTraceDetail 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.
timeline._readURL (cyclomatic 23) src/protean/server/observatory/static/js/timeline.js:986— timeline._readURL 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.
OutboxProcessor._process_single_message (cyclomatic 22) src/protean/server/outbox_processor.py:358— OutboxProcessor._process_single_message 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.
SubscriptionConfig.validate (cyclomatic 22) src/protean/server/subscription/profiles.py:472— SubscriptionConfig.validate 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.
overview.updateSubscriptions (cyclomatic 22) src/protean/server/observatory/static/js/overview.js:112— overview.updateSubscriptions has cyclomatic complexity 22 (threshold 15). Of this number, 17 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseEntity._maybe_inject_auto_id (cyclomatic 21) src/protean/core/entity.py:288— BaseEntity._maybe_inject_auto_id 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.
EventStoreSubscription.process_batch (cyclomatic 21) src/protean/server/subscription/event_store_subscription.py:862— EventStoreSubscription.process_batch 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.
timeline.searchTraces (cyclomatic 21) src/protean/server/observatory/static/js/timeline.js:200— timeline.searchTraces has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
timeline._switchCausationView (cyclomatic 21) src/protean/server/observatory/static/js/timeline.js:450— timeline._switchCausationView 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.
HasOne.__set__ (cyclomatic 20) src/protean/fields/association.py:429— HasOne.__set__ 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.
processes._renderTable (cyclomatic 20) src/protean/server/observatory/static/js/processes.js:97— processes._renderTable has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 108). 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.
timeline._renderAggregateTimeline (cyclomatic 20) src/protean/server/observatory/static/js/timeline.js:645— timeline._renderAggregateTimeline has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
check._print_rich (cyclomatic 19) src/protean/cli/check.py:306— check._print_rich has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
value_object.value_object_from_entity (cyclomatic 19) src/protean/core/value_object.py:389— value_object.value_object_from_entity 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.
HandlerConfigurator.validate_sequential_by (cyclomatic 19) src/protean/domain/handler_setup.py:355— HandlerConfigurator.validate_sequential_by 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.
IRBuilder._materialize_method_edges (cyclomatic 19) src/protean/ir/builder.py:1557— IRBuilder._materialize_method_edges has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
handlers.merge_subscription_status (cyclomatic 19) src/protean/server/observatory/routes/handlers.py:214— handlers.merge_subscription_status 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.
timeline.collect_timeline_stats (cyclomatic 19) src/protean/server/observatory/routes/timeline.py:316— timeline.collect_timeline_stats 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.
event_store_subscription.reconstruct_unresolved (cyclomatic 19) src/protean/server/subscription/event_store_subscription.py:38— event_store_subscription.reconstruct_unresolved 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.
Message.to_cloudevent (cyclomatic 19) src/protean/utils/eventing.py:1223— Message.to_cloudevent 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.
ir._print_diff_text (cyclomatic 18) src/protean/cli/ir.py:385— ir._print_diff_text has cyclomatic complexity 18 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
subscriptions.status (cyclomatic 18) src/protean/cli/subscriptions.py:45— subscriptions.status 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.
BaseAggregate.raise_ (cyclomatic 18) src/protean/core/aggregate.py:174— BaseAggregate.raise_ 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.
BaseEntity._run_invariants (cyclomatic 18) src/protean/core/entity.py:717— BaseEntity._run_invariants 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.
Domain.configure_logging (cyclomatic 18) src/protean/domain/__init__.py:2738— Domain.configure_logging 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.
HasMany.add (cyclomatic 18) src/protean/fields/association.py:588— HasMany.add 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.
ResolvedField.__init__ (cyclomatic 18) src/protean/fields/resolved.py:58— ResolvedField.__init__ 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.
diff._diff_contracts (cyclomatic 18) src/protean/ir/diff.py:485— diff._diff_contracts 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.
handlers.collect_per_handler_trace_metrics (cyclomatic 18) src/protean/server/observatory/routes/handlers.py:328— handlers.collect_per_handler_trace_metrics 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.
processes.collect_pm_trace_metrics (cyclomatic 18) src/protean/server/observatory/routes/processes.py:202— processes.collect_pm_trace_metrics 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.
SubscriptionConfig.from_profile (cyclomatic 18) src/protean/server/subscription/profiles.py:582— SubscriptionConfig.from_profile 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.
subscription_status._collect_stream_status (cyclomatic 18) src/protean/server/subscription_status.py:451— subscription_status._collect_stream_status 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.
timeline._renderTracesTable (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:241— timeline._renderTracesTable has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
timeline._showCorrelationView (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:337— timeline._showCorrelationView 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.
timeline._showAggregateView (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:596— timeline._showAggregateView 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.
timeline._fetchLatestEvent (cyclomatic 18) src/protean/server/observatory/static/js/timeline.js:1320— timeline._fetchLatestEvent 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.
RedisBroker._read_blocking (cyclomatic 17) src/protean/adapters/broker/redis.py:390— RedisBroker._read_blocking 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.
cli.server (cyclomatic 17) src/protean/cli/__init__.py:174— cli.server 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.
ir._print_element_changes (cyclomatic 17) src/protean/cli/ir.py:495— ir._print_element_changes has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
projection.status (cyclomatic 17) src/protean/cli/projection.py:148— projection.status 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.
aggregate.aggregate_factory (cyclomatic 17) src/protean/core/aggregate.py:625— aggregate.aggregate_factory 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.
entity.entity_factory (cyclomatic 17) src/protean/core/entity.py:1189— entity.entity_factory 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.
BaseRepository._do_add (cyclomatic 17) src/protean/core/repository.py:252— BaseRepository._do_add 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.
HasMany.remove (cyclomatic 17) src/protean/fields/association.py:712— HasMany.remove 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.
IRBuilder._diagnose_unindexed_filter_path (cyclomatic 17) src/protean/ir/builder.py:2737— IRBuilder._diagnose_unindexed_filter_path has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
config._parse_config (cyclomatic 17) src/protean/ir/config.py:112— config._parse_config 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.
schema._field_to_schema (cyclomatic 17) src/protean/ir/generators/schema.py:54— schema._field_to_schema 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.
slice_generator._validate_names (cyclomatic 17) src/protean/scaffold/slice_generator.py:1134— slice_generator._validate_names 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.
subscription_status._collect_partitioned_stream_status (cyclomatic 17) src/protean/server/subscription_status.py:321— subscription_status._collect_partitioned_stream_status has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
subscription_status._collect_broker_status (cyclomatic 17) src/protean/server/subscription_status.py:567— subscription_status._collect_broker_status has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
upgrade_opportunities._apply_import (cyclomatic 17) src/protean/upgrade_opportunities.py:530— upgrade_opportunities._apply_import 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.
new.run_project_setup (cyclomatic 16) REDACTED:18— new.run_project_setup 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.
BaseEntity.__setattr__ (cyclomatic 16) src/protean/core/entity.py:939— BaseEntity.__setattr__ 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.
BaseProjection.__init__ (cyclomatic 16) src/protean/core/projection.py:224— BaseProjection.__init__ 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.
containers.List (cyclomatic 16) src/protean/fields/containers.py:20— containers.List 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.
DomainContextMiddleware._emit_http_wide_event (cyclomatic 16) src/protean/integrations/fastapi/middleware.py:359— DomainContextMiddleware._emit_http_wide_event 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.
_FlowBuilder._step_simple (cyclomatic 16) src/protean/ir/analysis/dataflow.py:688— _FlowBuilder._step_simple 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.
SourceProvider._discover_modules (cyclomatic 16) src/protean/ir/analysis/source_provider.py:220— SourceProvider._discover_modules 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.
IRBuilder._extract_fields (cyclomatic 16) src/protean/ir/builder.py:353— IRBuilder._extract_fields 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.
IRBuilder._diagnose_unraised_event (cyclomatic 16) src/protean/ir/builder.py:3212— IRBuilder._diagnose_unraised_event 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.
diff._classify_field_changes (cyclomatic 16) src/protean/ir/diff.py:1224— diff._classify_field_changes 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.
apply.apply_plan (cyclomatic 16) src/protean/scaffold/apply.py:80— apply.apply_plan 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.
model_parser.emit_model (cyclomatic 16) src/protean/scaffold/model_parser.py:738— model_parser.emit_model has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
timeline._load_traces_for_correlation (cyclomatic 16) src/protean/server/observatory/routes/timeline.py:518— timeline._load_traces_for_correlation 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.
utils.clone_class (cyclomatic 16) src/protean/utils/__init__.py:658— utils.clone_class 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.
dlq.discover_subscriptions (cyclomatic 16) src/protean/utils/dlq.py:143— dlq.discover_subscriptions 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.
overview.updateHealthBanner (cyclomatic 16) src/protean/server/observatory/static/js/overview.js:311— overview.updateHealthBanner 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.
timeline.fetchEvents (cyclomatic 16) src/protean/server/observatory/static/js/timeline.js:118— timeline.fetchEvents 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.
SqlalchemyModel.__init_subclass__ (cognitive 119) src/protean/adapters/repository/sqlalchemy.py:595— SqlalchemyModel.__init_subclass__ has cognitive complexity 119 (threshold 15). Drivers by points: if/else 26 (97 pts), boolean chains 14, ternaries 1 (5 pts), loops 2 (3 pts) (nesting depth added 76). 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.
(anonymous) (cognitive 113) src/protean/server/observatory/static/js/processes.js:7— (anonymous) has cognitive complexity 113 (threshold 15). Drivers by points: boolean chains 42, if/else 36 (38 pts), ternaries 29 (31 pts), error handling 1, match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 113 points are its own statements and the rest belongs to 28 function items inside it that branch (_sorted::(anonymous), _renderTable::(anonymous), _filtered::(anonymous), …). 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.
(anonymous) (cognitive 96) src/protean/server/observatory/static/js/core.js:7— (anonymous) has cognitive complexity 96 (threshold 15). Drivers by points: if/else 57 (62 pts), boolean chains 12, ternaries 6 (8 pts), error handling 5 (7 pts), loops 5, match/switch 2 (nesting depth added 9). Most of this is not in the body itself: 3 of the 96 points are its own statements and the rest belongs to 48 function items inside it that branch (_initKeyboard::(anonymous), timeAgo, number, …). 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.
(anonymous) (cognitive 87) src/protean/server/observatory/static/js/domain-detail.js:15— (anonymous) has cognitive complexity 87 (threshold 15). Drivers by points: if/else 52 (55 pts), boolean chains 29, ternaries 3 (nesting depth added 3). Most of this is not in the body itself: 1 of the 87 points is its own statement and the rest belongs to 29 function items inside it that branch (_fieldTypeLabel, show, _fieldConstraints, …). 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.
utils._prepare_pydantic_namespace (cognitive 85) src/protean/utils/__init__.py:309— utils._prepare_pydantic_namespace has cognitive complexity 85 (threshold 15). Drivers by points: if/else 17 (63 pts), loops 4 (13 pts), boolean chains 9 (nesting depth added 55). 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.
(anonymous) (cognitive 82) src/protean/server/observatory/static/js/domain.js:8— (anonymous) has cognitive complexity 82 (threshold 15). Drivers by points: if/else 47 (53 pts), ternaries 9 (14 pts), boolean chains 13, error handling 1, loops 1 (nesting depth added 11). Most of this is not in the body itself: 2 of the 82 points are its own statements and the rest belongs to 37 function items inside it that branch (_wireSearch::(anonymous), _updateStats, _switchTab, …). 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.
metrics._hand_rolled_metrics (cognitive 80) src/protean/server/observatory/metrics.py:527— metrics._hand_rolled_metrics has cognitive complexity 80 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 8 (18 pts), error handling 9 (15 pts), boolean chains 5, ternaries 2 (5 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.
recover.recover (cognitive 74) src/protean/cli/recover.py:223— recover.recover has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (45 pts), loops 6 (16 pts), boolean chains 8, ternaries 3 (5 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.
(anonymous) (cognitive 74) src/protean/server/observatory/static/js/eventstore.js:7— (anonymous) has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (29 pts), boolean chains 25, ternaries 15 (17 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 74 points are its own statements and the rest belongs to 22 function items inside it that branch (_updateSummary, _sorted::(anonymous), _renderOutbox::(anonymous), …). 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.
(anonymous) (cognitive 72) src/protean/server/observatory/static/js/domain-topology.js:12— (anonymous) has cognitive complexity 72 (threshold 15). Drivers by points: if/else 36, boolean chains 24, ternaries 11, loops 1. Most of this is not in the body itself: 0 of the 72 points are its own statements and the rest belongs to 58 function items inside it that branch (render, _renderSingleNode, _buildBadgeText, …). 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.
slice_generator._validate (cognitive 71) src/protean/scaffold/slice_generator.py:648— slice_generator._validate has cognitive complexity 71 (threshold 15). Drivers by points: if/else 30 (55 pts), boolean chains 9, loops 3 (6 pts), ternaries 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._diagnose_unsourced_projection_field (cognitive 68) src/protean/ir/builder.py:2481— IRBuilder._diagnose_unsourced_projection_field has cognitive complexity 68 (threshold 15). Drivers by points: if/else 11 (39 pts), loops 5 (12 pts), ternaries 3 (11 pts), boolean chains 6 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mypy_plugin._synthesize_init (cognitive 64) src/protean/ext/mypy_plugin.py:631— mypy_plugin._synthesize_init has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (50 pts), error handling 2 (6 pts), boolean chains 5, loops 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
domain._build_flow_graph (cognitive 60) src/protean/server/observatory/routes/domain.py:202— domain._build_flow_graph has cognitive complexity 60 (threshold 15). Drivers by points: loops 19 (35 pts), if/else 6 (21 pts), boolean chains 4 (nesting depth added 31). 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.
BaseRepository._sync_children (cognitive 58) src/protean/core/repository.py:370— BaseRepository._sync_children has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 7 (18 pts), boolean chains 3 (nesting depth added 35). 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.
UnitOfWork._do_commit (cognitive 58) src/protean/core/unit_of_work.py:258— UnitOfWork._do_commit has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 9 (18 pts), error handling 5, boolean chains 4, ternaries 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandProcessor.process (cognitive 51) src/protean/domain/command_processor.py:278— CommandProcessor.process has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 9, ternaries 3 (7 pts), error handling 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handlers.merge_subscription_status (cognitive 50) src/protean/server/observatory/routes/handlers.py:214— handlers.merge_subscription_status has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 5 (10 pts), ternaries 1 (6 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mypy_plugin._synthesize_has_many_methods (cognitive 47) src/protean/ext/mypy_plugin.py:894— mypy_plugin._synthesize_has_many_methods has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 6, loops 4 (6 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 47) src/protean/server/observatory/static/js/domain-processes.js:15— (anonymous) has cognitive complexity 47 (threshold 15). Drivers by points: if/else 27 (30 pts), ternaries 8 (10 pts), boolean chains 7 (nesting depth added 5). Most of this is not in the body itself: 2 of the 47 points are its own statements and the rest belongs to 21 function items inside it that branch (_buildHeaderHTML, _toggleExpand, _renderStateMachine::(anonymous), …). 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.
IRBuilder._find_deprecated_import_uses (cognitive 46) src/protean/ir/builder.py:3807— IRBuilder._find_deprecated_import_uses has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 6 (12 pts), boolean chains 6 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEntity._run_invariants (cognitive 45) src/protean/core/entity.py:717— BaseEntity._run_invariants has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (15 pts), ternaries 4 (9 pts), error handling 1 (2 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.
IRBuilder._diagnose_unindexed_filter_path (cognitive 45) src/protean/ir/builder.py:2737— IRBuilder._diagnose_unindexed_filter_path has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (29 pts), loops 6 (13 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.
upgrade_uow._http_names (cognitive 44) src/protean/upgrade_uow.py:80— upgrade_uow._http_names has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 6 (13 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline.collect_all_events (cognitive 43) src/protean/server/observatory/routes/timeline.py:208— timeline.collect_all_events has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 7, loops 3 (4 pts), ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEntity.__init__ (cognitive 41) src/protean/core/entity.py:419— BaseEntity.__init__ has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 6 (11 pts), boolean chains 1, error handling 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline.collect_timeline_stats (cognitive 41) src/protean/server/observatory/routes/timeline.py:316— timeline.collect_timeline_stats has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (27 pts), error handling 2 (7 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._extract_resolved_field (cognitive 40) src/protean/ir/builder.py:424— IRBuilder._extract_resolved_field has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27 (34 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous) (cognitive 40) src/protean/server/observatory/static/js/infrastructure.js:7— (anonymous) has cognitive complexity 40 (threshold 15). Drivers by points: if/else 29 (30 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 3). Most of this is not in the body itself: 2 of the 40 points are its own statements and the rest belongs to 13 function items inside it that branch (_onDataLoaded, _formatUptime, _updateTile, …). 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.
BaseEntity.model_post_init (cognitive 39) src/protean/core/entity.py:534— BaseEntity.model_post_init has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 8 (11 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.
EventStoreSubscription.process_batch (cognitive 39) src/protean/server/subscription/event_store_subscription.py:862— EventStoreSubscription.process_batch has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (19 pts), ternaries 4 (12 pts), boolean chains 7, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline._bindEvents (cognitive 39) src/protean/server/observatory/static/js/timeline.js:1081— timeline._bindEvents has cognitive complexity 39 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 6 (nesting depth added 6). Most of this is not in the body itself: 15 of the 39 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1252, 1168, 1226, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
BaseEntity._maybe_inject_auto_id (cognitive 38) src/protean/core/entity.py:288— BaseEntity._maybe_inject_auto_id has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 5 (8 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._materialize_method_edges (cognitive 38) src/protean/ir/builder.py:1557— IRBuilder._materialize_method_edges has cognitive complexity 38 (threshold 15). Drivers by points: loops 13 (22 pts), if/else 5 (16 pts) (nesting depth added 20). 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.
diff._diff_contracts (cognitive 38) src/protean/ir/diff.py:485— diff._diff_contracts has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 4 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HandlerConfigurator.validate_sequential_by (cognitive 37) src/protean/domain/handler_setup.py:355— HandlerConfigurator.validate_sequential_by has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 6 (9 pts), boolean chains 3 (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.
IRBuilder._strongly_connected_components (cognitive 37) src/protean/ir/builder.py:1933— IRBuilder._strongly_connected_components has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 4 (10 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.
(anonymous) (cognitive 36) src/protean/server/observatory/static/js/charts.js:7— (anonymous) has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 18, if/else 10 (11 pts), ternaries 6, loops 1 (nesting depth added 1). Most of this is not in the body itself: 0 of the 36 points are its own statements and the rest belongs to 32 function items inside it that branch (areaChart, sparkline, barChart, …). 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.
RedisBroker._read_blocking (cognitive 35) src/protean/adapters/broker/redis.py:390— RedisBroker._read_blocking has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 6 (15 pts), error handling 3 (5 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.
event_store_subscription.reconstruct_unresolved (cognitive 35) src/protean/server/subscription/event_store_subscription.py:38— event_store_subscription.reconstruct_unresolved has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 3 (8 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ir.diff (cognitive 34) src/protean/cli/ir.py:111— ir.diff has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 9, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IRBuilder._diagnose_unraised_event (cognitive 34) src/protean/ir/builder.py:3212— IRBuilder._diagnose_unraised_event has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 7 (15 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OutboxProcessor._process_single_message (cognitive 34) src/protean/server/outbox_processor.py:358— OutboxProcessor._process_single_message has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 5 (8 pts), error handling 3 (6 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseCommand._build_metadata (cognitive 33) src/protean/core/command.py:143— BaseCommand._build_metadata has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 11, ternaries 7 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Domain._register_element (cognitive 33) src/protean/domain/__init__.py:1046— Domain._register_element has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 8, 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.
subscription_status._collect_partitioned_stream_status (cognitive 33) src/protean/server/subscription_status.py:321— subscription_status._collect_partitioned_stream_status has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (5 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upgrade_opportunities._apply_import (cognitive 33) src/protean/upgrade_opportunities.py:530— upgrade_opportunities._apply_import has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (7 pts), boolean chains 5, ternaries 2 (5 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.
entity.entity_factory (cognitive 32) src/protean/core/entity.py:1189— entity.entity_factory has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandProcessor.enrich (cognitive 32) src/protean/domain/command_processor.py:146— CommandProcessor.enrich has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5, ternaries 4, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._build_vo_cluster_map (cognitive 32) src/protean/ir/builder.py:1424— IRBuilder._build_vo_cluster_map has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 4 (7 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.
events._render_process_manager_subgraph (cognitive 32) src/protean/ir/generators/events.py:316— events._render_process_manager_subgraph has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 4 (7 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.
handlers._render_process_managers (cognitive 32) src/protean/ir/generators/handlers.py:155— handlers._render_process_managers has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 4 (7 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.
StreamSubscription.poll (cognitive 32) src/protean/server/subscription/stream_subscription.py:344— StreamSubscription.poll has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (26 pts), error handling 2 (4 pts), boolean chains 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.
timeline._showEventDetail (cognitive 32) src/protean/server/observatory/static/js/timeline.js:830— timeline._showEventDetail has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 9, error handling 1, ternaries 1 (nesting depth added 5). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
events._render_process_managers (cognitive 31) src/protean/ir/generators/events.py:146— events._render_process_managers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (7 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.
model_parser._parse_constraints (cognitive 31) src/protean/scaffold/model_parser.py:459— model_parser._parse_constraints has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (26 pts), error handling 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
domain._build_links (cognitive 31) src/protean/server/observatory/routes/domain.py:143— domain._build_links has cognitive complexity 31 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 7 (14 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RedisBroker._read (cognitive 30) src/protean/adapters/broker/redis.py:342— RedisBroker._read has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 2 (5 pts), boolean chains 2, error handling 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Engine._wire_components (cognitive 30) src/protean/server/engine.py:347— Engine._wire_components has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (10 pts), error handling 2 (4 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.
domain._build_pm_graphs (cognitive 30) src/protean/server/observatory/routes/domain.py:353— domain._build_pm_graphs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 5 (10 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
subscription_status._collect_broker_status (cognitive 30) src/protean/server/subscription_status.py:567— subscription_status._collect_broker_status has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 4 (8 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diff._classify_field_changes (cognitive 29) src/protean/ir/diff.py:1224— diff._classify_field_changes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 4, boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
domain._wireSearch (cognitive 29) src/protean/server/observatory/static/js/domain.js:154— domain._wireSearch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 6 (9 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 256, 247, 169, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cli.server (cognitive 28) src/protean/cli/__init__.py:174— cli.server has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ir._print_element_changes (cognitive 28) src/protean/cli/ir.py:495— ir._print_element_changes has cognitive complexity 28 (threshold 15). Drivers by points: loops 11 (20 pts), if/else 4 (5 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
BaseEvent._build_metadata (cognitive 28) src/protean/core/event.py:135— BaseEvent._build_metadata has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 10, ternaries 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.
BaseProjection.__init__ (cognitive 28) src/protean/core/projection.py:224— BaseProjection.__init__ has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (10 pts), error handling 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.
Engine.handle_message (cognitive 28) src/protean/server/engine.py:815— Engine.handle_message has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 5 (7 pts), error handling 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
handlers.collect_per_handler_trace_metrics (cognitive 28) src/protean/server/observatory/routes/handlers.py:328— handlers.collect_per_handler_trace_metrics has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 2 (4 pts), error handling 2 (3 pts), loops 2, 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.
processes.merge_pm_subscription_status (cognitive 28) src/protean/server/observatory/routes/processes.py:137— processes.merge_pm_subscription_status has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (6 pts), ternaries 1 (5 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline._load_traces_for_correlation (cognitive 28) src/protean/server/observatory/routes/timeline.py:518— timeline._load_traces_for_correlation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 4 (9 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
subscription_status.collect_subscription_statuses (cognitive 28) src/protean/server/subscription_status.py:808— subscription_status.collect_subscription_statuses has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 8 (10 pts), error handling 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dlq.discover_subscriptions (cognitive 28) src/protean/utils/dlq.py:143— dlq.discover_subscriptions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 7 (11 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handlers._renderTable (cognitive 28) src/protean/server/observatory/static/js/handlers.js:124— handlers._renderTable has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 9, boolean chains 7, loops 1 (2 pts) (nesting depth added 6). Of this number, 14 points are the body's own statements and 14 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.
value_object.value_object_from_entity (cognitive 27) src/protean/core/value_object.py:389— value_object.value_object_from_entity has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._extract_fields (cognitive 27) src/protean/ir/builder.py:353— IRBuilder._extract_fields has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
profiles.build_profile_registry (cognitive 27) src/protean/server/subscription/profiles.py:243— profiles.build_profile_registry has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (26 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.
docs.generate (cognitive 26) src/protean/cli/docs.py:101— docs.generate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 8, ternaries 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ir._print_diff_text (cognitive 26) src/protean/cli/ir.py:385— ir._print_diff_text has cognitive complexity 26 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 9 (11 pts), boolean chains 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
BaseProjection.model_post_init (cognitive 26) src/protean/core/projection.py:291— BaseProjection.model_post_init has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 6 (9 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.
Domain._traverse (cognitive 26) src/protean/domain/__init__.py:795— Domain._traverse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clusters._collect_cross_references (cognitive 26) src/protean/ir/generators/clusters.py:119— clusters._collect_cross_references has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 4 (8 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.
events._collect_referenced_event_fqns (cognitive 26) src/protean/ir/generators/events.py:256— events._collect_referenced_event_fqns has cognitive complexity 26 (threshold 15). Drivers by points: loops 8 (15 pts), if/else 3 (11 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
BaseEventStore.verify (cognitive 26) src/protean/port/event_store.py:1194— BaseEventStore.verify has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, ternaries 1 (3 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handlers.collect_handler_metadata (cognitive 26) src/protean/server/observatory/routes/handlers.py:158— handlers.collect_handler_metadata has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (10 pts), loops 3 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
processes.collect_pm_trace_metrics (cognitive 26) src/protean/server/observatory/routes/processes.py:202— processes.collect_pm_trace_metrics has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 2 (4 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upgrade._check_outbox_schema (cognitive 26) src/protean/upgrade.py:182— upgrade._check_outbox_schema has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handlers._sorted (cognitive 26) src/protean/server/observatory/static/js/handlers.js:54— handlers._sorted has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 22, ternaries 2 (3 pts), match/switch 1 (nesting depth added 1). Most of this is not in the body itself: 0 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 56). 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.
timeline._switchCausationView (cognitive 26) src/protean/server/observatory/static/js/timeline.js:450— timeline._switchCausationView has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, 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.
HasOne.__set__ (cognitive 25) src/protean/fields/association.py:429— HasOne.__set__ has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_FlowBuilder._step_simple (cognitive 25) src/protean/ir/analysis/dataflow.py:688— _FlowBuilder._step_simple has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SourceProvider._discover_modules (cognitive 25) src/protean/ir/analysis/source_provider.py:220— SourceProvider._discover_modules has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), boolean chains 3, error handling 2 (3 pts), 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.
IRBuilder._diagnose_adapter_calls (cognitive 25) src/protean/ir/builder.py:2110— IRBuilder._diagnose_adapter_calls has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (9 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.
timeline.search_traces (cognitive 25) src/protean/server/observatory/routes/timeline.py:850— timeline.search_traces has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Message.to_cloudevent (cognitive 25) src/protean/utils/eventing.py:1223— Message.to_cloudevent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 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.
overview.updateSubscriptions (cognitive 25) src/protean/server/observatory/static/js/overview.js:112— overview.updateSubscriptions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, loops 3 (4 pts) (nesting depth added 5). Of this number, 22 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent 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._readURL (cognitive 25) src/protean/server/observatory/static/js/timeline.js:986— timeline._readURL has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseAggregate.raise_ (cognitive 24) src/protean/core/aggregate.py:174— BaseAggregate.raise_ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, ternaries 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
HasMany.remove (cognitive 24) src/protean/fields/association.py:712— HasMany.remove has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (5 pts), boolean chains 3, 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.
IRBuilder._diagnose_event_handler_foreign_event (cognitive 24) src/protean/ir/builder.py:2178— IRBuilder._diagnose_event_handler_foreign_event has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (9 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.
apply.apply_plan (cognitive 24) src/protean/scaffold/apply.py:80— apply.apply_plan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3, ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upgrade_opportunities._scan_scope (cognitive 24) src/protean/upgrade_opportunities.py:794— upgrade_opportunities._scan_scope has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (7 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.
processes._sorted (cognitive 24) src/protean/server/observatory/static/js/processes.js:47— processes._sorted has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 20, ternaries 2 (3 pts), match/switch 1 (nesting depth added 1). Most of this is not in the body itself: 0 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 49). 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.
timeline._renderCausationTree (cognitive 24) src/protean/server/observatory/static/js/timeline.js:502— timeline._renderCausationTree has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 6, loops 1 (2 pts) (nesting depth added 1). 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, 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._fetchLatestEvent (cognitive 24) src/protean/server/observatory/static/js/timeline.js:1320— timeline._fetchLatestEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Brokers._initialize (cognitive 23) src/protean/adapters/broker/__init__.py:47— Brokers._initialize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (7 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.
EventStore.handlers_for (cognitive 23) src/protean/adapters/event_store/__init__.py:124— EventStore.handlers_for has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (8 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check._print_rich (cognitive 23) src/protean/cli/check.py:306— check._print_rich has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10, loops 3 (6 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HasMany.add (cognitive 23) src/protean/fields/association.py:588— HasMany.add has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts), boolean chains 4, ternaries 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._diagnose_unhandled_events (cognitive 23) src/protean/ir/builder.py:2309— IRBuilder._diagnose_unhandled_events has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 7 (10 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.
IRBuilder._diagnose_cross_aggregate_reference (cognitive 23) src/protean/ir/builder.py:3036— IRBuilder._diagnose_cross_aggregate_reference has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (6 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.
overview.updateHealthBanner (cognitive 23) src/protean/server/observatory/static/js/overview.js:311— overview.updateHealthBanner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, ternaries 1 (3 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.
aggregate.aggregate_factory (cognitive 22) src/protean/core/aggregate.py:625— aggregate.aggregate_factory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (6 pts), boolean chains 5, 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.
IRBuilder._build_projections (cognitive 22) src/protean/ir/builder.py:1200— IRBuilder._build_projections has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 6 (7 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.
subscription_status._collect_stream_status (cognitive 22) src/protean/server/subscription_status.py:451— subscription_status._collect_stream_status has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, error handling 4 (5 pts), loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline._updateCorrelationDisplay (cognitive 22) src/protean/server/observatory/static/js/timeline.js:400— timeline._updateCorrelationDisplay has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 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.
subscriptions.status (cognitive 21) src/protean/cli/subscriptions.py:45— subscriptions.status has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, ternaries 4 (8 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
aggregate._pydantic_element_to_fact_event (cognitive 21) src/protean/core/aggregate.py:518— aggregate._pydantic_element_to_fact_event has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (6 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.
BaseEntity.__setattr__ (cognitive 21) src/protean/core/entity.py:939— BaseEntity.__setattr__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 2 (4 pts), 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.
BaseValueObject._resolve_fieldspecs (cognitive 21) src/protean/core/value_object.py:114— BaseValueObject._resolve_fieldspecs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4, 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.
mypy_plugin._resolve_field_type_for_init (cognitive 21) src/protean/ext/mypy_plugin.py:810— mypy_plugin._resolve_field_type_for_init has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (8 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.
IRBuilder._diagnose_unbounded_indexed_string (cognitive 21) src/protean/ir/builder.py:2666— IRBuilder._diagnose_unbounded_indexed_string has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
manifest._derive_domain_name (cognitive 21) src/protean/scaffold/manifest.py:236— manifest._derive_domain_name has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), error handling 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
slice_generator._validate_names (cognitive 21) src/protean/scaffold/slice_generator.py:1134— slice_generator._validate_names has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 5 (6 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EventStoreSubscription.run_recovery_pass (cognitive 21) src/protean/server/subscription/event_store_subscription.py:1227— EventStoreSubscription.run_recovery_pass has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubscriptionConfig.validate (cognitive 21) src/protean/server/subscription/profiles.py:472— SubscriptionConfig.validate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, boolean chains 6. 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.
upgrade_opportunities._sqlalchemy_text_names (cognitive 21) src/protean/upgrade_opportunities.py:120— upgrade_opportunities._sqlalchemy_text_names has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upgrade_opportunities._split_scopes (cognitive 21) src/protean/upgrade_opportunities.py:600— upgrade_opportunities._split_scopes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline._showCorrelationView (cognitive 21) src/protean/server/observatory/static/js/timeline.js:337— timeline._showCorrelationView has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (17 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, 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.
timeline._renderAggregateTimeline (cognitive 21) src/protean/server/observatory/static/js/timeline.js:645— timeline._renderAggregateTimeline has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 5, if/else 3, loops 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
projection.status (cognitive 20) src/protean/cli/projection.py:148— projection.status has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, ternaries 4 (8 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.validate_indexes (cognitive 20) src/protean/core/index.py:135— index.validate_indexes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mypy_plugin._get_kwarg_bool (cognitive 20) src/protean/ext/mypy_plugin.py:1133— mypy_plugin._get_kwarg_bool has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Field._load (cognitive 20) src/protean/fields/base.py:291— Field._load has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
containers.List (cognitive 20) src/protean/fields/containers.py:20— containers.List has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_FlowBuilder._step (cognitive 20) src/protean/ir/analysis/dataflow.py:472— _FlowBuilder._step has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config._parse_config (cognitive 20) src/protean/ir/config.py:112— config._parse_config has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BaseBroker.publish (cognitive 20) src/protean/port/broker.py:255— BaseBroker.publish has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_parser.emit_model (cognitive 20) src/protean/scaffold/model_parser.py:738— model_parser.emit_model has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 1 (3 pts), 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.
Engine._register_handler_subscriptions (cognitive 20) src/protean/server/engine.py:512— Engine._register_handler_subscriptions has cognitive complexity 20 (threshold 15). Drivers by points: loops 9 (14 pts), if/else 2 (6 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
logging.configure_logging (cognitive 20) src/protean/utils/logging.py:154— logging.configure_logging has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
timeline.fetchEvents (cognitive 20) src/protean/server/observatory/static/js/timeline.js:118— timeline.fetchEvents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
sqlalchemy._make_sa_indexes (cognitive 19) src/protean/adapters/repository/sqlalchemy.py:408— sqlalchemy._make_sa_indexes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
schema.write_index_ddl (cognitive 19) src/protean/cli/schema.py:134— schema.write_index_ddl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEntity._update_data (cognitive 19) src/protean/core/entity.py:677— BaseEntity._update_data has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (11 pts), error handling 2 (5 pts), if/else 2 (3 pts) (nesting depth added 10). 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.
Domain.configure_logging (cognitive 19) src/protean/domain/__init__.py:2738— Domain.configure_logging has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
IRBuilder._extract_indexes (cognitive 19) src/protean/ir/builder.py:623— IRBuilder._extract_indexes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._run_custom_lint_rules (cognitive 19) src/protean/ir/builder.py:4014— IRBuilder._run_custom_lint_rules has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diff._diff_element (cognitive 19) src/protean/ir/diff.py:280— diff._diff_element has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (19 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.
diff._classify_clusters (cognitive 19) src/protean/ir/diff.py:1075— diff._classify_clusters has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 2 (5 pts) (nesting depth added 10). 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.
utils.clone_class (cognitive 19) src/protean/utils/__init__.py:658— utils.clone_class has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 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.
messages.showTraceDetail (cognitive 19) src/protean/server/observatory/static/js/messages.js:290— messages.showTraceDetail has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 5, error handling 1, ternaries 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.
timeline.searchTraces (cognitive 19) src/protean/server/observatory/static/js/timeline.js:200— timeline.searchTraces has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (8 pts), error handling 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.
timeline._showAggregateView (cognitive 19) src/protean/server/observatory/static/js/timeline.js:596— timeline._showAggregateView has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 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, 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.
SADAO._update (cognitive 18) src/protean/adapters/repository/sqlalchemy.py:1050— SADAO._update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseRepository._do_add (cognitive 18) src/protean/core/repository.py:252— BaseRepository._do_add has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, 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.
DomainValidator._validate_association_fields (cognitive 18) src/protean/domain/validation.py:207— DomainValidator._validate_association_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
adapter_conformance.pytest_collection_modifyitems (cognitive 18) src/protean/integrations/pytest/adapter_conformance.py:170— adapter_conformance.pytest_collection_modifyitems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
element_index._role (cognitive 18) src/protean/ir/analysis/element_index.py:566— element_index._role has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._diagnose_circular_cluster_dependencies (cognitive 18) src/protean/ir/builder.py:1891— IRBuilder._diagnose_circular_cluster_dependencies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 4 (7 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.
IRBuilder._apply_suppressions (cognitive 18) src/protean/ir/builder.py:2232— IRBuilder._apply_suppressions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (4 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.
IRBuilder._diagnose_deprecated_imports (cognitive 18) src/protean/ir/builder.py:3735— IRBuilder._diagnose_deprecated_imports has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts), 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.
event_model.generate_event_model_diff (cognitive 18) src/protean/ir/generators/event_model.py:1059— event_model.generate_event_model_diff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 7, boolean chains 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.
schema._field_to_schema (cognitive 18) src/protean/ir/generators/schema.py:54— schema._field_to_schema 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.
BaseDAO.save (cognitive 18) src/protean/port/dao.py:759— BaseDAO.save has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 1 (3 pts), 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.
SubscriptionConfig.from_profile (cognitive 18) src/protean/server/subscription/profiles.py:582— SubscriptionConfig.from_profile has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 11, if/else 6, boolean chains 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.
subscription_status._collect_one_recovery_checkpoint (cognitive 18) src/protean/server/subscription_status.py:1101— subscription_status._collect_one_recovery_checkpoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 3 (5 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
upgrade._check_outbox_migrations (cognitive 18) src/protean/upgrade.py:463— upgrade._check_outbox_migrations has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
logging._extract_aggregate_info (cognitive 18) src/protean/utils/logging.py:387— logging._extract_aggregate_info has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
projection_rebuilder._replay_projector (cognitive 18) src/protean/utils/projection_rebuilder.py:172— projection_rebuilder._replay_projector has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), error handling 2 (4 pts), boolean chains 3, 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.
processes._renderTable (cognitive 18) src/protean/server/observatory/static/js/processes.js:97— processes._renderTable has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9, boolean chains 7, if/else 2. Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 108). 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.
MemorySession.commit (cognitive 17) src/protean/adapters/repository/memory.py:194— MemorySession.commit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DictDAO._check_unique_indexes (cognitive 17) src/protean/adapters/repository/memory.py:545— DictDAO._check_unique_indexes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
docs._generate_handlers (cognitive 17) src/protean/cli/docs.py:496— docs._generate_handlers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (6 pts), loops 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
atomic_change._validate_status_transitions (cognitive 17) src/protean/core/aggregate.py:743— atomic_change._validate_status_transitions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IRBuilder._diagnose_handler_persists_and_calls_out (cognitive 17) src/protean/ir/builder.py:3117— IRBuilder._diagnose_handler_persists_and_calls_out has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diff._apply_upcaster_mitigation (cognitive 17) src/protean/ir/diff.py:1009— diff._apply_upcaster_mitigation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEventStore._load_aggregate_at_version (cognitive 17) src/protean/port/event_store.py:560— BaseEventStore._load_aggregate_at_version has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 1 (4 pts), error handling 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
model_parser._validate_read_side (cognitive 17) src/protean/scaffold/model_parser.py:638— model_parser._validate_read_side has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, 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.
Engine.shutdown (cognitive 17) src/protean/server/engine.py:1165— Engine.shutdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (5 pts), ternaries 2, boolean chains 1, 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.
Supervisor._monitor (cognitive 17) src/protean/server/supervisor.py:255— Supervisor._monitor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils._derive_element_class (cognitive 17) src/protean/utils/__init__.py:473— utils._derive_element_class has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
domain_discovery.find_domain_by_string (cognitive 17) src/protean/utils/domain_discovery.py:53— domain_discovery.find_domain_by_string has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Message._resolve_field_aliases (cognitive 17) src/protean/utils/eventing.py:902— Message._resolve_field_aliases has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Message._extract_subject (cognitive 17) src/protean/utils/eventing.py:1168— Message._extract_subject has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), 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.
RedisBroker._cleanup_stale_consumers (cognitive 16) src/protean/adapters/broker/redis.py:865— RedisBroker._cleanup_stale_consumers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, error handling 2 (3 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.
cli.main (cognitive 16) src/protean/cli/__init__.py:103— cli.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (4 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.
docs._load_domain_snapshot_config (cognitive 16) src/protean/cli/docs.py:702— docs._load_domain_snapshot_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ir._print_check_text (cognitive 16) src/protean/cli/ir.py:648— ir._print_check_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseQuery._convert_vo_descriptors (cognitive 16) src/protean/core/query.py:128— BaseQuery._convert_vo_descriptors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 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.
BaseRepository._has_changed_child (cognitive 16) src/protean/core/repository.py:341— BaseRepository._has_changed_child has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResolvedField.__init__ (cognitive 16) src/protean/fields/resolved.py:58— ResolvedField.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3, boolean chains 2, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
query_assertions._limit_values (cognitive 16) src/protean/integrations/pytest/query_assertions.py:64— query_assertions._limit_values has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 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.
IRBuilder._diagnose_infra_imports (cognitive 16) src/protean/ir/builder.py:2009— IRBuilder._diagnose_infra_imports has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 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.
IRBuilder._check_element_deprecated (cognitive 16) src/protean/ir/builder.py:3558— IRBuilder._check_element_deprecated has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEventStore._resolve_and_load_group (cognitive 16) src/protean/port/event_store.py:876— BaseEventStore._resolve_and_load_group has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeline._group_by_correlation (cognitive 16) src/protean/server/observatory/routes/timeline.py:738— timeline._group_by_correlation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upgrade_opportunities._custom_middleware_sites (cognitive 16) src/protean/upgrade_opportunities.py:303— upgrade_opportunities._custom_middleware_sites has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (11 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.
BaseMessageType._convert_vo_descriptors (cognitive 16) src/protean/utils/eventing.py:391— BaseMessageType._convert_vo_descriptors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 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.
Message.to_domain_object (cognitive 16) src/protean/utils/eventing.py:975— Message.to_domain_object has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (5 pts), boolean chains 1, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
logging._emit_wide_event (cognitive 16) src/protean/utils/logging.py:695— logging._emit_wide_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (5 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
HandlerMixin._handle (cognitive 16) src/protean/utils/mixins.py:568— HandlerMixin._handle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3, 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.
D20 · ADR Quality· No context/problem statement; the only content is a one-line decision with no consequences · ×1
No context/problem statement; the only content is a one-line decision with no consequences changes/1270.added.md— Add why this test matters (e.g. catching adapter-specific divergence that single-adapter tests miss) and its trade-offs (re-randomization cost, false-positive risk)
D20 · ADR Quality· No context/problem framing or consequences; only the specs and TLC claim is stated · ×1
No context/problem framing or consequences; only the specs and TLC claim is stated changes/1271.added.md— Add why Protean's delivery guarantees matter (e.g. out-of-order commits, crash resilience) and note any trade-offs such verification imposes
D20 · ADR Quality· Consequences/trade-offs are absent despite a strong context (shared test suite asserting shared adapter behaviour across memory and Redis) and an explicit rationale for failing fast · ×1
Consequences/trade-offs are absent despite a strong context (shared test suite asserting shared adapter behaviour across memory and Redis) and an explicit rationale for failing fast changes/1310.added.md— Add a Consequences section noting the trade-off of requiring a strict expected-failure pass to catch adapter divergence before it becomes a gap
D20 · ADR Quality· No context/problem (why derive the project.json) and no consequences/trade-offs · ×1
No context/problem (why derive the project.json) and no consequences/trade-offs changes/1328.added.md— Add a Context section explaining why derived manifests are needed over an authoritative one, and a Consequences section covering drift detection trade-offs
D20 · ADR Quality· No context/problem (why init-time/runtime raises need diagnostics) and no consequences/trade-offs · ×1
No context/problem (why init-time/runtime raises need diagnostics) and no consequences/trade-offs changes/1331.added.md— Add a Context section explaining that exceptions across outbox/broker boundaries are currently untraceable and the diagnostic needs fix this. Add Consequences covering pickle-invariance cost and the check-rule coexistence it enables
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only the decision "Runtime invariant failures now carry a coded diagnostic" is stated · ×1
No context/problem and no consequences/trade-offs; only the decision "Runtime invariant failures now carry a coded diagnostic" is stated changes/1332.added.md— Add why this matters (e.g. failure diagnostics are stale or lost after re-running) and document trade-offs such as the invariant-pre/post annotation burden
D20 · ADR Quality· No context/problem (why diagnostics need resolving_operation) and no consequences/trade-offs · ×1
No context/problem (why diagnostics need resolving_operation) and no consequences/trade-offs changes/1333.added.md— Add a Context section explaining why deterministic commands alone cannot resolve failures and why diagnostic resolution is needed. Add Consequences covering trade-offs such as the resolved failure being visible again or staleness-diagnostic overhead
D20 · ADR Quality· No consequences/trade-offs; only the structural format change and no cost of adding Given-When-Then before diagrams · ×1
No consequences/trade-offs; only the structural format change and no cost of adding Given-When-Then before diagrams changes/1336.changed.md— Add a Consequences section noting that each generated slice is longer by one line (Given-When-Then) and how reviewers might find it less readable than the original single-line event-model output
D20 · ADR Quality· No consequences/trade-offs; only the decision and no discussion of why it matters or what it costs · ×1
No consequences/trade-offs; only the decision and no discussion of why it matters or what it costs changes/1337.added.md— Add a Consequences section covering false-positive rate, overhead for raising events, and how to handle existing clusters that already emit nothing
D20 · ADR Quality· No context/problem statement (why an element-type name needs to be added) and no consequences/trade-offs · ×1
No context/problem statement (why an element-type name needs to be added) and no consequences/trade-offs changes/1340.added.md— Add a Context section explaining the problem (e.g. existing add commands are destructive or create plans that cannot be rolled back) and a Consequences section on trade-offs like preview-only behavior
D20 · ADR Quality· No context/problem and no consequences/trade-offs; the body is restated as a decision with no rationale or impact · ×1
No context/problem and no consequences/trade-offs; the body is restated as a decision with no rationale or impact changes/1341.changed.md— Add why generation-gap ownership matters (e.g. prevent accidental re-implementation of hand-owned code) and document the trade-offs: maintenance burden for owners, risk of stale ownership markers when apply fails mid-generation
D20 · ADR Quality· No context/problem (why versioned llms.txt context pack matters) and no consequences/trade-offs · ×1
No context/problem (why versioned llms.txt context pack matters) and no consequences/trade-offs changes/1344.added.md— Add a Context section explaining the problem (e.g. needing a single versioned context for Protean projects plus domain-specific overlays) and a Consequences section covering trade-offs like increased boilerplate or dependency coupling
D20 · ADR Quality· No context/problem (why an agents doc) and no consequences/trade-offs · ×1
No context/problem (why an agents doc) and no consequences/trade-offs changes/1346.added.md— Add a Context section explaining why this agent docs feature is needed (e.g. unifying documentation across error types, making fixes self-evident). Add Consequences: the new AGENTS.md file grows with code, how it compares to existing docs, and any maintenance burden.
D20 · ADR Quality· No context/problem and no consequences; only scoring details (per-task spec.json recipe, deterministic gold, compare()) are present · ×1
No context/problem and no consequences; only scoring details (per-task spec.json recipe, deterministic gold, compare()) are present changes/1349.added.md— Add the problem being solved (e.g. comparing two evaluation pipelines) and the trade-offs of each approach (deterministic vs adaptive rubric)
D20 · ADR Quality· No decision (explicit change or removal) and no consequences/trade-offs are stated · ×1
No decision (explicit change or removal) and no consequences/trade-offs are stated changes/1350.added.md— State what the metric is replacing (e.g. a single deterministic pass/fail guard) and its trade-offs (re-running on CI, added overhead)
D20 · ADR Quality· Consequences/trade-offs are absent despite a concrete decision (widening mutation testing to three paths) and an explicit test-killer list · ×1
Consequences/trade-offs are absent despite a concrete decision (widening mutation testing to three paths) and an explicit test-killer list changes/1353.changed.md— Add a Consequences section noting the cost of adding new targets: longer CI/CD cycles, the need for a quarterly pass, and that tests alone drive mutant-killing without source changes
D20 · ADR Quality· No context/problem or consequences/trade-offs; only an applicability charter is described · ×1
No context/problem or consequences/trade-offs; only an applicability charter is described changes/1354.added.md— Add a Context section explaining why Protean's shape-inflexible model matters (e.g. avoiding rework for growing systems) and a Consequences section on trade-offs such as loss of control over design decisions
D20 · ADR Quality· No context/problem (why snapshot predates schema matters) and no consequences/trade-offs · ×1
No context/problem (why snapshot predates schema matters) and no consequences/trade-offs changes/1362.fixed.md— Add a Context section explaining the failure mode (snapshot fails on mismatched field rename/requirement) and a Consequences section covering rebuild cost, warning channel load, and how to handle stale snapshots
D20 · ADR Quality· No context/problem (why a dead-letter queue) and no consequences/trade-offs · ×1
No context/problem (why a dead-letter queue) and no consequences/trade-offs changes/1364.added.md— Add a Context section explaining why an exhausted event-store DLQ matters (e.g. retry exhaustion, lost events). Add Consequences covering operational cost of maintaining the DLQ vs the benefit of inspecting failed positions
D20 · ADR Quality· No consequences/trade-offs section describing why drain-rate computation matters (e.g. false positives under load) and how it interacts with the sliding-window slope · ×1
No consequences/trade-offs section describing why drain-rate computation matters (e.g. false positives under load) and how it interacts with the sliding-window slope changes/1368.added.md— Add a Consequences section noting that the lag_drain_rate signal is computed on-the-fly from the existing lag-seconds gauge, so it does not expose new metrics but instead gives insight into drain behavior, and why ignoring gaps could lead to misjudging backlog recovery
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only an explicit decision (TLa+ failure-recovery protocol) with no framing · ×1
No context/problem and no consequences/trade-offs; only an explicit decision (TLa+ failure-recovery protocol) with no framing changes/1372.added.md— Add the problem motivating the specification (e.g. unrecoverable subscription dropouts under load) and its consequences (reliability risk vs build cost of TLa+ verification)}
D20 · ADR Quality· No context/problem (why an optimistic-concurrency no-lost-update spec) and no consequences/trade-offs · ×1
No context/problem (why an optimistic-concurrency no-lost-update spec) and no consequences/trade-offs changes/1373.added.md— Add the problem motivating this specification (e.g. concurrent updates causing lost updates under a given invariant), and note any trade-offs such as runtime cost of verification
D20 · ADR Quality· No Context/Problem section describing why Werkzeug's LocalProxy stack was chosen over stdlib contextvars · ×1
No Context/Problem section describing why Werkzeug's LocalProxy stack was chosen over stdlib contextvars changes/1375.changed.md— Add a Context section explaining the prior problem (incompatibility with asyncio/task semantics) and why domain/context vars were selected
D20 · ADR Quality· No context/problem (why cffi/greenlet were removed from core) and no consequences/trade-offs · ×1
No context/problem (why cffi/greenlet were removed from core) and no consequences/trade-offs changes/1376.changed.md— Add a Context section explaining the dependency removal rationale (e.g. upstream deprecations, Pinning to supported versions) and a Consequences section on how existing code must change (import declarations, wheel pinning)
D20 · ADR Quality· No context/problem (why trace validation matters) and no consequences/trade-offs · ×1
No context/problem (why trace validation matters) and no consequences/trade-offs changes/1382.added.md— Add the problem motivating OCC protocol trace validation (e.g. a lost-update bug is silently accepted by shipped code) and note any trade-offs such as added runtime overhead or increased log verbosity
D20 · ADR Quality· No context/problem (why an update without a UoW would lose version race) and no consequences/trade-offs · ×1
No context/problem (why an update without a UoW would lose version race) and no consequences/trade-offs changes/1382.fixed.md— Add the problem statement: why standalone SQLAlchemy updates are needed vs. UnitOfWork, and note the trade-off of losing the UoW path's concurrency semantics.
D20 · ADR Quality· No consequences/trade-offs; the decision (trace validation via verify-specs + negative checks) is stated but its cost (re-running tests for every failure, false-positive tolerance from divergence rejection) and how it interacts with CI/CD are not mentioned · ×1
No consequences/trade-offs; the decision (trace validation via verify-specs + negative checks) is stated but its cost (re-running tests for every failure, false-positive tolerance from divergence rejection) and how it interacts with CI/CD are not mentioned changes/1383.added.md— Add a Consequences section noting that each test run incurs overhead and that the divergence/replay rejection thresholds must be tuned to avoid false positives
D20 · ADR Quality· No context/problem (why the gap-safe `$all` checkpoint was added) and no consequences/trade-offs · ×1
No context/problem (why the gap-safe `$all` checkpoint was added) and no consequences/trade-offs changes/1384.added.md— Add a Context section explaining why gap safety for `$all` matters and a Consequences section on trade-offs such as increased runtime cost of verifying out-of-order logs
D20 · ADR Quality· No consequences/trade-offs; the decision "Trace validation for the recovery protocol" is stated but there are no notes on why it matters beyond the shipped record-before-advance path or how it affects test suite behavior · ×1
No consequences/trade-offs; the decision "Trace validation for the recovery protocol" is stated but there are no notes on why it matters beyond the shipped record-before-advance path or how it affects test suite behavior changes/1385.added.md— Add a Consequences section noting that this adds an extra negative check (log diverges, no crash redelivery) and explains why green runs are still required despite the model being sound
D20 · ADR Quality· No context/problem and no consequences/trade-offs are stated · ×1
No context/problem and no consequences/trade-offs are stated changes/1399.fixed.md— Explain why pattern-matching zero keys should not raise (e.g. avoid false-positive errors) and note the trade-off of silently ignoring a non-existent delete
D20 · ADR Quality· No context/problem (why schema evolution is needed) and no consequences/trade-offs · ×1
No context/problem (why schema evolution is needed) and no consequences/trade-offs changes/1400.added.md— Add the problem motivating each ladder tier (e.g. why lenient mode matters for new payloads) and document the trade-offs of permanent lenient mode
D20 · ADR Quality· No context/problem and no consequences/trade-offs · ×1
No context/problem and no consequences/trade-offs changes/1408.added.md— Add the problem (advisory check silencing) and its consequences (false positives, expected handler behavior)
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only the decision "Added Python 3.15" is stated · ×1
No context/problem and no consequences/trade-offs; only the decision "Added Python 3.15" is stated changes/1426.added.md— Add a Context section explaining why 3.15 was chosen over 3.14 (e.g., new features, deprecations) and a Consequences section on trade-offs such as requiring allow-prereleases or the CI/PyPI workflow
D20 · ADR Quality· No migration/consequences section and no trade-offs; the body is a single decision statement with no context or consequences · ×1
No migration/consequences section and no trade-offs; the body is a single decision statement with no context or consequences changes/1433.changed.md— Add a Consequences section covering why the checksum baseline must be regenerated (version mismatch failure) and how to do it (run protean-check-staleness then regenerate ir.json)
D20 · ADR Quality· No context/problem (why EventModeling diff vs text format matters) and no consequences/trade-offs · ×1
No context/problem (why EventModeling diff vs text format matters) and no consequences/trade-offs changes/1435.added.md— Add a Context section explaining why EventModeling diff is needed over the existing text format, and a Consequences section on trade-offs such as requiring EventModeling slice parsing
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only the validation rule is stated · ×1
No context/problem and no consequences/trade-offs; only the validation rule is stated changes/1435.changed.md— Add a Context section explaining why format validation matters (e.g. reproducible diffs) and a Consequences section on how rejection breaks existing workflows
D20 · ADR Quality· No context/problem (why beyond-head staleness matters) and no consequences/trade-offs · ×1
No context/problem (why beyond-head staleness matters) and no consequences/trade-offs changes/1446.added.md— Add a Context section explaining why checkpoints can become stale after a restore and the failure modes it avoids. Add Consequences covering operational cost of requiring verify-checkpoints and any false-positive risk from resetting to head.
D20 · ADR Quality· No consequences/trade-offs; the decision is stated but there are no notes on why truncating before every message_db test matters beyond the test-isolation claim · ×1
No consequences/trade-offs; the decision is stated but there are no notes on why truncating before every message_db test matters beyond the test-isolation claim changes/1449.fixed.md— Add a Consequences section noting that autouse fixture overhead (e.g. per-test setup/teardown) could be measurable and whether it is acceptable for the test suite
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only a one-line rationale with no framing · ×1
No context/problem and no consequences/trade-offs; only a one-line rationale with no framing changes/1463.added.md— Add why this bundling is needed (e.g. runtime guidance without vendoring) and the trade-offs (bundled size, dependency on importlib-resources)}
D20 · ADR Quality· No context/problem motivation or consequences/trade-offs · ×1
No context/problem motivation or consequences/trade-offs changes/1465.added.md— Add why protean dx is needed (e.g. decoupling coding-agent guidance from the project) and note trade-offs such as managed-block persistence vs. re-run cost
D20 · ADR Quality· No consequences/trade-offs; only the problem and a one-line fix are stated · ×1
No consequences/trade-offs; only the problem and a one-line fix are stated changes/1465.fixed.md— Add a Consequences section noting the change breaks observatory commands requiring click in core-only mode until server extra is installed
D20 · ADR Quality· No consequences/trade-offs section describing what the change breaks for users who rely on dry-run output (project-relative path listing) and why it is still needed · ×1
No consequences/trade-offs section describing what the change breaks for users who rely on dry-run output (project-relative path listing) and why it is still needed changes/1466.changed.md— Add a Consequences section noting that the dry run now prints project-relative paths instead of failing with FileExistsError, so anyone running `protean new --dry-run` to inspect what will be created must read the output rather than being warned off by failure
D20 · ADR Quality· No consequences/trade-offs; the decision is stated but no cost of rejecting new . and .. names (e.g. migration pain for projects that previously used them) · ×1
No consequences/trade-offs; the decision is stated but no cost of rejecting new . and .. names (e.g. migration pain for projects that previously used them) changes/1466.fixed.md— Add a Consequences section noting that existing projects relying on new ./.. names will break and describe how to migrate them
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only the decision "`protean new` refuses a target directory that resolves outside the output directory" is stated · ×1
No context/problem and no consequences/trade-offs; only the decision "`protean new` refuses a target directory that resolves outside the output directory" is stated changes/1466.security.md— Add why this matters (e.g. projects referencing symlinks in the output dir are now broken) and note any trade-offs, e.g. requiring targets to be placed inside the output dir instead of elsewhere
D20 · ADR Quality· No context/problem (why a Model Context Protocol server) and no consequences/trade-offs · ×1
No context/problem (why a Model Context Protocol server) and no consequences/trade-offs changes/1467.added.md— Add the problem motivating the MCP command (e.g. need to expose framework tools as standalone commands) and document trade-offs such as default stdio vs streaming over HTTP
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only the decision (renaming --pretend to --dry-run) is stated · ×1
No context/problem and no consequences/trade-offs; only the decision (renaming --pretend to --dry-run) is stated changes/1473.changed.md— Add a Context section explaining why pretend was removed and what it broke for users who relied on it, then a Consequences section noting that dry-running does not change output files or commit hooks
D20 · ADR Quality· No context/problem (why three files instead of one) or consequences/trade-offs · ×1
No context/problem (why three files instead of one) or consequences/trade-offs changes/1474.added.md— Add a Context section explaining the problem (the canonical set plus three new files) and a Consequences section on trade-offs such as increased file count and dx check drift detection
D20 · ADR Quality· The decision is excellent but the context/problem and consequences/trade-offs are thin; only a one-line summary of each is visible · ×1
The decision is excellent but the context/problem and consequences/trade-offs are thin; only a one-line summary of each is visible changes/1482.added.md— Add a Context section explaining why security boundaries matter (e.g. injection attacks on String/Text fields) and a Consequences section covering trade-offs like the lack of operator control over transport/authentication
D20 · ADR Quality· No context/problem (why the quickstart needed rework) and no consequences/trade-offs · ×1
No context/problem (why the quickstart needed rework) and no consequences/trade-offs changes/1485.changed.md— Add a Context section explaining why the existing docs quickstart was stale (no test ran), and a Consequences section covering trade-offs such as the removal of the non-tested guide
D20 · ADR Quality· No context/problem (why replace the README Quick Start) and no consequences/trade-offs · ×1
No context/problem (why replace the README Quick Start) and no consequences/trade-offs changes/1486.changed.md— Add why the README Quick Start is stale/corrupting (e.g. a published post was added but not reflected in docs), and note any trade-offs such as the guard test's cost of comparing verbatim regions
D20 · ADR Quality· No context/problem and no consequences/trade-offs; only a documentation-linking rationale · ×1
No context/problem and no consequences/trade-offs; only a documentation-linking rationale changes/1487.changed.md— Add the problem (e.g. why the reference application matters) and the trade-offs of linking docs to an external runnable app
D20 · ADR Quality· No context/problem (why move skills from placeholder to full set) and no consequences/trade-offs · ×1
No context/problem (why move skills from placeholder to full set) and no consequences/trade-offs changes/1521.added.md— Add a Context section explaining why the placeholder was inadequate and a Consequences section on trade-offs such as increased pack size and relicensing
D20 · ADR Quality· No context/problem (why upcasters must run on replayed events rather than snapshots) and no consequences/trade-offs · ×1
No context/problem (why upcasters must run on replayed events rather than snapshots) and no consequences/trade-offs changes/1526.changed.md— Add a Context section explaining the problem: stored snapshots hold aggregate state that may no longer match the current schema, so they must be discarded and replayed to rebuild aggregates. Then document Consequences such as replay cost vs snapshot durability.
D20 · ADR Quality· No context/problem (the stale read bug) and no consequences/trade-offs · ×1
No context/problem (the stale read bug) and no consequences/trade-offs changes/1529.fixed.md— Add the original problem (stale record returned instead of newest) and document the trade-offs: the false-positive staleness risk when replaying past checkpoints
D22 · Internal API Consistency· Duplicate function definition. The same function signature and likely implementation exist in two different internal modules (`_helpers` and `_ir_utils`). · ×1
Duplicate function definition. The same function signature and likely implementation exist in two different internal modules (`_helpers` and `_ir_utils`). — Remove the duplicate from one module and import from the other, or consolidate into a single utility module. (signatures: src.protean.cli._helpers.load_domain(domain_path: str, as_json: bool): Domain | src.protean.cli._ir_utils.load_domain(domain_path: str, as_json: bool): Domain)
D22 · Internal API Consistency· Inconsistent DLQ (Dead Letter Queue) API surface across broker implementations. `InlineBroker` exposes message retrieval (`get_dlq_messages`), while `RedisBroker` exposes management operations (`dlq_depth`, `dlq_trim`) but lacks a direct message retrieval method in the signature list. This forces consumers to use different methods or rely on underlying client instances to inspect DLQs depending on the broker. · ×1
Inconsistent DLQ (Dead Letter Queue) API surface across broker implementations. `InlineBroker` exposes message retrieval (`get_dlq_messages`), while `RedisBroker` exposes management operations (`dlq_depth`, `dlq_trim`) but lacks a direct message retrieval method in the signature list. This forces consumers to use different methods or rely on underlying client instances to inspect DLQs depending on the broker. — Standardize the DLQ interface. Either add `get_dlq_messages` to `RedisBroker` or ensure the `Brokers` manager provides a unified way to inspect DLQ contents across all providers. (signatures: src.protean.adapters.broker.inline.InlineBroker.get_dlq_messages(self, consumer_group: str, stream: str | None): dict[str, list[tuple[str, dict[str, Any], str, float]]] | src.protean.adapters.broker.redis.RedisBroker.dlq_depth(self, dlq_stream: str): int | src.protean.adapters.broker.redis.RedisBroker.dlq_trim(self, dlq_stream: str, min_id: str): int)
D22 · Internal API Consistency· Inconsistent method naming for lookup evaluation/generation. Elasticsearch lookups use `as_expression`, Memory lookups use `evaluate`, and SQLAlchemy lookups primarily expose `lookup_name` (with some having `as_expression` or `process_target`). This inconsistency makes it difficult to write generic code that iterates over lookup types. · ×1
Inconsistent method naming for lookup evaluation/generation. Elasticsearch lookups use `as_expression`, Memory lookups use `evaluate`, and SQLAlchemy lookups primarily expose `lookup_name` (with some having `as_expression` or `process_target`). This inconsistency makes it difficult to write generic code that iterates over lookup types. — Unify the method name across all repository adapters for generating query expressions (e.g., standardize on `as_expression` or `build_query`). If `evaluate` is meant for in-memory filtering, document the distinction clearly, but the naming variance is confusing. (signatures: src.protean.adapters.repository.elasticsearch.Exact.as_expression(self): Any | src.protean.adapters.repository.memory.Exact.evaluate(self): bool | src.protean.adapters.repository.sqlalchemy.Exact.lookup_name: str)
D22 · Internal API Consistency· Duplicate CLI commands for DLQ management. Both `eventstore` and `dlq` subcommands expose a `list_dlq` (and likely `inspect`, `replay`, `purge`) functionality. This creates user confusion about which command to use. · ×1
Duplicate CLI commands for DLQ management. Both `eventstore` and `dlq` subcommands expose a `list_dlq` (and likely `inspect`, `replay`, `purge`) functionality. This creates user confusion about which command to use. — Deprecate one of the command groups (likely `eventstore` if `dlq` is the dedicated namespace) and redirect users to the single canonical command. (signatures: src.protean.cli.eventstore.list_dlq(ctx: Context, domain: ..., subscription, output_json: ...) | src.protean.cli.dlq.list_dlq(domain: ..., subscription, limit: ...))
FunctionTooLong: timeline._bindEvents src/protean/server/observatory/static/js/timeline.js:1081— FunctionTooLong — _bindEvents runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Near-duplicate member pair (65 shared lines) src/protean/server/observatory/routes/handlers.py:332— src/protean/server/observatory/routes/handlers.py:332-425 | src/protean/server/observatory/routes/processes.py:207-284 — These two members are variants of one another: 65 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (41 shared lines) src/protean/port/event_store.py:1028— src/protean/port/event_store.py:1028-1103 | src/protean/server/observatory/routes/timeline.py:403-515 — These two members are variants of one another: 41 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) src/protean/core/query.py:129— src/protean/core/query.py:129-170 | src/protean/utils/eventing.py:392-432 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×1
Edited copy of a member (11 corresponding lines) docs_src/guides/domain-definition/009.py:14— docs_src/guides/domain-definition/009.py:14-31 | src/protean/dx/pack/skills/value-object/assets/value_object_with_validation.py:29-55 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) src/protean/ir/generators/events.py:129— src/protean/ir/generators/events.py:129-143 | src/protean/ir/generators/events.py:150-195 | src/protean/ir/generators/events.py:202-226 | src/protean/ir/generators/events.py:290-313 | src/protean/ir/generators/events.py:320-372 | src/protean/ir/generators/events.py:379-411 | src/protean/ir/generators/handlers.py:81-118 | src/protean/ir/generators/handlers.py:125-152 | src/protean/ir/generators/handlers.py:159-218 | src/protean/ir/generators/handlers.py:225-261 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) src/protean/ir/diff.py:95— src/protean/ir/diff.py:95-114 | src/protean/ir/diff.py:163-191 | src/protean/ir/diff.py:219-240 | src/protean/ir/diff.py:252-277 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (39–54 lines × 2) src/protean/adapters/broker/redis.py:1233— src/protean/adapters/broker/redis.py:1233-1286 | src/protean/adapters/broker/redis_pubsub.py:165-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (41–45 lines × 2) src/protean/domain/__init__.py:2357— src/protean/domain/__init__.py:2357-2397 | src/protean/domain/__init__.py:2439-2483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41–44 lines × 2) src/protean/core/entity.py:567— src/protean/core/entity.py:567-610 | src/protean/core/projection.py:303-343 — before extracting anything, compare `src/protean/core/entity.py` and `src/protean/core/projection.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/core/entity.py:613` calls `_discover_invariants`, `defaults` and `src/protean/core/projection.py:346` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (43 lines × 2) src/protean/server/subscription_status.py:491— src/protean/server/subscription_status.py:491-533 | src/protean/server/subscription_status.py:598-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/server/subscription_status.py:537` calls `suppress`, `xlen` and `src/protean/server/subscription_status.py:642` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (30–42 lines × 2) src/protean/server/engine.py:645— src/protean/server/engine.py:645-686 | src/protean/server/subscription_status.py:162-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/engine.py:645` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `handler_cls` to `type[BaseCommandHandler | BaseEventHandler]` in one and `type[Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (39 lines × 2) src/protean/server/observatory/routes/handlers.py:273— src/protean/server/observatory/routes/handlers.py:273-311 | src/protean/server/observatory/routes/processes.py:161-199 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (23–38 lines × 2) src/protean/ir/generators/event_model.py:1148— src/protean/ir/generators/event_model.py:1148-1185 | src/protean/ir/generators/event_model.py:1188-1210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34–35 lines × 2) src/protean/core/query.py:136— src/protean/core/query.py:136-170 | src/protean/utils/eventing.py:399-432 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (34 lines × 2) src/protean/server/observatory/api.py:1226— src/protean/server/observatory/api.py:1226-1259 | src/protean/server/observatory/api.py:1277-1310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32–33 lines × 2) src/protean/server/observatory/api.py:290— src/protean/server/observatory/api.py:290-322 | src/protean/server/observatory/api.py:354-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/api.py:290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–31 lines × 2) src/protean/port/dao.py:715— src/protean/port/dao.py:715-736 | src/protean/port/dao.py:811-841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (28–30 lines × 2) src/protean/core/repository.py:494— src/protean/core/repository.py:494-523 | src/protean/core/repository.py:529-556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (27–30 lines × 2) src/protean/ir/builder.py:678— src/protean/ir/builder.py:678-707 | src/protean/ir/builder.py:719-745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) src/protean/core/command.py:215— src/protean/core/command.py:215-243 | src/protean/core/event.py:195-223 — before extracting anything, compare `src/protean/core/command.py` and `src/protean/core/event.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/core/command.py:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–28 lines × 3) src/protean/ir/generators/events.py:151— src/protean/ir/generators/events.py:151-178 | src/protean/ir/generators/events.py:322-347 | src/protean/ir/generators/handlers.py:161-188 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/ir/generators/handlers.py:189` calls `_evt_node_id`, `short_name` and `src/protean/ir/generators/events.py:179` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27–28 lines × 2) src/protean/server/observatory/routes/handlers.py:398— src/protean/server/observatory/routes/handlers.py:398-425 | src/protean/server/observatory/routes/processes.py:258-284 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/routes/handlers.py:398` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (26 lines × 2) src/protean/ir/diff.py:1080— src/protean/ir/diff.py:1080-1105 | src/protean/ir/diff.py:1144-1169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–26 lines × 2) src/protean/ir/generators/base.py:173— src/protean/ir/generators/base.py:173-197 | src/protean/ir/generators/base.py:201-226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22–25 lines × 2) src/protean/cli/eventstore.py:492— src/protean/cli/eventstore.py:492-516 | src/protean/cli/eventstore.py:580-601 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) src/protean/fields/association.py:621— src/protean/fields/association.py:621-643 | src/protean/fields/association.py:725-747 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/fields/association.py:618` calls `super`, `__set__` and `src/protean/fields/association.py:722` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22 lines × 3) src/protean/server/observatory/api.py:315— src/protean/server/observatory/api.py:315-336 | src/protean/server/observatory/api.py:378-399 | src/protean/server/observatory/metrics.py:732-753 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–22 lines × 2) src/protean/server/observatory/routes/handlers.py:83— src/protean/server/observatory/routes/handlers.py:83-104 | src/protean/server/observatory/routes/processes.py:78-95 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–21 lines × 3) src/protean/ir/generators/events.py:203— src/protean/ir/generators/events.py:203-223 | src/protean/ir/generators/events.py:381-400 | src/protean/ir/generators/handlers.py:227-246 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (20–21 lines × 2) src/protean/server/observatory/routes/handlers.py:369— src/protean/server/observatory/routes/handlers.py:369-389 | src/protean/server/observatory/routes/processes.py:237-256 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15–19 lines × 3) src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:168— src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py:168-186 | src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py:121-135 | src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_simple.py:90-108 — before extracting anything, compare `src/protean/dx/pack/skills/add-command/assets/add_command_multiple_commands.py` and `src/protean/dx/pack/skills/api-endpoint/assets/api_endpoint_path_params.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) src/protean/integrations/fastapi/health.py:83— src/protean/integrations/fastapi/health.py:83-101 | src/protean/server/health.py:511-529 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14–18 lines × 2) src/protean/server/subscription_status.py:894— src/protean/server/subscription_status.py:894-911 | src/protean/server/subscription_status.py:915-928 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–17 lines × 3) src/protean/server/projection_status.py:139— src/protean/server/projection_status.py:139-155 | src/protean/server/subscription_status.py:895-911 | src/protean/server/subscription_status.py:916-928 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (15–16 lines × 3) src/protean/core/email.py:102— src/protean/core/email.py:102-117 | src/protean/core/query.py:223-238 | src/protean/core/value_object.py:198-212 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (11–16 lines × 2) src/protean/ir/builder.py:2310— src/protean/ir/builder.py:2310-2325 | src/protean/ir/builder.py:2356-2366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–15 lines × 2) src/protean/adapters/broker/inline.py:745— src/protean/adapters/broker/inline.py:745-756 | src/protean/adapters/broker/inline.py:846-860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–15 lines × 2) src/protean/adapters/repository/memory.py:748— src/protean/adapters/repository/memory.py:748-762 | src/protean/adapters/repository/memory.py:845-855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/adapters/repository/memory.py:748` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–15 lines × 2) src/protean/dx/managed_files.py:477— src/protean/dx/managed_files.py:477-489 | src/protean/scaffold/manifest.py:55-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13–14 lines × 2) docs_src/guides/getting-started/es-tutorial/ch09.py:281— docs_src/guides/getting-started/es-tutorial/ch09.py:281-294 | docs_src/guides/getting-started/es-tutorial/ch22.py:519-531 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch09.py` and `docs_src/guides/getting-started/es-tutorial/ch22.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12–14 lines × 2) src/protean/server/observatory/api.py:671— src/protean/server/observatory/api.py:671-682 | src/protean/server/observatory/api.py:937-950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/api.py:671` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/server/observatory/api.py:952` calls `get` and `src/protean/server/observatory/api.py:685` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–13 lines × 4) src/protean/ir/diff.py:95— src/protean/ir/diff.py:95-103 | src/protean/ir/diff.py:163-171 | src/protean/ir/diff.py:219-227 | src/protean/ir/diff.py:252-264 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) docs_src/guides/domain-behavior/006.py:122— docs_src/guides/domain-behavior/006.py:122-134 | docs_src/guides/domain-behavior/007.py:121-133 | src/protean/dx/pack/skills/domain-service/assets/domain_service_with_invariants.py:137-149 — before extracting anything, compare `docs_src/guides/domain-behavior/006.py` and `docs_src/guides/domain-behavior/007.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 9) src/protean/ir/builder.py:712— src/protean/ir/builder.py:712-723 | src/protean/ir/builder.py:756-767 | src/protean/ir/builder.py:913-924 | src/protean/ir/builder.py:949-960 | src/protean/ir/builder.py:986-997 | src/protean/ir/builder.py:1078-1089 | src/protean/ir/builder.py:1177-1188 | src/protean/ir/builder.py:1263-1274 | src/protean/ir/builder.py:1292-1303 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/ir/builder.py:768` calls `_extract_fields` and `src/protean/ir/builder.py:1275` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 5) src/protean/core/command.py:105— src/protean/core/command.py:105-116 | src/protean/core/email.py:101-112 | src/protean/core/event.py:91-102 | src/protean/core/query.py:222-233 | src/protean/core/value_object.py:197-208 — before extracting anything, compare `src/protean/core/command.py` and `src/protean/core/event.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 4) src/protean/ir/builder.py:917— src/protean/ir/builder.py:917-928 | src/protean/ir/builder.py:953-964 | src/protean/ir/builder.py:1127-1138 | src/protean/ir/builder.py:1181-1192 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 2) src/protean/cli/projection.py:215— src/protean/cli/projection.py:215-225 | src/protean/cli/subscriptions.py:112-123 — before extracting anything, compare `src/protean/cli/projection.py` and `src/protean/cli/subscriptions.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/cli/projection.py:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/cli/subscriptions.py:124` calls `sum` and `src/protean/cli/projection.py:227` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–12 lines × 2) src/protean/port/event_store.py:1092— src/protean/port/event_store.py:1092-1103 | src/protean/server/observatory/routes/timeline.py:506-515 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 5) src/protean/ir/builder.py:715— src/protean/ir/builder.py:715-725 | src/protean/ir/builder.py:759-769 | src/protean/ir/builder.py:1081-1091 | src/protean/ir/builder.py:1154-1164 | src/protean/ir/builder.py:1295-1305 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/ir/builder.py:770` calls `_extract_invariants` and `src/protean/ir/builder.py:1165` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 3) src/protean/ir/generators/events.py:179— src/protean/ir/generators/events.py:179-188 | src/protean/ir/generators/events.py:348-357 | src/protean/ir/generators/handlers.py:191-201 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/ir/generators/events.py:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ir/generators/handlers.py:189` calls `_evt_node_id`, `short_name` and `src/protean/ir/generators/events.py:178` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 2) src/protean/port/event_store.py:1065— src/protean/port/event_store.py:1065-1074 | src/protean/server/observatory/routes/timeline.py:455-465 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/routes/timeline.py:455` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 8) src/protean/ir/builder.py:916— src/protean/ir/builder.py:916-925 | src/protean/ir/builder.py:952-961 | src/protean/ir/builder.py:989-998 | src/protean/ir/builder.py:1048-1057 | src/protean/ir/builder.py:1126-1135 | src/protean/ir/builder.py:1180-1189 | src/protean/ir/builder.py:1266-1275 | src/protean/ir/builder.py:1353-1362 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/protean/ir/builder.py:926` calls `_extract_handler_map` and `src/protean/ir/builder.py:999` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 5) docs_src/guides/getting-started/es-tutorial/ch06.py:214— docs_src/guides/getting-started/es-tutorial/ch06.py:214-223 | docs_src/guides/getting-started/es-tutorial/ch08.py:240-249 | docs_src/guides/getting-started/es-tutorial/ch18.py:185-194 | docs_src/guides/getting-started/es-tutorial/ch20.py:179-188 | docs_src/guides/getting-started/es-tutorial/ch22.py:364-373 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch06.py` and `docs_src/guides/getting-started/es-tutorial/ch18.py` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) src/protean/ir/builder.py:995— src/protean/ir/builder.py:995-1004 | src/protean/ir/builder.py:1025-1034 | src/protean/ir/builder.py:1054-1063 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ir/builder.py:1023` calls `getattr` and `src/protean/ir/builder.py:994` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–10 lines × 2) docs_src/guides/domain-definition/009.py:23— docs_src/guides/domain-definition/009.py:23-31 | src/protean/dx/pack/skills/value-object/assets/value_object_with_validation.py:46-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `docs_src/guides/domain-definition/009.py:23` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 4) src/protean/server/observatory/api.py:759— src/protean/server/observatory/api.py:759-774 | src/protean/server/observatory/routes/handlers.py:522-530 | src/protean/server/observatory/routes/handlers.py:567-575 | src/protean/server/observatory/routes/processes.py:461-469 — before extracting anything, compare `src/protean/server/observatory/routes/handlers.py` and `src/protean/server/observatory/routes/processes.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 165 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/api.py:759` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) src/protean/ir/builder.py:802— src/protean/ir/builder.py:802-810 | src/protean/ir/builder.py:998-1006 | src/protean/ir/builder.py:1028-1036 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/ir/builder.py:801` calls `_extract_fields` and `src/protean/ir/builder.py:997` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–9 lines × 4) src/protean/server/observatory/metrics.py:326— src/protean/server/observatory/metrics.py:326-335 | src/protean/server/observatory/metrics.py:339-347 | src/protean/server/observatory/metrics.py:351-359 | src/protean/server/observatory/metrics.py:360-366 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/server/observatory/metrics.py:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/server/observatory/metrics.py:337` calls `health_stats`, `get`, `create_observation` and `src/protean/server/observatory/metrics.py:360` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 2) src/protean/server/observatory/api.py:262— src/protean/server/observatory/api.py:262-270 | src/protean/server/observatory/api.py:614-621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–8 lines × 3) src/protean/ir/generators/handlers.py:133— src/protean/ir/generators/handlers.py:133-139 | src/protean/ir/generators/handlers.py:183-190 | src/protean/ir/generators/handlers.py:242-248 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) src/protean/ir/generators/events.py:135— src/protean/ir/generators/events.py:135-140 | src/protean/ir/generators/events.py:297-302 | src/protean/ir/generators/handlers.py:92-98 | src/protean/ir/generators/handlers.py:132-137 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) src/protean/ir/generators/events.py:136— src/protean/ir/generators/events.py:136-140 | src/protean/ir/generators/events.py:218-223 | src/protean/ir/generators/events.py:298-302 | src/protean/ir/generators/events.py:396-400 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (50 lines × 2) docs_src/guides/getting-started/es-tutorial/ch02.py:47— docs_src/guides/getting-started/es-tutorial/ch02.py:47-96 | docs_src/guides/getting-started/es-tutorial/ch03.py:44-145 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (145 lines × 2) docs_src/guides/getting-started/es-tutorial/ch04.py:55— docs_src/guides/getting-started/es-tutorial/ch04.py:55-199 | docs_src/guides/getting-started/es-tutorial/ch07.py:50-222 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch04.py` and `docs_src/guides/getting-started/es-tutorial/ch07.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 692 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (112 lines × 4) docs_src/guides/getting-started/es-tutorial/ch04.py:55— docs_src/guides/getting-started/es-tutorial/ch04.py:55-199 | docs_src/guides/getting-started/es-tutorial/ch07.py:50-222 | docs_src/guides/getting-started/es-tutorial/ch12.py:61-172 | docs_src/guides/getting-started/es-tutorial/ch13.py:59-184 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch04.py` and `docs_src/guides/getting-started/es-tutorial/ch07.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 692 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (126 lines × 3) docs_src/guides/getting-started/es-tutorial/ch04.py:55— docs_src/guides/getting-started/es-tutorial/ch04.py:55-199 | docs_src/guides/getting-started/es-tutorial/ch07.py:50-222 | docs_src/guides/getting-started/es-tutorial/ch13.py:59-184 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch04.py` and `docs_src/guides/getting-started/es-tutorial/ch07.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 692 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (126 lines × 2) docs_src/guides/getting-started/es-tutorial/ch07.py:50— docs_src/guides/getting-started/es-tutorial/ch07.py:50-222 | docs_src/guides/getting-started/es-tutorial/ch16.py:52-177 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (103 lines × 7) docs_src/guides/getting-started/es-tutorial/ch04.py:55— docs_src/guides/getting-started/es-tutorial/ch04.py:55-199 | docs_src/guides/getting-started/es-tutorial/ch07.py:50-222 | docs_src/guides/getting-started/es-tutorial/ch13.py:59-184 | docs_src/guides/getting-started/es-tutorial/ch16.py:52-177 | docs_src/guides/getting-started/es-tutorial/ch17.py:57-159 | docs_src/guides/getting-started/es-tutorial/ch19.py:54-156 | docs_src/guides/getting-started/es-tutorial/ch21.py:55-157 — before extracting anything, compare `docs_src/guides/getting-started/es-tutorial/ch04.py` and `docs_src/guides/getting-started/es-tutorial/ch07.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 692 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (36 lines × 2) src/protean/dx/pack/skills/add-event/assets/add_event_same_aggregate.py:65— src/protean/dx/pack/skills/add-event/assets/add_event_same_aggregate.py:65-108 | src/protean/dx/pack/skills/event-handler/assets/event_handler_same_aggregate.py:47-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 7) docs_src/guides/domain-behavior/006.py:77— docs_src/guides/domain-behavior/006.py:77-84 | docs_src/guides/domain-behavior/007.py:76-83 | docs_src/guides/domain-behavior/008.py:76-83 | src/protean/dx/pack/skills/domain-service/assets/domain_service_callable.py:90-97 | src/protean/dx/pack/skills/domain-service/assets/domain_service_class_methods.py:84-91 | src/protean/dx/pack/skills/domain-service/assets/domain_service_instance_methods.py:87-94 | src/protean/dx/pack/skills/domain-service/assets/domain_service_with_invariants.py:87-94 — before extracting anything, compare `docs_src/guides/domain-behavior/006.py` and `docs_src/guides/domain-behavior/007.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) docs_src/guides/domain-behavior/006.py:96— docs_src/guides/domain-behavior/006.py:96-102 | docs_src/guides/domain-behavior/007.py:95-101 | src/protean/dx/pack/skills/domain-service/assets/domain_service_callable.py:127-133 | src/protean/dx/pack/skills/domain-service/assets/domain_service_with_invariants.py:166-172 — before extracting anything, compare `docs_src/guides/domain-behavior/006.py` and `docs_src/guides/domain-behavior/007.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 5) src/protean/port/event_store.py:831— src/protean/port/event_store.py:831-839 | src/protean/port/event_store.py:843-851 | src/protean/port/event_store.py:855-863 | src/protean/server/observatory/routes/timeline.py:149-157 | src/protean/server/observatory/routes/timeline.py:727-735 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 4) src/protean/utils/checkpoint_trace.py:100— src/protean/utils/checkpoint_trace.py:100-116 | src/protean/utils/occ_trace.py:106-122 | src/protean/utils/outbox_trace.py:99-114 | src/protean/utils/recovery_trace.py:103-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (18–24 lines × 2) src/protean/cli/test.py:297— src/protean/cli/test.py:297-314 | src/protean/cli/test.py:422-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/protean/cli/test.py:422` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/protean/cli/test.py:295` calls `track_exit_code`, `run_command`, `ThreadPoolExecutor` and `src/protean/cli/test.py:422` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Type Safety — 0 typed · 15 plain JS — the untyped files are src/protean/server/observatory/static/js/causation-graph.js, src/protean/server/observatory/static/js/charts.js, src/protean/server/observatory/static/js/core.js, src/protean/server/observatory/static/js/domain-detail.js, src/protean/server/observatory/static/js/domain-flows.js, src/protean/server/observatory/static/js/domain-processes.js (+9 more).
R10 · Code Duplication· Duplicated block with local edits (198 matched lines × 2 locations) · ×1
Duplicated block with local edits (198 matched lines × 2 locations) src/protean/server/observatory/static/js/handlers.js:121— src/protean/server/observatory/static/js/handlers.js:121 · src/protean/server/observatory/static/js/processes.js:94 — the two spans are one implementation copied and then locally edited — 1433 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 (107 matched lines × 2 locations) · ×1
Duplicated block with local edits (107 matched lines × 2 locations) src/protean/server/observatory/static/js/eventstore.js:32— src/protean/server/observatory/static/js/eventstore.js:32 · src/protean/server/observatory/static/js/processes.js:40 — the two spans are one implementation copied and then locally edited — 714 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 (58 matched lines × 2 locations) · ×1
Duplicated block with local edits (58 matched lines × 2 locations) src/protean/server/observatory/static/js/handlers.js:34— src/protean/server/observatory/static/js/handlers.js:34 · src/protean/server/observatory/static/js/processes.js:30 — the two spans are one implementation copied and then locally edited — 421 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 (29 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:799— src/protean/server/observatory/static/js/causation-graph.js:799 · src/protean/server/observatory/static/js/domain-topology.js:640 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (22 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:750— src/protean/server/observatory/static/js/causation-graph.js:750 · src/protean/server/observatory/static/js/domain-topology.js:586 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (19 lines × 2 locations) src/protean/server/observatory/static/js/charts.js:84— src/protean/server/observatory/static/js/charts.js:84 · src/protean/server/observatory/static/js/charts.js:189 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (18 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:645— src/protean/server/observatory/static/js/causation-graph.js:645 · src/protean/server/observatory/static/js/domain-topology.js:530 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (15 matched lines × 2 locations) · ×1
Duplicated block with local edits (15 matched lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:965— src/protean/server/observatory/static/js/causation-graph.js:965 · src/protean/server/observatory/static/js/timeline.js:953 — the two spans are one implementation copied and then locally edited — 95 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 (14 lines × 2 locations) src/protean/server/observatory/static/js/causation-graph.js:93— src/protean/server/observatory/static/js/causation-graph.js:93 · src/protean/server/observatory/static/js/domain-topology.js:119 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (13 lines × 3 locations) src/protean/server/observatory/static/js/eventstore.js:60— src/protean/server/observatory/static/js/eventstore.js:60 · src/protean/server/observatory/static/js/handlers.js:121 · src/protean/server/observatory/static/js/processes.js:94 — 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.
Duplicated block (13 lines × 2 locations) src/protean/server/observatory/static/js/messages.js:51— src/protean/server/observatory/static/js/messages.js:51 · src/protean/server/observatory/static/js/messages.js:68 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 4 locations) src/protean/server/observatory/static/js/causation-graph.js:690— src/protean/server/observatory/static/js/causation-graph.js:690 · src/protean/server/observatory/static/js/causation-graph.js:703 · src/protean/server/observatory/static/js/causation-graph.js:718 · src/protean/server/observatory/static/js/domain-topology.js:560 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (9 lines × 3 locations) src/protean/server/observatory/static/js/domain-detail.js:192— src/protean/server/observatory/static/js/domain-detail.js:192 · src/protean/server/observatory/static/js/domain-detail.js:214 · src/protean/server/observatory/static/js/domain-detail.js:319 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 3 locations) src/protean/server/observatory/static/js/eventstore.js:101— src/protean/server/observatory/static/js/eventstore.js:101 · src/protean/server/observatory/static/js/handlers.js:188 · src/protean/server/observatory/static/js/processes.js:147 — 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.
Duplicated block (8 lines × 4 locations) src/protean/server/observatory/static/js/handlers.js:62— src/protean/server/observatory/static/js/handlers.js:62 · src/protean/server/observatory/static/js/handlers.js:70 · src/protean/server/observatory/static/js/processes.js:59 · src/protean/server/observatory/static/js/processes.js:67 — the 4 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (7 lines × 4 locations) src/protean/server/observatory/static/js/causation-graph.js:678— src/protean/server/observatory/static/js/causation-graph.js:678 · src/protean/server/observatory/static/js/causation-graph.js:689 · src/protean/server/observatory/static/js/causation-graph.js:702 · src/protean/server/observatory/static/js/causation-graph.js:717 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 2 locations) src/protean/server/observatory/static/js/domain-flows.js:519— src/protean/server/observatory/static/js/domain-flows.js:519 · src/protean/server/observatory/static/js/timeline.js:262 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (7 lines × 3 locations) src/protean/server/observatory/static/js/timeline.js:692— src/protean/server/observatory/static/js/timeline.js:692 · src/protean/server/observatory/static/js/timeline.js:708 · src/protean/server/observatory/static/js/timeline.js:770 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (5 lines × 2 locations) src/protean/server/observatory/static/js/eventstore.js:27— src/protean/server/observatory/static/js/eventstore.js:27 · src/protean/server/observatory/static/js/handlers.js:40 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function (anonymous) (cyclomatic 31, cognitive 26) src/protean/server/observatory/static/js/handlers.js:56— (anonymous) has cyclomatic complexity 31 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 29, cognitive 24) src/protean/server/observatory/static/js/processes.js:49— (anonymous) has cyclomatic complexity 29 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 _renderCausationTree (cyclomatic 27, cognitive 25) src/protean/server/observatory/static/js/timeline.js:502— _renderCausationTree has cyclomatic complexity 27 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 _showEventDetail (cyclomatic 26, cognitive 29) src/protean/server/observatory/static/js/timeline.js:830— _showEventDetail has cyclomatic complexity 26 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 24, cognitive 21) src/protean/server/observatory/static/js/core.js:396— (anonymous) has cyclomatic complexity 24 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _readURL (cyclomatic 23, cognitive 27) src/protean/server/observatory/static/js/timeline.js:986— _readURL has cyclomatic complexity 23 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 showTraceDetail (cyclomatic 23, cognitive 16) src/protean/server/observatory/static/js/messages.js:290— showTraceDetail has cyclomatic complexity 23 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _switchCausationView (cyclomatic 21, cognitive 31) src/protean/server/observatory/static/js/timeline.js:450— _switchCausationView has cyclomatic complexity 21 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 searchTraces (cyclomatic 21, cognitive 19) src/protean/server/observatory/static/js/timeline.js:200— searchTraces has cyclomatic complexity 21 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 _fetchLatestEvent (cyclomatic 18, cognitive 24) src/protean/server/observatory/static/js/timeline.js:1320— _fetchLatestEvent has cyclomatic complexity 18 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 _showCorrelationView (cyclomatic 18, cognitive 21) src/protean/server/observatory/static/js/timeline.js:337— _showCorrelationView has cyclomatic complexity 18 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 _showAggregateView (cyclomatic 18, cognitive 21) src/protean/server/observatory/static/js/timeline.js:596— _showAggregateView has cyclomatic complexity 18 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 17, cognitive 15) src/protean/server/observatory/static/js/processes.js:108— (anonymous) has cyclomatic complexity 17 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 updateHealthBanner (cyclomatic 16, cognitive 23) src/protean/server/observatory/static/js/overview.js:311— updateHealthBanner has cyclomatic complexity 16 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 fetchEvents (cyclomatic 16, cognitive 20) src/protean/server/observatory/static/js/timeline.js:118— fetchEvents has cyclomatic complexity 16 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 _bindEvents (cyclomatic 16, cognitive 15) src/protean/server/observatory/static/js/timeline.js:1081— _bindEvents has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 _updateCorrelationDisplay (cyclomatic 15, cognitive 24) src/protean/server/observatory/static/js/timeline.js:400— _updateCorrelationDisplay has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 _renderAggregateTimeline (cyclomatic 15, cognitive 24) src/protean/server/observatory/static/js/timeline.js:645— _renderAggregateTimeline has cyclomatic complexity 15 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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 _transferCollapseState (cyclomatic 15, cognitive 20) src/protean/server/observatory/static/js/causation-graph.js:1112— _transferCollapseState has cyclomatic complexity 15 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 15, cognitive 14) src/protean/server/observatory/static/js/handlers.js:135— (anonymous) has cyclomatic complexity 15 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs 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.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 1 of 352 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 and example/demo trees and test files identified by path convention, largest first; 352 of the 529 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: src/protean/utils/inflection.py. 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 SAST — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 20543 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 security response headers detected src/protean/template/domain_template/nginx.conf:10— No Content-Security-Policy / X-Frame-Options / X-Content-Type-Options configuration found — defense in depth, even when a reverse proxy could set them. This is reported because `nginx.conf` is committed to this repository and declares the server that serves it, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.)
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.
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 01a0c52b-65b9-77e8-be56-5f6e37734985 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 43 · Warnings: 759 · Recommendations: 6 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 21-09-2026 @ 18:12 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.