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

The v1 probe runs every day on production and asks the owner once when a line is not PASS #15652

Merged opened this

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

Merged

mason/forge:mason/15625-the-v1-probe-runs-every-day-on-productio → main 0 commits fork

  • Merged. mason/15625-the-v1-probe-runs-every-day-on-productio was merged into main as 61bfc68.

Review

Sign in to review this change.
23 files changed +1058 −398
docs/features/daily-proof.md added +27
@@ -0,0 +1,27 @@
1 ---
2 topic: What a forge is
3 row: Does production still pass the v1 checks today?
4 ---
5 # The daily proof of production
6
7 A maintenance duty, `daily-proof` (#15625), runs the v1.0.0 checklist of `scripts/v1-probe.ts` once a day in process
8 against the forge's own public origin (`FORGE_URL`). The checks are one module, `src/release/v1_checks.ts`, which
9 the script and the duty share. Without `FORGE_URL` it skips and says so.
10
11 - **Read-only and token-free.** The same requests as the script: GETs, and one MCP `initialize` and `releases` call.
12 All of them go to the origin. No token is ever sent. The whole run has 60 s; once that is spent, the read in flight
13 ends and every later line says `no answer: the probe's budget ran out`.
14 - **The owner's ask.** A line asks when it is `FAIL`, or `UNKNOWN` where the day before had it `PASS`. Asking lines
15 are one flow alarm, `daily_proof` (`src/release/daily_proof.ts`). It names each line and its evidence, links
16 `/status`, and counts as the forge being broken: it is on home's one line, on `/asks` under "The forge", and the
17 notifier tells the owner. A line that stays failed asks once. A second line failing is a new ask. A line that
18 passes clears its own ask, and a day of all `PASS` clears every ask in one line of the duty's run
19 (`all 9 pass: cleared …`).
20 - **Where it reads.** `/status` (`src/web/pages/status.ts`) has a `daily proof` row once a run exists
21 (`9 of 9 pass, 6 h ago`). The terminal's Status screen (`src/tui/screens/status.ts`) shows the same row, and
22 `/status` asked for JSON carries `proof`. `GET /api/v1/proof/daily` answers anyone, with no token, with the
23 newest run's lines: `item`, `verdict`, `url` and `evidence`. Evidence is one plain line, nothing credential-shaped,
24 at most 240 characters. Each run is also a `maintenance_run` row (`GET /api/v1/maintenance/runs`).
25
26 The weekly `v1-proven` duty ([v1-proven.md](v1-proven.md)) is the older proof list. It files a defect issue; this
27 one asks the owner.
scripts/v1-probe.ts +8 −380
@@ -1,58 +1,17 @@
11 /**
22 * `bun scripts/v1-probe.ts <base-url> [--repo owner/name] [--edition <url>]`: the v1.0.0
3 * checklist (#15366), proven on the running forge. Read-only: every request
4 * is a GET, apart from one MCP `initialize` and one `tools/call` of the token-free
5 * `releases` tool (POSTs that change nothing), and
6 * every request goes to `<base-url>`, apart from one GET of `--edition`, and reads only
7 * `--repo` (default `trevato/forge`). It never signs in, pays or writes.
3 * checklist (#15366), proven on the running forge by hand. The checks are
4 * `src/release/v1_checks.ts`, which the daily proof runs too (#15625); this script reads its
5 * arguments, prints one line per item and exits 0 only when every line is PASS.
86 *
9 * `keeper's last beat` reads `/api/v1/keeper/pulse` with no token (#15524): the release tick's
10 * newest outcome, when, and whether it has gone silent; FAIL when it failed or is silent. Only
11 * when the pulse is absent (a release before it) and `FORGE_TOKEN` is set (the crew's token for
12 * the forge's repository is enough, #15449) does it GET `/api/v1/keeper` with that token, which
13 * also names the reason. The token is sent to `<base-url>` only, and to two endpoints only:
14 * `/api/v1/keeper`, and `/api/v1/here` when the keeper answers 403, to word the refusal by its
15 * cause (#15520).
16 *
17 * The schedules line reads `<base-url>/edition` (#15474), the morning paper's edition page; a 404
18 * there is UNKNOWN, `this release predates /edition`. `--edition` is another public page a
19 * scheduled app prints, and wins (#15388): its newest `<time datetime>` or `<updated>` is when the
20 * schedule last ran, the schedules API answers 404 to an anonymous read.
21 *
22 * The stranger-journey line reads the full check's verdict that the same `releases` answer states
23 * beside its running commit (`check`, #15514); only when it names no verdict on the newest
24 * release's commit is the check API asked, which answers 404 to an anonymous read.
25 * When that answers 404 and so does the repository itself, the base holds no such repository (an
26 * app's test copy of the forge, #15519) and the line names the forge to ask.
27 *
28 * It prints one line per item, `PASS`, `FAIL` or `UNKNOWN`, with the URL and
29 * the evidence, and exits 0 only when every line is PASS. UNKNOWN is what an
30 * anonymous read cannot prove; the line says what a person must check.
7 * `--repo` defaults to `trevato/forge`. `--edition` is another public page a scheduled app prints
8 * (#15388). `FORGE_TOKEN`, when set, is sent only as the checks say: to `<base-url>`'s
9 * `/api/v1/keeper` when the public pulse is absent, and to its `/api/v1/here` to word a refusal.
3110 */
3211
33 export type Verdict = "PASS" | "FAIL" | "UNKNOWN";
12 import { formatLine, probe } from "../src/release/v1_checks.ts";
3413
35 export interface Line {
36 readonly item: string;
37 readonly verdict: Verdict;
38 readonly url: string;
39 readonly evidence: string;
40 }
41
42 /** What one request saw: status, the headers named, the body, how long it took. */
43 interface Seen {
44 readonly status: number;
45 readonly headers: Headers;
46 readonly body: string;
47 readonly ms: number;
48 }
49
50 type Fetcher = (url: string, init?: RequestInit) => Promise<Response>;
51
52 /** Healthz slower than this is a FAIL: the common request answers in milliseconds. */
53 export const HEALTHZ_MS = 500;
54 const DAY_MS = 24 * 60 * 60 * 1000;
55 const PRICE = /[$€£]\s?\d+(?:[.,]\d+)?/;
14 export * from "../src/release/v1_checks.ts";
5615
5716 export interface Args {
5817 readonly base: string;
@@ -98,337 +57,6 @@ export function parseArgs(argv: readonly string[]): Args | { error: string } {
9857 return { base: url.origin, repo, ...(edition ? { edition } : {}) };
9958 }
10059
101 const STAMP = /<time\b[^>]*\bdatetime\s*=\s*["']([^"']{1,40})["']|<updated>\s*([^<]{1,40}?)\s*<\/updated>/gi;
102 const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
103
104 /**
105 * When the newest edition on a printed page was made: the latest `<time datetime>` or Atom
106 * `<updated>` not more than an hour ahead of `now`. A date with no time counts as the end of that
107 * day (UTC) capped at `now`, kept once its day has begun, so a paper dated today or yesterday is
108 * fresh whatever its time zone.
109 */
110 export function editionDate(body: string, now: number): { at: number; text: string } | undefined {
111 let best: { at: number; text: string } | undefined;
112 for (const m of body.matchAll(STAMP)) {
113 const text = (m[1] ?? m[2] ?? "").trim();
114 const parsed = Date.parse(text);
115 if (!Number.isFinite(parsed)) continue;
116 if (parsed - now > 60 * 60 * 1000) continue;
117 const at = DATE_ONLY.test(text) ? Math.min(parsed + DAY_MS, now) : parsed;
118 if (!best || at > best.at) best = { at, text };
119 }
120 return best;
121 }
122
123 /** What production announced: a release number, or the short commit of an unstamped build. */
124 export function announcedOf(served: string): { kind: "version" | "commit"; text: string } | undefined {
125 if (/^v?\d+\.\d+\.\d+$/.test(served)) return { kind: "version", text: served.replace(/^v/, "") };
126 if (/^[0-9a-f]{7,40}$/.test(served)) return { kind: "commit", text: served };
127 return undefined;
128 }
129
130 /** The newest release of `repo` in the `releases` tool's answer. */
131 export interface Release {
132 readonly name: string;
133 readonly version: string | undefined;
134 readonly commit: string;
135 /** True when no release is listed and this is the running build the answer names (#15473). */
136 readonly running?: true;
137 }
138
139 /**
140 * The newest release of `repo` from a `tools/call releases` JSON-RPC answer: undefined when the
141 * answer is not the tool's JSON (no source answered), `{ release: undefined }` when it lists none
142 * and names no running commit. A production whose release is not listed (`"live":[]`) still names
143 * the `version` and `commit` it runs: that build is the release (#15473).
144 */
145 export function newestRelease(answer: unknown, repo: string): { release: Release | undefined } | undefined {
146 const text = (answer as { result?: { content?: { text?: unknown }[] } } | undefined)?.result?.content?.[0]?.text;
147 if (typeof text !== "string") return undefined;
148 let value: unknown;
149 try {
150 value = JSON.parse(text);
151 } catch {
152 return undefined;
153 }
154 const list = (value as { releases?: unknown } | null)?.releases;
155 if (!Array.isArray(list)) return undefined;
156 for (const item of list as { repo?: unknown; version?: unknown; commit?: unknown }[]) {
157 if (item?.repo !== repo || typeof item.commit !== "string" || !/^[0-9a-f]{40}$/.test(item.commit)) continue;
158 const version = typeof item.version === "string" && item.version !== "" ? item.version.replace(/^v/, "") : undefined;
159 return { release: { name: version ? `v${version}` : item.commit.slice(0, 7), version, commit: item.commit } };
160 }
161 const top = value as { version?: unknown; commit?: unknown };
162 if (typeof top.commit !== "string" || !/^[0-9a-f]{40}$/.test(top.commit)) return { release: undefined };
163 const version = typeof top.version === "string" && /^v?\d+\.\d+\.\d+$/.test(top.version) ? top.version.replace(/^v/, "") : undefined;
164 return { release: { name: `running ${version ? `v${version}` : top.commit.slice(0, 7)}`, version, commit: top.commit, running: true } };
165 }
166
167 /**
168 * The full check's verdict on the running commit, as the public `releases` answer states it
169 * (#15514).
170 */
171 export interface RunningCheck {
172 readonly commit: string;
173 readonly state: string;
174 readonly runId: string | null;
175 }
176
177 /**
178 * The `check` the `releases` tool's answer names beside its running commit, or undefined when the
179 * answer says nothing of it (an older forge, or no check known).
180 */
181 export function runningCheckOf(answer: unknown): RunningCheck | undefined {
182 const text = (answer as { result?: { content?: { text?: unknown }[] } } | undefined)?.result?.content?.[0]?.text;
183 if (typeof text !== "string") return undefined;
184 let value: unknown;
185 try {
186 value = JSON.parse(text);
187 } catch {
188 return undefined;
189 }
190 const c = (value as { check?: { commit?: unknown; state?: unknown; runId?: unknown } | null } | null)?.check;
191 if (typeof c?.commit !== "string" || !/^[0-9a-f]{40}$/.test(c.commit) || typeof c.state !== "string") return undefined;
192 return { commit: c.commit, state: c.state, runId: typeof c.runId === "string" ? c.runId : null };
193 }
194
195 /**
196 * A POST the probe may send: MCP `initialize`, or `tools/call` of the read-only `releases` tool.
197 */
198 function readOnlyCall(body: unknown): boolean {
199 if (typeof body !== "string") return false;
200 try {
201 const m = JSON.parse(body) as { method?: unknown; params?: { name?: unknown } };
202 return m.method === "initialize" || (m.method === "tools/call" && m.params?.name === "releases");
203 } catch {
204 return false;
205 }
206 }
207
208 /** Runs every item against `base` and returns the lines in checklist order. */
209 export async function probe(base: string, repo: string, fetcher: Fetcher = fetch, now = Date.now(), edition?: string, token?: string): Promise<Line[]> {
210 const origin = new URL(base).origin;
211 const get = async (path: string, init?: RequestInit): Promise<Seen | string> => {
212 const url = new URL(path, origin);
213 const method = init?.method ?? "GET";
214 if (url.origin !== origin && !(method === "GET" && url.href === edition)) return `${url.href} is not on ${origin}`;
215 if (method !== "GET" && !(method === "POST" && url.pathname === "/mcp" && readOnlyCall(init?.body))) return `${method} is not a read`;
216 const started = performance.now();
217 try {
218 const r = await fetcher(url.href, { ...init, method, redirect: "manual", signal: AbortSignal.timeout(15_000) });
219 const body = await r.text();
220 return { status: r.status, headers: r.headers, body, ms: Math.round(performance.now() - started) };
221 } catch (e) {
222 return `no answer: ${e instanceof Error ? e.message : String(e)}`;
223 }
224 };
225 const at = (path: string): string => new URL(path, origin).href;
226 const json = (s: Seen): unknown => {
227 if (!(s.headers.get("content-type") ?? "").includes("json")) return undefined;
228 try {
229 return JSON.parse(s.body) as unknown;
230 } catch {
231 return undefined;
232 }
233 };
234 const api = `/api/v1/repos/${repo}`;
235 const lines: Line[] = [];
236 const say = (item: string, verdict: Verdict, path: string, evidence: string): void => {
237 lines.push({ item, verdict, url: at(path), evidence });
238 };
239
240 // 1. Sign-up and pricing.
241 const signup = await get("/signup");
242 if (typeof signup === "string") say("sign-up page", "UNKNOWN", "/signup", signup);
243 else if (signup.status === 200 && /<form/i.test(signup.body)) say("sign-up page", "PASS", "/signup", "200 with a form");
244 else say("sign-up page", "FAIL", "/signup", `${signup.status}${signup.status === 200 ? " without a form" : ""}`);
245 const pricing = await get("/pricing");
246 const price = typeof pricing === "string" ? undefined : PRICE.exec(pricing.body)?.[0];
247 if (typeof pricing === "string") say("pricing names a price", "UNKNOWN", "/pricing", pricing);
248 else if (pricing.status === 200 && price) say("pricing names a price", "PASS", "/pricing", `200, names ${price}`);
249 else say("pricing names a price", "FAIL", "/pricing", `${pricing.status}, names no price`);
250
251 // 2. Production's version, from MCP initialize, and the newest release, from the token-free
252 // `releases` tool (what /changelog shows anyone): `/tags` answers 404 to an anonymous read.
253 const mcp = (id: number, method: string, params: unknown) =>
254 get("/mcp", {
255 method: "POST",
256 headers: { "content-type": "application/json", accept: "application/json, text/event-stream" },
257 body: JSON.stringify({ jsonrpc: "2.0", id, method, params }),
258 });
259 const init = await mcp(1, "initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "v1-probe", version: "1" } });
260 const served = typeof init === "string" ? undefined : (json(init) as { result?: { serverInfo?: { version?: unknown } } } | undefined)?.result?.serverInfo?.version;
261 const announced = typeof served === "string" ? announcedOf(served) : undefined;
262 const shipped = await mcp(2, "tools/call", { name: "releases", arguments: { repo } });
263 const read = typeof shipped === "string" ? undefined : newestRelease(json(shipped), repo);
264 const releasePath = "/mcp";
265 const tagName = read?.release?.name;
266 const tagCommit = read?.release?.commit;
267 const unread = typeof shipped === "string" ? shipped : `${shipped.status}, the releases tool did not answer its JSON`;
268
269 // 3. The stranger journey's last green release: the public answer states the running commit's
270 // check (#15514); when it names another commit or none, the check API (which a stranger may not
271 // read) is asked. `unknown` (#15537) is a hosted forge whose host did not say: no verdict
272 // either, so it is asked the same way, and the line says the release could not tell.
273 const stated = typeof shipped === "string" ? undefined : runningCheckOf(json(shipped));
274 const own = stated !== undefined && stated.commit === tagCommit && stated.state !== "none" && stated.state !== "unknown" ? stated : undefined;
275 const untold = stated !== undefined && stated.commit === tagCommit && stated.state === "unknown";
276 const checkPath = own ? releasePath : tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath;
277 if (!read) say("stranger journey green on a release", "UNKNOWN", checkPath, `${unread}; a person must open the latest release's check`);
278 else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, `the releases tool lists no release of ${repo} and names no running commit`);
279 else {
280 const check = own === undefined ? await get(checkPath) : undefined;
281 const c = own ?? (check === undefined || typeof check === "string" ? undefined : (json(check) as { state?: unknown; runId?: unknown; finishedAt?: unknown } | undefined));
282 if (!c || typeof c.state !== "string") {
283 const asked = check === undefined ? "no check named" : typeof check === "string" ? check : `${check.status}, not the check's JSON`;
284 const why = untold ? `the release says its check is unknown (its host forge did not answer); ${asked}` : asked;
285 // A 404 can mean the base holds no such repository, as on an app's test copy of the forge
286 // (#15519): its own empty database states no verdict, however public the read, so the line
287 // names the forge to ask in place of a person.
288 const repoRead = typeof check === "object" && check.status === 404 ? await get(api) : undefined;
289 if (typeof repoRead === "object" && repoRead.status === 404) {
290 say("stranger journey green on a release", "UNKNOWN", api, `${origin} holds no public ${repo}, so it states no check of it; run the probe against the forge that holds ${repo}`);
291 } else say("stranger journey green on a release", "UNKNOWN", checkPath, `${why}; a person must open ${tagName}'s check and see the stranger tests green`);
292 } else if (c.state === "ok") say("stranger journey green on a release", "PASS", checkPath, `${tagName} (${tagCommit.slice(0, 9)}) full check ok, run ${String(c.runId)}, which runs the stranger tests`);
293 else if (c.state === "failed") say("stranger journey green on a release", "FAIL", checkPath, `${tagName} check failed, run ${String(c.runId)}`);
294 else say("stranger journey green on a release", "UNKNOWN", checkPath, `${tagName} check is ${c.state}`);
295 }
296
297 // 4. /changelog, /changelog.atom and production's version agree with the newest release.
298 if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`);
299 else if (!read) say("version agrees", "UNKNOWN", releasePath, `production says ${announced.text}; ${unread}`);
300 else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; the releases tool lists no release of ${repo} and names no running commit`);
301 else {
302 const r = read.release;
303 const agrees = announced.kind === "version" ? r.version === announced.text : r.commit.startsWith(announced.text);
304 const theirs = announced.kind === "version" ? (r.version ?? `no version (${r.commit.slice(0, 7)})`) : r.commit.slice(0, announced.text.length);
305 if (!agrees) say("version agrees", "FAIL", releasePath, `production says ${announced.text}, the newest release ${r.name} is ${theirs}`);
306 else {
307 const page = await get("/changelog");
308 const atom = await get("/changelog.atom");
309 const named = (s: Seen | string): boolean => typeof s !== "string" && s.status === 200 && ((r.version !== undefined && s.body.includes(r.version)) || s.body.includes(r.commit.slice(0, 7)));
310 const misses = [named(page) ? "" : "/changelog", named(atom) ? "" : "/changelog.atom"].filter(Boolean);
311 if (misses.length === 0) say("version agrees", "PASS", "/changelog", `production ${announced.text} = release ${r.name}, named by /changelog and /changelog.atom`);
312 else say("version agrees", "FAIL", misses[0] ?? "/changelog", `production ${announced.text} = release ${r.name}, but ${misses.join(" and ")} ${misses.length === 1 ? "does" : "do"} not name it`);
313 }
314 }
315
316 // 5. /healthz fast.
317 const health = await get("/healthz");
318 if (typeof health === "string") say("healthz fast", "FAIL", "/healthz", health);
319 else if (health.status === 200 && health.ms <= HEALTHZ_MS) say("healthz fast", "PASS", "/healthz", `200 in ${health.ms} ms`);
320 else say("healthz fast", "FAIL", "/healthz", `${health.status} in ${health.ms} ms (limit ${HEALTHZ_MS} ms)`);
321
322 // 6. Schedules (#11595) ran in the last 24 h: from `--edition`, else `<base>/edition` (#15474); a
323 // 404 on the default is UNKNOWN.
324 const item = "schedules ran in 24 h";
325 const byDefault = !edition;
326 const editionUrl = edition ?? at("/edition");
327 const page = await get(editionUrl);
328 const stamp = typeof page === "string" || page.status !== 200 ? undefined : editionDate(page.body, now);
329 if (typeof page === "string") say(item, "UNKNOWN", editionUrl, `${page}; a person must open ${editionUrl}`);
330 else if (page.status === 404 && byDefault) say(item, "UNKNOWN", editionUrl, `404, this release predates /edition; a person must open ${at(`/${repo}`)} signed in and read its Schedules card`);
331 else if (page.status !== 200) say(item, "UNKNOWN", editionUrl, `${page.status}, the page is not public; a person must open ${editionUrl}`);
332 else if (!stamp) say(item, "UNKNOWN", editionUrl, `200 with no <time datetime> or <updated>; a person must open ${editionUrl} and read the edition's date`);
333 else {
334 const ago = Math.round((now - stamp.at) / 60_000);
335 say(item, now - stamp.at <= DAY_MS ? "PASS" : "FAIL", editionUrl, `newest edition dated ${stamp.text}, ${ago} min ago`);
336 }
337
338 // 7. Security headers and CSP on / and /pricing.
339 for (const [path, seen] of [["/", await get("/")], ["/pricing", pricing]] as const) {
340 if (typeof seen === "string") {
341 say(`security headers on ${path}`, "UNKNOWN", path, seen);
342 continue;
343 }
344 const csp = seen.headers.get("content-security-policy") ?? "";
345 const missing = [
346 /default-src 'none'|default-src 'self'/.test(csp) ? "" : "content-security-policy",
347 seen.headers.get("x-content-type-options") === "nosniff" ? "" : "x-content-type-options",
348 seen.headers.get("referrer-policy") ? "" : "referrer-policy",
349 ].filter(Boolean);
350 if (missing.length === 0) say(`security headers on ${path}`, "PASS", path, `CSP, nosniff, referrer-policy ${seen.headers.get("referrer-policy")}`);
351 else say(`security headers on ${path}`, "FAIL", path, `missing ${missing.join(", ")}`);
352 }
353
354 // 8. The release keeper's newest beat: the public pulse first (#15524), then, when a release
355 // before it answers none, `/api/v1/keeper` for a caller holding a token (#15449). A refusal is
356 // worded by its cause (#15520), read from `/api/v1/here` with the same token: a 401 is a token
357 // this forge knows no account for; "anonymous" means the header never reached the forge (a proxy
358 // in front strips `authorization`, as the hosting forge's app proxy does for every app); a name
359 // is an account without the right.
360 const keeperRefusal = async (status: number): Promise<string> => {
361 if (status === 401) return NOT_ACCEPTED(status, origin);
362 if (status !== 403) return `${status}, the keeper did not answer`;
363 const here = await get("/api/v1/here?path=/", { headers: { authorization: `Bearer ${token}` } });
364 if (typeof here === "string") return `403, and /api/v1/here did not answer: ${here}`;
365 if (here.status === 401) return NOT_ACCEPTED(status, origin);
366 const you = (json(here) as { you?: { as?: unknown } } | undefined)?.you;
367 if (you?.as === "anonymous") return `403, the token did not reach ${origin}: a proxy in front strips the authorization header, so this forge saw no one`;
368 const as = typeof you?.as === "string" ? you.as.replace(/[^\w-]/g, "") : "unknown";
369 return `403, this token's account (here a ${as}) may not read the release history: it must write the forge's repository or administer`;
370 };
371 const pulseSeen = await get(PULSE_PATH);
372 const pulse = typeof pulseSeen === "string" || pulseSeen.status !== 200 ? undefined : pulseOf(json(pulseSeen));
373 if (pulse === null) say(KEEPER_ITEM, "UNKNOWN", PULSE_PATH, "no heartbeat yet: the release tick has not reported");
374 else if (pulse !== undefined) say(KEEPER_ITEM, pulseVerdict(pulse), PULSE_PATH, pulseWords(pulse));
375 else if (token) {
376 const keeper = await get("/api/v1/keeper", { headers: { authorization: `Bearer ${token}` } });
377 const beat = keeperBeat(typeof keeper === "string" ? undefined : json(keeper));
378 if (typeof keeper === "string") say(KEEPER_ITEM, "UNKNOWN", "/api/v1/keeper", keeper);
379 else if (keeper.status !== 200) say(KEEPER_ITEM, "UNKNOWN", "/api/v1/keeper", await keeperRefusal(keeper.status));
380 else if (beat === undefined) say(KEEPER_ITEM, "UNKNOWN", "/api/v1/keeper", "200 without a heartbeat: the release tick has not reported yet");
381 else {
382 const words = `${beat.outcome} at ${beat.at}${beat.silent ? " (silent for over an hour)" : ""}: ${beat.reason}`;
383 say(KEEPER_ITEM, beat.outcome === "failed" || beat.silent ? "FAIL" : "PASS", "/api/v1/keeper", words);
384 }
385 }
386 return lines;
387 }
388
389 export const KEEPER_ITEM = "keeper's last beat";
390 export const PULSE_PATH = "/api/v1/keeper/pulse";
391
392 /** A public pulse's beat (#15524). */
393 export interface Pulse {
394 readonly at: string;
395 readonly outcome: string;
396 readonly silent: boolean;
397 }
398
399 /**
400 * The pulse answer read: null when it says no beat yet (`{at: null}`), undefined when it is not a
401 * pulse at all; its words stripped of control characters.
402 */
403 export function pulseOf(answer: unknown): Pulse | null | undefined {
404 if (answer === null || typeof answer !== "object") return undefined;
405 const { at, outcome, silent } = answer as Record<string, unknown>;
406 if (at === null) return null;
407 if (typeof at !== "string" || typeof outcome !== "string") return undefined;
408 const plain = (t: string) => t.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").slice(0, 60);
409 return { at: plain(at), outcome: plain(outcome), silent: silent === true };
410 }
411
412 export const pulseVerdict = (p: Pulse): Verdict => (p.outcome === "failed" || p.silent ? "FAIL" : "PASS");
413 export const pulseWords = (p: Pulse): string => `${p.outcome} at ${p.at}${p.silent ? " (silent: no beat for over a day)" : ""}`;
414
415 const NOT_ACCEPTED = (status: number, origin: string) =>
416 `${status}, token not accepted here: ${origin} knows no account for it (a token from another forge?)`;
417
418 /**
419 * The keeper answer's `heartbeat`, its words stripped of control characters; undefined when it has
420 * none.
421 */
422 export function keeperBeat(answer: unknown): { at: string; outcome: string; reason: string; silent: boolean } | undefined {
423 const h = (answer as { heartbeat?: unknown } | null | undefined)?.heartbeat as Record<string, unknown> | null | undefined;
424 if (h === null || typeof h !== "object") return undefined;
425 const { at, outcome, reason, silent } = h;
426 if (typeof at !== "string" || typeof outcome !== "string" || typeof reason !== "string") return undefined;
427 const plain = (t: string) => t.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").slice(0, 300);
428 return { at: plain(at), outcome: plain(outcome), reason: plain(reason), silent: silent === true };
429 }
430
431 export const formatLine = (l: Line): string => `${l.verdict.padEnd(7)} ${l.item}: ${l.url} - ${l.evidence}`;
43260
43361 if (import.meta.main) {
43462 const parsed = parseArgs(process.argv.slice(2));
src/contract/openapi/routes/getApiV1ProofDaily.ts added +10
@@ -0,0 +1,10 @@
1 import type { Route } from "../shared.ts";
2
3 export const route: Route = {
4 method: "get",
5 path: "/api/v1/proof/daily",
6 summary: "The daily proof of production",
7 detail: "The newest daily run of the v1 checks against the forge's own public origin, for anyone: `at`, `pass` and `total`, and each line's `item`, `verdict` (PASS, FAIL or UNKNOWN), `url` and `evidence` (one plain line, nothing credential-shaped). `{at: null}` before the first run",
8 auth: false,
9 role: "anonymous",
10 };
src/contract/openapi/routes/index.ts +1
@@ -130,6 +130,7 @@ export { route as getApiV1Packs } from "./getApiV1Packs.ts";
130130 export { route as getApiV1PacksName } from "./getApiV1PacksName.ts";
131131 export { route as getApiV1PassportHealth } from "./getApiV1PassportHealth.ts";
132132 export { route as getApiV1Plans } from "./getApiV1Plans.ts";
133 export { route as getApiV1ProofDaily } from "./getApiV1ProofDaily.ts";
133134 export { route as getApiV1ReachAsks } from "./getApiV1ReachAsks.ts";
134135 export { route as getApiV1Releases } from "./getApiV1Releases.ts";
135136 export { route as getApiV1Repos } from "./getApiV1Repos.ts";
src/contract/tags.ts +1
@@ -59,6 +59,7 @@ const ALIAS: Readonly<Record<string, string>> = {
5959 metrics: "meta",
6060 packs: "meta",
6161 keeper: "meta",
62 proof: "meta",
6263 heartbeat: "meta",
6364 broker: "meta",
6465 telemetry: "meta",
src/core/migration-pins/20261122120000-daily-proof.pin added +1
@@ -0,0 +1,1 @@
1 205554adb3a98d3e30fce3fcb22925737d387496ce3b9af92b443f353e661c18
src/core/migrations/20261122120000-daily-proof.ts added +18
@@ -0,0 +1,18 @@
1 // The daily proof (#15625, release/daily_proof.ts): each run of the v1 checks against the forge's
2 // own public origin, its lines as JSON (the newest 30 kept), and the lines that ask the owner, one
3 // row a line while it stays failed, deleted when it passes. Telemetry, not history: a lost row is
4 // a run to make again tomorrow.
5 export default `
6 CREATE TABLE daily_proof_run (
7 id INTEGER PRIMARY KEY AUTOINCREMENT,
8 at TEXT NOT NULL,
9 lines TEXT NOT NULL
10 );
11 CREATE TABLE daily_proof_ask (
12 item TEXT PRIMARY KEY,
13 raised_at TEXT NOT NULL,
14 verdict TEXT NOT NULL,
15 url TEXT NOT NULL,
16 evidence TEXT NOT NULL
17 );
18 `;
src/flow/alarms.ts +7 −3
@@ -25,9 +25,10 @@ import { releaseQuietAlarm } from "./alarm_release_quiet.ts";
2525 import { alarmSilent } from "./alarm_silent.ts";
2626 import { alarmStuck } from "./alarm_stuck.ts";
2727 import { cloneBreaker } from "../crew/clone_breaker.ts";
28 import { proofAlarm } from "../release/daily_proof.ts";
2829
2930 export interface FiredAlarm {
30 readonly key: "landing_stopped" | "red_main" | "stuck" | "idle_crew" | "no_release" | "main_ahead" | "release_quiet" | "lane_stopped" | "bug_clock" | "silent" | "repeat" | "from_app" | "unreachable" | "backup" | "paid_order" | "clone_failing";
31 readonly key: "landing_stopped" | "red_main" | "stuck" | "idle_crew" | "no_release" | "main_ahead" | "release_quiet" | "lane_stopped" | "bug_clock" | "silent" | "repeat" | "from_app" | "unreachable" | "backup" | "paid_order" | "clone_failing" | "daily_proof";
3132 readonly says: string;
3233 readonly since: string;
3334 /** A same-origin path to the item the alarm names. */
@@ -47,10 +48,11 @@ function redMainHref(db: Database): string {
4748 * The alarms that say the forge itself is broken or its data is at risk: main is red, landing
4849 * or the lane has stopped, the backup failed, no release will go out. The only alarms the home
4950 * page counts (one line, `web/pages/home_flow.ts`) and `/asks` lists under "The forge"; the crew
50 * dying on its clones (`crew/clone_breaker.ts`) is one. An
51 * dying on its clones (`crew/clone_breaker.ts`) is one, and so is a line of the daily proof of
52 * production that asks (`release/daily_proof.ts`, #15625). An
5153 * approved pull that sits (`stuck`) is not one: it is work standing still, listed on `/asks`.
5254 */
53 export const FORGE_BROKEN: ReadonlySet<FiredAlarm["key"]> = new Set(["red_main", "landing_stopped", "lane_stopped", "backup", "no_release", "clone_failing"]);
55 export const FORGE_BROKEN: ReadonlySet<FiredAlarm["key"]> = new Set(["red_main", "landing_stopped", "lane_stopped", "backup", "no_release", "clone_failing", "daily_proof"]);
5456
5557 export function firedAlarms(
5658 db: Database,
@@ -87,6 +89,8 @@ export function firedAlarms(
8789 if (clone.fired) out.push({ key: "clone_failing", says: clone.says, since: clone.since!, href: "/boards" });
8890 const idle = alarmIdleCrew(db, now, { ceilingUsd: opts.ceilingUsd ?? null });
8991 if (idle.fired) out.push({ key: "idle_crew", says: idle.says, since: idle.since!, href: "/boards" });
92 const proof = proofAlarm(db);
93 if (proof.fired) out.push({ key: "daily_proof", says: proof.says, since: proof.since!, href: "/status" });
9094 }
9195 const release = noReleaseAlarm(db, now);
9296 if (release.fired) out.push({ key: "no_release", says: release.says, since: release.since!, href: "/releases" });
src/http/api.ts +2
@@ -390,6 +390,7 @@ import { economicsRoutes } from "./api/economics.ts";
390390 import { releasesRoutes } from "./api/releases.ts";
391391 import { hookRoutes } from "./api/hooks.ts";
392392 import { keeperRoutes } from "./api/keeper.ts";
393 import { dailyProofRoutes } from "./api/daily_proof.ts";
393394 import { agentRoutes } from "./api/agents.ts";
394395 import { subscriptionRoutes } from "./api/subscriptions.ts";
395396 import { boardRoutes } from "./api/boards.ts";
@@ -3563,6 +3564,7 @@ export function apiRoutes(router: Router<Handler>, isPage: (path: string) => boo
35633564
35643565 hookRoutes(router);
35653566 keeperRoutes(router);
3567 dailyProofRoutes(router);
35663568
35673569 // Sync one mirror, or let a fork take its parent's updates. A mirror only
35683570 // pulls, so any writer may ask. A fork fast-forwards, or writes a merge
src/http/api/daily_proof.ts added +20
@@ -0,0 +1,20 @@
1 /**
2 * `GET /api/v1/proof/daily` (#15625): the daily proof's newest run for anyone, like the keeper's
3 * pulse: when it ran, how many of its lines pass, and each line's item, verdict, URL and evidence,
4 * the evidence plain (`plainEvidence`: no control characters, nothing credential-shaped, capped).
5 * Named fields only, so nothing new on a run leaks by spreading it. `{at: null}` before the first.
6 */
7
8 import { notePhase, takeSessionTime } from "../../core/route_timing.ts";
9 import { proofAnswer } from "../../release/daily_proof.ts";
10 import type { Handler } from "../context.ts";
11 import type { Router } from "../router.ts";
12
13 export function dailyProofRoutes(router: Router<Handler>): void {
14 router.add("GET", "/api/v1/proof/daily", (ctx) => {
15 notePhase(ctx.request, "session", takeSessionTime(ctx.request));
16 return new Response(JSON.stringify(proofAnswer(ctx.app.db)), {
17 headers: { "content-type": "application/json", "cache-control": "no-cache" },
18 });
19 });
20 }
src/http/marks/api-v1-proof.json added +4
@@ -0,0 +1,4 @@
1 {
2 "head": "/api/v1/proof",
3 "mark": "open"
4 }
src/maintain/duties/daily_proof.ts added +34
@@ -0,0 +1,34 @@
1 /**
2 * The daily proof (#15625): once a day, the v1 checks against the forge's own public origin
3 * (`FORGE_URL`), read-only, no token, 60 s for the whole run; see `../../release/daily_proof.ts`.
4 * A line that asks the owner is a finding too, so the run's row says what the ask says.
5 */
6
7 import { ownRepoPath } from "../../kernel/own_repo.ts";
8 import { publicOrigin } from "../../core/public_origin.ts";
9 import { BUDGET_MS, proveDaily, recordRun } from "../../release/daily_proof.ts";
10 import type { Fetcher } from "../../release/v1_checks.ts";
11 import type { Duty, Finding } from "../duty.ts";
12
13 export function dailyProof(fetcher: Fetcher = fetch, budget: () => AbortSignal = () => AbortSignal.timeout(BUDGET_MS)): Duty {
14 return {
15 name: "daily-proof",
16 intervalMs: 86_400_000,
17 // The checks stop themselves at their budget; the runner waits a little past it for the lines.
18 timeoutMs: BUDGET_MS + 5_000,
19 budget: { runsPerDay: 2, dollarsPerDay: 1, reason: "daily is one a day; the second is room for a restart, and it spends no money" },
20 async run({ db, now, app }) {
21 const url = app?.config.url;
22 if (url === undefined || url === "") return { findings: [], actions: ["skipped: this forge does not know its public origin (FORGE_URL)"] };
23 const lines = await proveDaily(publicOrigin(url, ""), app?.config.forgeRepo || ownRepoPath(), fetcher, now.getTime(), budget());
24 const done = recordRun(db, lines, now);
25 const findings: Finding[] = done.raised.map((l) => ({
26 summary: `daily proof: ${l.item} is ${l.verdict}`,
27 probe: { kind: "measurement", what: `${l.url}: ${l.verdict === "FAIL" ? "1 is a failure" : "1 is unknown where it passed the day before"}`, number: 1, at: now.toISOString() },
28 }));
29 return { findings, actions: done.said };
30 },
31 };
32 }
33
34 export const duty: Duty = dailyProof();
src/maintain/duty.ts +5
@@ -47,6 +47,11 @@ export interface Duty {
4747 /** Lowercase words and dashes; the row's `duty`. */
4848 readonly name: string;
4949 readonly intervalMs: number;
50 /**
51 * How long the runner waits for this duty before it records it as timed out; the runner's own
52 * (`DUTY_TIMEOUT_MS`) when unset. For a duty whose work has a longer budget of its own.
53 */
54 readonly timeoutMs?: number;
5055 readonly budget: DutyBudget;
5156 readonly run: (ctx: DutyContext) => DutyResult | Promise<DutyResult>;
5257 }
src/maintain/runner.ts +1 −1
@@ -56,7 +56,7 @@ export function startMaintain(app: App, options: { duties?: readonly Duty[]; eve
5656 work.then(() => running.delete(duty.name), () => running.delete(duty.name));
5757 let timer: ReturnType<typeof setTimeout> | undefined;
5858 const deadline = new Promise<never>((_, reject) => {
59 timer = setTimeout(() => reject(new Error("timed out")), timeoutMs);
59 timer = setTimeout(() => reject(new Error("timed out")), duty.timeoutMs ?? timeoutMs);
6060 });
6161 const result = await Promise.race([work, deadline]).finally(() => clearTimeout(timer));
6262 const refused = refusal(result.findings);
src/perf/page_budgets/maintenance.ts +2 −2
@@ -5,6 +5,6 @@ import type { PageBudget } from "../page_budget.ts";
55 // over the duties would still show. One query reads every dismissal (#13967), one every quieted
66 // finding (#14557); one grouped read of the degraded findings (#14577); +3: the edge-kept duty
77 // (#14682); one grouped read of every duty's last run (#14674); +3: the deepsec-sweep duty
8 // (#15026). 90 is the steady count measured
8 // (#15026); +3: the daily-proof duty (#15625). 93 is the steady count measured
99 // warm on every run, not a load-sensitive figure.
10 export const budget: PageBudget = { page: "maintenance", pattern: "/maintenance", medianMs: 50, statements: 90 };
10 export const budget: PageBudget = { page: "maintenance", pattern: "/maintenance", medianMs: 50, statements: 93 };
src/release/daily_proof.ts added +217
@@ -0,0 +1,217 @@
1 /**
2 * The daily proof (#15625): the v1 checks (`v1_checks.ts`, what `scripts/v1-probe.ts` runs by
3 * hand) run once a day in process against the forge's own public origin, read-only and with no
4 * token, within `BUDGET_MS`. Plain data in, plain data out; the duty
5 * (`maintain/duties/daily_proof.ts`) is the clock.
6 *
7 * A line asks the owner when it is FAIL, or UNKNOWN where the run before had it PASS (an UNKNOWN
8 * that never passed is what an anonymous read cannot prove, not a regression). An asking line is
9 * one `daily_proof_ask` row from the run that raised it until a run where it passes, so it asks
10 * once however many days it stays failed; its verdict and evidence follow the newest run. A run of
11 * all PASS clears every ask and says so in one line. The asks are one flow alarm, `daily_proof`,
12 * whose `since` is the newest raise: the notifier tells the owner once per `since`, so a second
13 * line failing is a new ask and a line that stays failed is not.
14 *
15 * `/status`, its terminal screen and `GET /api/v1/proof/daily` read the newest run; what they
16 * show passes through `plainEvidence`, so no credential-shaped text or control character leaves.
17 */
18
19 import type { Database } from "bun:sqlite";
20 import { redactSecrets } from "../kernel/log.ts";
21 import { probe, type Fetcher, type Line, type Verdict } from "./v1_checks.ts";
22
23 /** The whole run's budget: every read the checks make, together. */
24 export const BUDGET_MS = 60_000;
25 /** Runs kept: a month of days. */
26 export const KEEP_RUNS = 30;
27 const EVIDENCE_MAX = 240;
28 const VERDICTS: ReadonlySet<string> = new Set<Verdict>(["PASS", "FAIL", "UNKNOWN"]);
29
30 export interface ProofRun {
31 readonly at: string;
32 readonly lines: readonly Line[];
33 }
34
35 export interface ProofAsk {
36 readonly item: string;
37 readonly raisedAt: string;
38 readonly verdict: Verdict;
39 readonly url: string;
40 readonly evidence: string;
41 }
42
43 /** What recording one run did. */
44 export interface Recorded {
45 /** The lines that asked the owner in this run. */
46 readonly raised: readonly Line[];
47 /** The items whose ask this run cleared. */
48 readonly cleared: readonly string[];
49 /** One sentence per thing done, for the duty's row. */
50 readonly said: readonly string[];
51 }
52
53 /**
54 * Evidence as the public may read it: one line, no control characters, nothing credential-shaped,
55 * capped.
56 */
57 export function plainEvidence(text: string): string {
58 const flat = redactSecrets(text.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ")).trim();
59 return flat.length > EVIDENCE_MAX ? `${flat.slice(0, EVIDENCE_MAX - 1)}…` : flat;
60 }
61
62 /**
63 * Runs the checks once against `base`, reading `repo`: no token, no edition page but the base's
64 * own, and every read bounded together by `budget` (60 s by default).
65 */
66 export function proveDaily(
67 base: string,
68 repo: string,
69 fetcher: Fetcher = fetch,
70 now = Date.now(),
71 budget: AbortSignal = AbortSignal.timeout(BUDGET_MS),
72 ): Promise<Line[]> {
73 return probe(base, repo, fetcher, now, undefined, undefined, budget);
74 }
75
76 const isLine = (v: unknown): v is Line => {
77 const l = v as Partial<Line> | null;
78 return typeof l?.item === "string" && typeof l.url === "string" && typeof l.evidence === "string" && VERDICTS.has(String(l.verdict));
79 };
80
81 /** The newest run, or undefined before the first. */
82 export function lastRun(db: Database): ProofRun | undefined {
83 const row = db.query<{ at: string; lines: string }, []>("SELECT at, lines FROM daily_proof_run ORDER BY id DESC LIMIT 1").get();
84 if (row === null) return undefined;
85 let parsed: unknown;
86 try {
87 parsed = JSON.parse(row.lines);
88 } catch {
89 parsed = [];
90 }
91 return { at: row.at, lines: Array.isArray(parsed) ? parsed.filter(isLine) : [] };
92 }
93
94 /** The lines asking the owner now, oldest raise first. */
95 export function openAsks(db: Database): ProofAsk[] {
96 return db
97 .query<{ item: string; raised_at: string; verdict: Verdict; url: string; evidence: string }, []>(
98 "SELECT item, raised_at, verdict, url, evidence FROM daily_proof_ask ORDER BY raised_at, item",
99 )
100 .all()
101 .map((r) => ({ item: r.item, raisedAt: r.raised_at, verdict: r.verdict, url: r.url, evidence: r.evidence }));
102 }
103
104 /** Whether a line asks the owner, given what the run before said of the same item. */
105 export const asks = (line: Line, before: Verdict | undefined): boolean =>
106 line.verdict === "FAIL" || (line.verdict === "UNKNOWN" && before === "PASS");
107
108 /**
109 * Keeps one run's lines and moves the asks: raises the new, keeps the standing, clears the passing.
110 */
111 export function recordRun(db: Database, lines: readonly Line[], at: Date): Recorded {
112 const iso = at.toISOString();
113 const before = new Map((lastRun(db)?.lines ?? []).map((l) => [l.item, l.verdict] as const));
114 const open = new Set(openAsks(db).map((a) => a.item));
115 const allPass = lines.length > 0 && lines.every((l) => l.verdict === "PASS");
116 const raised: Line[] = [];
117 const cleared: string[] = [];
118 db.transaction(() => {
119 db.run("INSERT INTO daily_proof_run (at, lines) VALUES (?1, ?2)", [iso, JSON.stringify(lines)]);
120 db.run("DELETE FROM daily_proof_run WHERE id <= (SELECT id FROM daily_proof_run ORDER BY id DESC LIMIT 1 OFFSET ?1)", [KEEP_RUNS]);
121 for (const l of lines) {
122 if (l.verdict === "PASS") {
123 if (open.delete(l.item)) cleared.push(l.item);
124 db.run("DELETE FROM daily_proof_ask WHERE item = ?1", [l.item]);
125 } else if (open.has(l.item)) {
126 db.run("UPDATE daily_proof_ask SET verdict = ?2, url = ?3, evidence = ?4 WHERE item = ?1", [l.item, l.verdict, l.url, plainEvidence(l.evidence)]);
127 } else if (asks(l, before.get(l.item))) {
128 raised.push(l);
129 db.run("INSERT INTO daily_proof_ask (item, raised_at, verdict, url, evidence) VALUES (?1, ?2, ?3, ?4, ?5)", [l.item, iso, l.verdict, l.url, plainEvidence(l.evidence)]);
130 }
131 }
132 // A day of all PASS leaves nothing asking, whatever line an ask was raised for.
133 if (allPass) {
134 cleared.push(...open);
135 db.run("DELETE FROM daily_proof_ask");
136 }
137 })();
138 const said: string[] = raised.map((l) => `asked the owner: ${l.item} is ${l.verdict}: ${plainEvidence(l.evidence)}`);
139 if (allPass) said.push(cleared.length > 0 ? `all ${lines.length} pass: cleared ${cleared.join(", ")}` : `all ${lines.length} pass`);
140 else {
141 if (cleared.length > 0) said.push(`passes again: ${cleared.join(", ")}`);
142 const passing = lines.filter((l) => l.verdict === "PASS").length;
143 said.push(`${passing} of ${lines.length} pass`);
144 }
145 return { raised, cleared, said };
146 }
147
148 /** How long ago, in the fewest words: `12 min ago`, `6 h ago`, `3 days ago`. */
149 export function sinceWords(ms: number): string {
150 const min = Math.max(0, Math.floor(ms / 60_000));
151 if (min < 60) return `${min} min ago`;
152 const h = Math.floor(min / 60);
153 return h < 48 ? `${h} h ago` : `${Math.floor(h / 24)} days ago`;
154 }
155
156 /** The newest run as counts: how many lines, how many pass, when. */
157 export interface ProofTally {
158 readonly at: string;
159 readonly pass: number;
160 readonly total: number;
161 }
162
163 export function tally(run: ProofRun): ProofTally {
164 return { at: run.at, pass: run.lines.filter((l) => l.verdict === "PASS").length, total: run.lines.length };
165 }
166
167 /** `11 of 11 pass, 6 h ago`, or that it has not run. */
168 export function tallyWords(t: ProofTally | undefined, now: number): string {
169 if (t === undefined) return "not run yet";
170 return `${t.pass} of ${t.total} pass, ${sinceWords(now - Date.parse(t.at))}`;
171 }
172
173 /** The owner's ask while any line asks: the lines and their evidence, since the newest raise. */
174 export function proofAlarm(db: Database): { fired: boolean; since?: string; says: string } {
175 const open = openAsks(db);
176 if (open.length === 0) return { fired: false, says: "Every line of the daily proof passes, or has not asked." };
177 const since = open.reduce((a, b) => (b.raisedAt > a ? b.raisedAt : a), open[0]!.raisedAt);
178 const named = open.map((a) => `${a.item} is ${a.verdict} (${a.evidence})`).join("; ");
179 return { fired: true, since, says: `The daily proof of production: ${named}.` };
180 }
181
182 /**
183 * The public answer: the newest run's counts and its lines, named fields only, evidence plain.
184 * `{at: null}` before the first run.
185 */
186 export function proofAnswer(db: Database):
187 | { at: null }
188 | { at: string; pass: number; total: number; lines: { item: string; verdict: Verdict; url: string; evidence: string }[] } {
189 const run = lastRun(db);
190 if (run === undefined) return { at: null };
191 const t = tally(run);
192 return {
193 at: t.at,
194 pass: t.pass,
195 total: t.total,
196 lines: run.lines.map((l) => ({ item: l.item, verdict: l.verdict, url: l.url, evidence: plainEvidence(l.evidence) })),
197 };
198 }
199
200 /** The newest run as `/status` and its terminal screen say it; undefined before the first run. */
201 export interface ProofStatus extends ProofTally {
202 /** `pass` when every line passes, `fail` when one fails, `unknown` otherwise. */
203 readonly state: "pass" | "fail" | "unknown";
204 /** `11 of 11 pass, 6 h ago`. */
205 readonly says: string;
206 }
207
208 export function proofStatus(db: Database, now: number): ProofStatus | undefined {
209 const run = lastRun(db);
210 if (run === undefined) return undefined;
211 const t = tally(run);
212 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) };
214 }
215
216 /** The row's name on `/status` and its terminal screen. */
217 export const PROOF_ROW = "daily proof";
src/release/v1_checks.ts added +420
@@ -0,0 +1,420 @@
1 /**
2 * The v1.0.0 checklist (#15366) as plain checks: `probe` reads a running forge and returns one
3 * line per item, `PASS`, `FAIL` or `UNKNOWN`, with the URL and the evidence. Two callers share it:
4 * `scripts/v1-probe.ts`, by hand, and the daily proof (`daily_proof.ts`, #15625), in process.
5 *
6 * Read-only: every request is a GET, apart from one MCP `initialize` and one `tools/call` of the
7 * token-free `releases` tool (POSTs that change nothing), and every request goes to `base`, apart
8 * from one GET of `edition`, and reads only `repo`. It never signs in, pays or writes; a request
9 * that is not one of those is refused before it is sent.
10 *
11 * `keeper's last beat` reads `/api/v1/keeper/pulse` with no token (#15524): the release tick's
12 * newest outcome, when, and whether it has gone silent; FAIL when it failed or is silent. Only
13 * when the pulse is absent (a release before it) and `FORGE_TOKEN` is set (the crew's token for
14 * the forge's repository is enough, #15449) does it GET `/api/v1/keeper` with that token, which
15 * also names the reason. The token is sent to `base` only, and to two endpoints only:
16 * `/api/v1/keeper`, and `/api/v1/here` when the keeper answers 403, to word the refusal by its
17 * cause (#15520).
18 *
19 * The schedules line reads `<base-url>/edition` (#15474), the morning paper's edition page; a 404
20 * there is UNKNOWN, `this release predates /edition`. `edition` (the script's `--edition`) is
21 * another public page a scheduled app prints, and wins (#15388): its newest `<time datetime>` or
22 * `<updated>` is when the schedule last ran, the schedules API answers 404 to an anonymous read.
23 *
24 * The stranger-journey line reads the full check's verdict that the same `releases` answer states
25 * beside its running commit (`check`, #15514); only when it names no verdict on the newest
26 * release's commit is the check API asked, which answers 404 to an anonymous read.
27 * When that answers 404 and so does the repository itself, the base holds no such repository (an
28 * app's test copy of the forge, #15519) and the line names the forge to ask.
29 *
30 * UNKNOWN is what an anonymous read cannot prove; the line says what a person must check.
31 */
32
33 export type Verdict = "PASS" | "FAIL" | "UNKNOWN";
34
35 export interface Line {
36 readonly item: string;
37 readonly verdict: Verdict;
38 readonly url: string;
39 readonly evidence: string;
40 }
41
42 /** What one request saw: status, the headers named, the body, how long it took. */
43 interface Seen {
44 readonly status: number;
45 readonly headers: Headers;
46 readonly body: string;
47 readonly ms: number;
48 }
49
50 export type Fetcher = (url: string, init?: RequestInit) => Promise<Response>;
51
52 /** Healthz slower than this is a FAIL: the common request answers in milliseconds. */
53 export const HEALTHZ_MS = 500;
54 const DAY_MS = 24 * 60 * 60 * 1000;
55 const PRICE = /[$€£]\s?\d+(?:[.,]\d+)?/;
56
57 const STAMP = /<time\b[^>]*\bdatetime\s*=\s*["']([^"']{1,40})["']|<updated>\s*([^<]{1,40}?)\s*<\/updated>/gi;
58 const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
59
60 /**
61 * When the newest edition on a printed page was made: the latest `<time datetime>` or Atom
62 * `<updated>` not more than an hour ahead of `now`. A date with no time counts as the end of that
63 * day (UTC) capped at `now`, kept once its day has begun, so a paper dated today or yesterday is
64 * fresh whatever its time zone.
65 */
66 export function editionDate(body: string, now: number): { at: number; text: string } | undefined {
67 let best: { at: number; text: string } | undefined;
68 for (const m of body.matchAll(STAMP)) {
69 const text = (m[1] ?? m[2] ?? "").trim();
70 const parsed = Date.parse(text);
71 if (!Number.isFinite(parsed)) continue;
72 if (parsed - now > 60 * 60 * 1000) continue;
73 const at = DATE_ONLY.test(text) ? Math.min(parsed + DAY_MS, now) : parsed;
74 if (!best || at > best.at) best = { at, text };
75 }
76 return best;
77 }
78
79 /** What production announced: a release number, or the short commit of an unstamped build. */
80 export function announcedOf(served: string): { kind: "version" | "commit"; text: string } | undefined {
81 if (/^v?\d+\.\d+\.\d+$/.test(served)) return { kind: "version", text: served.replace(/^v/, "") };
82 if (/^[0-9a-f]{7,40}$/.test(served)) return { kind: "commit", text: served };
83 return undefined;
84 }
85
86 /** The newest release of `repo` in the `releases` tool's answer. */
87 export interface Release {
88 readonly name: string;
89 readonly version: string | undefined;
90 readonly commit: string;
91 /** True when no release is listed and this is the running build the answer names (#15473). */
92 readonly running?: true;
93 }
94
95 /**
96 * The newest release of `repo` from a `tools/call releases` JSON-RPC answer: undefined when the
97 * answer is not the tool's JSON (no source answered), `{ release: undefined }` when it lists none
98 * and names no running commit. A production whose release is not listed (`"live":[]`) still names
99 * the `version` and `commit` it runs: that build is the release (#15473).
100 */
101 export function newestRelease(answer: unknown, repo: string): { release: Release | undefined } | undefined {
102 const text = (answer as { result?: { content?: { text?: unknown }[] } } | undefined)?.result?.content?.[0]?.text;
103 if (typeof text !== "string") return undefined;
104 let value: unknown;
105 try {
106 value = JSON.parse(text);
107 } catch {
108 return undefined;
109 }
110 const list = (value as { releases?: unknown } | null)?.releases;
111 if (!Array.isArray(list)) return undefined;
112 for (const item of list as { repo?: unknown; version?: unknown; commit?: unknown }[]) {
113 if (item?.repo !== repo || typeof item.commit !== "string" || !/^[0-9a-f]{40}$/.test(item.commit)) continue;
114 const version = typeof item.version === "string" && item.version !== "" ? item.version.replace(/^v/, "") : undefined;
115 return { release: { name: version ? `v${version}` : item.commit.slice(0, 7), version, commit: item.commit } };
116 }
117 const top = value as { version?: unknown; commit?: unknown };
118 if (typeof top.commit !== "string" || !/^[0-9a-f]{40}$/.test(top.commit)) return { release: undefined };
119 const version = typeof top.version === "string" && /^v?\d+\.\d+\.\d+$/.test(top.version) ? top.version.replace(/^v/, "") : undefined;
120 return { release: { name: `running ${version ? `v${version}` : top.commit.slice(0, 7)}`, version, commit: top.commit, running: true } };
121 }
122
123 /**
124 * The full check's verdict on the running commit, as the public `releases` answer states it
125 * (#15514).
126 */
127 export interface RunningCheck {
128 readonly commit: string;
129 readonly state: string;
130 readonly runId: string | null;
131 }
132
133 /**
134 * The `check` the `releases` tool's answer names beside its running commit, or undefined when the
135 * answer says nothing of it (an older forge, or no check known).
136 */
137 export function runningCheckOf(answer: unknown): RunningCheck | undefined {
138 const text = (answer as { result?: { content?: { text?: unknown }[] } } | undefined)?.result?.content?.[0]?.text;
139 if (typeof text !== "string") return undefined;
140 let value: unknown;
141 try {
142 value = JSON.parse(text);
143 } catch {
144 return undefined;
145 }
146 const c = (value as { check?: { commit?: unknown; state?: unknown; runId?: unknown } | null } | null)?.check;
147 if (typeof c?.commit !== "string" || !/^[0-9a-f]{40}$/.test(c.commit) || typeof c.state !== "string") return undefined;
148 return { commit: c.commit, state: c.state, runId: typeof c.runId === "string" ? c.runId : null };
149 }
150
151 /**
152 * A POST the probe may send: MCP `initialize`, or `tools/call` of the read-only `releases` tool.
153 */
154 function readOnlyCall(body: unknown): boolean {
155 if (typeof body !== "string") return false;
156 try {
157 const m = JSON.parse(body) as { method?: unknown; params?: { name?: unknown } };
158 return m.method === "initialize" || (m.method === "tools/call" && m.params?.name === "releases");
159 } catch {
160 return false;
161 }
162 }
163
164 /** What a line says of a read the budget cut short, or never let start. */
165 export const OUT_OF_BUDGET = "no answer: the probe's budget ran out";
166
167 /** A promise that rejects when `signal` aborts, for a fetcher that does not listen to it. */
168 const abortedBy = (signal: AbortSignal): Promise<never> =>
169 new Promise((_, reject) => {
170 if (signal.aborted) reject(new Error(OUT_OF_BUDGET));
171 else signal.addEventListener("abort", () => reject(new Error(OUT_OF_BUDGET)), { once: true });
172 });
173
174 /**
175 * Runs every item against `base` and returns the lines in checklist order. `budget`, when given,
176 * bounds the whole run: once it aborts, the read in flight ends and every later read answers
177 * `OUT_OF_BUDGET` at once, so the lines still come back, each saying what it could not read.
178 */
179 export async function probe(
180 base: string,
181 repo: string,
182 fetcher: Fetcher = fetch,
183 now = Date.now(),
184 edition?: string,
185 token?: string,
186 budget?: AbortSignal,
187 ): Promise<Line[]> {
188 const origin = new URL(base).origin;
189 const cut = budget === undefined ? undefined : abortedBy(budget);
190 cut?.catch(() => {});
191 const get = async (path: string, init?: RequestInit): Promise<Seen | string> => {
192 const url = new URL(path, origin);
193 const method = init?.method ?? "GET";
194 if (url.origin !== origin && !(method === "GET" && url.href === edition)) return `${url.href} is not on ${origin}`;
195 if (method !== "GET" && !(method === "POST" && url.pathname === "/mcp" && readOnlyCall(init?.body))) return `${method} is not a read`;
196 if (budget?.aborted) return OUT_OF_BUDGET;
197 const started = performance.now();
198 const timeout = AbortSignal.timeout(15_000);
199 const signal = budget === undefined ? timeout : AbortSignal.any([timeout, budget]);
200 try {
201 const read = (async () => {
202 const r = await fetcher(url.href, { ...init, method, redirect: "manual", signal });
203 return { status: r.status, headers: r.headers, body: await r.text() };
204 })();
205 read.catch(() => {}); // a read the budget outran settles unheard
206 const r = cut === undefined ? await read : await Promise.race([read, cut]);
207 return { ...r, ms: Math.round(performance.now() - started) };
208 } catch (e) {
209 if (budget?.aborted) return OUT_OF_BUDGET;
210 return `no answer: ${e instanceof Error ? e.message : String(e)}`;
211 }
212 };
213 const at = (path: string): string => new URL(path, origin).href;
214 const json = (s: Seen): unknown => {
215 if (!(s.headers.get("content-type") ?? "").includes("json")) return undefined;
216 try {
217 return JSON.parse(s.body) as unknown;
218 } catch {
219 return undefined;
220 }
221 };
222 const api = `/api/v1/repos/${repo}`;
223 const lines: Line[] = [];
224 const say = (item: string, verdict: Verdict, path: string, evidence: string): void => {
225 lines.push({ item, verdict, url: at(path), evidence });
226 };
227
228 // 1. Sign-up and pricing.
229 const signup = await get("/signup");
230 if (typeof signup === "string") say("sign-up page", "UNKNOWN", "/signup", signup);
231 else if (signup.status === 200 && /<form/i.test(signup.body)) say("sign-up page", "PASS", "/signup", "200 with a form");
232 else say("sign-up page", "FAIL", "/signup", `${signup.status}${signup.status === 200 ? " without a form" : ""}`);
233 const pricing = await get("/pricing");
234 const price = typeof pricing === "string" ? undefined : PRICE.exec(pricing.body)?.[0];
235 if (typeof pricing === "string") say("pricing names a price", "UNKNOWN", "/pricing", pricing);
236 else if (pricing.status === 200 && price) say("pricing names a price", "PASS", "/pricing", `200, names ${price}`);
237 else say("pricing names a price", "FAIL", "/pricing", `${pricing.status}, names no price`);
238
239 // 2. Production's version, from MCP initialize, and the newest release, from the token-free
240 // `releases` tool (what /changelog shows anyone): `/tags` answers 404 to an anonymous read.
241 const mcp = (id: number, method: string, params: unknown) =>
242 get("/mcp", {
243 method: "POST",
244 headers: { "content-type": "application/json", accept: "application/json, text/event-stream" },
245 body: JSON.stringify({ jsonrpc: "2.0", id, method, params }),
246 });
247 const init = await mcp(1, "initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "v1-probe", version: "1" } });
248 const served = typeof init === "string" ? undefined : (json(init) as { result?: { serverInfo?: { version?: unknown } } } | undefined)?.result?.serverInfo?.version;
249 const announced = typeof served === "string" ? announcedOf(served) : undefined;
250 const shipped = await mcp(2, "tools/call", { name: "releases", arguments: { repo } });
251 const read = typeof shipped === "string" ? undefined : newestRelease(json(shipped), repo);
252 const releasePath = "/mcp";
253 const tagName = read?.release?.name;
254 const tagCommit = read?.release?.commit;
255 const unread = typeof shipped === "string" ? shipped : `${shipped.status}, the releases tool did not answer its JSON`;
256
257 // 3. The stranger journey's last green release: the public answer states the running commit's
258 // check (#15514); when it names another commit or none, the check API (which a stranger may not
259 // read) is asked. `unknown` (#15537) is a hosted forge whose host did not say: no verdict
260 // either, so it is asked the same way, and the line says the release could not tell.
261 const stated = typeof shipped === "string" ? undefined : runningCheckOf(json(shipped));
262 const own = stated !== undefined && stated.commit === tagCommit && stated.state !== "none" && stated.state !== "unknown" ? stated : undefined;
263 const untold = stated !== undefined && stated.commit === tagCommit && stated.state === "unknown";
264 const checkPath = own ? releasePath : tagCommit ? `${api}/commits/${tagCommit}/check` : releasePath;
265 if (!read) say("stranger journey green on a release", "UNKNOWN", checkPath, `${unread}; a person must open the latest release's check`);
266 else if (!tagName || !tagCommit) say("stranger journey green on a release", "FAIL", checkPath, `the releases tool lists no release of ${repo} and names no running commit`);
267 else {
268 const check = own === undefined ? await get(checkPath) : undefined;
269 const c = own ?? (check === undefined || typeof check === "string" ? undefined : (json(check) as { state?: unknown; runId?: unknown; finishedAt?: unknown } | undefined));
270 if (!c || typeof c.state !== "string") {
271 const asked = check === undefined ? "no check named" : typeof check === "string" ? check : `${check.status}, not the check's JSON`;
272 const why = untold ? `the release says its check is unknown (its host forge did not answer); ${asked}` : asked;
273 // A 404 can mean the base holds no such repository, as on an app's test copy of the forge
274 // (#15519): its own empty database states no verdict, however public the read, so the line
275 // names the forge to ask in place of a person.
276 const repoRead = typeof check === "object" && check.status === 404 ? await get(api) : undefined;
277 if (typeof repoRead === "object" && repoRead.status === 404) {
278 say("stranger journey green on a release", "UNKNOWN", api, `${origin} holds no public ${repo}, so it states no check of it; run the probe against the forge that holds ${repo}`);
279 } else say("stranger journey green on a release", "UNKNOWN", checkPath, `${why}; a person must open ${tagName}'s check and see the stranger tests green`);
280 } else if (c.state === "ok") say("stranger journey green on a release", "PASS", checkPath, `${tagName} (${tagCommit.slice(0, 9)}) full check ok, run ${String(c.runId)}, which runs the stranger tests`);
281 else if (c.state === "failed") say("stranger journey green on a release", "FAIL", checkPath, `${tagName} check failed, run ${String(c.runId)}`);
282 else say("stranger journey green on a release", "UNKNOWN", checkPath, `${tagName} check is ${c.state}`);
283 }
284
285 // 4. /changelog, /changelog.atom and production's version agree with the newest release.
286 if (!announced) say("version agrees", "UNKNOWN", "/mcp", typeof init === "string" ? init : `initialize named no version or commit (${init.status})`);
287 else if (!read) say("version agrees", "UNKNOWN", releasePath, `production says ${announced.text}; ${unread}`);
288 else if (!read.release) say("version agrees", "FAIL", releasePath, `production says ${announced.text}; the releases tool lists no release of ${repo} and names no running commit`);
289 else {
290 const r = read.release;
291 const agrees = announced.kind === "version" ? r.version === announced.text : r.commit.startsWith(announced.text);
292 const theirs = announced.kind === "version" ? (r.version ?? `no version (${r.commit.slice(0, 7)})`) : r.commit.slice(0, announced.text.length);
293 if (!agrees) say("version agrees", "FAIL", releasePath, `production says ${announced.text}, the newest release ${r.name} is ${theirs}`);
294 else {
295 const page = await get("/changelog");
296 const atom = await get("/changelog.atom");
297 const named = (s: Seen | string): boolean => typeof s !== "string" && s.status === 200 && ((r.version !== undefined && s.body.includes(r.version)) || s.body.includes(r.commit.slice(0, 7)));
298 const misses = [named(page) ? "" : "/changelog", named(atom) ? "" : "/changelog.atom"].filter(Boolean);
299 if (misses.length === 0) say("version agrees", "PASS", "/changelog", `production ${announced.text} = release ${r.name}, named by /changelog and /changelog.atom`);
300 else say("version agrees", "FAIL", misses[0] ?? "/changelog", `production ${announced.text} = release ${r.name}, but ${misses.join(" and ")} ${misses.length === 1 ? "does" : "do"} not name it`);
301 }
302 }
303
304 // 5. /healthz fast.
305 const health = await get("/healthz");
306 if (typeof health === "string") say("healthz fast", "FAIL", "/healthz", health);
307 else if (health.status === 200 && health.ms <= HEALTHZ_MS) say("healthz fast", "PASS", "/healthz", `200 in ${health.ms} ms`);
308 else say("healthz fast", "FAIL", "/healthz", `${health.status} in ${health.ms} ms (limit ${HEALTHZ_MS} ms)`);
309
310 // 6. Schedules (#11595) ran in the last 24 h: from `--edition`, else `<base>/edition` (#15474); a
311 // 404 on the default is UNKNOWN.
312 const item = "schedules ran in 24 h";
313 const byDefault = !edition;
314 const editionUrl = edition ?? at("/edition");
315 const page = await get(editionUrl);
316 const stamp = typeof page === "string" || page.status !== 200 ? undefined : editionDate(page.body, now);
317 if (typeof page === "string") say(item, "UNKNOWN", editionUrl, `${page}; a person must open ${editionUrl}`);
318 else if (page.status === 404 && byDefault) say(item, "UNKNOWN", editionUrl, `404, this release predates /edition; a person must open ${at(`/${repo}`)} signed in and read its Schedules card`);
319 else if (page.status !== 200) say(item, "UNKNOWN", editionUrl, `${page.status}, the page is not public; a person must open ${editionUrl}`);
320 else if (!stamp) say(item, "UNKNOWN", editionUrl, `200 with no <time datetime> or <updated>; a person must open ${editionUrl} and read the edition's date`);
321 else {
322 const ago = Math.round((now - stamp.at) / 60_000);
323 say(item, now - stamp.at <= DAY_MS ? "PASS" : "FAIL", editionUrl, `newest edition dated ${stamp.text}, ${ago} min ago`);
324 }
325
326 // 7. Security headers and CSP on / and /pricing.
327 for (const [path, seen] of [["/", await get("/")], ["/pricing", pricing]] as const) {
328 if (typeof seen === "string") {
329 say(`security headers on ${path}`, "UNKNOWN", path, seen);
330 continue;
331 }
332 const csp = seen.headers.get("content-security-policy") ?? "";
333 const missing = [
334 /default-src 'none'|default-src 'self'/.test(csp) ? "" : "content-security-policy",
335 seen.headers.get("x-content-type-options") === "nosniff" ? "" : "x-content-type-options",
336 seen.headers.get("referrer-policy") ? "" : "referrer-policy",
337 ].filter(Boolean);
338 if (missing.length === 0) say(`security headers on ${path}`, "PASS", path, `CSP, nosniff, referrer-policy ${seen.headers.get("referrer-policy")}`);
339 else say(`security headers on ${path}`, "FAIL", path, `missing ${missing.join(", ")}`);
340 }
341
342 // 8. The release keeper's newest beat: the public pulse first (#15524), then, when a release
343 // before it answers none, `/api/v1/keeper` for a caller holding a token (#15449). A refusal is
344 // worded by its cause (#15520), read from `/api/v1/here` with the same token: a 401 is a token
345 // this forge knows no account for; "anonymous" means the header never reached the forge (a proxy
346 // in front strips `authorization`, as the hosting forge's app proxy does for every app); a name
347 // is an account without the right.
348 const keeperRefusal = async (status: number): Promise<string> => {
349 if (status === 401) return NOT_ACCEPTED(status, origin);
350 if (status !== 403) return `${status}, the keeper did not answer`;
351 const here = await get("/api/v1/here?path=/", { headers: { authorization: `Bearer ${token}` } });
352 if (typeof here === "string") return `403, and /api/v1/here did not answer: ${here}`;
353 if (here.status === 401) return NOT_ACCEPTED(status, origin);
354 const you = (json(here) as { you?: { as?: unknown } } | undefined)?.you;
355 if (you?.as === "anonymous") return `403, the token did not reach ${origin}: a proxy in front strips the authorization header, so this forge saw no one`;
356 const as = typeof you?.as === "string" ? you.as.replace(/[^\w-]/g, "") : "unknown";
357 return `403, this token's account (here a ${as}) may not read the release history: it must write the forge's repository or administer`;
358 };
359 const pulseSeen = await get(PULSE_PATH);
360 const pulse = typeof pulseSeen === "string" || pulseSeen.status !== 200 ? undefined : pulseOf(json(pulseSeen));
361 if (pulse === null) say(KEEPER_ITEM, "UNKNOWN", PULSE_PATH, "no heartbeat yet: the release tick has not reported");
362 else if (pulse !== undefined) say(KEEPER_ITEM, pulseVerdict(pulse), PULSE_PATH, pulseWords(pulse));
363 else if (token) {
364 const keeper = await get("/api/v1/keeper", { headers: { authorization: `Bearer ${token}` } });
365 const beat = keeperBeat(typeof keeper === "string" ? undefined : json(keeper));
366 if (typeof keeper === "string") say(KEEPER_ITEM, "UNKNOWN", "/api/v1/keeper", keeper);
367 else if (keeper.status !== 200) say(KEEPER_ITEM, "UNKNOWN", "/api/v1/keeper", await keeperRefusal(keeper.status));
368 else if (beat === undefined) say(KEEPER_ITEM, "UNKNOWN", "/api/v1/keeper", "200 without a heartbeat: the release tick has not reported yet");
369 else {
370 const words = `${beat.outcome} at ${beat.at}${beat.silent ? " (silent for over an hour)" : ""}: ${beat.reason}`;
371 say(KEEPER_ITEM, beat.outcome === "failed" || beat.silent ? "FAIL" : "PASS", "/api/v1/keeper", words);
372 }
373 }
374 return lines;
375 }
376
377 export const KEEPER_ITEM = "keeper's last beat";
378 export const PULSE_PATH = "/api/v1/keeper/pulse";
379
380 /** A public pulse's beat (#15524). */
381 export interface Pulse {
382 readonly at: string;
383 readonly outcome: string;
384 readonly silent: boolean;
385 }
386
387 /**
388 * The pulse answer read: null when it says no beat yet (`{at: null}`), undefined when it is not a
389 * pulse at all; its words stripped of control characters.
390 */
391 export function pulseOf(answer: unknown): Pulse | null | undefined {
392 if (answer === null || typeof answer !== "object") return undefined;
393 const { at, outcome, silent } = answer as Record<string, unknown>;
394 if (at === null) return null;
395 if (typeof at !== "string" || typeof outcome !== "string") return undefined;
396 const plain = (t: string) => t.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").slice(0, 60);
397 return { at: plain(at), outcome: plain(outcome), silent: silent === true };
398 }
399
400 export const pulseVerdict = (p: Pulse): Verdict => (p.outcome === "failed" || p.silent ? "FAIL" : "PASS");
401 export const pulseWords = (p: Pulse): string => `${p.outcome} at ${p.at}${p.silent ? " (silent: no beat for over a day)" : ""}`;
402
403 const NOT_ACCEPTED = (status: number, origin: string) =>
404 `${status}, token not accepted here: ${origin} knows no account for it (a token from another forge?)`;
405
406 /**
407 * The keeper answer's `heartbeat`, its words stripped of control characters; undefined when it has
408 * none.
409 */
410 export function keeperBeat(answer: unknown): { at: string; outcome: string; reason: string; silent: boolean } | undefined {
411 const h = (answer as { heartbeat?: unknown } | null | undefined)?.heartbeat as Record<string, unknown> | null | undefined;
412 if (h === null || typeof h !== "object") return undefined;
413 const { at, outcome, reason, silent } = h;
414 if (typeof at !== "string" || typeof outcome !== "string" || typeof reason !== "string") return undefined;
415 const plain = (t: string) => t.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").slice(0, 300);
416 return { at: plain(at), outcome: plain(outcome), reason: plain(reason), silent: silent === true };
417 }
418
419 export const formatLine = (l: Line): string => `${l.verdict.padEnd(7)} ${l.item}: ${l.url} - ${l.evidence}`;
420
src/tui/screens/status.ts +9 −3
@@ -4,16 +4,22 @@
44 */
55
66 import { asOfWords, rowWords, statusWords } from "../../core/status_words.ts";
7 import { PROOF_ROW, proofStatus } from "../../release/daily_proof.ts";
78 import type { Ctx, Screen } from "../app/app.ts";
89 import { binding } from "../app/keys.ts";
910 import type { Session } from "../session.ts";
1011 import { style } from "../term/style.ts";
1112 import { pad } from "../term/width.ts";
1213
13 /** The screen's lines: the sentence, then each row's name and word. */
14 export function statusLines(session: Session): string[] {
14 /**
15 * The screen's lines: the sentence, then each row's name and word, then the daily proof's once it
16 * has run (#15625), as the page shows it.
17 */
18 export function statusLines(session: Session, now = Date.now()): string[] {
1519 const w = statusWords(session.app);
16 return [w.sentence, asOfWords(w), "", ...w.rows.map((r) => `${pad(r.name, 20)}${rowWords(r)}`)];
20 const proof = proofStatus(session.app.db, now);
21 const rows = w.rows.map((r) => `${pad(r.name, 20)}${rowWords(r)}`);
22 return [w.sentence, asOfWords(w), "", ...rows, ...(proof === undefined ? [] : [`${pad(PROOF_ROW, 20)}${proof.says}`])];
1723 }
1824
1925 export function statusScreen(session: Session, ctx: Ctx): Screen {
src/web/pages/status.ts +19 −7
@@ -2,6 +2,8 @@
22 * GET /status: is the forge working, in one sentence and three rows (#13211, #13348).
33 * Signed out, always 200, under 6 KB, no script, no polling. Asked with
44 * `Accept: application/json` it answers the same words as data.
5 * Once the daily proof of production has run (#15625) a fourth row says how many of its lines
6 * passed and when (`release/daily_proof.ts`); its lines are `GET /api/v1/proof/daily`.
57 *
68 * It is its own small document, not the shell: the shell's head, menus, palette and
79 * scripts weigh more than the whole answer is allowed to. The words are held 10 s
@@ -13,6 +15,7 @@ import { asOfWords, rowWords, statusJson, statusWords, type StatusWords } from "
1315 import type { Ctx } from "../../http/context.ts";
1416 import { notePhase, takeSessionTime, timePhase } from "../../core/route_timing.ts";
1517 import { releaseOf, running, shortOf } from "../../kernel/version.ts";
18 import { PROOF_ROW, proofStatus, type ProofStatus } from "../../release/daily_proof.ts";
1619 import { stylesheetAsset } from "../asset.ts";
1720 import { html } from "../html.ts";
1821 import { brandHead, shareHead, themeColorHead } from "../layout.ts";
@@ -20,19 +23,23 @@ import { badge } from "../ui.ts";
2023 import { statusRow } from "./security.ts";
2124
2225 const tone = { ok: "success", slow: "attn", down: "danger" } as const;
26 const proofTone = { pass: "success", unknown: "attn", fail: "danger" } as const;
2327
2428 /** How many times the markup was built: a test reads it to see the hold at work. */
2529 export const statusBuilds = { count: 0 };
26 const built = new WeakMap<StatusWords, { origin: string; text: string }>();
30 const built = new WeakMap<StatusWords, { origin: string; proof: string; text: string }>();
2731
2832 /** The status page's description: what it answers, the same on every visit. */
2933 const STATUS_LINE = "Whether Open Platform Forge is working now: pages and sign-in, building, and billing records.";
3034
31 function markup(words: StatusWords, origin: string): string {
35 function markup(words: StatusWords, origin: string, proof: ProofStatus | undefined): string {
36 const said = proof?.says ?? "";
3237 const kept = built.get(words);
33 if (kept !== undefined && kept.origin === origin) return kept.text;
38 if (kept !== undefined && kept.origin === origin && kept.proof === said) return kept.text;
3439 statusBuilds.count += 1;
3540 const rows = words.rows.map((r) => statusRow(r.name, badge(rowWords(r), { tone: tone[r.state] })));
41 // The daily proof of production (#15625): a row once it has run, never an "ok" nobody checked.
42 const proofRow = proof === undefined ? null : statusRow(PROOF_ROW, badge(proof.says, { tone: proofTone[proof.state] }));
3643 const text = html`<!doctype html>
3744 <html lang="en">
3845 <head>
@@ -48,12 +55,12 @@ ${themeColorHead(undefined)}
4855 <body>
4956 <main class="shell" id="main">
5057 <div class="page-head"><h1>${words.sentence}</h1><p class="hint">${asOfWords(words)}</p></div>
51 <dl class="status-rows">${rows}</dl>
58 <dl class="status-rows">${rows}${proofRow}</dl>
5259 </main>
5360 <footer class="foot"><a href="/">forge</a><span class="spacer"></span><a href="/status">Status</a><a href="/privacy">Privacy</a></footer>
5461 </body>
5562 </html>`.text;
56 built.set(words, { origin, text });
63 built.set(words, { origin, proof: said, text });
5764 return text;
5865 }
5966
@@ -66,19 +73,24 @@ function runningFields(): { version: string | null; commit: string | null; short
6673 return { version: releaseOf(r), commit: r.commit, short: r.commit === null ? null : shortOf(r.commit) };
6774 }
6875
76 /** The daily proof in the JSON answer: counts and words; its lines are `/api/v1/proof/daily`. */
77 const proofJson = (p: ProofStatus | undefined) =>
78 p === undefined ? null : { at: p.at, pass: p.pass, total: p.total, state: p.state, says: p.says, lines: "/api/v1/proof/daily" };
79
6980 const CSP =
7081 "default-src 'none'; style-src 'self'; img-src 'self' data:; manifest-src 'self'; form-action 'none'; base-uri 'none'; frame-ancestors 'none'";
7182
7283 export function statusPage(ctx: Ctx): Response {
7384 notePhase(ctx.request, "session", takeSessionTime(ctx.request));
7485 const words = statusWords(ctx.app);
86 const proof = proofStatus(ctx.app.db, Date.now());
7587 const accept = ctx.request.headers.get("accept") ?? "";
7688 if (accept.includes("application/json"))
7789 return timePhase(
7890 ctx.request,
7991 "render",
8092 () =>
81 new Response(JSON.stringify({ ...statusJson(words), ...runningFields() }), {
93 new Response(JSON.stringify({ ...statusJson(words), ...runningFields(), proof: proofJson(proof) }), {
8294 headers: { "cache-control": "public, max-age=10", vary: "accept", "content-type": "application/json" },
8395 }),
8496 );
@@ -86,7 +98,7 @@ export function statusPage(ctx: Ctx): Response {
8698 ctx.request,
8799 "render",
88100 () =>
89 new Response(markup(words, ctx.url.origin), {
101 new Response(markup(words, ctx.url.origin, proof), {
90102 headers: {
91103 "content-type": "text/html; charset=utf-8",
92104 "cache-control": "public, max-age=10",
test/daily-proof.test.ts added +235
@@ -0,0 +1,235 @@
1 /**
2 * The daily proof (#15625): the v1 checks run once a day in process against the forge's own
3 * public origin, over a stubbed fetch here. All pass asks nothing; a FAIL asks the owner once
4 * (one `daily_proof` flow alarm, one `since`) however many days it stays failed; a day of all PASS
5 * clears it in one line; an UNKNOWN asks only where it passed the day before; the whole run stops
6 * at its budget and still returns its lines. The last run reads on /status, its JSON, the terminal
7 * and `GET /api/v1/proof/daily` without a token.
8 */
9 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
10 import { mkdtemp, rm } from "node:fs/promises";
11 import { tmpdir } from "node:os";
12 import { join } from "node:path";
13 import { createApp, type App } from "../src/app.ts";
14 import { firedAlarms, FORGE_BROKEN } from "../src/flow/alarms.ts";
15 import { serve, type Servers } from "../src/http/server.ts";
16 import { dailyProof } from "../src/maintain/duties/daily_proof.ts";
17 import type { DutyResult } from "../src/maintain/duty.ts";
18 import { lastRun, openAsks, plainEvidence, proofAlarm, recordRun, tallyWords } from "../src/release/daily_proof.ts";
19 import { OUT_OF_BUDGET, type Line } from "../src/release/v1_checks.ts";
20 import { Session } from "../src/tui/forge.ts";
21 import { statusLines } from "../src/tui/screens/status.ts";
22
23 const BASE = "https://forge.example";
24 const COMMIT = "c".repeat(40);
25 const DAY = 86_400_000;
26 const T0 = Date.parse("2026-11-20T07:00:00Z");
27 const SEC = { "content-security-policy": "default-src 'none'", "x-content-type-options": "nosniff", "referrer-policy": "same-origin" };
28
29 interface Calls {
30 url: string;
31 method: string;
32 authorization: string | null;
33 }
34
35 /** What the stub forge says today: everything green unless a switch says otherwise. */
36 interface World {
37 noPrice?: boolean;
38 /** The call (1-based) that never answers and aborts the budget instead. */
39 hangAt?: number;
40 }
41
42 /** A forge over a stubbed fetch, answering what the v1 checks read, and recording every call. */
43 function stubForge(world: () => World, now: () => number, calls: Calls[], budget?: AbortController) {
44 return async (url: string, init?: RequestInit): Promise<Response> => {
45 const headers = new Headers(init?.headers);
46 calls.push({ url, method: init?.method ?? "GET", authorization: headers.get("authorization") });
47 const w = world();
48 if (w.hangAt === calls.length) {
49 budget?.abort();
50 return new Promise<Response>(() => {}); // never answers, and does not listen to the signal
51 }
52 const page = (b: string) => new Response(b, { headers: { "content-type": "text/html", ...SEC } });
53 const json = (v: unknown, status = 200) => Response.json(v, { status });
54 const path = new URL(url).pathname;
55 switch (path) {
56 case "/":
57 return page("<h1>forge</h1>");
58 case "/signup":
59 return page("<form method=post></form>");
60 case "/pricing":
61 return page(w.noPrice ? "<p>free for now</p>" : "<p>$5 a month</p>");
62 case "/healthz":
63 return new Response("ok");
64 case "/changelog":
65 case "/changelog.atom":
66 return page("<p>1.0.0</p>");
67 case "/edition":
68 return page(`<time datetime="${new Date(now() - 3_600_000).toISOString()}"></time>`);
69 case "/api/v1/keeper/pulse":
70 return json({ at: new Date(now() - 600_000).toISOString(), outcome: "cut", silent: false });
71 case "/mcp": {
72 const call = JSON.parse(String(init?.body)) as { method: string };
73 if (call.method === "tools/call") {
74 const text = JSON.stringify({ version: "1.0.0", commit: COMMIT, releases: [{ repo: "o/forge", version: "1.0.0", commit: COMMIT }], check: { commit: COMMIT, state: "ok", runId: "r1" } });
75 return json({ jsonrpc: "2.0", id: 2, result: { content: [{ type: "text", text }] } });
76 }
77 return json({ jsonrpc: "2.0", id: 1, result: { serverInfo: { name: "forge", version: "1.0.0" } } });
78 }
79 }
80 return json({ error: "not_found" }, 404);
81 };
82 }
83
84 let dir: string;
85 let app: App;
86 let servers: Servers;
87 let world: World = {};
88 let now = T0;
89 const calls: Calls[] = [];
90 const fakeApp = () => ({ config: { url: `${BASE}/`, forgeRepo: "o/forge" } }) as unknown as App;
91 const runDay = async (day: number, w: World = {}): Promise<DutyResult> => {
92 world = w;
93 now = T0 + day * DAY;
94 const budget = new AbortController();
95 const duty = dailyProof(stubForge(() => world, () => now, calls, budget), () => budget.signal);
96 return duty.run({ db: app.db, bus: app.bus, now: new Date(now), app: fakeApp() });
97 };
98 const verdicts = () => Object.fromEntries((lastRun(app.db)?.lines ?? []).map((l) => [l.item, l.verdict]));
99
100 beforeAll(async () => {
101 dir = await mkdtemp(join(tmpdir(), "daily-proof-"));
102 app = createApp({ dataDir: dir, port: 0 });
103 servers = await serve(app);
104 });
105 afterAll(async () => {
106 await servers.stop();
107 app.close();
108 await rm(dir, { recursive: true, force: true });
109 });
110
111 describe("the daily proof", () => {
112 test("before the first run nothing shows: no row, no ask, {at: null}", async () => {
113 expect(lastRun(app.db)).toBeUndefined();
114 expect(proofAlarm(app.db).fired).toBe(false);
115 const res = await fetch(`${servers.url}/api/v1/proof/daily`);
116 expect(await res.json()).toEqual({ at: null });
117 expect(await (await fetch(`${servers.url}/status`)).text()).not.toContain("daily proof");
118 });
119
120 test("all pass: every line PASS, nothing asks, one line says so", async () => {
121 const r = await runDay(0);
122 const v = verdicts();
123 expect(Object.keys(v).length).toBeGreaterThanOrEqual(9);
124 expect(Object.values(v).every((x) => x === "PASS")).toBe(true);
125 expect(r.findings).toEqual([]);
126 expect(r.actions).toEqual([`all ${Object.keys(v).length} pass`]);
127 expect(openAsks(app.db)).toEqual([]);
128 expect(firedAlarms(app.db, new Date(now), { dataDir: null }).map((a) => a.key)).not.toContain("daily_proof");
129 });
130
131 test("read-only and token-free: every call a GET or an MCP read, to the forge's own origin", () => {
132 expect(calls.length).toBeGreaterThan(0);
133 for (const c of calls) {
134 expect(new URL(c.url).origin).toBe(BASE);
135 expect(c.authorization).toBeNull();
136 expect(c.method === "GET" || (c.method === "POST" && new URL(c.url).pathname === "/mcp")).toBe(true);
137 }
138 });
139
140 test("one fail asks the owner once, naming the line and its evidence", async () => {
141 const r = await runDay(1, { noPrice: true });
142 expect(verdicts()["pricing names a price"]).toBe("FAIL");
143 expect(r.findings.map((f) => f.summary)).toEqual(["daily proof: pricing names a price is FAIL"]);
144 expect(r.actions[0]).toBe("asked the owner: pricing names a price is FAIL: 200, names no price");
145 const alarm = firedAlarms(app.db, new Date(now), { dataDir: null }).find((a) => a.key === "daily_proof");
146 expect(alarm).toMatchObject({ since: new Date(now).toISOString(), href: "/status" });
147 expect(alarm!.says).toContain("pricing names a price is FAIL (200, names no price)");
148 expect(FORGE_BROKEN.has("daily_proof")).toBe(true);
149 });
150
151 test("the same line does not ask twice while it stays failed", async () => {
152 const before = proofAlarm(app.db).since;
153 const r = await runDay(2, { noPrice: true });
154 expect(r.findings).toEqual([]);
155 expect(r.actions.some((a) => a.startsWith("asked the owner"))).toBe(false);
156 // The notifier's ask is `alarm:<key>@<since>`: the same since is the same ask.
157 expect(proofAlarm(app.db)).toMatchObject({ fired: true, since: before });
158 expect(openAsks(app.db).map((a) => a.item)).toEqual(["pricing names a price"]);
159 });
160
161 test("a day of all PASS clears it with one line", async () => {
162 const r = await runDay(3);
163 expect(r.actions).toEqual([`all ${Object.keys(verdicts()).length} pass: cleared pricing names a price`]);
164 expect(openAsks(app.db)).toEqual([]);
165 expect(proofAlarm(app.db).fired).toBe(false);
166 });
167
168 test("the budget: a read that never answers ends the run, and the lines still come back", async () => {
169 calls.length = 0;
170 const r = await runDay(4, { hangAt: 3 });
171 // The third read hung and aborted the budget; no read after it was sent.
172 expect(calls.length).toBe(3);
173 const lines = lastRun(app.db)!.lines;
174 expect(lines.filter((l) => l.evidence.includes(OUT_OF_BUDGET)).length).toBeGreaterThan(3);
175 expect(lines.find((l) => l.item === "healthz fast")).toMatchObject({ verdict: "FAIL", evidence: OUT_OF_BUDGET });
176 expect(r.findings.length).toBeGreaterThan(0);
177 await runDay(5); // all pass again, for the reads below
178 expect(openAsks(app.db)).toEqual([]);
179 });
180
181 test("the last run reads on /status, its JSON, the terminal and the public API, without a token", async () => {
182 const t = tallyWords({ at: lastRun(app.db)!.at, pass: 1, total: 1 }, now + 6 * 3_600_000);
183 expect(t).toBe("1 of 1 pass, 6 h ago");
184 const total = lastRun(app.db)!.lines.length;
185 const html = await (await fetch(`${servers.url}/status`)).text();
186 expect(html).toContain("daily proof");
187 expect(html).toMatch(new RegExp(`${total} of ${total} pass, \\d+ (min|h|days) ago`));
188 const asJson = (await (await fetch(`${servers.url}/status`, { headers: { accept: "application/json" } })).json()) as { proof: Record<string, unknown> };
189 expect(asJson.proof).toMatchObject({ pass: total, total, state: "pass", lines: "/api/v1/proof/daily" });
190 const user = { sshUsername: "git", remoteAddress: "127.0.0.1", fingerprint: "SHA256:test", user: undefined };
191 expect(statusLines(new Session(app, user)).at(-1)).toMatch(new RegExp(`^daily proof\\s+${total} of ${total} pass`));
192 const res = await fetch(`${servers.url}/api/v1/proof/daily`);
193 expect(res.status).toBe(200);
194 const body = (await res.json()) as { pass: number; total: number; lines: Record<string, unknown>[] };
195 expect(body).toMatchObject({ pass: total, total });
196 expect(Object.keys(body.lines[0]!).sort()).toEqual(["evidence", "item", "url", "verdict"]);
197 });
198 });
199
200 describe("recording a run", () => {
201 const line = (item: string, verdict: Line["verdict"], evidence = "seen"): Line => ({ item, verdict, url: `${BASE}/x`, evidence });
202
203 test("an UNKNOWN asks only where the run before had it PASS", () => {
204 const db = createApp({ dataDir: join(dir, "unknown"), port: 0 }).db;
205 recordRun(db, [line("a", "UNKNOWN"), line("b", "PASS")], new Date(T0));
206 expect(openAsks(db)).toEqual([]); // never passed: what an anonymous read cannot prove
207 const r = recordRun(db, [line("a", "UNKNOWN"), line("b", "UNKNOWN")], new Date(T0 + DAY));
208 expect(r.raised.map((l) => l.item)).toEqual(["b"]);
209 expect(r.said.at(-1)).toBe("0 of 2 pass");
210 const again = recordRun(db, [line("a", "PASS"), line("b", "UNKNOWN")], new Date(T0 + 2 * DAY));
211 expect(again.raised).toEqual([]);
212 expect(openAsks(db).map((a) => a.item)).toEqual(["b"]);
213 });
214
215 test("a second line failing is a new ask; a passing line clears its own", () => {
216 const db = createApp({ dataDir: join(dir, "second"), port: 0 }).db;
217 recordRun(db, [line("a", "FAIL"), line("b", "PASS")], new Date(T0));
218 const first = proofAlarm(db).since;
219 recordRun(db, [line("a", "FAIL"), line("b", "FAIL")], new Date(T0 + DAY));
220 expect(proofAlarm(db).since).not.toBe(first);
221 const r = recordRun(db, [line("a", "PASS"), line("b", "FAIL")], new Date(T0 + 2 * DAY));
222 expect(r.cleared).toEqual(["a"]);
223 expect(r.said).toContain("passes again: a");
224 expect(openAsks(db).map((a) => a.item)).toEqual(["b"]);
225 });
226
227 test("evidence leaves plain: one line, nothing credential-shaped, capped", () => {
228 const e = plainEvidence(`no answer\n\u001b[2J Bearer ${"x".repeat(30)} ${"y".repeat(400)}`);
229 expect(e).not.toContain("\n");
230 expect(e).not.toContain("\u001b");
231 expect(e).not.toContain("x".repeat(30));
232 expect(e).toContain("[redacted]");
233 expect(e.length).toBeLessThanOrEqual(240);
234 });
235 });
test/data-browser.test.ts +3
@@ -32,6 +32,9 @@ const AUDITED_CLEAR: string[] = [
3232 "child_reach_ask.body_id",
3333 "child_reach_grant.body_id",
3434 "comment.body",
35 // A daily-proof line's evidence (`release/daily_proof.ts` plainEvidence): one plain line,
36 // credential-shaped text removed before it is stored.
37 "daily_proof_ask.evidence",
3538 "degraded_span.sentence",
3639 "desk_note.body",
3740 "efficiency_sample.value",
test/maintain.test.ts +12
@@ -158,6 +158,18 @@ test("a hung duty is recorded as timed out and the next duty still runs, without
158158 release();
159159 });
160160
161 test("a duty's own timeoutMs replaces the runner's (#15625: the daily proof's budget is 60 s)", async () => {
162 clear();
163 let release = () => {};
164 const own: Duty = { name: "t-own-timeout", intervalMs: 1, timeoutMs: 20, budget: ROOMY, run: () => new Promise((r) => { release = () => r({ findings: [], actions: [] }); }) };
165 // The runner's own would wait ten minutes; the duty's 20 ms is what ends it.
166 const m = startMaintain(app, { duties: [own], everyMs: 1e9, timeoutMs: 600_000 });
167 m.stop();
168 await m.tick();
169 expect(latest(app.db, 5).find((r) => r.duty === "t-own-timeout")!.outcome).toBe("failed: timed out");
170 release();
171 });
172
161173 test("an empty finding reads refused:", async () => {
162174 clear();
163175 const d: Duty = { name: "t-empty", intervalMs: 1, budget: ROOMY, run: () => ({ findings: [{ summary: " ", probe }], actions: [] }) };
test/pages-budget.test.ts +2 −2
@@ -59,8 +59,8 @@ const HEAVIER: Record<string, { statements?: number; git?: number }> = {
5959 "/api/v1/asks": { statements: 61 }, // +1: the stopped apps someone asked for, one read of the viewer's archived repositories (#12277)
6060 "/board": { statements: 72 }, // +1: the forge-copy read for the tell box (#12037); +1: the vitals read the database's growth (#12025); +6: the money line (#510) — one settings read, then the month's and the 30 days' meter, storage and ledger reads; constant in the number of apps
6161 "/settings/capacity": { statements: 70 },
62 "/maintenance": { statements: 90 }, // +3: deepsec-sweep (#15026); +3: edge-kept (#14682), one more duty reading its own state; +1: every duty's last run in one query (#14674); +1: quieted findings (#14557); +1: the findings fold (#14577); +5: slow-tests (#13966); +3: untested-sources (#14125) and the dismissal query (#13967); +4: flaky-tests (#13937), red apps (#13938), chapter stall (#14057), dead-doc-paths (#13977); +3: stale-branches (#14141) — each reads its own state and runs
63 "/api/v1/maintenance/duties": { statements: 72 }, // the same duties as JSON; slow-tests (#13966), stale-branches (#14141), edge-kept (#14682) and deepsec-sweep (#15026) each add 3
62 "/maintenance": { statements: 93 }, // +3: daily-proof (#15625); +3: deepsec-sweep (#15026); +3: edge-kept (#14682), one more duty reading its own state; +1: every duty's last run in one query (#14674); +1: quieted findings (#14557); +1: the findings fold (#14577); +5: slow-tests (#13966); +3: untested-sources (#14125) and the dismissal query (#13967); +4: flaky-tests (#13937), red apps (#13938), chapter stall (#14057), dead-doc-paths (#13977); +3: stale-branches (#14141) — each reads its own state and runs
63 "/api/v1/maintenance/duties": { statements: 75 }, // the same duties as JSON; slow-tests (#13966), stale-branches (#14141), edge-kept (#14682), deepsec-sweep (#15026) and daily-proof (#15625) each add 3
6464 };
6565
6666 /** Patterns with no fixture today: lower this as fixtures are added, never raise it silently. */

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs