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

Status page: backups get their own honest row instead of reading as slow pages #16891

Merged opened this

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

Merged

fix/status-backup-wish → main 0 commits 3 threads · 3 unresolved

  • Merged. fix/status-backup-wish was merged into main as e8a1cb1.

Review

Sign in to review this change.
8 files changed +81 −30
docs/STATUS.md +1 −1
@@ -139,7 +139,7 @@ cannot confirm. A package registry is not shipped yet.
139139 working issues in the background with Claude Code and proposing through
140140 pulls a person merges.
141141 - **The `flow` label**: ready issues labelled `flow` go first; no switch, no state.
142 - **`/status`**: one sentence, signed out, always 200: `All working.`, `Slowed: <cause>.` or `Down since <time>.`, over three rows (pages and sign-in, building, billing records), each `ok`, `slow` or `down` from a real signal. `Accept: application/json` gives the same words as data; the palette's *Status* shows them in the terminal. Under the sentence the page says `as of HH:MM UTC`; a row that is slow or down says `since HH:MM UTC` (when its first cause was seen). The JSON carries `asOf` (ISO) and, per row, `{state, since?}`. Words come from a fixed table (`src/core/status_words.ts`), never copied from errors.
142 - **`/status`**: one sentence, signed out, always 200: `All working.`, `Slowed: <cause>.` or `Down since <time>.`, over four rows (pages and sign-in, building, billing records, backups), each `ok`, `slow` or `down` from a real signal; backups is slow while a snapshot failed, the off-site copy is behind, or a repository could not be bundled whole (`backup-refs`, `backup-repo`). `Accept: application/json` gives the same words as data; the palette's *Status* shows them in the terminal. Under the sentence the page says `as of HH:MM UTC`; a row that is slow or down says `since HH:MM UTC` (when its first cause was seen). The JSON carries `asOf` (ISO) and, per row, `{state, since?}`. Words come from a fixed table (`src/core/status_words.ts`), never copied from errors.
143143
144144 Pages render without a line of JavaScript and are designed thumb-first. Six
145145 premade themes (from warm paper to polar night) switch instantly and persist in
docs/design/areas/settings.md +2 −2
@@ -87,8 +87,8 @@ full width, when it has rows. Styled in `src/web/style/components.ts`.
8787
8888 - `.status-rows` — the `<dl>` of those rows, ruled by hairlines.
8989 - `.status-row` — one row: label, state, action; one column on a phone, three from 640px.
90 - `.status-days` — /status's 30 day cells (`<i>`, titled when measured; the strip's own title names a hollow cell) in a row's action slot (#15621), oldest first, at most 240px wide;
91 `.sd-ok`, `.sd-degraded`, `.sd-down` fill with the tone tokens, `.sd-none` is a hollow hairline box, never a
90 - `.status-days` — /status's 30 day cells (`<i>`, an off day titled with its minutes; the strip's own title names a filled and a hollow cell) in a row's action slot (#15621), oldest first, at most 240px wide;
91 `.sd-ok`, `.sd-degraded`, `.sd-down` fill with the tone tokens, a day with no data is a bare `<i>`, a hollow hairline box, never a
9292 colour. Hidden from screen readers, which read the row's one `.sr-only` sentence instead; a `.hint` after it names the row's worst day for touch and keyboard.
9393 - `.status-act` — a row's actions, at its end; absent when there are none.
9494 - `.settings-block` — a titled block of a settings page that is not a card: a small heading and its content.
docs/features/status-time.md +11 −2
@@ -12,12 +12,21 @@ words were read (held at most 10 s). A row that is slow or down says since when:
1212 `Accept: application/json` gives `asOf` (ISO) and, per row, `{ "state", "since" }`;
1313 `since` is absent on an ok row, and where no time is known (billing records, a restart).
1414
15 ## The backups row
16
17 `backups` is slow while the backups are incomplete, since the cause was first seen: a
18 repository the nightly snapshot could not bundle whole (branches whose commits are missing, or
19 a repository left out), a snapshot that failed, the off-box mirror that is unreachable or a day
20 out of sync, or the watched bucket late or failing its drill. The page says only `backups need a
21 look`, never a repository or branch name; `/health` (an admin's) names which and how to fix it.
22 A drill still owed and snapshots kept on the state volume are standing to-dos and leave it ok.
23
1524 ## The last 30 days
1625
1726 Each row ends with its last 30 UTC days, oldest first, one cell a day: ok, degraded
1827 (some minutes slow), down (some minutes down) or no data (a hollow box, never green).
19 Hover a measured cell for its day and minutes slow or down (a hollow cell's hover says
20 "no data"); under the strip, a row that had an off day names its worst one with its minutes,
28 Hover an off cell for its day and minutes slow or down (an ok or hollow cell's hover is the
29 strip's own: filled is ok, hollow is no data); under the strip, a row that had an off day names its worst one with its minutes,
2130 so touch and keyboard read them too; a screen reader hears one sentence per row, naming the
2231 off days with their minutes. Days come from the forge's own two-minute tick
2332 (`status_day`, 31 days kept, `src/core/status_days.ts`), each sample crediting the minutes
src/core/status_words.ts +21 −8
@@ -1,6 +1,6 @@
11 /**
22 * What the forge says about itself to anyone who asks "is it down or is it me?"
3 * (#13211): one sentence, then three rows. The page (`web/pages/status.ts`), its
3 * (#13211): one sentence, then four rows. The page (`web/pages/status.ts`), its
44 * JSON answer and the terminal screen (`tui/screens/status.ts`) read this one
55 * function, so they cannot disagree.
66 *
@@ -9,7 +9,9 @@
99 * answers, it is not restarting) and the vitals that stop serving (crash
1010 * loop, full disk: down) or slow it (memory, disk, error burst: slow);
1111 * - "building": the check lane (queue, stuck runs, a red main);
12 * - "billing records": the cost ledger's chain.
12 * - "billing records": the cost ledger's chain;
13 * - "backups": a snapshot that failed, the off-site copy behind, or a repository the snapshot
14 * could not bundle whole (branches whose commits are missing, a repository left out).
1315 * There is no row for previews or apps: nothing here measures them, and an
1416 * "ok" nobody checked is worse than no row.
1517 *
@@ -22,11 +24,11 @@ import { forgeVitals } from "../actions/health.ts";
2224 import { ledgerNeed } from "./ledger.ts";
2325 import { forgeHealth } from "../kernel/guard.ts";
2426
25 export type Row = "pages and sign-in" | "building" | "billing records";
27 export type Row = "pages and sign-in" | "building" | "billing records" | "backups";
2628 export type RowState = "ok" | "slow" | "down";
2729
2830 /** The rows, in the order they are shown. */
29 export const ROWS: readonly Row[] = ["pages and sign-in", "building", "billing records"];
31 export const ROWS: readonly Row[] = ["pages and sign-in", "building", "billing records", "backups"];
3032
3133 export interface StatusWords {
3234 /** `All working.`, `Slowed: <cause>.`, `Down since <time>.` or `Down.` */
@@ -62,9 +64,19 @@ const starts = (...p: string[]) => (c: string) => p.some((x) => c === x || c.sta
6264 * slowdown.
6365 */
6466 const WISHES = starts(
65 "disk-80", "disk-70", "db-size", "db-growth", "forges-memory", "access-log", "alarm", "backup", "drill",
66 "mirror", "snapshots", "snapshot-failed", "budget", "file", "probe", "asking", "release",
67 "disk-80", "disk-70", "db-size", "db-growth", "forges-memory", "access-log", "alarm", "drill",
68 "snapshots", "budget", "file", "probe", "asking", "release",
6769 );

'mirror' moved from a standing wish to a slow cause. Add a test that a healthy mirror stays 'All working.' and name the real causes that feed it.

70 /**
71 * What leaves the backups incomplete, each raised by `kernel/vitals.ts` only while it is so: a
72 * repository the snapshot could not bundle whole (`backup-refs:<repo>`, `backup-repo:<repo>`), a
73 * snapshot that failed (`snapshot-failed`), the off-box mirror that did not take the newest
74 * snapshot, is unreachable, has no passphrase or is a day out of sync (`mirror`, `mirrorNeed`; a
75 * mirror set up and current raises nothing), and the watched bucket late, unreadable or failing
76 * its drill (`backup`). Said on their own row, never as slow pages. A drill owed and snapshots kept
77 * on the state volume are standing to-dos and stay wishes.
78 */
79 const BACKUPS = starts("backup-refs", "backup-repo", "snapshot-failed", "mirror", "backup");
6880 /** What touches the check lane. */
6981 const BUILDING = starts("queue", "stuck", "red", "shared");
7082 /**
@@ -79,6 +91,7 @@ const PLAIN: Readonly<Record<Row, string>> = {
7991 "pages and sign-in": "pages are slower than usual",
8092 building: "building is slower than usual",
8193 "billing records": "billing records need a look",
94 backups: "backups need a look",
8295 };
8396 /** The causes said with their row's plain words; any other is said generically. */
8497 const KNOWN = starts("queue", "stuck", "red", "shared", "memory", "memory-growth", "disk", "disk-floor", "disk-red", "disk-full", "errors", "internal", "crash-loop");
@@ -102,12 +115,12 @@ export function statusOf(input: StatusInput): StatusWords {
102115 const brokenSince: string[] = [];
103116 for (const c of input.causes) {
104117 if (!c.broken && WISHES(c.cause)) continue;
105 const row: Row = BUILDING(c.cause) ? "building" : "pages and sign-in";
118 const row: Row = BACKUPS(c.cause) ? "backups" : BUILDING(c.cause) ? "building" : "pages and sign-in";
106119 const stops = c.broken && STOPS(c.cause);
107120 raise(row, stops ? "down" : "slow");
108121 if (at(c.since) !== null && (since.get(row) === undefined || c.since < since.get(row)!)) since.set(row, c.since);
109122 if (stops) brokenSince.push(c.since);
110 else slow.push(KNOWN(c.cause) ? PLAIN[row] : GENERIC);
123 else slow.push(KNOWN(c.cause) || row === "backups" ? PLAIN[row] : GENERIC);
111124 }
112125 if (input.ledgerBroken) {
113126 raise("billing records", "slow");
src/web/pages/status.ts +9 −8
@@ -1,5 +1,5 @@
11 /**
2 * GET /status: is the forge working, in one sentence and three rows (#13211, #13348).
2 * GET /status: is the forge working, in one sentence and four rows (#13211, #13348).
33 * Signed out, always 200, under 6 KB, no script, no polling. Each row ends with its last 30
44 * days, one cell a day (#15621, `core/status_days.ts`). Asked with
55 * `Accept: application/json` it answers the same words as data.
@@ -32,7 +32,7 @@ export const statusBuilds = { count: 0 };
3232 const built = new WeakMap<StatusWords, { origin: string; proof: string; text: string }>();
3333
3434 /** The status page's description: what it answers, the same on every visit. */
35 const STATUS_LINE = "Whether Open Platform Forge is working now: pages and sign-in, building, and billing records.";
35 const STATUS_LINE = "Whether Open Platform Forge is working now: pages and sign-in, building, billing records, and backups.";

Principle 1 and 8: the description now lists four things in one run-on line. Fine, but the file header (line 3, 'under 6 KB') and the comment at line 49 still state the old budget; update them or get back under it.

3636
3737 /**
3838 * `2 degraded (2026-11-19 3 min, 2026-11-20 14 min)`: how many days were in a state, and which
@@ -44,19 +44,20 @@ function countOf(days: readonly Day[], state: Day["state"], dated: boolean): str
4444 }
4545
4646 /**
47 * A row's 30 days (#15621): one cell a day, a measured one titled with its day and, when off, its
48 * minutes slow or down; a hollow one (no data) untitled, so hovering it shows the strip's own
49 * title, which names a hollow cell as no data (90 titled gaps would cost 2.3 KB of a 6 KB page);
50 * one sentence for a screen reader in place of 30 cells read aloud, naming the off days with their
47 * A row's 30 days (#15621): one cell a day. An off day (degraded, down) is titled with its day
48 * and its minutes slow or down; an ok day and a day with no data are untitled, so hovering one
49 * shows the strip's own title, which says what a filled and a hollow cell mean; a day with no data
50 * is a bare `<i>`. Four rows of 30 titled or classed cells would cost 3 KB of a 6 KB page. One
51 * sentence for a screen reader in place of 30 cells read aloud, naming the off days with their
5152 * minutes; and, when a day was off, one visible line naming the worst, so touch and keyboard read
5253 * the minutes without a hover.
5354 */
54 const STRIP_TITLE = "hollow: no data";
55 const STRIP_TITLE = "a day each; filled: ok, hollow: no data";
5556
5657 function daysStrip(days: readonly Day[]): Html {
5758 const said = `Last ${days.length} days: ${countOf(days, "ok", false)}, ${countOf(days, "degraded", true)}, ${countOf(days, "down", true)}, ${countOf(days, "none", false)}.`;
5859 const worst = worstDay(days);
59 return html`<span class="status-days" aria-hidden="true" title="${STRIP_TITLE}">${days.map((d) => (d.state === "none" ? html`<i class="sd-none"></i>` : html`<i class="sd-${d.state}" title="${dayWords(d)}"></i>`))}</span><span class="sr-only">${said}</span>${worst === null ? null : html`<span class="hint" aria-hidden="true">worst ${dayWords(worst)}</span>`}`;
60 return html`<span class="status-days" aria-hidden="true" title="${STRIP_TITLE}">${days.map((d) => (d.state === "none" ? html`<i></i>` : d.state === "ok" ? html`<i class="sd-ok"></i>` : html`<i class="sd-${d.state}" title="${dayWords(d)}"></i>`))}</span><span class="sr-only">${said}</span>${worst === null ? null : html`<span class="hint" aria-hidden="true">worst ${dayWords(worst)}</span>`}`;
6061 }
6162
6263 /**
src/web/style/components.ts +1 −1
@@ -1320,7 +1320,7 @@ a[data-palette] { display: none; }
13201320 .status-days > .sd-ok { background: var(--success); }
13211321 .status-days > .sd-degraded { background: var(--attn); }
13221322 .status-days > .sd-down { background: var(--danger); }
1323 .status-days > .sd-none { box-shadow: inset 0 0 0 1px var(--border); }
1323 .status-days > i:not([class]) { box-shadow: inset 0 0 0 1px var(--border); }
13241324 @media (min-width: 640px) {
13251325 .status-row { grid-template-columns: 168px minmax(0, 1fr) auto; }
13261326 .status-act { justify-content: flex-end; }
test/status-history.test.ts +6 −4
@@ -19,6 +19,7 @@ const words = (pages: "ok" | "slow" | "down", building: "ok" | "slow" | "down" =
1919 { name: "pages and sign-in", state: pages },
2020 { name: "building", state: building },
2121 { name: "billing records", state: "ok" },
22 { name: "backups", state: "ok" },
2223 ],
2324 });
2425
@@ -36,7 +37,7 @@ describe("status days", () => {
3637 test("an empty record is all no data, and says history starts today", () => {
3738 const h = statusHistory(app.db, NOW);
3839 expect(h.start).toBeNull();
39 expect(h.rows.map((r) => r.name)).toEqual(["pages and sign-in", "building", "billing records"]);
40 expect(h.rows.map((r) => r.name)).toEqual(["pages and sign-in", "building", "billing records", "backups"]);
4041 for (const r of h.rows) {
4142 expect(r.days).toHaveLength(30);
4243 expect(r.days.every((d) => d.state === "none")).toBe(true);
@@ -119,6 +120,7 @@ describe("the tick's sample", () => {
119120 const today = new Date().toISOString().slice(0, 10);
120121 const rows = own.db.query("SELECT row, ok + slow + down AS minutes FROM status_day WHERE day = ? ORDER BY row").all(today);
121122 expect(rows).toEqual([
123 { row: "backups", minutes: 2 },
122124 { row: "billing records", minutes: 2 },
123125 { row: "building", minutes: 2 },
124126 { row: "pages and sign-in", minutes: 2 },
@@ -152,12 +154,12 @@ describe("GET /status with a record", () => {
152154
153155 test("each row has 30 titled cells and a sentence for a screen reader; no script", async () => {
154156 const text = await (await fetch(`${base}/status`)).text();
155 expect((text.match(/<i class="sd-/g) ?? []).length).toBe(90);
157 expect((text.match(/<i( class="sd-[a-z]+"( title="[^"]*")?)?><\/i>/g) ?? []).length).toBe(120);
156158 const yesterday = new Date(Date.now() - DAY).toISOString().slice(0, 10);
157159 expect(text).toContain(`<i class="sd-degraded" title="${yesterday}: degraded, 2 min slow or down"></i>`);
158 expect((text.match(/<i class="sd-none"><\/i>/g) ?? []).length).toBe(87);
160 expect((text.match(/<i><\/i>/g) ?? []).length).toBe(116);
159161 // A gap is untitled; hovering it shows the strip's title, which names it.
160 expect((text.match(/<span class="status-days" aria-hidden="true" title="hollow: no data">/g) ?? []).length).toBe(3);
162 expect((text.match(/<span class="status-days" aria-hidden="true" title="a day each; filled: ok, hollow: no data">/g) ?? []).length).toBe(4);
161163 expect(text).toContain(`<span class="sr-only">Last 30 days: 0 ok, 1 degraded (${yesterday} 2 min), 0 down, 29 no data.</span>`);
162164 // The minutes are on the page without a hover: one line per row that had an off day.
163165 expect((text.match(/<span class="hint" aria-hidden="true">worst /g) ?? []).length).toBe(1);
test/status-page.test.ts +30 −4
@@ -6,6 +6,7 @@ import { createApp, type App } from "../src/app.ts";
66 import { serve, type Servers } from "../src/http/server.ts";
77 import { ownProbeHeaders } from "../src/kernel/probe.ts";
88 import { asOfWords, rowWords, statusJson, statusOf, statusReuse, statusWords, type StatusInput } from "../src/core/status_words.ts";
9 import { MIRROR_STALE_MS, mirrorNeed } from "../src/snapshot/mirror.ts";
910 import { statusBuilds } from "../src/web/pages/status.ts";
1011 import { createForgeApp, forgeCommands, Session } from "../src/tui/forge.ts";
1112 import { statusLines } from "../src/tui/screens/status.ts";
@@ -35,10 +36,10 @@ const healthy: StatusInput = { asOf: AS_OF, ok: true, draining: false, causes: [
3536 const cause = (c: string, broken: boolean, since = "2026-11-15T09:00:00Z") => ({ cause: c, broken, since });
3637
3738 describe("status words", () => {
38 test("healthy says all working with three ok rows", () => {
39 test("healthy says all working with four ok rows", () => {
3940 const w = statusOf(healthy);
4041 expect(w.sentence).toBe("All working.");
41 expect(w.rows.map((r) => r.name)).toEqual(["pages and sign-in", "building", "billing records"]);
42 expect(w.rows.map((r) => r.name)).toEqual(["pages and sign-in", "building", "billing records", "backups"]);
4243 expect(w.rows.every((r) => r.state === "ok")).toBe(true);
4344 });
4445
@@ -84,10 +85,35 @@ describe("status words", () => {
8485 expect(statusOf({ ...healthy, causes: [cause("disk-red", true)] }).sentence).toBe("Slowed: pages are slower than usual.");
8586 const r = statusOf({ ...healthy, causes: [cause("red:7", true)] });
8687 expect(r.sentence).toBe("Slowed: building is slower than usual.");
87 expect(r.rows.map((x) => x.state)).toEqual(["ok", "slow", "ok"]);
88 expect(r.rows.map((x) => x.state)).toEqual(["ok", "slow", "ok", "ok"]);
8889 expect(statusOf({ ...healthy, causes: [cause("something-new", true)] }).sentence).toBe("Slowed: something is slower than usual.");
8990 });
9091
92 test("branches a snapshot cannot bundle, a repository it left out, a failed snapshot: the backups row, never pages", () => {
93 for (const c of ["backup-refs:scout/forge", "backup-repo:alice/notes", "snapshot-failed", "mirror", "backup"]) {
94 const w = statusOf({ ...healthy, causes: [cause(c, false, "2026-11-30T08:36:20Z")] });
95 expect(w.sentence).toBe("Slowed: backups need a look.");
96 expect(w.rows.map((r) => [r.name, r.state])).toEqual([["pages and sign-in", "ok"], ["building", "ok"], ["billing records", "ok"], ["backups", "slow"]]);
97 expect(w.rows.find((r) => r.name === "backups")!.since).toBe("2026-11-30T08:36:20Z");
98 }
99 // A backup still to set up is a wish: a drill owed, snapshots on the state volume.
100 expect(statusOf({ ...healthy, causes: [cause("drill", false), cause("snapshots", false)] }).sentence).toBe("All working.");
101 });
102
103 test("a mirror set up and current raises no cause, so the page says All working; one a day out of sync is the backups row", () => {
104 const now = Date.parse("2026-11-30T12:00:00Z");
105 const mirror = { where: "s3://bucket/forge", attemptAt: "2026-11-30T11:00:00Z", reachable: true, syncedAt: "2026-11-30T11:00:00Z" };
106 const words = (state: typeof mirror) => {
107 const need = mirrorNeed(state, now);
108 return statusOf({ ...healthy, causes: need === undefined ? [] : [cause("mirror", false, need.since)] });
109 };
110 expect(mirrorNeed(mirror, now)).toBeUndefined();
111 expect(words(mirror).sentence).toBe("All working.");
112 const stale = { ...mirror, syncedAt: new Date(now - MIRROR_STALE_MS - 60_000).toISOString() };
113 expect(words(stale).rows.find((r) => r.name === "backups")!.state).toBe("slow");
114 expect(words(stale).rows.find((r) => r.name === "pages and sign-in")!.state).toBe("ok");
115 });
116
91117 test("a cause the table does not know is said generically, a standing wish is not", () => {
92118 const secret = "ECONNREFUSED 10.0.0.7:5432 /data/secret.key";
93119 const w = statusOf({ ...healthy, causes: [cause(secret, false, secret)] });
@@ -208,7 +234,7 @@ describe("GET /status", () => {
208234 expect(page).toContain(j.sentence);
209235 expect(j.asOf).toMatch(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/);
210236 for (const [name, row] of Object.entries(j.rows)) expect(page).toMatch(new RegExp(`<dt>${name}</dt>\\s*<dd>[^]*?${row.state}`));
211 expect(Object.keys(j.rows)).toHaveLength(3);
237 expect(Object.keys(j.rows)).toHaveLength(4);
212238 });
213239
214240 // One answer to "what is running" (#14220): an owner compares the two to tell whether

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs