@biffo/cli 0.276.4 → 0.276.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1008,6 +1008,12 @@ export function mergeContention(prs, runsByBranch) {
|
|
|
1008
1008
|
let raced = 0
|
|
1009
1009
|
let measured = 0
|
|
1010
1010
|
let stale = 0
|
|
1011
|
+
// The two ways a PR counted in `measured` can never reach `raced` (#1419).
|
|
1012
|
+
// Both continues below fire *after* `measured += 1`, so `racedShare` (which
|
|
1013
|
+
// divides by `measured`) is deflated by exactly this population — see the
|
|
1014
|
+
// field comments on the return value for what that does and does not mean.
|
|
1015
|
+
let noGreenRun = 0
|
|
1016
|
+
let mergedBeforeGreen = 0
|
|
1011
1017
|
|
|
1012
1018
|
// Merge times bucketed by base branch. Keyed by base ref because a repo's
|
|
1013
1019
|
// `dev` and `staging` are separate races — a merge to `staging` does not make
|
|
@@ -1036,12 +1042,18 @@ export function mergeContention(prs, runsByBranch) {
|
|
|
1036
1042
|
.filter((run) => run.conclusion === 'success')
|
|
1037
1043
|
.map((run) => Date.parse(/** @type {string} */ (run.updated_at ?? run.created_at)))
|
|
1038
1044
|
.sort((a, b) => a - b)
|
|
1039
|
-
if (greens.length === 0)
|
|
1045
|
+
if (greens.length === 0) {
|
|
1046
|
+
noGreenRun += 1
|
|
1047
|
+
continue
|
|
1048
|
+
}
|
|
1040
1049
|
|
|
1041
1050
|
const lag = (Date.parse(/** @type {string} */ (pr.mergedAt)) - greens[0]) / 60000
|
|
1042
1051
|
// A negative lag means the merge landed before any run completed — the PR
|
|
1043
1052
|
// was merged without waiting, which is not contention.
|
|
1044
|
-
if (lag <= 0)
|
|
1053
|
+
if (lag <= 0) {
|
|
1054
|
+
mergedBeforeGreen += 1
|
|
1055
|
+
continue
|
|
1056
|
+
}
|
|
1045
1057
|
greenToMerge.push(lag)
|
|
1046
1058
|
if (lag > RACE_THRESHOLD_MINUTES && churn.revisions > 0) raced += 1
|
|
1047
1059
|
|
|
@@ -1088,7 +1100,35 @@ export function mergeContention(prs, runsByBranch) {
|
|
|
1088
1100
|
// The cleanest single indicator — green for longer than the threshold *and*
|
|
1089
1101
|
// forced to repush. tabsii-crm scores 0% here and biffo-template 13.9%,
|
|
1090
1102
|
// which is the difference a busy shared integration branch makes.
|
|
1103
|
+
//
|
|
1104
|
+
// **Deflated by construction (#1419).** `measured` counts every merged PR
|
|
1105
|
+
// with known churn, including two kinds that are structurally incapable of
|
|
1106
|
+
// ever being `raced`: no run ever went green (`racedExcludedNoGreenRun`),
|
|
1107
|
+
// or the merge landed before any run completed — "merged without waiting",
|
|
1108
|
+
// see the comment above (`racedExcludedMergedBeforeGreen`). Both continue
|
|
1109
|
+
// past `measured += 1` before `raced` can fire. This key is kept computing
|
|
1110
|
+
// exactly what it always has, so historical figures stay comparable — but
|
|
1111
|
+
// never read it without `racedExcludedNoGreenRun` /
|
|
1112
|
+
// `racedExcludedMergedBeforeGreen` / `racedEligible` beside it. Read
|
|
1113
|
+
// `racedShareEligible` for the share over the population that could
|
|
1114
|
+
// actually have raced.
|
|
1091
1115
|
racedShare: rate(raced, measured),
|
|
1116
|
+
// The exclusions themselves, so the gap in `racedShare` above is visible
|
|
1117
|
+
// rather than silently folded into a smaller number (the estate's recorded
|
|
1118
|
+
// failure shape: `gates.share` read 80% locally-catchable when 12 of 17
|
|
1119
|
+
// inputs were excluded unread and the honest figure was 47.1%).
|
|
1120
|
+
racedExcludedNoGreenRun: noGreenRun,
|
|
1121
|
+
racedExcludedMergedBeforeGreen: mergedBeforeGreen,
|
|
1122
|
+
// The population that survived both exclusions — identical to
|
|
1123
|
+
// `prsWithGreen` below, named again here so `racedShareEligible`'s
|
|
1124
|
+
// denominator never has to be inferred from a differently-named field.
|
|
1125
|
+
racedEligible: greenToMerge.length,
|
|
1126
|
+
// `racedShare` recomputed over `racedEligible` instead of `measured` — the
|
|
1127
|
+
// corrected reading. Only PRs that *could* have raced are in this
|
|
1128
|
+
// denominator, so it is not deflated by merge-without-waiting or
|
|
1129
|
+
// never-went-green PRs. Compare the two: a wide gap means this repo's
|
|
1130
|
+
// `racedShare` history has been understating contention.
|
|
1131
|
+
racedShareEligible: rate(raced, greenToMerge.length),
|
|
1092
1132
|
// H3's counter-metric (#977): the share of merges whose base moved between
|
|
1093
1133
|
// first green and merge, so the landed combination was never tested. Reads
|
|
1094
1134
|
// as exposure, not damage — see the note above before quoting it.
|