Skip to main content

Module unstable_interface

Module unstable_interface 

Expand description

unstable-interface analysis — heavily-depended-on files that change often AND drag their dependents along when they do.

The “Unstable Interface” of Kazman & Cai’s DV8 hotspot patterns (Mo, Cai, Kazman, Xiao 2015 Hotspot Patterns): an anchor file that (i) many files import (high afferent coupling / fan-in), (ii) changes frequently (it is itself unstable), and (iii) co-changes with the very files that depend on it — so its instability propagates outward. A stable, widely-imported interface is healthy; an unstable one is a structural debt amplifier.

§Fusion — three facts CodeLore already holds

  • Structural fan-in: distinct importers per file, from the imports table (the afferent-coupling term god_classes already computes).
  • Instability: per-file revision count, from revisions::run_revisions.
  • Propagation: importers that are also Fisher-significant co-change partners, from coupling::run_coupling.

§Calibration

A file qualifies when it has at least DEFAULT_MIN_FAN_IN importers, has been revised at least opts.min_revs times, and co-changes with at least one of its importers (the DV8 definition requires the instability to actually reach a dependent). The composite instability_score = revisions × coupled_dependents ranks files where high own-churn meets wide dependent propagation. Thresholds follow the import resolver’s language coverage, exactly as god_classes fan-in does.

Structs§

UnstableInterfaceRow
One unstable-interface finding.

Constants§

DEFAULT_MIN_FAN_IN
Minimum distinct importers for a file to count as an “interface”. A file imported by one or two others is just a dependency, not an interface whose instability is worth surfacing.

Functions§

run_unstable_interface
Run the unstable-interface analysis. Returns interfaces ranked by composite instability score (highest first).