Skip to main content

Module change_set

Module change_set 

Expand description

Delta-scoped change-set engine: what a set of working-tree edits does to the repository’s health before they are committed.

The engine never re-implements a health formula. It re-parses only the changed files (via the pure buffer-level complexity extractor), substitutes their rows into a temporary complexity_metrics_projected table, and runs the existing run_code_health_scoped twice — once against today’s HEAD tables (the baseline) and once against the substituted table (the projection). Everything the substitution does not touch stays frozen at HEAD facts automatically:

  • History terms (churn n_cn, author fragmentation n_au, and shotgun-surgery via coupling centrality) read the untouched changes / commits tables, so they are identical in both runs.
  • Cross-file structure — god-class fan-in/out reads the untouched imports table (imports_source stays "imports"). The DRY biomarker is dual-sourced: the baseline counts clones from the HEAD-faithful clones table (ingested from HEAD blobs) while the projection fingerprints the working tree, so a duplicate introduced only in the working tree raises the projection’s DRY count without touching the baseline — a real negative delta and a clone-introduction finding, not a cancel to zero. On a clean tree the two clone sources agree, keeping the delta exactly 0.0.
  • Calibrated weights, clamps, and the no-DRY scale divisor are inherited byte-for-byte because both runs go through the one real scoring engine.

This is why a byte-identical file re-parses to byte-identical rows, which rank identically, which yields a delta of exactly 0.0.

§Median population

Both scoped runs use min_revs = 1 and no row cap (the change_context precedent), so HealthProjection’s medians are taken over every scoreable file, not diff’s min-revs-5 hotspot set. The delta-of-medians semantics is preserved; only the population differs, and it is documented here so the gate’s delta_code_health_min reading is understood as all-scoreable-files rather than the hotspot subset.

Modules§

cache
Content-keyed JSON sidecar for ChangeSetReport, mirroring the enrichment narrative cache’s shape: plain-hex key, per-repo directory under the shared cache root, best-effort read/write, corrupt = miss.

Structs§

ChangeSetReport
The full measured picture of what the current working-tree edits do to the repository: enumerated changes, projected health deltas, cycle-membership delta, absent historical co-change partners, and the advisory findings derived from all of them.
FileDelta
One changed file’s HEAD-vs-projected code-health scores, or an honest reason a score is absent.
Finding
One advisory observation about the change set. Findings carry no verdict; gate verdicts come from evaluating thresholds against the report.
HealthProjection
The projected-health half of a change-set report.

Functions§

build_change_set_report
Build the full change-set report for the current working tree vs HEAD.
project_health
Project the code-health effect of changes on the working tree vs HEAD.