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

/status names the proof lines that did not pass, each with its evidence in plain words, instead of "0 of 8 pass" #15944

Merged opened this

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

Merged

scout/forge:scout/15938-status-names-the-proof-lines-that-did-no → main 0 commits fork 3 threads · 3 unresolved

  • Merged. scout/15938-status-names-the-proof-lines-that-did-no was merged into main as 825d424.

Review

Sign in to review this change.
5 files changed +94 −2
docs/features/status-proof-lines.md added +15
@@ -0,0 +1,15 @@
1 ---
2 topic: When something is wrong
3 row: /status names the daily-proof lines that did not pass, with their evidence
4 ---
5 # /status names the proof lines that did not pass
6
7 Open `/status` (signed out) or choose **Status** in the terminal palette
8 (`ssh` in, `ctrl+k`, Status). Under the `daily proof` row, a closed fold says
9 `2 of 8 daily proof lines did not pass`; open it for one line each: the item,
10 `FAIL` or `could not be read`, and its evidence in plain words. The terminal prints
11 the same lines, indented under the row.
12
13 The badge is danger only when a line says `FAIL`; when every line that did not pass
14 could not be read, it is attention, not red. Nothing is shown beyond what
15 `GET /api/v1/proof/daily` already serves anonymously.
src/release/daily_proof.ts +4 −1
@@ -203,6 +203,8 @@ export interface ProofStatus extends ProofTally {
203203 readonly state: "pass" | "fail" | "unknown";
204204 /** `11 of 11 pass, 6 h ago`. */
205205 readonly says: string;
206 /** The lines that did not pass, evidence already plain. */
207 readonly open: readonly { item: string; verdict: Verdict; evidence: string }[];
206208 }
207209
208210 export function proofStatus(db: Database, now: number): ProofStatus | undefined {
@@ -210,7 +212,8 @@ export function proofStatus(db: Database, now: number): ProofStatus | undefined
210212 if (run === undefined) return undefined;
211213 const t = tally(run);
212214 const state = run.lines.some((l) => l.verdict === "FAIL") ? "fail" : t.total > 0 && t.pass === t.total ? "pass" : "unknown";
213 return { ...t, state, says: tallyWords(t, now) };
215 const open = run.lines.filter((l) => l.verdict !== "PASS").map((l) => ({ item: l.item, verdict: l.verdict, evidence: plainEvidence(l.evidence) }));
216 return { ...t, state, says: tallyWords(t, now), open };
214217 }
215218
216219 /** The row's name on `/status` and its terminal screen. */
src/tui/screens/status.ts +2
@@ -29,6 +29,8 @@ export function statusLines(session: Session, now = Date.now()): string[] {
2929 "",
3030 ...w.rows.map((r) => `${pad(r.name, 20)}${pad(rowWords(r), 24)}${strip.get(r.name) ?? ""}`),
3131 ...(proof === undefined ? [] : [`${pad(PROOF_ROW, 20)}${proof.says}`]),
32 // The lines that did not pass, one each, as the page's fold names them (#15938).
33 ...(proof?.open ?? []).map((l) => ` ${l.item}: ${l.verdict === "FAIL" ? "FAIL" : "could not be read"}${l.evidence === "" ? "" : ` · ${l.evidence}`}`),
3234 "",
3335 `last 30 days, oldest first: # ok ~ degraded ! down . no data${starts === null ? "" : `; ${starts}`}`,
3436 ];
src/web/pages/status.ts +12 −1
@@ -59,8 +59,18 @@ function daysStrip(days: readonly Day[]): Html {
5959 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>`}`;
6060 }
6161
62 /**
63 * The proof lines that did not pass, one each: item, FAIL or "could not be read", evidence
64 * (#15938).
65 */
66 function proofFold(proof: ProofStatus): Html | null {
67 if (proof.open.length === 0) return null;

Principle 7 (rows over boxes): each line is a fact (item, verdict, evidence), so render it as a dl row rather than a hint paragraph per line.

68 const items = proof.open.map((l) => statusRow(l.item, html`${l.verdict === "FAIL" ? "FAIL" : "could not be read"}${l.evidence === "" ? "" : html` · ${l.evidence}`}`));
outdated

proof-lines is a new class with no CSS and no entry in docs/design/areas/<area>.md. Box 3 says no new component class. Remove it, or use the existing fold's class.

69 return html`<details class="disclosure"><summary>${proof.open.length} of ${proof.total} daily proof lines did not pass</summary><dl class="status-rows">${items}</dl></details>`;
70 }
71
6272 function markup(words: StatusWords, origin: string, proof: ProofStatus | undefined, read: () => StatusHistory): string {
63 const said = proof?.says ?? "";
73 const said = proof === undefined ? "" : `${proof.says}\n${JSON.stringify(proof.open)}`;
6474 const kept = built.get(words);
6575 if (kept !== undefined && kept.origin === origin && kept.proof === said) return kept.text;
6676 statusBuilds.count += 1;
@@ -86,6 +96,7 @@ ${themeColorHead(undefined)}
8696 <main class="shell" id="main">
8797 <div class="page-head"><h1>${words.sentence}</h1><p class="hint">${asOfWords(words)}</p></div>
8898 <dl class="status-rows">${rows}${proofRow}</dl>
99 ${proof === undefined ? null : proofFold(proof)}
89100 ${starts === null ? "" : html`<p class="hint">${starts}</p>`}
90101 </main>
91102 <footer class="foot"><a href="/">forge</a><span class="spacer"></span><a href="/status">Status</a><a href="/privacy">Privacy</a></footer>
test/status-proof-lines.test.ts added +61
@@ -0,0 +1,61 @@
1 /** /status names the daily-proof lines that did not pass, with their evidence, escaped (#15938). */
2 import { afterAll, beforeAll, expect, test } from "bun:test";
3 import { mkdtemp, rm } from "node:fs/promises";
4 import { tmpdir } from "node:os";
5 import { join } from "node:path";
6 import { createApp, type App } from "../src/app.ts";
7 import { serve, type Servers } from "../src/http/server.ts";
8 import { recordRun } from "../src/release/daily_proof.ts";
9 import { Session } from "../src/tui/forge.ts";
10 import { statusLines } from "../src/tui/screens/status.ts";
11 import type { Line } from "../src/release/v1_checks.ts";
12
13 let dir: string;
14 let app: App;
15 let servers: Servers;
16 const T0 = Date.parse("2026-11-20T07:00:00Z");
17 const line = (item: string, verdict: Line["verdict"], evidence = "seen"): Line => ({ item, verdict, url: "https://forge.example/x", evidence });
18 const page = async () => (await fetch(`${servers.url}/status`)).text();
19
20 beforeAll(async () => {
21 dir = await mkdtemp(join(tmpdir(), "status-proof-"));
22 app = createApp({ dataDir: dir, port: 0 });
23 servers = await serve(app);
24 });
25 afterAll(async () => {
26 await servers.stop();
27 app.close();
28 await rm(dir, { recursive: true, force: true });
29 });
30
31 test("only UNKNOWN lines: listed as could not be read, badge not danger", async () => {
32 recordRun(app.db, [line("a", "PASS"), line("b", "UNKNOWN", "no answer"), line("c", "UNKNOWN", "timed out")], new Date(T0));
33 const html = await page();
34 expect(html).toContain("2 of 3 daily proof lines did not pass");
35 expect(html).toContain("<dt>b</dt>\n <dd>could not be read · no answer</dd>");
36 expect(html).not.toContain("<dt>a</dt>");
37 expect(html).not.toMatch(/data-variant="danger"[^>]*>[^<]*pass/);
38 });
39
40 test("a FAIL is named FAIL, its evidence escaped, and the badge turns danger", async () => {
41 recordRun(app.db, [line("a", "FAIL", "<script>alert(1)</script>"), line("b", "UNKNOWN"), line("c", "UNKNOWN"), line("d", "PASS")], new Date(T0 + 86_400_000));
42 const html = await page();
43 expect(html).toContain("<dt>a</dt>\n <dd>FAIL · &lt;script&gt;alert(1)&lt;/script&gt;</dd>");
44 expect(html).not.toContain("<script>alert");
45 expect(html).toMatch(/data-variant="danger"[^>]*>[^<]*pass/);
outdated

/danger/ matches anywhere in the page, so this passes even if the badge is not danger. Match the proof row's badge, like the not.toMatch in the first test.

46 expect((html.match(/<dt>[abc]<\/dt>/g) ?? []).length).toBe(3);
47 });
48
49 test("all passing shows no fold", async () => {
50 recordRun(app.db, [line("a", "PASS")], new Date(T0 + 2 * 86_400_000));
51 expect(await page()).not.toContain("did not pass");
52 });
53
54 test("the terminal shows the same lines", () => {
55 recordRun(app.db, [line("a", "FAIL", "boom"), line("b", "UNKNOWN", "no answer"), line("c", "PASS")], new Date(T0 + 3 * 86_400_000));
56 const user = { sshUsername: "git", remoteAddress: "127.0.0.1", fingerprint: "SHA256:test", user: undefined };
57 const lines = statusLines(new Session(app, user));
58 expect(lines).toContain(" a: FAIL · boom");
59 expect(lines).toContain(" b: could not be read · no answer");
60 expect(lines.join("\n")).not.toContain(" c:");
61 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs