Available on crate feature
vcs-git only.Expand description
Historical metric trend: the change-history (VCS) metrics computed at several points in time, so a consumer can see whether a file’s risk is improving or degrading rather than only its risk now (issue #333).
This module is backend-agnostic. It owns the time-point math
(timestamps), the parameter validation (validate_points), the
assembled Trend container, and the improving/regressing
delta summary. The actual repeated history walks
live in the backend (git::build_trend), which resolves the
repository tip at each point in time and folds the per-snapshot
Stats into a Trend via Trend::from_snapshots.
Structs§
- Trend
- The change-history metrics of a set of files sampled at several points in time (issue #333).
- Trend
Delta - One file’s risk-score movement across the trend (see
Trend::deltas). - Trend
Deltas - The improving / regressing split returned by
Trend::deltas.
Constants§
- MAX_
TREND_ POINTS - Maximum number of time points. Each point is a full history walk, so the count is capped to bound the worst-case runtime on deep histories (issue #333’s “very deep histories: cap point count”). 120 points is a decade of monthly snapshots — far beyond any practical trend chart.
- MIN_
TREND_ POINTS - Minimum number of time points. A trend needs at least two snapshots to
express a direction; a single point is just
bca vcs --as-of. - TREND_
SCHEMA_ VERSION - Output-shape version for the trend document. Bumped on any
shape-breaking change to the serialized time series so consumers can
detect an incompatible schema (separate from the per-file
VCS_SCHEMA_VERSION, which versions each point’s metric block).
Functions§
- timestamps
- The
pointsUnix-second timestamps a trend samples, evenly spaced acrossspan_secsand ending atend(the most recent point is exactlyend, the oldest isend - span_secs). Returned oldest-first. - validate_
points - Validate a requested point count against the
MIN_TREND_POINTS/MAX_TREND_POINTSbounds. The single source of truth shared by every front end so the accepted range cannot drift between them.