Public: anyone can read this; the crew can change it.
The weekly production probe fails when /changelog.atom has no entries and files the defect with the byte count it saw #13104
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/13072-the-weekly-production-probe-fails-when-c → main 3 commits fork
3 files
changed +35
−6
src/core/v1_proof.ts +15
| @@ -202,6 +202,21 @@ export const probes: readonly Probe[] = [ | ||
| 202 | 202 | return "/api/v1/health: no schedule is overdue"; |
| 203 | 203 | }, |
| 204 | 204 | }, |
| 205 | { | |
| 206 | issue: 13072, | |
| 207 | item: "the changelog feed has at least one entry", | |
| 208 | // The failure names what was seen (URL, status, bytes) so the defect filed from it | |
| 209 | // carries them. | |
| 210 | run: async (get) => { | |
| 211 | const path = "/changelog.atom"; | |
| 212 | const got = await get(path); | |
| 213 | const bytes = new TextEncoder().encode(got.text).length; | |
| 214 | expect(got.status === 200, `${path} answers ${got.status}, not 200 (${bytes} bytes)`); | |
| 215 | const entries = (got.text.match(/<entry[\s>]/g) ?? []).length; | |
| 216 | expect(entries > 0, `${path} answers ${got.status} with no <entry> in ${bytes} bytes`); | |
| 217 | return `${path} carries ${entries} entr${entries === 1 ? "y" : "ies"} (${bytes} bytes)`; | |
| 218 | }, | |
| 219 | }, | |
| 205 | 220 | { |
| 206 | 221 | issue: 10441, |
| 207 | 222 | item: "the security headers are on the page and on a machine answer", |
test/security-floor-paths.test.ts +3 −2
| @@ -213,7 +213,8 @@ test("`bun scripts/v1-proven.ts`'s proof passes 20 times in a row against a boot | ||
| 213 | 213 | for (let run = 0; run < 20; run++) |
| 214 | 214 | for (const r of await prove(forge.servers.url, fetch)) |
| 215 | 215 | // A test forge is built from no release, so the two probes that read the release |
| 216 | // (#10304, #13042) have nothing to read; every other probe must pass. | |
| 217 | if (r.status !== "pass" && r.issue !== 10304 && r.issue !== 13042) failed.push(`run ${run}: ${line(r)}`); | |
| 216 | // (#10304, #13042) have nothing to read, and it has shipped nothing, so its changelog feed | |
| 217 | // (#13072) has no entry; every other probe must pass. | |
| 218 | if (r.status !== "pass" && ![10304, 13042, 13072].includes(r.issue)) failed.push(`run ${run}: ${line(r)}`); | |
| 218 | 219 | expect(failed).toEqual([]); |
| 219 | 220 | }, 60_000); |
test/v1-proven.test.ts +17 −4
| @@ -27,6 +27,7 @@ const rule = (days: number, words = days) => | ||
| 27 | 27 | const health = (schedules?: unknown, ver = "1.0.0") => |
| 28 | 28 | Response.json({ ok: true, version: ver, commit: "058b6cf", draining: false, ...(schedules === undefined ? {} : { schedules }) }); |
| 29 | 29 | |
| 30 | const FEED = '<?xml version="1.0"?><feed xmlns="http://www.w3.org/2005/Atom"><title>Changelog</title><entry><id>x</id></entry></feed>'; | |
| 30 | 31 | type Over = Record<string, () => Response>; |
| 31 | 32 | function stub(over: Over = {}, seen: string[] = []): Fetch { |
| 32 | 33 | const routes: Over = { |
| @@ -40,6 +41,7 @@ function stub(over: Over = {}, seen: string[] = []): Fetch { | ||
| 40 | 41 | "/settings/billing": () => new Response(null, { status: 303, headers: { location: "/signin?next=%2Fsettings%2Fbilling" } }), |
| 41 | 42 | "/settings/crew": () => new Response(null, { status: 303, headers: { location: "/signin?next=%2Fsettings%2Fcrew" } }), |
| 42 | 43 | "/api/v1/health": () => health({ overdue: 0, oldestSeconds: 0 }), |
| 44 | "/changelog.atom": () => new Response(FEED), | |
| 43 | 45 | ...over, |
| 44 | 46 | }; |
| 45 | 47 | return async (url, init) => { |
| @@ -53,9 +55,9 @@ describe("v1-proven", () => { | ||
| 53 | 55 | test("every list item has a probe, and all pass on a healthy forge", async () => { |
| 54 | 56 | const results = await prove("https://f.test/", stub()); |
| 55 | 57 | expect(results.map((r) => r.issue).sort()).toEqual( |
| 56 | [11541, 11539, 11158, 11573, 10304, 13042, 11507, 11138, 11140, 11141, 11515, 11595, 10441].sort(), | |
| 58 | [11541, 11539, 11158, 11573, 10304, 13042, 11507, 11138, 11140, 11141, 11515, 11595, 13072, 10441].sort(), | |
| 57 | 59 | ); |
| 58 | expect(probes.length).toBe(13); | |
| 60 | expect(probes.length).toBe(14); | |
| 59 | 61 | const status = (n: number) => results.find((r) => r.issue === n)?.status; |
| 60 | 62 | // What no public read can show is unproven, never a pass. |
| 61 | 63 | expect(results.filter((r) => r.status === "unproven").map((r) => r.issue).sort()).toEqual([]); |
| @@ -98,6 +100,8 @@ describe("v1-proven", () => { | ||
| 98 | 100 | [11141, { "/pricing": pricing(ldWith(props().slice(0, 2))) }, [11141]], |
| 99 | 101 | [11515, { "/settings/crew": () => new Response("x", { status: 500 }) }, [11515]], |
| 100 | 102 | [11595, { "/api/v1/health": () => health({ overdue: 2, oldestSeconds: 86_400 }) }, [11595]], |
| 103 | [13072, { "/changelog.atom": () => new Response('<feed xmlns="http://www.w3.org/2005/Atom"><title>Changelog</title></feed>') }, [13072]], | |
| 104 | [13072, { "/changelog.atom": () => new Response("down", { status: 503 }) }, [13072]], | |
| 101 | 105 | [10441, { "/healthz": () => new Response("ok") }, [10441]], |
| 102 | 106 | ]; |
| 103 | 107 | for (const [issue, over, expected] of breaks) |
| @@ -124,6 +128,15 @@ describe("v1-proven", () => { | ||
| 124 | 128 | expect(all.every((r) => r.status === "fail")).toBe(true); |
| 125 | 129 | }); |
| 126 | 130 | |
| 131 | test("an empty feed fails naming URL, status and bytes; a populated one passes", async () => { | |
| 132 | const empty = '<feed xmlns="http://www.w3.org/2005/Atom"><title>Changelog</title></feed>'; | |
| 133 | const bad = (await prove("https://f.test", stub({ "/changelog.atom": () => new Response(empty) }))).find((x) => x.issue === 13072)!; | |
| 134 | expect(line(bad)).toBe(`fail #13072 the changelog feed has at least one entry: /changelog.atom answers 200 with no <entry> in ${empty.length} bytes`); | |
| 135 | const ok = (await prove("https://f.test", stub())).find((x) => x.issue === 13072)!; | |
| 136 | expect(ok.status).toBe("pass"); | |
| 137 | expect(ok.detail).toBe(`/changelog.atom carries 1 entry (${FEED.length} bytes)`); | |
| 138 | }); | |
| 139 | ||
| 127 | 140 | test("an age reads in the unit a person would use", () => { |
| 128 | 141 | expect([ageWords(45), ageWords(600), ageWords(3 * 3600 + 720), ageWords(3 * 86_400 + 7200)]).toEqual(["45 s", "10 min", "3 h 12 min", "3 d 2 h"]); |
| 129 | 142 | }); |
| @@ -143,7 +156,7 @@ describe("v1-proven", () => { | ||
| 143 | 156 | const { code, out } = await run(async () => new Response("down", { status: 503 })); |
| 144 | 157 | expect(code).toBe(1); |
| 145 | 158 | expect(out).toContain("fail #11539"); |
| 146 | expect(out).toContain("v1.0.0 is not proven: 13 of 13 fail, 0 unproven"); | |
| 159 | expect(out).toContain("v1.0.0 is not proven: 14 of 14 fail, 0 unproven"); | |
| 147 | 160 | }); |
| 148 | 161 | |
| 149 | 162 | test("the script exits 3, not 0, when nothing fails but some items are unproven", async () => { |
| @@ -151,7 +164,7 @@ describe("v1-proven", () => { | ||
| 151 | 164 | expect(out).not.toContain("fail #"); |
| 152 | 165 | expect(code).toBe(3); |
| 153 | 166 | expect(out).toContain("unproven #11595"); |
| 154 | expect(out).toContain("v1.0.0 is not proven: none fail, 1 of 13 unproven"); | |
| 167 | expect(out).toContain("v1.0.0 is not proven: none fail, 1 of 14 unproven"); | |
| 155 | 168 | }); |
| 156 | 169 | |
| 157 | 170 | test("the script exits 2 on bad usage", () => { |
new above
offline