From cf28e3be82f64962bfa79e02d1812d5f6b72dbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20T=C3=B6rcsv=C3=A1ri?= Date: Mon, 24 Aug 2026 19:35:52 +0200 Subject: [PATCH] tests(trio): settleConverged names the diverging tab + first differing line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bare expect(false).toBe(true) after the 90s poll hid WHAT diverged in the drift-trio S4 same-item races (CI 2026-08-24 ×2, local under 15-worker contention 2/21). The failure now reports each tab that differs from A and the first differing model line, so the next divergence self-documents (memory: s4-value-race-divergence — never re-quarantine without the diff). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01AH2iPekUGsEAYnMUD5BmAi --- tests/kicad/utils/trio.ts | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/kicad/utils/trio.ts b/tests/kicad/utils/trio.ts index c419708..a2f1eae 100644 --- a/tests/kicad/utils/trio.ts +++ b/tests/kicad/utils/trio.ts @@ -420,15 +420,26 @@ function firstDiff(a: string, b: string): string { * between scenario steps — bounded poll, no blind sleeps (tests/TESTING.md). */ export async function settleConverged(trio: TabSet, cfg: ToolCfg, timeout = 90000): Promise { - await expect - .poll( - async () => { - const texts = await Promise.all(trio.tabs.map(([, p]) => modelText(p, cfg))); - return texts.every((t) => t === texts[0]); - }, - { timeout, intervals: [400] }, - ) - .toBe(true); + // On timeout the failure names WHICH tab diverged and the first differing + // line — a bare `false` hid the actual divergence (memory: s4-value-race). + let last: string[] = []; + try { + await expect + .poll( + async () => { + last = await Promise.all(trio.tabs.map(([, p]) => modelText(p, cfg))); + return last.every((t) => t === last[0]); + }, + { timeout, intervals: [400] }, + ) + .toBe(true); + } catch (e) { + const labels = trio.tabs.map(([l]) => l); + const diffs = last + .map((t, i) => (i > 0 && t !== last[0] ? `${labels[0]} vs ${labels[i]}: ${firstDiff(last[0], t)}` : null)) + .filter(Boolean); + throw new Error(`trio did not converge:\n${diffs.join("\n")}\n\n${(e as Error).message}`); + } } /**