pub struct BaseRate {
pub merges: usize,
pub reverted: usize,
pub commits: usize,
pub revert_commits: usize,
pub window: usize,
}Expand description
Base rate over a labelled history.
Fields§
§merges: usizeMerges examined.
reverted: usizeMerges reverted within the window.
commits: usizeCommits in the history that was scanned, for context: a rate over 40 merges and a rate over 40,000 are not the same evidence.
revert_commits: usizeCommits that revert anything, anywhere in the scanned history.
This is the corpus-suitability signal, and measuring git/git is what showed it was needed: 15,579 merges, 46 revert commits in the whole first-parent history, giving a labelled rate of 0.001. That is not “git’s merges are 99.9% safe” — it is a project that drops bad topics from an integration branch before they reach the mainline instead of reverting them. The proxy measures revert culture, and where there is none it reads as safety.
A corpus with near-zero reverts cannot supply a base rate at all.
Check this before believing Self::rate.
window: usizeThe window the labelling used, in commits.
Implementations§
Source§impl BaseRate
impl BaseRate
Sourcepub fn rate(&self) -> f64
pub fn rate(&self) -> f64
Reverted merges as a fraction of merges, in 0.0..=1.0.
A lower bound on the true bad-merge rate, for the reasons in
the module docs. A history with no merges scores 0.0 rather than
dividing by zero — check Self::merges before believing it.
Sourcepub fn corpus_is_suitable(&self) -> bool
pub fn corpus_is_suitable(&self) -> bool
Whether the corpus reverts often enough for Self::rate to mean
anything, at a deliberately low bar: at least one revert commit
per 200 scanned commits.
The threshold is a judgement, not a measurement, and it is set
where it is because git/git sits an order of magnitude below it
(46 reverts in 24,234 first-parent commits) while a
merge-queue-driven project sits above. A false here means “find
another corpus”, never “this project’s merges are safe”.