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

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

torque/forge:torque/12962-red-after-landing-test-budget-raised-tes → main 1 commit fork 1 thread · 1 unresolved

  • Merged. torque/12962-red-after-landing-test-budget-raised-tes was merged into main as 4aa74cb.

Review

Sign in to review this change.
6 files changed +46 −23
src/kernel/budgets.ts +6 −8
@@ -9,15 +9,13 @@ export const BUDGETS = {
99 * A check run, in ms. Set from measurement, not from the 15 min the plan
1010 * wants: this repository's own gate takes 18–25 min alone and 45 min
1111 * 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.
1917 */
20 gate: 90 * 60_000,
18 gate: 60 * 60_000,
2119 /**
2220 * A verification of the default branch, in ms: the full gate run one file
2321 * 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
103103 expect(card({ gate: 60 * MIN, verify: 60 * MIN, review: BUDGETS.review })).toBe(true);
104104 });
105105
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
116106 test("the check limit stays at 60 min or lower; the whole-suite measuring run has its own (#12949)", () => {
117107 expect(BUDGETS.gate).toBeLessThanOrEqual(60 * MIN);
118108 expect(BUDGETS.verify).toBeGreaterThan(BUDGETS.gate);
test/check-budget.test.ts +1 −1
@@ -40,7 +40,7 @@ afterAll(async () => {
4040
4141 test("the summary names the thing, the time and the limit", () => {
4242 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",
4444 );
4545 });
4646
test/landsim.test.ts +9
@@ -45,6 +45,7 @@ import {
4545 type Violation,
4646 type World,
4747 ruleAfterCheck,
48 limitRaisedUnderCheck,
4849 } from "./support/landsim.ts";
4950
5051 /**
@@ -126,6 +127,14 @@ describe("the landing simulator", () => {
126127 expect([...out.refusals.keys()]).toContain("land: check_stale");
127128 }, 60_000);
128129
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
129138 // #12104: when two changes add lines at the same place, a kept fork's landing keeps both sides.
130139 test(
131140 "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 {
16231623 return { seed: 12656, files, pulls, steps, requireChecks: false };
16241624 }
16251625
1626 /**
1627 * #12962: two pulls, each green alone, landed a minute apart and disagreed. One raised

The path says src/budgets.ts; the real file is src/kernel/budgets.ts. Use the real path in the comment and the files map.

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
16261652 function pairScript(
16271653 seed: number,
16281654 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
469469 const v = vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy, now });
470470 const lane = v.degraded.find((d) => d.cause === "queue:check");
471471 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\)\.$/,
473473 );
474474 expect(v.todo).toContain(lane!.sentence);
475475 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
500500 { pull: 4700, since: iso(2) },
501501 ];
502502 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).",
504504 );
505505 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).",
507507 );
508508 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.",
510510 );
511511 expect(laneSentence(4, oldest, [], 3, now)).toBe(
512512 "4 checks wait for 3 slots, none busy; the oldest since 01:04; nothing runs.",

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs