Skip to content

Authored-complexity debt: decompose 322 functions with >10 source-level decisions (a3) #61

Description

@orenlab

Summary

The new source-level cyclomatic complexity metric (authored-decision count, replacing the Y9 CFG metric) surfaced genuine complexity the old metric under-reported. This is measured structural debt for targeted decomposition after v2.1.0a2 — not a calibration defect and not waived.

The measured distribution (source-decision authored complexity)

Threshold Count
> 10 authored decisions 322 functions
> 20 57 functions
max 98 (_normalize_metrics_families)

For contrast, the retired Y9 CFG metric reported max 34 / 146 above 10 / 5 above 20 on the same tree — it never counted comprehension loops, BoolOp short-circuit boundaries, or ternaries, which the source-decision metric legitimately does.

Why this is debt, not a metric bug

The counter passed a full audit: a from-scratch recount over all 5,412 functions gives 0 mismatches after one fixed defect (lambda-body decisions were wrongly attributed to the enclosing unit). _normalize_metrics_families at 98 is a genuine ~1,000-line switchboard (42 comprehensions, 18 BoolOps, 3 ternaries). The number is honest.

The a2 health scale was recalibrated against the new metric's own distribution via a pinned measurement procedure (the interpretation scale, not the code, was the unit-mismatch); fail_health was left unchanged. This issue tracks the remaining real work: decomposing the flagged functions.

Scope for a3

  • Target the >20 tier first (57 functions), then the >10 tier.
  • Progress is measured by the trajectory of this distribution (counts >10/>20/>30, max, percentiles — snapshot recorded in-repo as the baseline), not by "feels cleaner".
  • Each decomposition ships red-first with mutation evidence, per the standing testing law.

Labels: debt, a3, complexity.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions