Public: anyone can read this; the crew can change it.
Red after landing: test/budget-raised.test.ts fails on main: two pulls landed a minute apart and disagree about the check limit #12963
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/12962-red-after-landing-test-budget-raised-tes → main 1 commit fork 1 thread · 1 unresolved
6 files
changed +46
−23
src/kernel/budgets.ts +6 −8
| @@ -9,15 +9,13 @@ export const BUDGETS = { | ||
| 9 | 9 | * A check run, in ms. Set from measurement, not from the 15 min the plan |
| 10 | 10 | * wants: this repository's own gate takes 18–25 min alone and 45 min |
| 11 | 11 | * beside another check, so 15 would fail every check it has. Lower it |
| 12 | * when the gate is sharded under it. Raised from 60 to 90 min on 2026-11-15 | |
| 13 | * (#12947): a gate beside other work took the whole 60, twice, and the kill | |
| 14 | * is history under a raised limit (`limitSinceRaised`). 90 is a ceiling, not | |
| 15 | * a target: #12949 finds what made the gate slow (with #1242, the time per | |
| 16 | * test and per file), and the limit goes back to 60 or lower when a gate | |
| 17 | * beside other work finishes under it. There is no fast-tier budget until a | |
| 18 | * fast tier exists to measure. | |
| 12 | * when the gate is sharded under it. It was raised to 90 min for a day | |
| 13 | * (#12947) on a misreading: the twice-killed run was the scheduled | |
| 14 | * whole-suite measuring run (`env verify`), not a pull's check. That run has | |
| 15 | * its own limit, `verify`, so the check limit stays at 60 or lower (#12949, | |
| 16 | * #12962). There is no fast-tier budget until a fast tier exists to measure. | |
| 19 | 17 | */ |
| 20 | gate: 90 * 60_000, | |
| 18 | gate: 60 * 60_000, | |
| 21 | 19 | /** |
| 22 | 20 | * A verification of the default branch, in ms: the full gate run one file |
| 23 | 21 | * to a process, at the lowest priority, beside whatever else the lane |
test/budget-raised.test.ts −10
| @@ -103,16 +103,6 @@ test("vitals: a verification killed at the old limit is no card; under limits th | ||
| 103 | 103 | expect(card({ gate: 60 * MIN, verify: 60 * MIN, review: BUDGETS.review })).toBe(true); |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | test("a gate killed at the old 60 min limit is history under the live limit (#12947)", () => { | |
| 107 | const killed = { | |
| 108 | kind: "check", | |
| 109 | env: "preview", | |
| 110 | summary: "budget: a full gate took 60 min, limit 60", | |
| 111 | }; | |
| 112 | expect(BUDGETS.gate).toBeGreaterThan(60 * 60_000); | |
| 113 | expect(limitSinceRaised(killed)).toBe(true); | |
| 114 | }); | |
| 115 | ||
| 116 | 106 | test("the check limit stays at 60 min or lower; the whole-suite measuring run has its own (#12949)", () => { |
| 117 | 107 | expect(BUDGETS.gate).toBeLessThanOrEqual(60 * MIN); |
| 118 | 108 | expect(BUDGETS.verify).toBeGreaterThan(BUDGETS.gate); |
test/check-budget.test.ts +1 −1
| @@ -40,7 +40,7 @@ afterAll(async () => { | ||
| 40 | 40 | |
| 41 | 41 | test("the summary names the thing, the time and the limit", () => { |
| 42 | 42 | expect(budgetSummary("a full gate", 18 * 60_000, BUDGETS.gate)).toBe( |
| 43 | "budget: a full gate took 18 min, limit 90", | |
| 43 | "budget: a full gate took 18 min, limit 60", | |
| 44 | 44 | ); |
| 45 | 45 | }); |
| 46 | 46 |
test/landsim.test.ts +9
| @@ -45,6 +45,7 @@ import { | ||
| 45 | 45 | type Violation, |
| 46 | 46 | type World, |
| 47 | 47 | ruleAfterCheck, |
| 48 | limitRaisedUnderCheck, | |
| 48 | 49 | } from "./support/landsim.ts"; |
| 49 | 50 | |
| 50 | 51 | /** |
| @@ -126,6 +127,14 @@ describe("the landing simulator", () => { | ||
| 126 | 127 | expect([...out.refusals.keys()]).toContain("land: check_stale"); |
| 127 | 128 | }, 60_000); |
| 128 | 129 | |
| 130 | // #12962: two pulls green apart, landed a minute apart; the second's green is of the older base. | |
| 131 | test("a pull checked before another landed is not landed on it (#12962)", async () => { | |
| 132 | const out = await runScenario(world, limitRaisedUnderCheck()); | |
| 133 | expect(out.violations.map((v) => `${v.cls}: ${v.message}`)).toEqual([]); | |
| 134 | expect(out.landed).toBe(1); | |
| 135 | expect([...out.refusals.keys()]).toContain("land: check_stale"); | |
| 136 | }, 60_000); | |
| 137 | ||
| 129 | 138 | // #12104: when two changes add lines at the same place, a kept fork's landing keeps both sides. |
| 130 | 139 | test( |
| 131 | 140 | "two fork pulls that add lines at the end of one file both land, both sides present (#12104)", |
test/support/landsim.ts +26
| @@ -1623,6 +1623,32 @@ export function ruleAfterCheck(): Scenario { | ||
| 1623 | 1623 | return { seed: 12656, files, pulls, steps, requireChecks: false }; |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | /** | |
| 1627 | * #12962: two pulls, each green alone, landed a minute apart and disagreed. One raised | |
| 1628 | * `gate` in src/budgets.ts (and the tests that read it); the other, checked against the | |
| 1629 | * old base, added the test that the limit stays at 60 or lower. The files differ, so the | |
| 1630 | * merge is clean; only the check of the newer base can see it. A green of the older base | |
| 1631 | * must not land on a main that moved under it. | |
| 1632 | */ | |
| 1633 | export function limitRaisedUnderCheck(): Scenario { | |
| 1634 | const files = { "src/budgets.ts": "export const gate = 60;\n", "test/limit.test.ts": "// limit is 60\n" }; | |
| 1635 | const pulls: PullSpec[] = [ | |
| 1636 | { id: 1, who: "dave", fork: false, point: 0, edits: [{ k: "write", file: "src/budgets.ts", content: "export const gate = 90;\n" }, { k: "write", file: "test/limit.test.ts", content: "// limit is 90\n" }] }, | |
| 1637 | { id: 2, who: "carol", fork: false, point: 0, edits: [{ k: "write", file: "test/budget-raised.test.ts", content: "// gate stays at 60 or lower\n" }] }, | |
| 1638 | ]; | |
| 1639 | const steps: Step[] = [ | |
| 1640 | { op: "open", p: 1 }, | |
| 1641 | { op: "open", p: 2 }, | |
| 1642 | { op: "check", p: 1 }, | |
| 1643 | { op: "check", p: 2 }, | |
| 1644 | { op: "approve", p: 1 }, | |
| 1645 | { op: "approve", p: 2 }, | |
| 1646 | { op: "land", p: 1, how: "squash" }, | |
| 1647 | { op: "land", p: 2, how: "squash" }, | |
| 1648 | ]; | |
| 1649 | return { seed: 12962, files, pulls, steps, requireChecks: false }; | |
| 1650 | } | |
| 1651 | ||
| 1626 | 1652 | function pairScript( |
| 1627 | 1653 | seed: number, |
| 1628 | 1654 | files: Record<string, string>, |
test/vitals.test.ts +4 −4
| @@ -469,7 +469,7 @@ test("a lane older than its budget is degraded with its cause; a silent run is s | ||
| 469 | 469 | const v = vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy, now }); |
| 470 | 470 | const lane = v.degraded.find((d) => d.cause === "queue:check"); |
| 471 | 471 | expect(lane?.sentence).toMatch( |
| 472 | /^3 checks wait behind one lane; the oldest since \d\d:\d\d; the lane runs a check for 31 min \(limit 90\)\.$/, | |
| 472 | /^3 checks wait behind one lane; the oldest since \d\d:\d\d; the lane runs a check for 31 min \(limit 60\)\.$/, | |
| 473 | 473 | ); |
| 474 | 474 | expect(v.todo).toContain(lane!.sentence); |
| 475 | 475 | expect(v.ok).toBe(true); |
| @@ -500,13 +500,13 @@ test("laneSentence says one lane for one slot and names the slots in force for s | ||
| 500 | 500 | { pull: 4700, since: iso(2) }, |
| 501 | 501 | ]; |
| 502 | 502 | expect(laneSentence(3, oldest, [runs[0]!], 1, now)).toBe( |
| 503 | "3 checks wait behind one lane; the oldest since 01:04; the lane runs #4656 for 5 min (limit 90).", | |
| 503 | "3 checks wait behind one lane; the oldest since 01:04; the lane runs #4656 for 5 min (limit 60).", | |
| 504 | 504 | ); |
| 505 | 505 | expect(laneSentence(11, oldest, runs, 2, now)).toBe( |
| 506 | "11 checks wait for 2 slots, all busy; the oldest since 01:04; the longest running is #4656 at 5 min (limit 90).", | |
| 506 | "11 checks wait for 2 slots, all busy; the oldest since 01:04; the longest running is #4656 at 5 min (limit 60).", | |
| 507 | 507 | ); |
| 508 | 508 | expect(laneSentence(1, oldest, [runs[1]!], 7, now, 2)).toBe( |
| 509 | "1 check waits for 7 slots, 1 busy; the oldest since 01:04; the longest running is #4700 at 2 min (limit 90); 2 more held by a red main.", | |
| 509 | "1 check waits for 7 slots, 1 busy; the oldest since 01:04; the longest running is #4700 at 2 min (limit 60); 2 more held by a red main.", | |
| 510 | 510 | ); |
| 511 | 511 | expect(laneSentence(4, oldest, [], 3, now)).toBe( |
| 512 | 512 | "4 checks wait for 3 slots, none busy; the oldest since 01:04; nothing runs.", |
new above
offline
The path says
src/budgets.ts; the real file issrc/kernel/budgets.ts. Use the real path in the comment and the files map.