You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe("convergence sort key (lastRegatedAt, NOT GitHub updatedAt)",()=>{
88
-
it("INVARIANT arm (i): orders by lastRegatedAt ascending when present — the staler RE-GATE sorts first",()=>{
89
-
// #1 was re-gated recently but created long ago; #2 was re-gated long ago but created recently. The re-gate
90
-
// marker — not createdAt — drives the order, so #2 (stalest re-gate) comes first.
94
+
it("INVARIANT arm (i): orders by lastRegatedAt ascending when present — the staler RE-GATE sorts first (among repair-eligible candidates; a plain already-regated PR is otherwise excluded, see #never-endless-reregate)",()=>{
95
+
// Both PRs already have a regate stamp, so both need repairPriority to remain eligible at all post-#never-
96
+
// endless-reregate. #1 was re-gated recently but created long ago; #2 was re-gated long ago but created
97
+
// recently. The re-gate marker — not createdAt — drives the order, so #2 (stalest re-gate) comes first.
expect(picked.map((p)=>p.number)).toEqual([4,7,9]);// all epoch → deterministic number order
120
131
});
121
132
122
-
it("a never-regated PR (lastRegatedAt absent) outranks a just-regated one — the property that makes the sweep converge",()=>{
133
+
it("one-shot review (#never-endless-reregate): a just-regated PR is excluded outright, never merely outranked — only the never-regated PR remains",()=>{
123
134
constpulls=[
124
135
pr({
125
136
number: 1,
126
137
lastRegatedAt: minutesAgo(1),
127
138
createdAt: minutesAgo(1000),
128
-
}),// just re-gated → freshest
129
-
pr({number: 2,createdAt: minutesAgo(50)}),// never re-gated → its createdAt (50m) is staler than #1's re-gate (1m)
139
+
}),// already regated once → permanently ineligible for the sweep, regardless of staleness
140
+
pr({number: 2,createdAt: minutesAgo(50)}),// never regated → the only real candidate
expect(picked.map((p)=>p.number)).toEqual([1,2]);// #1 (oldest-created) first, unlike staleness (which has no history here either, so both modes agree in this case)
257
287
});
258
288
259
-
it("orders by re-gate staleness after the oldest-first initial drain is complete",()=>{
260
-
// #1 was re-gated most recently (10m ago) despite being the OLDEST-created PR by far; #2 was re-gated
261
-
// longer ago (100m) despite being the NEWEST-created. Once every eligible PR has a lastRegatedAt stamp,
289
+
it("orders by re-gate staleness among repair-eligible candidates once every one of them has a stamp (an ordinary already-regated PR stays excluded, see #never-endless-reregate)",()=>{
290
+
// Both PRs already have a regate stamp, so both need repairPriority to remain eligible at all. #1 was
291
+
// re-gated most recently (10m ago) despite being the OLDEST-created PR by far; #2 was re-gated longer ago
292
+
// (100m) despite being the NEWEST-created. Once every eligible (repair) PR has a lastRegatedAt stamp,
262
293
// oldest-first uses re-gate staleness so ongoing sweeps keep converging instead of pinning old PRs.
0 commit comments