Module new_code
Expand description
new-code gate scope — the born/touched partition of the active working set
that the [new_code] two-band gate evaluates.
This module is the impure half (fact-store + repo access) of the gate; the
pure comparison against the configured thresholds lives in
crate::quality_gates::evaluate_new_code_rows, mirroring the
analysis→rows→evaluator split every other gate uses.
§The partition
Over a rolling window of window_days anchored to the repo’s most recent
commit date (reproducible on archived repos, matching every other windowed
analysis):
- Born in window — a live-at-HEAD source file whose first commit lands inside the window. Its HEAD code-health score is carried for the born band.
- Touched (not born) in window — a live-at-HEAD source file whose most
recent commit lands inside the window but whose first commit predates it.
Its net health movement over the window is computed by the shared
window-start scan (
effort_exposure::window_net_movement), the same machinery the improving-churn effort exemption uses — no second scan. - Everything else (untouched legacy, non-source, files deleted before HEAD) is out of scope.
§Shallow history
When no commit predates the window (effort_exposure::window_start_rev
returns None), the whole repository fits inside the window: there is no
legacy tail to contrast the working set against, so the partition is
meaningless. run_new_code_scope reports this via
NewCodeScope::window_start_present = false, and the gate surfaces skip
with a disclosure rather than flag every file as born.
Structs§
- NewCode
Scope - The born/touched partition of the working set for one
[new_code]window.
Functions§
- run_
new_ code_ scope - Compute the
NewCodeScopeforwindow_daysagainst the fact store.