Repository navigation
Backlog
Description
Dashboard e2e is the main reason CI gets rerun. Each flake gets fixed with a test-side wait, and then another test starts to flake. This is the analysis of the causes. Evidence is from 0eb3febf3.
Impact (10-26 to 11-25)
- 168 of 342 reruns that ended green (49%) had a
test / dashboard e2efailure on an earlier attempt. - 88 of 1,324 main pushes (6.6%) had an e2e failure.
retries: 1hides flakes: about 39% of recent main runs uploaded a flaky-test trace.failOnFlakyTestswas added in c3cb6c9db and removed in 4759af9b3.- Vitest dashboard tests are not a flake source.
- 13 recent deflake commits are waits, splits, or exemptions, for example 1e9a143a4, b204668c5, and 548f661d0. 9 are real fixes.
Causes
- Real timers with a frozen
Date.setFixedTime(e2e/harness.ts:430-434) pins onlyDate. The 5s/api/versionspoll, the SSE stream, and the 2s and 500ms detail polls keep running. Only 7 of 76 specs control timers.- Request budgets count background polls (
e2e/request-budget.ts:58-60). - 57 errors in the window are "The test ended while requests that it caused were open".
- Request budgets count background polls (
- Query functions with side effects. The versions
queryFnsets React state and starts invalidations (src/client/versions.ts:373-379). The detailqueryFninvalidates side reads and Inbox lists (conversations/queries.ts:165,conversationSideReads.ts:40). One poll can start fetches that a test cannot await. The harness allows 8 background reads (e2e/harness.ts:83-103). - Two mock layers. There are about 306
page.routeoverrides on top of the in-process mock server (src/mock-reporting, about 10.5k lines).- Some
/apireads reach real Postgres or Redis, which CI shares across workers. Each full run logs 35api.unhandled.exceptionerrors. - Mock state reset is a hand-kept list (
app.ts:99-109). - The server runs in the Playwright worker, so CPU load slows the server and the test together.
- Some
- Scroll and virtualization. Transcript rows use an estimated size and then a measured one.
transcriptBottomPinning.ts(949 lines) settles after a double rAF or a 400ms timeout. This is the most common failure mode: 113toBeInViewporterrors. It is also visibly buggy on mobile, including the scroll to unread history. - Smaller races.
- List order is held while the pointer is over the list (
heldListOrder.ts:116,inbox/heldRows.ts). - 11 of 13 lazy
Suspensesites usefallback={null}. - There are 24
replace: trueURL writes. The current top flake is that Inboxitem=never reaches the URL. - CI uses the runner's Chrome, which is not pinned.
- List order is held while the pointer is over the list (
Current flakes
- inbox/code › Code · Mine sorts, and inbox-cards › image strip click:
item=is missing from the URL. - conversations-mobile long press: fails 3 of 12 runs under CPU load.
- question-cards mobile and inbox-item-evidence: the waiting pill count is 1 when 0 is expected.
- navigation.spec.ts:325: fails 4 of 6 runs under load.
- System and space-lead request budgets.
Proposed plan (from the analysis)
- Harness:
- Install the fake clock in every test, and turn polls off unless a spec opts in.
- Make the mock server use the injected browser time.
- Fail any read that reaches a real store.
- Remove
page.routeoverrides. - Pin Chrome.
- Sync layer: query functions only read. One module owns the versions poll and invalidation, and gives tests a settle signal they can await. Set
QueryClientdefaults and query key factories in one place. - Code reads time through an injectable clock and scheduler.
- Replace the bottom-pinning code with a virtualizer built for chat.
- Remove fragile behavior: pointer-held order, the 500ms quick-question poll, and hover-only fetches. Remove request-budget and viewport assertions that only test timing.
- Turn
failOnFlakyTestsback on.
The server-rendering migration that was discussed would fix none of these causes. Related: #4177, #4031, #4254.
via @dcramer.
--
Metadata
Metadata
Assignees
Labels
No labels
Activity
test(dashboard): Stop e2e tests from silencing the open-request check
test(dashboard): Stop e2e tests from retrying steps or waiting for ne…
test(dashboard): Stop e2e tests from forwarding routes to the mock se…
test(dashboard): Stop e2e tests from leaving background reads open
test(dashboard): Stop e2e tests from retrying steps or waiting for ne…
test(dashboard): Stop e2e tests from hiding races they cause (#4360)
test(dashboard): Stop e2e tests from forwarding routes to the mock se…
test(dashboard): Stop e2e tests from forwarding routes to the mock se…
test(dashboard): Stop e2e teardown from ignoring route handler errors
test(dashboard): Wait out React's Suspense reveal before a screenshot
test(dashboard): Stop e2e tests from forwarding routes to the mock se…
test(dashboard): Stop e2e teardown from ignoring route handler errors
test(dashboard): Wait out Suspense reveals and lazy chunks before a s…
test(dashboard): Stop e2e tests from forwarding routes to the mock se…
test(dashboard): Stop e2e teardown from ignoring route handler errors
test(dashboard): Wait out jump marks and ignore repeat polls before a…
test(dashboard): Fulfill the new Space detail read and page-2 pin feed
test(dashboard): Wait for running route handlers before a page closes