From 1322b1af2abcfe09f7cbd0b95cc1622d4b9a8a4e Mon Sep 17 00:00:00 2001 From: Nick Gomez <122398915+nick-inkeep@users.noreply.github.com> Date: Thu, 18 Jun 2026 04:52:16 -0700 Subject: [PATCH] test(open-knowledge): stabilize two contention-induced e2e flakes (#1953) Two Playwright stress flakes the e2e-stability detector caught under full-suite contention, with distinct root causes. Both are test-side fixes with no app behavior change. crdt-stress.e2e.ts S6: the wait for the user-typed marker to reach Y.Text('source') via server Observer A used a 10s budget, while the sibling content-propagation wait just above it uses 30s for the same Observer-A-mediated convergence. The test runs three turns that each append the large fixture, so the doc grows to roughly 3x and the later turns re-derive Y.Text from a much larger fragment; under contention the marker round-trip then exceeds 10s (measured at 11.4s under a workers=12 over-subscription) while landing well under 30s. The marker is never dropped (the test's final assertion confirms all three survive), so this aligns the budget with the sibling wait. editor-tabs.e2e.ts (sidebar click replaces the active .mdx tab with a duplicate): the test drove the New-tab button and sidebar treeitems without the waitForActiveProviderSynced settle barrier that the other sidebar-driving specs use. Under contention a click can race the @pierre/trees virtualized tree's first layout and click/focus handling and hang to the 120s test timeout. This adds settle barriers after the goto and after the intervening navigation, before the fragile clicks. Verified green under a workers=12 over-subscription (both targets x3, crdt markers landing within 30s when they exceed 10s, the new barriers resolving without hanging) and under the detector invocation. GitOrigin-RevId: 255f2dddd5a70e1be7019a92b0fb03cc25784634 --- packages/app/tests/stress/crdt-stress.e2e.ts | 2 +- packages/app/tests/stress/editor-tabs.e2e.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/app/tests/stress/crdt-stress.e2e.ts b/packages/app/tests/stress/crdt-stress.e2e.ts index e439e6f7..4c5429d9 100644 --- a/packages/app/tests/stress/crdt-stress.e2e.ts +++ b/packages/app/tests/stress/crdt-stress.e2e.ts @@ -45,7 +45,7 @@ test('S6: multi-turn stress — large content + user edits', async ({ page, api, await page.waitForFunction( (m: string) => window.__activeProvider?.document?.getText('source')?.toString()?.includes(m), marker, - { timeout: 10_000 }, + { timeout: 30_000 }, ); const turnState = await page.evaluate(() => { diff --git a/packages/app/tests/stress/editor-tabs.e2e.ts b/packages/app/tests/stress/editor-tabs.e2e.ts index 8827ac9c..a478fea7 100644 --- a/packages/app/tests/stress/editor-tabs.e2e.ts +++ b/packages/app/tests/stress/editor-tabs.e2e.ts @@ -9,6 +9,7 @@ import { REQUIRED_FIXTURE_ENTRY_NAMES, test, type WorkerServer, + waitForActiveProviderSynced, } from './_helpers'; function testId(): string { @@ -689,12 +690,14 @@ test.describe('Editor tabs', () => { await page.goto(`/#/${barDoc}`); await expect(editorTabButtons(page, barLabel)).toHaveCount(1, { timeout: 10_000 }); + await waitForActiveProviderSynced(page); await editorNewTabButton(page).click(); await expect(closeNewTabButtons(page)).toHaveCount(1, { timeout: 10_000 }); await sidebarTreeItem(page, `hello-${id}.mdx`).click(); await expect(editorTabButtons(page, helloLabel)).toHaveCount(1, { timeout: 10_000 }); await expectActiveTab(editorTabButtons(page, helloLabel).first()); + await waitForActiveProviderSynced(page); await sidebarTreeItem(page, `bar-${id}.mdx`).click();