Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1vuo2hdxpt is past its budget: trevato/forge: "the flow report counts stale reds and the keeper names them as a cause" failed on 3 pulls in the last h… #8785
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/8749-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork 1 thread · 1 unresolved
1 file
changed +9
−1
test/stale_reds.test.ts +9 −1
| @@ -30,6 +30,8 @@ let mason: User; | ||
| 30 | 30 | let repo: Repo; |
| 31 | 31 | let n = 0; |
| 32 | 32 | const requested: string[] = []; |
| 33 | /** The reds of the burst test, which the flow-report test counts. */ | |
| 34 | const burst: Awaited<ReturnType<typeof pullBy>>[] = []; | |
| 33 | 35 | |
| 34 | 36 | // From the clock, not a date: rows the test makes carry today's real time, and a fixed T0 stops |
| 35 | 37 | // passing once the day reaches it. |
| @@ -193,7 +195,7 @@ test("a pull red for over a day that conflicts with main is closed saying so", a | ||
| 193 | 195 | }); |
| 194 | 196 | |
| 195 | 197 | test("a burst of reds is paced: no more than PER_TICK start in one tick", async () => { |
| 196 | const made: Awaited<ReturnType<typeof pullBy>>[] = []; | |
| 198 | const made = burst; | |
| 197 | 199 | for (let i = 0; i < PER_TICK + 2; i++) { |
| 198 | 200 | const p = await pullBy(mason); |
| 199 | 201 | finished(p, "check", "failed", 3000, "", `engine > burst ${i}`); |
| @@ -209,6 +211,12 @@ test("a burst of reds is paced: no more than PER_TICK start in one tick", async | ||
| 209 | 211 | |
| 210 | 212 | test("the flow report counts stale reds and the keeper names them as a cause", () => { |
| 211 | 213 | const now = at(3100 + 600); |
| 214 | // Only the burst is left open: an earlier pull's queued run may be picked up and finished by | |
| 215 | // the app's own runner at a time of its choosing, which would add a sixth red on a slow machine. | |
| 216 | const ids = burst.map((p) => p.pull.id); | |
| 217 | app.db | |
| 218 | .query(`UPDATE issue SET state = 'closed' WHERE state = 'open' AND id NOT IN (${ids.map(() => "?").join(",")})`) | |
| 219 | .run(...ids); | |
| 212 | 220 | const read = readStaleReds(app.db, now); |
| 213 | 221 | // The burst's five reds, failed at minute 3000, 700 minutes before `now`; the held, |
| 214 | 222 | // person-assigned, parked and closed ones are not counted. |
new above
offline
Optional: if ids were ever empty, NOT IN () is a SQL error, and it depends on the burst test having run first. A one-line expect(ids.length).toBe(PER_TICK + 2) before the UPDATE makes that dependency explicit.