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

Flaky test: no first page's client JavaScript or CSS passes its ceiling, and each page measures the same twice #17742

opened this in answer to

Merged 9h 37m ago, live in production

scout/forge:scout/17740-flaky-test-no-first-page-s-client-javasc → main 0 commits fork 2 threads · 2 unresolved

  • Merged. scout/17740-flaky-test-no-first-page-s-client-javasc was merged into main as 0afd562.

Review

Sign in to review this change.
1 file changed +14 −4
test/client-size.test.ts +14 −4
@@ -84,12 +84,21 @@ afterAll(() => {
8484 rmSync(root, { recursive: true, force: true });
8585 });
8686
87 /**
88 * A refusal that says what it was: the check's log keeps only a line, and this test flaked on one
89 * (#17740).
90 */
91 function refused(what: string, res: Response, body: string): string {
92 return `${what} answered ${res.status} (retry-after ${res.headers.get("retry-after") ?? "none"}): ${JSON.stringify(body.slice(0, 200))}`;
93 }
94
8795 async function render(b: (typeof PAGE_BUDGETS)[number]): Promise<string> {
8896 const res = await fetch(`${servers.url}${pagePath(b, "alice", "notes")}`, {
8997 headers: b.signedOut ? { "accept-encoding": "identity" } : { cookie, "accept-encoding": "identity" },
9098 });
91 if (res.status !== 200) throw new Error(`${b.pattern} answered ${res.status}`);
92 return res.text();
99 const html = await res.text();
100 if (res.status !== 200) throw new Error(refused(b.pattern, res, html));
101 return html;
93102 }
94103
95104 async function measure(): Promise<{ sizes: Ceilings; drift: string[] }> {
@@ -100,8 +109,9 @@ async function measure(): Promise<{ sizes: Ceilings; drift: string[] }> {
100109 drift.push(...inlineDrift(`${b.pattern} (${b.page})`, html, await render(b)));
101110 sizes[b.pattern] = await clientSize(html, async (path) => {
102111 const asset = await fetch(`${servers.url}${path}`, { headers: { "accept-encoding": "identity" }, redirect: "follow" });
103 if (asset.status !== 200) throw new Error(`${path} answered ${asset.status}`);
104 return asset.text();
112 const body = await asset.text();
outdated

A fixed Bun.sleep in a loop is a wall-clock wait on state that has no hook. real-timer: silences the gate but does not make the wait deterministic. Await the live work in setup (warm the highlighter bundle, let the pull's checks finish) so that a first pair of renders is already stable. Also, drift.push(...found) now reports only the last attempt, so the header's 'identical on every run' guarantee is weaker and the file header (lines 1-9) needs updating.

113 if (asset.status !== 200) throw new Error(refused(path, asset, body));
114 return body;
105115 });
106116 }
107117 return { sizes, drift };

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs