From a889f4b1e24a5012a865120ec39eb7295f833462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 11 Sep 2026 12:43:30 +0200 Subject: [PATCH] test(e2e): read the session back through the page, not the shared pool The offline fence spec already sends its account switch with the page's own fetch, because every Playwright API context in the runner shares one keep-alive agent and can be handed a socket the server closed on its idle timeout. The read on the next line still went through that agent, and it failed with read ECONNRESET on all three attempts, which fails the run because CI treats a flaky test as a failure on purpose. It reads through the page now, like the write above it. The two remaining calls on the shared context sit in finally blocks that swallow their errors, so they cannot fail a test. --- e2e/v137-record-session-fence-offline.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/e2e/v137-record-session-fence-offline.spec.ts b/e2e/v137-record-session-fence-offline.spec.ts index 13faa6b88..455df1581 100644 --- a/e2e/v137-record-session-fence-offline.spec.ts +++ b/e2e/v137-record-session-fence-offline.spec.ts @@ -433,8 +433,16 @@ test.describe.serial("FENCE-AC-07 record-fence disk layers", () => { return res.status; }); expect(left).toBe(200); - const me = await context.request.get("/api/auth/me"); - const now = (await me.json()).data.recordSession as { + // Read back through the page for the same reason the switch above goes + // that way. This was the last call in the file still using the shared + // API context, and it duly failed with `read ECONNRESET` on all three + // attempts once the pooled socket had gone stale. The browser opens its + // own connection, and a GET for the caller's own session is outside the + // app either way. + const now = (await page.evaluate(async () => { + const res = await fetch("/api/auth/me"); + return (await res.json()).data.recordSession; + })) as { epoch: number; scope: string | null; };