Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:2wmgndoat9 is past its budget: trevato/forge: "every GET page names session and render in Server-Timing, bar the listed debt" failed on 3 pulls in the… #5998
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5961-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 2 commits fork
1 file
changed +11
−7
test/server-timing-sweep.test.ts +11 −7
| @@ -96,26 +96,30 @@ test("every GET page names session and render in Server-Timing, bar the listed d | ||
| 96 | 96 | |
| 97 | 97 | const named: string[] = []; |
| 98 | 98 | const bare: string[] = []; |
| 99 | await Promise.all( | |
| 100 | paths.map(async (path) => { | |
| 99 | // A few at a time with a generous abort: the verdict is about headers, not | |
| 100 | // about how fast a loaded check machine answers every page at once. | |
| 101 | const queue = [...paths]; | |
| 102 | const worker = async () => { | |
| 103 | for (let path = queue.shift(); path !== undefined; path = queue.shift()) { | |
| 101 | 104 | const res = await fetch(`${servers.url}${path}`, { |
| 102 | 105 | headers: { cookie }, |
| 103 | 106 | redirect: "manual", |
| 104 | signal: AbortSignal.timeout(5000), | |
| 107 | signal: AbortSignal.timeout(60_000), | |
| 105 | 108 | }); |
| 106 | 109 | await res.arrayBuffer(); |
| 107 | if (!(res.headers.get("content-type") ?? "").startsWith("text/html")) return; | |
| 110 | if (!(res.headers.get("content-type") ?? "").startsWith("text/html")) continue; | |
| 108 | 111 | const names = (res.headers.get("server-timing") ?? "").split(",").map((p) => p.trim().split(";")[0]); |
| 109 | 112 | expect(names).toContain("app"); |
| 110 | 113 | (names.includes("session") && names.includes("render") ? named : bare).push(path); |
| 111 | }), | |
| 112 | ); | |
| 114 | } | |
| 115 | }; | |
| 116 | await Promise.all(Array.from({ length: 4 }, worker)); | |
| 113 | 117 | |
| 114 | 118 | const debt = new Set(UNNAMED.map(([p]) => p)); |
| 115 | 119 | expect(bare.filter((p) => !debt.has(p)).sort()).toEqual([]); |
| 116 | 120 | expect(named.filter((p) => debt.has(p)).sort()).toEqual([]); |
| 117 | 121 | for (const [, issue] of UNNAMED) expect(issue).toMatch(/^#\d+$/); |
| 118 | }); | |
| 122 | }, 120_000); | |
| 119 | 123 | |
| 120 | 124 | test("the sweep reads wrapped router.add registrations, so a reformat cannot shrink it", () => { |
| 121 | 125 | const found = registeredGets(); |
new above
offline