Skip to content

test: stop CI flakes from load tests and wall-clock checks - #22

Merged
maxsoldev merged 3 commits into
mainfrom
fix-hook-and-flaky-tests
Nov 21, 2026
Merged

maxsoldev merged 3 commits into
mainfrom
fix-hook-and-flaky-tests

Conversation

@maxsoldev

Copy link
Copy Markdown
Owner

Summary

Of 62 CI runs, the test failures that were not caused by code came from wall-clock limits on shared runners. The worst case: the load tests ran beside the unit tests.

 pnpm test
-  vitest run                         # 87 files in parallel, load tests among them
+  vitest run --project unit          # 84 files in parallel
+  vitest run --project perf          # query/performance, ingest/performance, api/latency: one at a time
Failure Cause Fix
3 unit tests (16–68 ms) past the 5 s timeout, #20 query/performance.test.ts (24 s of CPU) ran beside them; run 2× slower than usual perf project after unit
imageSize "under 50 ms" took 61 ms wall-clock check invalid base64 after the first 64 KB: no clock
latency p95 661 ms (fixed before in 596600a) load test beside other tests runs alone now

Also: the commit-msg hook let no local merge commit through (Merge branch …); it now skips merges, as CI does.

Evidence

  • Per-file times, failed run vs a passing run (Node 22): total 77.8 s vs 35.2 s; query/performance 49 s vs 24 s; serve 14.8 s vs 1.0 s.
  • Before: vitest run → 3 × TestTimeoutError: Test timed out in 5000ms (run 44913102985).
    After: pnpm test locally → unit 84 files / 1069 tests in 5.0 s, then perf 3 files / 6 tests in 20.4 s.
  • New image test fails when decodeBase64 reads the whole string (checked by hand), passes on the real code.
  • Hook: git merge --no-ff passes; git commit -m "Bad subject" is blocked.
  • pnpm check green.

Merge Danger

Door: two-way

Blast Radius: tests

CI's Node job runs the tests about 20 s longer: the load tests no longer overlap the rest.

A local git merge writes "Merge branch ..." and the hook blocked it.
CI skips merge commits (git log --no-merges), so the hook does too:
it exits early while MERGE_HEAD exists.
"decodes in under 50 ms" failed on a slow CI runner (61 ms) while
the code was right. The test now puts invalid base64 after the first
64 KB: an image read whole would not decode, one read by its header
does. Checked: with the whole string decoded, the test fails.
A CI run on Node failed with three unit tests past vitest's 5 s
timeout; they take 16-68 ms. That run was twice as slow as usual, and
query/performance.test.ts, which takes 24 s, ran beside them. The load
tests take most of the CPU, so on a slow runner the unit tests beside
them stall, and their own timings get noise (latency.test.ts once
measured a p95 of 661 ms).

Two vitest projects now: unit (files in parallel) and perf (the three
load test files, fileParallelism off), run one after the other by
pnpm test. bun test already runs files one at a time, and its job
never timed out. A longer timeout was rejected: it would hide a real
hang too.
@maxsoldev
maxsoldev merged commit 1b5a629 into main Nov 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant