Public: anyone can read this; the crew can change it.

When checks wait behind one lane, the queue:check card names the setting that would widen it #5121

Parked opened this
Closed without merging

scout/forge:scout/5111-when-checks-wait-behind-one-lane-the-que → main 1 commit fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +19 −8
src/kernel/vitals.ts +6 −4
@@ -31,7 +31,7 @@ import { proofNeed } from "../release/prove.ts";
3131 import { rollbackNeed } from "../release/launch.ts";
3232 import { behindStanding } from "../release/behind.ts";
3333 import { newestDrills } from "../core/domain_drills.ts";
34 import { capacityValue } from "../core/capacity.ts";
34 import { CAPACITY, capacityValue } from "../core/capacity.ts";
3535 import { DOMAINS } from "./domains.ts";
3636 import { domainDrillNeeds } from "./domain_drill.ts";
3737 import { freeChecks, heldChecks, redHref, redSentence } from "../checks/red_main.ts";
@@ -255,7 +255,8 @@ export interface LaneRun {
255255 /**
256256 * The lane's one sentence, with its cause: how many wait, since when, and
257257 * what runs. With one slot: "22 checks wait behind one lane; the oldest since
258 * 04:13; the lane runs #1212 for 31 min (limit 60)". With several: "11 checks
258 * 04:13; the lane runs #1212 for 31 min (limit 60). Checks at once is 1 — raise
259 * it in Settings → Capacity." (the setting's label, so the card names the fix). With several: "11 checks
259260 * wait for 7 slots, all busy; the oldest since 01:04; the longest running is
260261 * #4656 at 5 min (limit 60)".
261262 */
@@ -279,8 +280,9 @@ export function laneSentence(
279280 const name = (r: LaneRun) => (r.pull === null ? "a check" : `#${r.pull}`);
280281 if (slots <= 1) {
281282 const head = `${queued} ${plural} behind one lane; the oldest since ${since}`;
282 if (longest === null) return `${head}; the lane runs nothing${more}.`;
283 return `${head}; the lane runs ${name(longest)} for ${minutes(longest)} min (limit ${BUDGETS.gate / 60_000})${more}.`;
283 const widen = ` ${CAPACITY["checks.concurrency"].label} is 1 — raise it in Settings → Capacity.`;
284 if (longest === null) return `${head}; the lane runs nothing${more}.${widen}`;
285 return `${head}; the lane runs ${name(longest)} for ${minutes(longest)} min (limit ${BUDGETS.gate / 60_000})${more}.${widen}`;
284286 }
285287 const busy =
286288 runs.length === 0 ? "none busy" : runs.length >= slots ? "all busy" : `${runs.length} busy`;
test/red-main.test.ts +1 −1
@@ -227,7 +227,7 @@ describe("the lane sentence and a red main", () => {
227227 old([...held, asked].map((r) => r.id));
228228 const lane = read().find((d) => d.cause === "queue:check");
229229 expect(lane?.sentence).toStartWith("1 check waits behind one lane;");
230 expect(lane?.sentence).toEndWith("; 3 more held by a red main.");
230 expect(lane?.sentence).toEndWith("; 3 more held by a red main. Checks at once is 1 — raise it in Settings → Capacity.");
231231 });
232232
233233 test("old held checks and a fresh free one: the lane is not blamed", () => {
test/vitals.test.ts +12 −3
@@ -1,5 +1,6 @@
11 /** The forge's standing: its shape, the admin gate, and what it flags. */
22
3 import { CAPACITY } from "../src/core/capacity.ts";
34 import { laneSentence } from "../src/kernel/vitals.ts";
45 import { afterAll, beforeAll, expect, test } from "bun:test";
56 import { mkdtemp, rm } from "node:fs/promises";
@@ -241,7 +242,7 @@ test("the lane: depth, the running check and its age, the median of the last fin
241242 // Waiting past thirty minutes names the cause, not only the symptom.
242243 const later = vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy, now: now + 3_600_000 });
243244 const cause = later.needs.find((n) => n.includes("one lane"));
244 expect(cause).toMatch(/^6 checks wait behind one lane; the oldest since \d\d:\d\d; the lane runs nothing\.$/);
245 expect(cause).toMatch(/^6 checks wait behind one lane; the oldest since \d\d:\d\d; the lane runs nothing\. Checks at once is 1 — raise it in Settings → Capacity\.$/);
245246 expect(cause).not.toContain("Lane:");
246247 });
247248
@@ -445,7 +446,7 @@ test("a lane older than its budget is degraded with its cause; a silent run is s
445446 const v = vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy, now });
446447 const lane = v.degraded.find((d) => d.cause === "queue:check");
447448 expect(lane?.sentence).toMatch(
448 /^3 checks wait behind one lane; the oldest since \d\d:\d\d; the lane runs a check for 31 min \(limit 60\)\.$/,
449 /^3 checks wait behind one lane; the oldest since \d\d:\d\d; the lane runs a check for 31 min \(limit 60\)\. Checks at once is 1 — raise it in Settings → Capacity\.$/,
449450 );
450451 expect(v.ok).toBe(false);
451452 // Five minutes in, the oldest is under its budget: nothing to say.
@@ -466,6 +467,14 @@ test("only the disk need sees the disk: a 5% reading raises it, and nothing else
466467 expect(vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy }).needs).toEqual([]);
467468 });
468469
470 test("laneSentence names the setting that widens a single lane, and only then", () => {
471 const now = Date.parse("2026-01-01T02:00:00Z");
472 const oldest = "2026-01-01T01:04:00Z";
473 const label = CAPACITY["checks.concurrency"].label;
474 expect(laneSentence(3, oldest, [], 1, now)).toEndWith(` ${label} is 1 — raise it in Settings → Capacity.`);
475 expect(laneSentence(3, oldest, [], 3, now)).not.toContain("Settings");
476 });
477
469478 test("laneSentence says one lane for one slot and names the slots in force for several", () => {
470479 const now = Date.parse("2026-01-01T02:00:00Z");
471480 const oldest = "2026-01-01T01:04:00Z";
@@ -475,7 +484,7 @@ test("laneSentence says one lane for one slot and names the slots in force for s
475484 { pull: 4700, since: iso(2) },
476485 ];
477486 expect(laneSentence(3, oldest, [runs[0]!], 1, now)).toBe(
478 "3 checks wait behind one lane; the oldest since 01:04; the lane runs #4656 for 5 min (limit 60).",
487 "3 checks wait behind one lane; the oldest since 01:04; the lane runs #4656 for 5 min (limit 60). Checks at once is 1 — raise it in Settings → Capacity.",
479488 );
480489 expect(laneSentence(11, oldest, runs, 2, now)).toBe(
481490 "11 checks wait for 2 slots, all busy; the oldest since 01:04; the longest running is #4656 at 5 min (limit 60).",

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs