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

Maintenance board: each worker's findings, actions and their effect, on forge/boards and a home tile #16695

Merged opened this in answer to

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

Merged

scout/forge:scout/7561-maintenance-board-each-worker-s-findings → main 0 commits fork 5 threads · 5 unresolved

  • Merged. scout/7561-maintenance-board-each-worker-s-findings was merged into main as 6972771.

Review

Sign in to review this change.
18 files changed +733 −4
docs/features/maintenance-board.md added +26
@@ -0,0 +1,26 @@
1 ---
2 topic: When something is wrong
3 row: Maintenance board: what each worker found, did and whether it helped
4 ---
5 # Maintenance board (#7561)
6
7 `/boards/maintenance` (a starting board, a plain file in `forge/boards`, so a fresh forge has it and
8 an admin edits it like any other) opens with the pipeline's bottleneck and numbers, a lane for each
9 worker (batch doctor, flow keeper, release keeper, efficiency, performance, rules) and the findings
10 list. Charts below it: items entering each stage, red batches by reason, findings, actions, runs and
11 spend per duty (the `maintenanceRuns` source; `maintenanceProbes` gives each probe's number).
12
13 **Lane:** last run and result, runs today, findings and actions over seven days, spend today against
14 the duty's dollars a day, and a Pause or Resume button (`src/web/pages/maintenance_board.ts`). The
15 button posts to the same `/maintenance/duties/:name` as the Maintenance page, `dutyswitch` in the
16 terminal (`src/tui/screens/dutyswitch.ts`), the API and the MCP, and comes back to the board. A
17 paused duty does not run on its next tick. The batch doctor, release keeper and performance watcher
18 are not duties of the roster: their lane has no switch.
19
20 **Effect:** each finding stands on a probe (a name and a number). The duty's newest run reads it
21 again: gone and the run ok is *fixed*; the same or lower is *still there*; higher is *worse*; no
22 later run yet is *waiting* (`src/maintain/effect.ts`). The terminal's Maintenance screen
23 (`src/tui/screens/maintenance.ts`) lists the same effects.
24
25 **Home:** the Maintenance card says how many findings are open (what each duty's newest run still
26 found) and how many were fixed this week, and opens the board.
src/boards/guide.ts +3
@@ -43,6 +43,8 @@ export const GUIDE: Readonly<Record<string, Guide>> = {
4343 spawnTime: { name: "Time to a live forge", rows: "daily figures", kind: "samples", value: "value", filter: { column: "metric", op: "eq", value: "p95" } },
4444 restarts: { name: "App restarts", rows: "restarts", kind: "events" },
4545 queueVerdicts: { name: "Red merge batches", rows: "verdicts", kind: "events" },
46 maintenanceRuns: { name: "Maintenance runs", rows: "duty runs", kind: "events" },
47 maintenanceProbes: { name: "Maintenance probes", rows: "probe readings", kind: "samples", value: "number" },
4648 stages: { name: "Work by stage", rows: "items entering a stage", kind: "events" },
4749 };
4850
@@ -64,6 +66,7 @@ export const NOTES: Readonly<Record<string, string>> = {
6466
6567 /** The unit of a number column, by name; `UNIT_OF` overrides it where one name means two things. */
6668 const UNITS: Readonly<Record<string, string>> = {
69 findings: "findings", actions: "actions", dollars: "US dollars", number: "the probe's own unit",
6770 cost_usd: "US dollars", turns: "model turns", attempt: "attempts", tokens_in: "tokens", tokens_out: "tokens", wall_ms: "ms",
6871 p: "probability, 0 to 1", ms: "ms", n: "requests", step: "seconds", cpu_cores: "cores", cpu_cores_max: "cores",
6972 memory_bytes: "bytes", memory_bytes_max: "bytes", load: "runnable tasks", celsius: "°C", celsius_max: "°C",
src/boards/sources.ts +33
@@ -408,6 +408,39 @@ export const SOURCES: Readonly<Record<string, Source>> = {
408408 action: "what was done about it, in a fixed phrase",
409409 },
410410 },
411 // The maintenance duties' runs (#7561), one row per real run. The outcome's words (an error
412 // line can carry anything) and the findings' summaries are not listed: only a fixed result
413 // word and counts.
414 maintenanceRuns: {
415 table: "maintenance_run_view",
416 owner: "admin",
417 select:
418 "SELECT duty, started AS at, CASE WHEN outcome = 'ok' THEN 'ok' WHEN outcome LIKE 'budget:%' THEN 'budget' ELSE 'failed' END AS result, " +
419 "json_array_length(findings) AS findings, json_array_length(actions) AS actions, dollars, " +
420 "CAST(ROUND((julianday(finished) - julianday(started)) * 86400000) AS INTEGER) AS ms FROM maintenance_run",
421 time: "at",
422 columns: { duty: "text", at: "time", result: "text", findings: "number", actions: "number", dollars: "number", ms: "number" },
423 docs: {
424 duty: "the duty's name, a fixed word",
425 result: "ok, failed (it threw, timed out or had a finding refused) or budget (stopped by its own budget, not run)",
426 findings: "what the run found, each standing on a probe",
427 actions: "what the run did about it",
428 dollars: "what the run spent, USD, counted against the duty's budget",
429 ms: "how long the run took, ms",
430 },
431 },
432 // Each probe a maintenance run read (#7561): the number a finding stands on. The probe's name
433 // can carry a repository's name, so it is not listed; the board's findings list names it.
434 maintenanceProbes: {
435 table: "maintenance_probe",
436 owner: "admin",
437 select:
438 "SELECT m.duty AS duty, m.started AS at, json_extract(p.value, '$.kind') AS kind, json_extract(p.value, '$.number') AS number " +
439 "FROM maintenance_run m, json_each(m.probes) p WHERE json_type(p.value) = 'object' AND json_type(p.value, '$.number') IN ('integer', 'real')",
440 time: "at",
441 columns: { duty: "text", at: "time", kind: "text", number: "number" },
442 docs: { kind: "query or measurement", number: "the probe's number when the run read it" },
443 },
411444 // Items entering each stage from issue to live, one row per entry, read
412445 // from issue, run and pull as `flow/throughput.ts` reads them: an issue
413446 // opens, a builder first starts on it (a retry is not a second item), its
src/boards/starting.ts +9 −1
@@ -83,12 +83,20 @@ export const STARTING_BOARDS: Readonly<Record<string, Board>> = {
8383 panel("Decider time per hour (ms)", "line", { source: "decisions", aggregate: "avg", column: "ms", groupBy: HOUR, series: "kind" }, 2),
8484 ],
8585 },
86 // The release keeper (#7557): every release dark for 0 s is the target.
86 // The maintenance workers (#7561): the pipeline's numbers, each duty's runs, findings, actions
87 // and spend; above the panels the page draws each duty's lane, its switch and the findings list
88 // with what became of each. The release keeper (#7557): every release dark for 0 s is the target.
8789 maintenance: {
8890 title: "Maintenance",
8991 range: "30d",
9092 refresh: "1m",
9193 panels: [
94 panel("Items entering each stage", "bar", { source: "stages", aggregate: "count", groupBy: "stage" }, 2),
95 panel("Red batches by reason", "bar", { source: "queueVerdicts", aggregate: "count", groupBy: "why" }),
96 panel("Findings per day, by duty", "bar", { source: "maintenanceRuns", aggregate: "sum", column: "findings", groupBy: DAY, series: "duty" }, 2),
97 panel("Actions per day, by duty", "bar", { source: "maintenanceRuns", aggregate: "sum", column: "actions", groupBy: DAY, series: "duty" }, 2),
98 panel("Runs by duty and result", "bar", { source: "maintenanceRuns", aggregate: "count", groupBy: "duty", series: "result" }, 2),
99 panel("Spend per duty (USD)", "bar", { source: "maintenanceRuns", aggregate: "sum", column: "dollars", groupBy: "duty" }),
92100 panel("Seconds dark per release", "bar", { source: "keeperReleases", aggregate: "max", column: "seconds_dark", groupBy: "version" }, 2),
93101 panel("Worst latency per release (ms)", "bar", { source: "keeperReleases", aggregate: "max", column: "worst_ms", groupBy: "version" }, 2),
94102 panel("Releases by outcome", "bar", { source: "keeperReleases", aggregate: "count", groupBy: "stage" }),
src/flow/figures.ts +7
@@ -10,6 +10,7 @@
1010 * strip's; each lane counts its own.
1111 */
1212
13 import { readRuns, tally } from "../maintain/effect.ts";
1314 import type { Database } from "bun:sqlite";
1415 import { median } from "./pipeline.ts";
1516 import type { Kpis } from "./kpis.ts";
@@ -33,6 +34,11 @@ export interface Figures {
3334 /** From the crew's first run on an issue to its closing as done, over 7 days (`ship_time.ts`). */
3435 readonly ship: ShipTime;
3536 readonly bugs: { readonly open: number; readonly overdue: number } | null;
37 /**
38 * The maintenance workers' findings still open and those fixed in seven days
39 * (`maintain/effect.ts`).
40 */
41 readonly maintenance?: { readonly open: number; readonly fixed: number };
3642 readonly backup: { readonly at: string | null; readonly state: "green" | "red" | "unknown" | null; readonly note: string };
3743 }
3844
@@ -92,6 +98,7 @@ export function readFigures(db: Database, now: Date, kpis: Kpis): Figures {
9298 spend: { todayUsd: kpis.spend.todayUsd, ceilingUsd: kpis.spend.ceilingUsd, days: spend, totalUsd: spend.reduce((a, b) => a + b, 0) },
9399 checks: { medianMs: kpis.medianCheckMs, days: keys.map((k) => median(took.get(k) ?? [])) },
94100 ship: readShipTime(db, now),
101 maintenance: tally(readRuns(db), now),
95102 bugs: kpis.bugs === undefined ? null : { open: kpis.bugs.open, overdue: kpis.bugs.overdue },
96103 backup: { at: kpis.backupAt, state: backupState, note: kpis.backup?.note ?? "" },
97104 };
src/maintain/effect.ts added +130
@@ -0,0 +1,130 @@
1 /**
2 * What a maintenance finding came to (#7561): a later real run of the same duty reads the same
3 * probe again, and the board says "fixed", "still there", "worse", or "waiting" when none has.
4 * Plain data in, plain data out: `effectsOf` takes rows, `readRuns` reads them.
5 */
6
7 import type { Database } from "bun:sqlite";
8
9 export const EFFECTS = ["fixed", "still there", "worse", "waiting"] as const;
10 export type Effect = (typeof EFFECTS)[number];
11
12 /** One run as the rule reads it: its probes by name, and whether it came out ok. */
13 export interface RunFacts {
14 readonly id: number;
15 readonly duty: string;
16 readonly started: string;
17 readonly ok: boolean;
18 readonly findings: number;
19 readonly actions: readonly string[];
20 readonly probes: readonly { readonly what: string; readonly number: number }[];
21 readonly issueId: string | null;
22 }
23
24 export interface FindingEffect {
25 readonly run: number;
26 readonly duty: string;
27 readonly at: string;
28 readonly probe: string;
29 readonly number: number;
30 readonly action: string;
31 readonly issueId: string | null;
32 readonly effect: Effect;
33 /** When the probe was read again (ISO); null while waiting. */
34 readonly checkedAt: string | null;
35 }
36
37 /**
38 * One effect per finding, newest first. A finding is followed to the duty's newest run: the probe
39 * gone there (and that run ok) is fixed, a higher number is worse, the same or lower still there.
40 * A probe a duty read again on the very next run is the same finding, listed once, from its first
41 * run.
42 */
43 export function effectsOf(runs: readonly RunFacts[]): FindingEffect[] {
44 const by = new Map<string, RunFacts[]>();
45 for (const r of runs) by.set(r.duty, [...(by.get(r.duty) ?? []), r]);
46 const out: FindingEffect[] = [];
47 for (const list of by.values()) {
48 list.sort((a, b) => a.id - b.id);
49 const last = list.length - 1;
50 list.forEach((r, i) => {
51 const before = list[i - 1];
52 const newest = i < last ? list[last] : undefined;
53 r.probes.forEach((p, k) => {
54 if (before?.probes.some((q) => q.what === p.what)) return;
55 const again = newest?.probes.find((q) => q.what === p.what);
56 let effect: Effect = "waiting";
57 if (newest !== undefined) {
58 if (again !== undefined) effect = again.number > p.number ? "worse" : "still there";
59 else if (newest.ok) effect = "fixed";
60 }
61 out.push({
62 run: r.id, duty: r.duty, at: r.started, probe: p.what, number: p.number,
63 action: r.actions[k] ?? r.actions[0] ?? "", issueId: r.issueId,
64 effect, checkedAt: effect === "waiting" || newest === undefined ? null : newest.started,
65 });
66 });
67 });
68 }
69 return out.sort((a, b) => b.run - a.run);
70 }
71
72 /** Runs read at most: the newest, so the read walks the primary key and stops. */
73 export const RUNS_READ = 400;
74
75 interface Row { id: number; duty: string; started: string; outcome: string; findings: string; actions: string; probes: string; issue_id: string | null }
76
77 const list = (text: string): unknown[] => {
78 try {
79 const v: unknown = JSON.parse(text);
80 return Array.isArray(v) ? v : [];
81 } catch {
82 return [];
83 }
84 };
85
86 /**
87 * The newest real runs as facts; a budget stop is not a run, a probe that is no number is no probe.
88 */
89 export function readRuns(db: Database): RunFacts[] {
90 const rows = db
91 .query(
92 `SELECT id, duty, started, outcome, findings, actions, probes, issue_id FROM maintenance_run
93 WHERE outcome NOT LIKE 'budget:%' ORDER BY id DESC LIMIT ?1`,
94 )
95 .all(RUNS_READ) as Row[];
96 return rows.map((r) => ({
97 id: r.id, duty: r.duty, started: r.started, ok: r.outcome === "ok",
98 findings: list(r.findings).length,
99 actions: list(r.actions).filter((a): a is string => typeof a === "string"),
100 probes: list(r.probes).flatMap((p) => {
101 const o = p as { what?: unknown; number?: unknown } | null;
102 return o !== null && typeof o === "object" && typeof o.what === "string" && typeof o.number === "number" && Number.isFinite(o.number)
103 ? [{ what: o.what, number: o.number }]
104 : [];
105 }),
106 issueId: r.issue_id,
107 }));
108 }
109
110 const WEEK_MS = 7 * 24 * 3_600_000;
111
112 /**
113 * The home tile's two numbers, from runs read once (`readRuns`): findings open (what each duty's
114 * newest run still found) and findings fixed in the last seven days (read again, and gone).
115 */
116 export function tally(runs: readonly RunFacts[], now: Date): { open: number; fixed: number } {
117 const newest = new Map<string, RunFacts>();
118 for (const r of runs) if (!newest.has(r.duty)) newest.set(r.duty, r);
119 let open = 0;
120 for (const r of newest.values()) open += r.probes.length;
121 const since = now.getTime() - WEEK_MS;
122 const fixed = effectsOf(runs).filter((e) => e.effect === "fixed" && e.checkedAt !== null && Date.parse(e.checkedAt) >= since).length;
123 return { open, fixed };
124 }
125
126 /**
127 * One finding's effect as the terminal says it:
128 * `efficiency-watcher: npm bytes per hour, 900: fixed`.
129 */
130 export const effectWords = (e: FindingEffect): string => `${e.duty}: ${e.probe}, ${String(e.number)}: ${e.effect}`;
src/maintain/lanes.ts added +76
@@ -0,0 +1,76 @@
1 /**
2 * The maintenance board's lanes (#7561): one per worker, with its last run and result, its runs
3 * today, what it found and did in a week, and what it spent against its budget. Plain rows; the
4 * page draws them. The three workers that are not duties of the roster (the batch doctor, the
5 * release keeper, the performance watcher) run with the pipeline and have no switch.
6 */
7
8 import type { Database } from "bun:sqlite";
9 import { budgetsOf, dayBounds } from "./budget.ts";
10 import { isPaused } from "./pause.ts";
11 import { duties } from "./registry.ts";
12 import { WEEK_MS } from "./week_line.ts";
13
14 /**
15 * The workers, in the order the board shows them: the name each writes in `maintenance_run.duty`.
16 */
17 export const LANES = [
18 { duty: "batch-doctor", title: "Batch doctor" },
19 { duty: "flow-keeper", title: "Flow keeper" },
20 { duty: "release-keeper", title: "Release keeper" },
21 { duty: "efficiency-watcher", title: "Efficiency" },
22 { duty: "performance-watcher", title: "Performance" },
23 { duty: "rule-watcher", title: "Rules" },
24 ] as const;
25
26 export interface Lane {
27 readonly duty: string;
28 readonly title: string;
29 /** ISO start of the newest real run; null when it never ran. */
30 readonly last: string | null;
31 /** "ok", "failed" or "paused"; null when it never ran. */
32 readonly result: "ok" | "failed" | "paused" | null;
33 readonly runsToday: number;
34 /** Over seven days. */
35 readonly findings: number;
36 readonly actions: number;
37 readonly spentToday: number;
38 /** Dollars a day it may spend; null for a worker with no budget row. */
39 readonly budget: number | null;
40 readonly paused: boolean;
41 /** Whether the roster has a switch for it. */
42 readonly switchable: boolean;
43 }
44
45 interface Row { duty: string; runs: number; found: number; acted: number; spent: number; last: string | null; outcome: string | null }
46
47 export function readLanes(db: Database, now: Date): Lane[] {
48 const names = JSON.stringify(LANES.map((l) => l.duty));
49 const { from, to } = dayBounds(now);
50 const week = new Date(now.getTime() - WEEK_MS).toISOString();
51 const rows = db
52 .query(
53 `SELECT d.value AS duty,
54 (SELECT COUNT(*) FROM maintenance_run m WHERE m.duty = d.value AND m.started >= ?2 AND m.started < ?3 AND m.outcome NOT LIKE 'budget:%') AS runs,
55 (SELECT COALESCE(SUM(json_array_length(m.findings)), 0) FROM maintenance_run m WHERE m.duty = d.value AND m.started >= ?4 AND m.outcome NOT LIKE 'budget:%') AS found,
56 (SELECT COALESCE(SUM(json_array_length(m.actions)), 0) FROM maintenance_run m WHERE m.duty = d.value AND m.started >= ?4 AND m.outcome NOT LIKE 'budget:%') AS acted,
57 (SELECT COALESCE(SUM(m.dollars), 0) FROM maintenance_run m WHERE m.duty = d.value AND m.started >= ?2 AND m.started < ?3 AND m.outcome NOT LIKE 'budget:%') AS spent,
58 (SELECT m.started FROM maintenance_run m WHERE m.duty = d.value AND m.outcome NOT LIKE 'budget:%' ORDER BY m.id DESC LIMIT 1) AS last,
59 (SELECT m.outcome FROM maintenance_run m WHERE m.duty = d.value AND m.outcome NOT LIKE 'budget:%' ORDER BY m.id DESC LIMIT 1) AS outcome
60 FROM json_each(?1) d`,
61 )
62 .all(names, from, to, week) as Row[];
63 const by = new Map(rows.map((r) => [r.duty, r]));
64 const budgets = budgetsOf(db, duties);
65 return LANES.map((l) => {
66 const r = by.get(l.duty);
67 const switchable = duties.some((d) => d.name === l.duty);
68 const paused = switchable && isPaused(db, l.duty);
69 const result = paused ? "paused" : r?.outcome == null ? null : r.outcome === "ok" ? "ok" : "failed";
70 return {
71 ...l,
72 last: r?.last ?? null, result, runsToday: r?.runs ?? 0, findings: r?.found ?? 0, actions: r?.acted ?? 0,
73 spentToday: r?.spent ?? 0, budget: budgets.get(l.duty)?.dollarsPerDay ?? null, paused, switchable,
74 };
75 });
76 }
src/tui/screens/maintenance.ts +6 −2
@@ -7,6 +7,7 @@
77 * refused by the service. Enter, Esc or q closes it.
88 */
99
10 import { effectWords, effectsOf, readRuns } from "../../maintain/effect.ts";
1011 import { diskLine, diskSentence } from "../../maintenance/disk_line.ts";
1112 import { readDisk } from "../../kernel/disk_reading.ts";
1213 import { filedText } from "../../maintenance/filed.ts";
@@ -69,13 +70,16 @@ export function maintenanceLines(f: Session, standby?: Standby, level?: Level):
6970 // Findings quieted (#14557): numbered, so `b` can bring one back; when each is back.
7071 const hidden = quieted(f.app.db).flatMap((q, i) => wrap(`${String(i + 1)}. quieted until ${when(q.until)}: ${q.label}`, INNER));
7172 const hiddenText = hidden.length === 0 ? [] : ["", ...hidden];
73 // What became of each finding, as on the Maintenance board (#7561): the same probe, read again.
74 const effects = effectsOf(readRuns(f.app.db)).slice(0, 8).flatMap((e) => wrap(effectWords(e), INNER));
75 const effectText = effects.length === 0 ? [] : ["", "What became of them:", ...effects];
7276 // A paused duty waits on a person to resume it, as on the page.
7377 const paused = dutyStates(f.app.db).filter((d) => d.paused).flatMap((d) => wrap(d.says, INNER));
7478 // The data volume's free space, as on the page (#15999): amber there, so it waits on a person
7579 // here.
7680 const disk = diskLine((f.app.config.disk ?? readDisk)(f.app.config.dataDir));
7781 const diskText = disk === null ? [] : [...wrap(diskSentence(disk), INNER), ""];
78 if (level === undefined) return [...diskText, ...stalled, ...drill, ...lead, "", ...facts, ...checks, "", ...dutyText(loud), ...paused, ...quietText, ...findings, ...hiddenText];
82 if (level === undefined) return [...diskText, ...stalled, ...drill, ...lead, "", ...facts, ...checks, "", ...dutyText(loud), ...paused, ...quietText, ...findings, ...hiddenText, ...effectText];
7983 // The same split as the page, by the same rule (maintenance/level.ts): what waits on a person,
8084 // and what is only to read.
8185 const needs = stateLevel(s.phase) === "needs-you" || returnLevel(last?.healthy) === "needs-you";
@@ -83,7 +87,7 @@ export function maintenanceLines(f: Session, standby?: Standby, level?: Level):
8387 const out =
8488 level === "needs-you"
8589 ? [...(disk?.low === true ? diskText : []), ...stalled, ...drill, ...(needs ? [...lead, "", ...facts, ...checks, ""] : []), ...dutyText(overdue), ...paused]
86 : [...(disk?.low === false ? diskText : []), ...(needs ? [] : [...lead, "", ...facts, ...checks, ""]), ...dutyText(loud.filter((d) => !d.overdue)), ...quietText, ...findings, ...hiddenText];
90 : [...(disk?.low === false ? diskText : []), ...(needs ? [] : [...lead, "", ...facts, ...checks, ""]), ...dutyText(loud.filter((d) => !d.overdue)), ...quietText, ...findings, ...hiddenText, ...effectText];
8791 return out.length === 0 ? [level === "needs-you" ? "Nothing here needs you." : "Nothing here to read."] : out;
8892 }
8993
src/web/pages/boards-view.ts +2
@@ -17,6 +17,7 @@ import { liveRegionsJs } from "../client.ts";
1717 import { boardStreamJs } from "./boards-stream.ts";
1818 import { notFoundPage, signInFirst } from "../chrome.ts";
1919 import { html, when, type Html } from "../html.ts";
20 import { BOARD_SLUG, maintenanceStrip } from "./maintenance_board.ts";
2021 import { page } from "../layout.ts";
2122 import { btn, chartFrame, confirmAction, field, selectField } from "../ui.ts";
2223 import { emptyList } from "../empty_words.ts";
@@ -275,6 +276,7 @@ export async function boardShow(ctx: Ctx): Promise<Response> {
275276 <div class="hf-title"><h1>${board.title}</h1><p class="hf-live muted">${String(n)} ${n === 1 ? "chart" : "charts"} over ${RANGE_WORDS[board.range].toLowerCase()}. Times are UTC. ${board.refresh === "off" ? null : html`<span id="board-live" class="num" role="status" data-state="idle">Moves as events arrive.</span>`}</p></div>
276277 <nav class="bd-nav" aria-label="Elsewhere">${btn("All boards", { href: "/boards", variant: "ghost" })}${btn("Explore the data", { href: "/boards/data", variant: "ghost" })}</nav>
277278 </header>
279 ${slug === BOARD_SLUG ? maintenanceStrip(ctx.app.db) : null}
278280 ${panels}
279281 ${manage(slug, board, queryFields(readParams(ctx.url.searchParams)), listPins(ctx.app.db, ctx.auth.user?.id ?? ""))}
280282 </div>`,
src/web/pages/home_figures.ts +13
@@ -215,6 +215,19 @@ export function cards(f: Figures, now: number): Card[] {
215215 href: "/boards",
216216 },
217217 ]),
218 // Quiet when the workers have found and fixed nothing: the home's first view is budgeted.
219 ...(f.maintenance === undefined || f.maintenance.open + f.maintenance.fixed === 0
220 ? []
221 : [
222 {
223 label: "Maintenance",
224 value: count(f.maintenance.open),
225 unit: f.maintenance.open === 1 ? "finding open" : "findings open",
226 note: `${count(f.maintenance.fixed)} fixed this week`,
227 ...(f.maintenance.open > 0 ? { tone: "attn" as const } : {}),
228 href: "/boards/maintenance",
229 },
230 ]),
218231 {
219232 label: "Off-box backup",
220233 value: backupAge === null ? "—" : duration(backupAge),
src/web/pages/maintenance.ts +4 −1
@@ -33,6 +33,7 @@ import { isKind, quiet, quieted, quietKeys, unquiet, when, type QuietKind, type
3333 import { liveLabel } from "../../maintenance/quiet_live.ts";
3434 import { writePauseFold } from "./maintenance_pause.ts";
3535 import { budgetRows } from "./maintenance_budgets.ts";
36 import { BACK } from "./maintenance_board.ts";
3637 import { statusRow } from "./security.ts";
3738 import { diskLine } from "../../maintenance/disk_line.ts";
3839 import { readDisk } from "../../kernel/disk_reading.ts";
@@ -271,7 +272,9 @@ export async function maintenanceDuty(ctx: Ctx): Promise<Response> {
271272 const want = formField(form, "paused");
272273 if (want !== "yes" && want !== "no") return flashTo(ctx, "/maintenance", { tone: "danger", message: "paused is yes or no." });
273274 const r = switchDuty(ctx.app.db, ctx.params["name"], want === "yes", ctx.auth.user!.username);
274 return flashTo(ctx, "/maintenance", r.ok ? { message: r.says } : { tone: "danger", message: r.says });
275 // The Maintenance board's switch comes back to the board; no other place is named by a form.
276 const back = formField(form, "back") === BACK ? BACK : "/maintenance";
277 return flashTo(ctx, back, r.ok ? { message: r.says } : { tone: "danger", message: r.says });
275278 }
276279
277280 /**
src/web/pages/maintenance_board.ts added +95
@@ -0,0 +1,95 @@
1 /**
2 * What the Maintenance board draws above its charts (#7561), server-rendered: the pipeline's
3 * bottleneck and numbers, a lane per worker with its pause switch, and the findings list with what
4 * became of each one (fixed, still there, worse). Read from `maintenance_run` and the pipeline;
5 * every word is a fixed one or a number, and a name goes through `html`.
6 */
7
8 import type { Database } from "bun:sqlite";
9 import { cachedStepStats, readPipeline, statWords, verdict } from "../../flow/pipeline.ts";
10 import { effectsOf, readRuns, type FindingEffect } from "../../maintain/effect.ts";
11 import { readLanes, type Lane } from "../../maintain/lanes.ts";
12 import { ageWords } from "../../snapshot/bucket.ts";
13 import { html, type Html } from "../html.ts";
14 import { badge, btn } from "../ui.ts";
15
16 export const BOARD_SLUG = "maintenance";
17 export const BACK = `/boards/${BOARD_SLUG}`;
18 const SHOWN = 20;
19
20 const ago = (iso: string | null, now: number): string => {
21 if (iso === null) return "not yet run";
22 const t = Date.parse(iso);
23 return Number.isNaN(t) ? "not yet run" : `${ageWords(now - t)} ago`;
24 };
25
26 function top(db: Database, now: Date): Html {
27 let says = "The pipeline could not be read just now.";
28 let steps: string[] = [];
29 try {
30 says = verdict(readPipeline(db, now), now.getTime());
31 steps = cachedStepStats(db, now).map(statWords);
32 } catch {
33 // the lanes below stand without it
34 }
35 return html`<section id="maintenance-pipeline" class="mb" aria-label="The pipeline">
36 <p><strong>${says}</strong></p>
37 ${steps.map((s) => html`<p class="small muted">${s}</p>`)}
38 </section>`;
39 }
40
41 const resultBadge = (l: Lane): Html =>
42 l.result === null ? html`<span class="muted">not yet run</span>`
43 : l.result === "ok" ? badge("ok", {})
44 : badge(l.result, { tone: l.result === "failed" ? "danger" : "attn" });
45
46 function lane(l: Lane, now: number): Html {
47 const money = (n: number): string => `$${n.toFixed(2)}`;
48 return html`<tr id="lane-${l.duty}" data-duty="${l.duty}">
49 <th scope="row">${l.title}</th>
50 <td>${ago(l.last, now)} ${resultBadge(l)}</td>
51 <td class="num">${String(l.runsToday)}</td>
52 <td class="num">${String(l.findings)}</td>
53 <td class="num">${String(l.actions)}</td>
54 <td class="num">${money(l.spentToday)}${l.budget === null ? "" : ` of ${money(l.budget)}`}</td>
55 <td>${l.switchable
56 ? html`<form method="post" action="/maintenance/duties/${l.duty}" class="inline">
57 <input type="hidden" name="paused" value="${l.paused ? "no" : "yes"}"><input type="hidden" name="back" value="${BACK}">${btn(l.paused ? "Resume" : "Pause", { variant: "outline", label: `${l.paused ? "Resume" : "Pause"} ${l.title}` })}
outdated

Six identical buttons named "Pause"/"Resume" are not distinguishable by a screen reader. Add an aria-label naming the duty ("Pause Flow keeper").

58 </form>`
59 : html`<span class="muted">runs with the pipeline</span>`}</td>
60 </tr>`;
61 }
62
63 const effectBadge = (e: FindingEffect): Html =>
64 e.effect === "fixed" ? badge("fixed", {}) : e.effect === "worse" ? badge("worse", { tone: "danger" }) : e.effect === "still there" ? badge("still there", { tone: "attn" }) : html`<span class="muted">waiting</span>`;
65
66 function finding(e: FindingEffect, now: number): Html {
67 return html`<tr data-effect="${e.effect}">
68 <td>${ago(e.at, now)}</td><td>${e.duty}</td><td>${e.probe}</td><td class="num">${String(e.number)}</td>
69 <td>${e.action}</td>
70 <td>${effectBadge(e)}</td>
outdated

A link reading only "open" has no context for a screen reader; give it an aria-label naming the finding. Better, remove this column until a duty sets issue_id.

71 </tr>`;
72 }
73
74 /**
75 * The strip: pipeline, lanes, findings. With no run at all, one plain sentence in
76 * place of the last two.
77 */
78 export function maintenanceStrip(db: Database, now = new Date()): Html {
79 const lanes = readLanes(db, now);
80 const found = effectsOf(readRuns(db));
81 const at = now.getTime();
82 const ran = lanes.some((l) => l.last !== null) || found.length > 0;
83 const shown = found.slice(0, SHOWN);
84 return html`<div id="maintenance-strip">
85 ${top(db, now)}
86 ${ran
87 ? html`<div class="table-scroll" role="region" tabindex="0" aria-label="Maintenance duties"><table id="maintenance-lanes" class="table mb" aria-label="Maintenance duties"><thead><tr><th>Duty</th><th>Last run</th><th>Runs today</th><th>Findings, 7 d</th><th>Actions, 7 d</th><th>Spend today</th><th>Switch</th></tr></thead>
88 <tbody>${lanes.map((l) => lane(l, at))}</tbody></table></div>
89 ${shown.length === 0
90 ? html`<p id="maintenance-findings" class="muted mb">No finding to follow.</p>`
91 : html`<div class="table-scroll" role="region" tabindex="0" aria-label="Maintenance findings"><table id="maintenance-findings" class="table mb" aria-label="Maintenance findings"><thead><tr><th>Found</th><th>Duty</th><th>Probe</th><th>Number</th><th>Action</th><th>Effect</th></tr></thead>
92 <tbody>${shown.map((e) => finding(e, at))}</tbody></table></div>`}`
93 : html`<p id="maintenance-empty" class="muted mb">Nothing to do yet: no worker has run.</p>`}
94 </div>`;
95 }
test/helpers/maintain-board.ts added +44
@@ -0,0 +1,44 @@
1 /**
2 * A forge with an admin and a server, and `maintenance_run` rows to seed, for the Maintenance
3 * board's tests (#7561).
4 */
5 import { mkdtempSync } from "node:fs";
6 import { tmpdir } from "node:os";
7 import { join } from "node:path";
8 import { createApp, type App } from "../../src/app.ts";
9 import { createToken } from "../../src/core/tokens.ts";
10 import { createUser } from "../../src/core/users.ts";
11 import { serve, type Servers } from "../../src/http/server.ts";
12
13 export interface Board { app: App; servers: Servers; token: string; root: string }
14
15 export async function boardForge(): Promise<Board> {
16 const root = mkdtempSync(join(tmpdir(), "forge-maintain-board-"));
17 const app = createApp({ dataDir: root, port: 0 });
18 const servers = await serve(app);
19 const made = await createUser(app.db, { origin: "seed", trusted: true, username: "alice", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: true });
20 if (!made.ok) throw new Error("no admin");
21 return { app, servers, token: createToken(app.db, made.value.id, "t", "admin").token, root };
22 }
23
24 export interface Seed {
25 duty: string;
26 at: string;
27 outcome?: string;
28 probes?: { what: string; number: number }[];
29 actions?: string[];
30 dollars?: number;
31 }
32
33 export function seedRun(app: App, s: Seed): void {
34 const probes = (s.probes ?? []).map((p) => ({ kind: "measurement", what: p.what, number: p.number, at: s.at }));
35 app.db
36 .query("INSERT INTO maintenance_run (duty, started, finished, findings, actions, probes, outcome, dollars) VALUES (?1, ?2, ?2, ?3, ?4, ?5, ?6, ?7)")
37 .run(s.duty, s.at, JSON.stringify(probes.map((p) => p.what)), JSON.stringify(s.actions ?? []), JSON.stringify(probes), s.outcome ?? "ok", s.dollars ?? 0);
38 }
39
40 export const board = (b: Board, path = "/boards/maintenance") =>
41 fetch(b.servers.url + path, { headers: { authorization: `Bearer ${b.token}` } });
42
43 /** One run of every worker in the board's lanes, each with a finding. */
44 export const DUTIES = ["batch-doctor", "flow-keeper", "release-keeper", "efficiency-watcher", "performance-watcher", "rule-watcher"] as const;
test/maintain-board-effect.test.ts added +53
@@ -0,0 +1,53 @@
1 /**
2 * A finding's effect goes from "still there" to "fixed" when the probe passes in a seeded replay
3 * (#7561).
4 */
5 import { afterAll, beforeAll, expect, test } from "bun:test";
6 import { rmSync } from "node:fs";
7 import { offerStartingBoards } from "../src/actions/boards.ts";
8 import { effectsOf, readRuns, tally } from "../src/maintain/effect.ts";
9 import { board, boardForge, seedRun, type Board } from "./helpers/maintain-board.ts";
10
11 let b: Board;
12 const NOW = new Date();
13 const at = (h: number) => new Date(NOW.getTime() - h * 3_600_000).toISOString();
14 const NPM = "npm bytes per hour";
15 beforeAll(async () => {
16 b = await boardForge();
17 await offerStartingBoards(b.app);
18 });
19 afterAll(() => {
20 b.servers.stop();
21 b.app.close();
22 rmSync(b.root, { recursive: true, force: true });
23 });
24
25 const effect = () => effectsOf(readRuns(b.app.db)).find((e) => e.probe === NPM)?.effect;
26 const run = (hoursAgo: number, number: number | null) =>
27 seedRun(b.app, { duty: "efficiency-watcher", at: at(hoursAgo), probes: number === null ? [] : [{ what: NPM, number }], actions: ["held the install"] });
28
29 test("a replay: waiting, then still there, then worse, then fixed", async () => {
30 run(6, 900);
31 expect(effect()).toBe("waiting");
32 run(5, 900);
33 expect(effect()).toBe("still there");
34 expect(effectsOf(readRuns(b.app.db)).filter((e) => e.probe === NPM).length).toBe(1);
35 expect(await (await board(b)).text()).toContain('data-effect="still there"');
36 run(4, 1200);
37 expect(effect()).toBe("worse");
38 run(3, null);
39 expect(effect()).toBe("fixed");
40 const text = await (await board(b)).text();
41 expect(text).toContain('data-effect="fixed"');
42 expect(text).not.toContain('data-effect="still there"');
43 expect(tally(readRuns(b.app.db), NOW)).toEqual({ open: 0, fixed: 1 });
44 });
45
46 test("a run that failed does not say fixed, and a lower number is still there", () => {
47 const row = (id: number, ok: boolean, n: number | null) => ({
48 id, duty: "d", started: `2026-11-20T0${id}:00:00.000Z`, ok, findings: n === null ? 0 : 1, actions: [] as string[],
49 probes: n === null ? [] : [{ what: "p", number: n }], issueId: null,
50 });
51 expect(effectsOf([row(1, true, 5), row(2, false, null)])[0]!.effect).toBe("waiting");
52 expect(effectsOf([row(1, true, 5), row(2, true, 3)])[0]!.effect).toBe("still there");
53 });
test/maintain-board-empty.test.ts added +31
@@ -0,0 +1,31 @@
1 /**
2 * The Maintenance board exists on a fresh forge and, with no run, says "nothing to do yet" (#7561).
3 */
4 import { afterAll, beforeAll, expect, test } from "bun:test";
5 import { rmSync } from "node:fs";
6 import { offerStartingBoards } from "../src/actions/boards.ts";
7 import { readBoard } from "../src/boards/store.ts";
8 import { board, boardForge, type Board } from "./helpers/maintain-board.ts";
9
10 let b: Board;
11 beforeAll(async () => {
12 b = await boardForge();
13 await offerStartingBoards(b.app);
14 });
15 afterAll(() => {
16 b.servers.stop();
17 b.app.close();
18 rmSync(b.root, { recursive: true, force: true });
19 });
20
21 test("a fresh forge offers a board named Maintenance", async () => {
22 expect((await readBoard(b.app.reposRoot, "maintenance"))?.title).toBe("Maintenance");
23 });
24
25 test("with no run the board answers, says nothing to do yet, and the tile counts zero", async () => {
26 const res = await board(b);
27 expect(res.status).toBe(200);
28 const text = await res.text();
29 expect(text).toContain("Nothing to do yet");
30 expect(text).not.toContain('id="maintenance-lanes"');
31 });
test/maintain-board-pause.test.ts added +79
@@ -0,0 +1,79 @@
1 /**
2 * Pausing a duty from the Maintenance board stops its next run and the board shows it paused
3 * (#7561).
4 */
5 import { afterAll, beforeAll, expect, test } from "bun:test";
6 import { rmSync } from "node:fs";
7 import { offerStartingBoards } from "../src/actions/boards.ts";
8 import type { Duty } from "../src/maintain/duty.ts";
9 import { isPaused } from "../src/maintain/pause.ts";
10 import { startMaintain } from "../src/maintain/runner.ts";
11 import { board, boardForge, seedRun, type Board } from "./helpers/maintain-board.ts";
12 import { quietLogs } from "./helpers/globals.ts";
13
14 quietLogs();
15 let b: Board;
16 beforeAll(async () => {
17 b = await boardForge();
18 await offerStartingBoards(b.app);
19 seedRun(b.app, { duty: "flow-keeper", at: new Date().toISOString() });
20 });
21 afterAll(() => {
22 b.servers.stop();
23 b.app.close();
24 rmSync(b.root, { recursive: true, force: true });
25 });
26
27 const login = async (): Promise<string> => {
28 const res = await fetch(`${b.servers.url}/signin`, {
29 method: "POST", redirect: "manual",
30 headers: { "content-type": "application/x-www-form-urlencoded", origin: b.servers.url },
31 body: new URLSearchParams({ username: "alice", password: "a-good-passphrase" }),
32 });
33 return (res.headers.get("set-cookie") ?? "").split(";")[0] ?? "";
34 };
35 const post = (cookie: string, fields: Record<string, string>, origin = b.servers.url) =>
36 fetch(`${b.servers.url}/maintenance/duties/flow-keeper`, {
37 method: "POST", redirect: "manual",
38 headers: { "content-type": "application/x-www-form-urlencoded", origin, cookie },
39 body: new URLSearchParams(fields),
40 });
41
42 test("the board's switch pauses the duty, comes back to the board, and shows paused", async () => {
43 const cookie = await login();
44 const res = await post(cookie, { paused: "yes", back: "/boards/maintenance" });
45 expect(res.status).toBe(303);
46 expect(new URL(res.headers.get("location")!, b.servers.url).pathname).toBe("/boards/maintenance");
47 expect(isPaused(b.app.db, "flow-keeper")).toBe(true);
48 const text = await (await board(b)).text();
49 expect(text).toMatch(/id="lane-flow-keeper"[\s\S]*?paused[\s\S]*?Resume/);
50 });
51
52 test("a paused duty does not run on the next tick; resumed from the board it does", async () => {
53 let calls = 0;
54 const stub: Duty = { name: "flow-keeper", intervalMs: 1, budget: { runsPerDay: 1e5, dollarsPerDay: 1e4, reason: "test" }, run: () => { calls++; return { findings: [], actions: [] }; } };
55 const m = startMaintain(b.app, { duties: [stub], everyMs: 1e9 });
56 m.stop();
57 await m.tick(new Date(Date.now() + 60_000));
58 expect(calls).toBe(0);
59 await post(await login(), { paused: "no", back: "/boards/maintenance" });
60 await m.tick(new Date(Date.now() + 120_000));
61 expect(calls).toBe(1);
62 });
63
64 test("a cross-origin post and a back address that is not the board change nothing or go to /maintenance", async () => {
65 const cookie = await login();
66 expect((await post(cookie, { paused: "yes" }, "https://evil.example")).status).not.toBe(303);
67 expect(isPaused(b.app.db, "flow-keeper")).toBe(false);
68 const res = await post(cookie, { paused: "yes", back: "https://evil.example/" });
69 expect(new URL(res.headers.get("location")!, b.servers.url).pathname).toBe("/maintenance");
70 });
71
72 test("each switch names its duty, the tables scroll on a phone and carry a name, and no Link column", async () => {
73 const text = await (await board(b)).text();
74 expect(text).toMatch(/aria-label="(Pause|Resume) Flow keeper"/);
75 expect(text).toContain('class="table-scroll" role="region" tabindex="0" aria-label="Maintenance duties"');
76 expect(text).toContain('id="maintenance-lanes" class="table mb" aria-label="Maintenance duties"');
77 expect(text).not.toContain("<th>Link</th>");
78 expect(text).not.toContain('id="maintenance-tile"');
79 });
test/maintain-board-shape.test.ts added +54
@@ -0,0 +1,54 @@
1 /**
2 * With a seeded run from every duty the Maintenance board shows a lane each, the findings with
3 * their probe and number, and every panel's source runs (#7561).
4 */
5 import { afterAll, beforeAll, expect, test } from "bun:test";
6 import { rmSync } from "node:fs";
7 import { offerStartingBoards } from "../src/actions/boards.ts";
8 import { runQuery } from "../src/boards/query.ts";
9 import { STARTING_BOARDS } from "../src/boards/starting.ts";
10 import { SOURCES } from "../src/boards/sources.ts";
11 import { LANES } from "../src/maintain/lanes.ts";
12 import { board, boardForge, DUTIES, seedRun, type Board } from "./helpers/maintain-board.ts";
13
14 let b: Board;
15 const NOW = new Date();
16 const at = (h: number) => new Date(NOW.getTime() - h * 3_600_000).toISOString();
17 beforeAll(async () => {
18 b = await boardForge();
19 await offerStartingBoards(b.app);
20 DUTIES.forEach((duty, i) =>
21 seedRun(b.app, { duty, at: at(i + 1), probes: [{ what: `probe of ${duty}`, number: 10 + i }], actions: [`did ${duty}`], dollars: 0.25 }),
22 );
23 });
24 afterAll(() => {
25 b.servers.stop();
26 b.app.close();
27 rmSync(b.root, { recursive: true, force: true });
28 });
29
30 test("one lane per duty, with its last run, runs today and a switch where the roster has one", async () => {
31 const text = await (await board(b)).text();
32 for (const l of LANES) expect(text).toContain(`id="lane-${l.duty}"`);
33 expect(text).toContain('action="/maintenance/duties/flow-keeper"');
34 expect(text).not.toContain('action="/maintenance/duties/batch-doctor"');
35 expect(text).toContain("runs with the pipeline");
36 expect(text).toContain('id="maintenance-pipeline"');
37 });
38
39 test("the findings list names the probe, its number and the action", async () => {
40 const text = await (await board(b)).text();
41 expect(text).toContain("probe of flow-keeper");
42 expect(text).toContain("did flow-keeper");
43 expect(text).toContain('<td class="num">11</td>');
44 });
45
46 test("the maintenance sources list no free text, and every panel of the board runs", () => {
47 for (const name of ["maintenanceRuns", "maintenanceProbes"]) {
48 const cols = Object.keys(SOURCES[name]!.columns);
49 for (const bad of ["outcome", "findings_text", "summary", "what", "probes", "actions_text"]) expect(cols).not.toContain(bad);
50 }
51 for (const p of STARTING_BOARDS.maintenance!.panels) {
52 expect(runQuery(b.app.db, p.query, { repoIds: "all" }).ok).toBe(true);
53 }
54 });
test/maintain-home-tile.test.ts added +68
@@ -0,0 +1,68 @@
1 /** The home figure "maintenance: N findings open, M fixed this week" opens the board (#7561). */
2 import { afterAll, beforeAll, expect, test } from "bun:test";
3 import { rmSync } from "node:fs";
4 import { readRuns, tally } from "../src/maintain/effect.ts";
5 import type { Figures } from "../src/flow/figures.ts";
6 import type { Kpis } from "../src/flow/kpis.ts";
7 import { NO_REACH } from "../src/flow/reach.ts";
8 import { cards } from "../src/web/pages/home_figures.ts";
9 import { boardForge, seedRun, type Board } from "./helpers/maintain-board.ts";
10
11 let b: Board;
12 const NOW = new Date();
13 const at = (h: number) => new Date(NOW.getTime() - h * 3_600_000).toISOString();
14 beforeAll(async () => {
15 b = await boardForge();
16 });
17 afterAll(() => {
18 b.servers.stop();
19 b.app.close();
20 rmSync(b.root, { recursive: true, force: true });
21 });
22
23 const base: Figures = {
24 visitors: { today: 0, week: 0, days: [0], accountsToday: 0, accounts: 1 },
25 speed: { load: null, lcp: null, inp: null },
26 shipped: { days: [0], total: 0 },
27 spend: { todayUsd: 0, ceilingUsd: null, days: [0], totalUsd: 0 },
28 checks: { medianMs: null, days: [null] },
29 ship: { days: 7, count: 0, medianMs: null, p90Ms: null, histogram: [], slowest: [] },
30 bugs: null,
31 backup: { at: null, state: null, note: "" },
32 };
33
34 test("counts what the newest runs still find and what was fixed in the week", () => {
35 seedRun(b.app, { duty: "flow-keeper", at: at(30), probes: [{ what: "alarm a", number: 1 }] });
36 seedRun(b.app, { duty: "flow-keeper", at: at(20), probes: [] });
37 seedRun(b.app, { duty: "rule-watcher", at: at(2), probes: [{ what: "rule x", number: 3 }, { what: "rule y", number: 1 }] });
38 const t = tally(readRuns(b.app.db), NOW);
39 expect(t).toEqual({ open: 2, fixed: 1 });
40 });
41
42 test("the card says the two numbers and opens the board", () => {
43 const card = cards({ ...base, maintenance: { open: 2, fixed: 1 } }, Date.now()).find((c) => c.label === "Maintenance")!;
44 expect(card.value).toBe("2");
45 expect(card.unit).toBe("findings open");
46 expect(card.note).toBe("1 fixed this week");
47 expect(card.href).toBe("/boards/maintenance");
48 });
49
50 test("a board with nothing found or fixed adds no card to the home", () => {
51 const f = cards({ ...base, maintenance: { open: 0, fixed: 0 } }, Date.now());
52 expect(f.find((c) => c.label === "Maintenance")).toBeUndefined();
53 });
54
55 test("home reads the tile from the forge's own figures", async () => {
56 const { readFigures } = await import("../src/flow/figures.ts");
57 const kpis: Kpis = {
58 landedHours: [0],
59 landed: 0,
60 live: null,
61 medianCheckMs: null,
62 builders: { running: 0, slots: 0, idle: null },
63 spend: { todayUsd: 0, ceilingUsd: null },
64 backupAt: null,
65 reach: NO_REACH,
66 };
67 expect(readFigures(b.app.db, NOW, kpis).maintenance).toEqual({ open: 2, fixed: 1 });
68 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs