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 #5131
scout/forge:scout/5111-when-checks-wait-behind-one-lane-the-que → main 2 commits fork
3 files
changed +19
−8
src/kernel/vitals.ts +6 −4
| @@ -31,7 +31,7 @@ import { proofNeed } from "../release/prove.ts"; | ||
| 31 | 31 | import { rollbackNeed } from "../release/launch.ts"; |
| 32 | 32 | import { behindStanding } from "../release/behind.ts"; |
| 33 | 33 | import { newestDrills } from "../core/domain_drills.ts"; |
| 34 | import { capacityValue } from "../core/capacity.ts"; | |
| 34 | import { CAPACITY, capacityValue } from "../core/capacity.ts"; | |
| 35 | 35 | import { DOMAINS } from "./domains.ts"; |
| 36 | 36 | import { domainDrillNeeds } from "./domain_drill.ts"; |
| 37 | 37 | import { freeChecks, heldChecks, redHref, redSentence } from "../checks/red_main.ts"; |
| @@ -255,7 +255,8 @@ export interface LaneRun { | ||
| 255 | 255 | /** |
| 256 | 256 | * The lane's one sentence, with its cause: how many wait, since when, and |
| 257 | 257 | * 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 | |
| 259 | 260 | * wait for 7 slots, all busy; the oldest since 01:04; the longest running is |
| 260 | 261 | * #4656 at 5 min (limit 60)". |
| 261 | 262 | */ |
| @@ -279,8 +280,9 @@ export function laneSentence( | ||
| 279 | 280 | const name = (r: LaneRun) => (r.pull === null ? "a check" : `#${r.pull}`); |
| 280 | 281 | if (slots <= 1) { |
| 281 | 282 | 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}`; | |
| 284 | 286 | } |
| 285 | 287 | const busy = |
| 286 | 288 | 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", () => { | ||
| 227 | 227 | old([...held, asked].map((r) => r.id)); |
| 228 | 228 | const lane = read().find((d) => d.cause === "queue:check"); |
| 229 | 229 | 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."); | |
| 231 | 231 | }); |
| 232 | 232 | |
| 233 | 233 | test("old held checks and a fresh free one: the lane is not blamed", () => { |
test/vitals.test.ts +12 −3
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | /** The forge's standing: its shape, the admin gate, and what it flags. */ |
| 2 | 2 | |
| 3 | import { CAPACITY } from "../src/core/capacity.ts"; | |
| 3 | 4 | import { laneSentence } from "../src/kernel/vitals.ts"; |
| 4 | 5 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 5 | 6 | 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 | ||
| 241 | 242 | // Waiting past thirty minutes names the cause, not only the symptom. |
| 242 | 243 | const later = vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy, now: now + 3_600_000 }); |
| 243 | 244 | 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\.$/); | |
| 245 | 246 | expect(cause).not.toContain("Lane:"); |
| 246 | 247 | }); |
| 247 | 248 | |
| @@ -445,7 +446,7 @@ test("a lane older than its budget is degraded with its cause; a silent run is s | ||
| 445 | 446 | const v = vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy, now }); |
| 446 | 447 | const lane = v.degraded.find((d) => d.cause === "queue:check"); |
| 447 | 448 | 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\.$/, | |
| 449 | 450 | ); |
| 450 | 451 | expect(v.ok).toBe(false); |
| 451 | 452 | // 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 | ||
| 466 | 467 | expect(vitals({ db: app.db, signals: app.signals, dataDir, disk: roomy }).needs).toEqual([]); |
| 467 | 468 | }); |
| 468 | 469 | |
| 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 | ||
| 469 | 478 | test("laneSentence says one lane for one slot and names the slots in force for several", () => { |
| 470 | 479 | const now = Date.parse("2026-01-01T02:00:00Z"); |
| 471 | 480 | 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 | ||
| 475 | 484 | { pull: 4700, since: iso(2) }, |
| 476 | 485 | ]; |
| 477 | 486 | 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.", | |
| 479 | 488 | ); |
| 480 | 489 | expect(laneSentence(11, oldest, runs, 2, now)).toBe( |
| 481 | 490 | "11 checks wait for 2 slots, all busy; the oldest since 01:04; the longest running is #4656 at 5 min (limit 60).", |
new above
offline