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
Check · Review · Land · Live done — Landed and live in production.
fix/status-backup-wish → main 0 commits 3 threads · 3 unresolved
8 files
changed +81
−30
docs/STATUS.md +1 −1
| @@ -139,7 +139,7 @@ cannot confirm. A package registry is not shipped yet. | ||
| 139 | 139 | working issues in the background with Claude Code and proposing through |
| 140 | 140 | pulls a person merges. |
| 141 | 141 | - **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. | |
| 143 | 143 | |
| 144 | 144 | Pages render without a line of JavaScript and are designed thumb-first. Six |
| 145 | 145 | 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`. | ||
| 87 | 87 | |
| 88 | 88 | - `.status-rows` — the `<dl>` of those rows, ruled by hairlines. |
| 89 | 89 | - `.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 | |
| 92 | 92 | 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. |
| 93 | 93 | - `.status-act` — a row's actions, at its end; absent when there are none. |
| 94 | 94 | - `.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: | ||
| 12 | 12 | `Accept: application/json` gives `asOf` (ISO) and, per row, `{ "state", "since" }`; |
| 13 | 13 | `since` is absent on an ok row, and where no time is known (billing records, a restart). |
| 14 | 14 | |
| 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 | ||
| 15 | 24 | ## The last 30 days |
| 16 | 25 | |
| 17 | 26 | Each row ends with its last 30 UTC days, oldest first, one cell a day: ok, degraded |
| 18 | 27 | (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, | |
| 21 | 30 | so touch and keyboard read them too; a screen reader hears one sentence per row, naming the |
| 22 | 31 | off days with their minutes. Days come from the forge's own two-minute tick |
| 23 | 32 | (`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 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * 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 | |
| 4 | 4 | * JSON answer and the terminal screen (`tui/screens/status.ts`) read this one |
| 5 | 5 | * function, so they cannot disagree. |
| 6 | 6 | * |
| @@ -9,7 +9,9 @@ | ||
| 9 | 9 | * answers, it is not restarting) and the vitals that stop serving (crash |
| 10 | 10 | * loop, full disk: down) or slow it (memory, disk, error burst: slow); |
| 11 | 11 | * - "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). | |
| 13 | 15 | * There is no row for previews or apps: nothing here measures them, and an |
| 14 | 16 | * "ok" nobody checked is worse than no row. |
| 15 | 17 | * |
| @@ -22,11 +24,11 @@ import { forgeVitals } from "../actions/health.ts"; | ||
| 22 | 24 | import { ledgerNeed } from "./ledger.ts"; |
| 23 | 25 | import { forgeHealth } from "../kernel/guard.ts"; |
| 24 | 26 | |
| 25 | export type Row = "pages and sign-in" | "building" | "billing records"; | |
| 27 | export type Row = "pages and sign-in" | "building" | "billing records" | "backups"; | |
| 26 | 28 | export type RowState = "ok" | "slow" | "down"; |
| 27 | 29 | |
| 28 | 30 | /** 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"]; | |
| 30 | 32 | |
| 31 | 33 | export interface StatusWords { |
| 32 | 34 | /** `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 | ||
| 62 | 64 | * slowdown. |
| 63 | 65 | */ |
| 64 | 66 | 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", | |
| 67 | 69 | ); |
| 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"); | |
| 68 | 80 | /** What touches the check lane. */ |
| 69 | 81 | const BUILDING = starts("queue", "stuck", "red", "shared"); |
| 70 | 82 | /** |
| @@ -79,6 +91,7 @@ const PLAIN: Readonly<Record<Row, string>> = { | ||
| 79 | 91 | "pages and sign-in": "pages are slower than usual", |
| 80 | 92 | building: "building is slower than usual", |
| 81 | 93 | "billing records": "billing records need a look", |
| 94 | backups: "backups need a look", | |
| 82 | 95 | }; |
| 83 | 96 | /** The causes said with their row's plain words; any other is said generically. */ |
| 84 | 97 | 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 { | ||
| 102 | 115 | const brokenSince: string[] = []; |
| 103 | 116 | for (const c of input.causes) { |
| 104 | 117 | 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"; | |
| 106 | 119 | const stops = c.broken && STOPS(c.cause); |
| 107 | 120 | raise(row, stops ? "down" : "slow"); |
| 108 | 121 | if (at(c.since) !== null && (since.get(row) === undefined || c.since < since.get(row)!)) since.set(row, c.since); |
| 109 | 122 | 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); | |
| 111 | 124 | } |
| 112 | 125 | if (input.ledgerBroken) { |
| 113 | 126 | raise("billing records", "slow"); |
src/web/pages/status.ts +9 −8
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /** |
| 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). | |
| 3 | 3 | * Signed out, always 200, under 6 KB, no script, no polling. Each row ends with its last 30 |
| 4 | 4 | * days, one cell a day (#15621, `core/status_days.ts`). Asked with |
| 5 | 5 | * `Accept: application/json` it answers the same words as data. |
| @@ -32,7 +32,7 @@ export const statusBuilds = { count: 0 }; | ||
| 32 | 32 | const built = new WeakMap<StatusWords, { origin: string; proof: string; text: string }>(); |
| 33 | 33 | |
| 34 | 34 | /** 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."; | |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * `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 | ||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 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 | |
| 51 | 52 | * minutes; and, when a day was off, one visible line naming the worst, so touch and keyboard read |
| 52 | 53 | * the minutes without a hover. |
| 53 | 54 | */ |
| 54 | const STRIP_TITLE = "hollow: no data"; | |
| 55 | const STRIP_TITLE = "a day each; filled: ok, hollow: no data"; | |
| 55 | 56 | |
| 56 | 57 | function daysStrip(days: readonly Day[]): Html { |
| 57 | 58 | const said = `Last ${days.length} days: ${countOf(days, "ok", false)}, ${countOf(days, "degraded", true)}, ${countOf(days, "down", true)}, ${countOf(days, "none", false)}.`; |
| 58 | 59 | 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>`}`; | |
| 60 | 61 | } |
| 61 | 62 | |
| 62 | 63 | /** |
src/web/style/components.ts +1 −1
| @@ -1320,7 +1320,7 @@ a[data-palette] { display: none; } | ||
| 1320 | 1320 | .status-days > .sd-ok { background: var(--success); } |
| 1321 | 1321 | .status-days > .sd-degraded { background: var(--attn); } |
| 1322 | 1322 | .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); } | |
| 1324 | 1324 | @media (min-width: 640px) { |
| 1325 | 1325 | .status-row { grid-template-columns: 168px minmax(0, 1fr) auto; } |
| 1326 | 1326 | .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" = | ||
| 19 | 19 | { name: "pages and sign-in", state: pages }, |
| 20 | 20 | { name: "building", state: building }, |
| 21 | 21 | { name: "billing records", state: "ok" }, |
| 22 | { name: "backups", state: "ok" }, | |
| 22 | 23 | ], |
| 23 | 24 | }); |
| 24 | 25 | |
| @@ -36,7 +37,7 @@ describe("status days", () => { | ||
| 36 | 37 | test("an empty record is all no data, and says history starts today", () => { |
| 37 | 38 | const h = statusHistory(app.db, NOW); |
| 38 | 39 | 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"]); | |
| 40 | 41 | for (const r of h.rows) { |
| 41 | 42 | expect(r.days).toHaveLength(30); |
| 42 | 43 | expect(r.days.every((d) => d.state === "none")).toBe(true); |
| @@ -119,6 +120,7 @@ describe("the tick's sample", () => { | ||
| 119 | 120 | const today = new Date().toISOString().slice(0, 10); |
| 120 | 121 | const rows = own.db.query("SELECT row, ok + slow + down AS minutes FROM status_day WHERE day = ? ORDER BY row").all(today); |
| 121 | 122 | expect(rows).toEqual([ |
| 123 | { row: "backups", minutes: 2 }, | |
| 122 | 124 | { row: "billing records", minutes: 2 }, |
| 123 | 125 | { row: "building", minutes: 2 }, |
| 124 | 126 | { row: "pages and sign-in", minutes: 2 }, |
| @@ -152,12 +154,12 @@ describe("GET /status with a record", () => { | ||
| 152 | 154 | |
| 153 | 155 | test("each row has 30 titled cells and a sentence for a screen reader; no script", async () => { |
| 154 | 156 | 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); | |
| 156 | 158 | const yesterday = new Date(Date.now() - DAY).toISOString().slice(0, 10); |
| 157 | 159 | 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); | |
| 159 | 161 | // 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); | |
| 161 | 163 | expect(text).toContain(`<span class="sr-only">Last 30 days: 0 ok, 1 degraded (${yesterday} 2 min), 0 down, 29 no data.</span>`); |
| 162 | 164 | // The minutes are on the page without a hover: one line per row that had an off day. |
| 163 | 165 | 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"; | ||
| 6 | 6 | import { serve, type Servers } from "../src/http/server.ts"; |
| 7 | 7 | import { ownProbeHeaders } from "../src/kernel/probe.ts"; |
| 8 | 8 | 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"; | |
| 9 | 10 | import { statusBuilds } from "../src/web/pages/status.ts"; |
| 10 | 11 | import { createForgeApp, forgeCommands, Session } from "../src/tui/forge.ts"; |
| 11 | 12 | import { statusLines } from "../src/tui/screens/status.ts"; |
| @@ -35,10 +36,10 @@ const healthy: StatusInput = { asOf: AS_OF, ok: true, draining: false, causes: [ | ||
| 35 | 36 | const cause = (c: string, broken: boolean, since = "2026-11-15T09:00:00Z") => ({ cause: c, broken, since }); |
| 36 | 37 | |
| 37 | 38 | describe("status words", () => { |
| 38 | test("healthy says all working with three ok rows", () => { | |
| 39 | test("healthy says all working with four ok rows", () => { | |
| 39 | 40 | const w = statusOf(healthy); |
| 40 | 41 | 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"]); | |
| 42 | 43 | expect(w.rows.every((r) => r.state === "ok")).toBe(true); |
| 43 | 44 | }); |
| 44 | 45 | |
| @@ -84,10 +85,35 @@ describe("status words", () => { | ||
| 84 | 85 | expect(statusOf({ ...healthy, causes: [cause("disk-red", true)] }).sentence).toBe("Slowed: pages are slower than usual."); |
| 85 | 86 | const r = statusOf({ ...healthy, causes: [cause("red:7", true)] }); |
| 86 | 87 | 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"]); | |
| 88 | 89 | expect(statusOf({ ...healthy, causes: [cause("something-new", true)] }).sentence).toBe("Slowed: something is slower than usual."); |
| 89 | 90 | }); |
| 90 | 91 | |
| 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 | ||
| 91 | 117 | test("a cause the table does not know is said generically, a standing wish is not", () => { |
| 92 | 118 | const secret = "ECONNREFUSED 10.0.0.7:5432 /data/secret.key"; |
| 93 | 119 | const w = statusOf({ ...healthy, causes: [cause(secret, false, secret)] }); |
| @@ -208,7 +234,7 @@ describe("GET /status", () => { | ||
| 208 | 234 | expect(page).toContain(j.sentence); |
| 209 | 235 | expect(j.asOf).toMatch(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/); |
| 210 | 236 | 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); | |
| 212 | 238 | }); |
| 213 | 239 | |
| 214 | 240 | // One answer to "what is running" (#14220): an owner compares the two to tell whether |
new above
offline
'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.