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

Sentinel: red:01m23vygyffx5hg2f5vm8r74sr is past its budget: trevato/forge: main is red at 960a50f — "a deployed preview's findings are stored under its run, and the run still pass… #4862

Merged opened this

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

Merged

scout/forge:scout/4830-sentinel-red-01m23vygyffx5hg2f5vm8r74sr → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/4830-sentinel-red-01m23vygyffx5hg2f5vm8r74sr was merged into main as 0b0d200.

Review

Sign in to review this change.
2 files changed +33 −1
src/apps/preview_spec.ts +19 −1
@@ -16,11 +16,29 @@ export const PREVIEW_SPEC_TIMEOUT_MS = 30_000;
1616
1717 const SECTION = "https://specification.website/";
1818
19 /** `webspec()` over `paths` at `base`, with a clock; never throws. */
19 /** A finding that says the page never answered, not that it answered badly. */
20 const unanswered = (f: Finding) => f.check === "fetch" || f.check === "webspec";
21
22 /**
23 * `webspec()` over `paths` at `base`, with a clock; never throws. A page that
24 * did not answer is asked once more: a preview just swapped in on a busy
25 * machine can miss its first request, and that is not a finding about it.
26 */
2027 export async function previewSpec(
2128 base: string,
2229 paths: readonly string[],
2330 timeoutMs = PREVIEW_SPEC_TIMEOUT_MS,
31 ): Promise<Finding[]> {
32 const first = await previewSpecOnce(base, paths, timeoutMs);
33 if (!first.some(unanswered)) return first;
34 const again = await previewSpecOnce(base, paths, timeoutMs);
35 return again.filter(unanswered).length <= first.filter(unanswered).length ? again : first;

The retry reruns the full timeout; a hung preview now holds the deploy check for 2x30s. Give the second run only the remaining budget.

36 }
37
38 async function previewSpecOnce(
39 base: string,
40 paths: readonly string[],
41 timeoutMs = PREVIEW_SPEC_TIMEOUT_MS,
2442 ): Promise<Finding[]> {
2543 const stop = new AbortController();
2644 let timer: ReturnType<typeof setTimeout> | undefined;
test/preview-spec.test.ts +14
@@ -118,6 +118,20 @@ test("a webspec that cannot finish is one finding, and is stored", async () => {
118118 expect(slow[0]!.message).toContain("timed out");
119119 });
120120
121 test("a page that misses its first request is asked once more", async () => {
122 let calls = 0;
123 const flaky = Bun.serve({
124 port: 0,
125 fetch: () => (++calls === 1
126 ? new Response("busy", { status: 503 })
127 : new Response("<!doctype html><html lang=en><title>t</title><p>hi", { headers: { "content-type": "text/html" } })),
128 });
129 const found = await previewSpec(`http://127.0.0.1:${flaky.port}`, ["/"], 5_000);
130 flaky.stop(true);
131 expect(found.some((f) => f.check === "fetch")).toBe(false);
132 expect(found.some((f) => f.check === "etag")).toBe(true);
133 });
134
121135 test("the terminal's checks row carries the count, edge findings apart", () => {
122136 const found = [
123137 { path: "/", check: "etag", message: "m", section: "https://specification.website/#caching" },

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs