Module architecture_trend
Expand description
architecture-trend analysis — structural decay over the commit
sequence.
The HEAD-only architecture metrics (architecture-metrics,
dependency-cycles) answer “how tangled is the code now”. This
answers the more useful question — “is it getting worse, and when
did it start?” — by recomputing the structural-health metrics at a
series of historical revisions and emitting one row per sample point.
§How it samples history
Up to SAMPLE_POINTS commits are picked evenly across the full
date-ordered history (the newest is always included). At each sampled
rev the import graph is rebuilt from scratch in memory — no
persistent table is touched:
- files live at that rev come from the
changes/commitshistory (latest change at-or-before the rev’s date that isn’t a deletion — the same date-anchored livenesscode-ageuses), - each live source blob is read at that rev (
Repo::read_blob_at), parsed for imports, and resolved in memory with the same per-language resolvers the HEAD scan uses, - the resolved edges feed the shared SCC + reachability kernel.
§Cost
This is the one analysis that re-parses source at many revisions, so
it is markedly heavier than the SQL-only analyses (roughly
SAMPLE_POINTS × a HEAD import scan). It is computed on demand and
never cached.
Structs§
- Architecture
Trend Row - One sampled point on the architecture-decay trend.
Constants§
- SAMPLE_
POINTS - Maximum number of historical sample points on the trend.
Functions§
- run_
architecture_ trend - Run the
architecture-trendanalysis. Returns one row per sampled rev, oldest first. Needs repository access (it reads historical blobs), unlike the SQL-only analyses.