Skip to content

ci(test): speed up the test and type-check jobs - #1567

Merged
viethung0o0 merged 1 commit into
mainfrom
ci/test-sharding
Oct 27, 2026
Merged

viethung0o0 merged 1 commit into
mainfrom
ci/test-sharding

Conversation

@viethung0o0

@viethung0o0 viethung0o0 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Speeds up the test and type-check jobs.

  • Tests run on 8 shards; the vitest preset now actually pre-bundles heavy dependencies (drizzle, zod, S3 client, ioredis, bullmq, date-fns) and vitest moves to 4.1.12.
  • Type-check is split across two runners and runs incrementally with a cached tsbuildinfo.
  • Fixes stale turbo cache hits: test and check-types hashes now include the source of internal dependencies, so a change to e.g. packages/business re-runs builder and worker instead of replaying their cached results.
  • Fixes a realtime bug found while profiling: a socket closed during open (resync, overload) only reached the client after ~16s. The client's reconnect backoff now resets only after sustained uptime, so faster closes cannot turn into a fast reconnect loop; coming back online or to the tab retries at once.

Results (CI, every workspace re-run, 0 turbo cache hits)

Before (main) After (this PR)
Tests 29.4 min (1 runner) 5.3 min (slowest of 8 shards)
Types 7.3 min (1 runner) 2.8 min (slowest of 2 runners, tsbuildinfo restored)

@github-actions github-actions Bot added the ci CI/CD pipeline changes label Oct 27, 2026
@viethung0o0 viethung0o0 changed the title ci: shard tests and cut slow test imports ci(test): shard test runs across four runners and cut slow imports Oct 27, 2026
@viethung0o0 viethung0o0 changed the title ci(test): shard test runs across four runners and cut slow imports ci(test): shard tests across eight runners and pre-bundle heavy deps Oct 27, 2026
@viethung0o0 viethung0o0 changed the title ci(test): shard tests across eight runners and pre-bundle heavy deps ci(test): shard tests, pre-bundle heavy deps and cache type-check state Oct 27, 2026
@viethung0o0 viethung0o0 changed the title ci(test): shard tests, pre-bundle heavy deps and cache type-check state ci(test): speed up the test and type-check jobs Oct 27, 2026
@viethung0o0
viethung0o0 force-pushed the ci/test-sharding branch 2 times, most recently from e5621e5 to 0bdb62d Compare October 27, 2026 16:46
- Run tests on eight shards with a depth-2 checkout.
- Make the vitest preset actually pre-bundle heavy dependencies
  (drizzle-orm and subpaths, zod, S3 client, ioredis, bullmq, date-fns);
  its optimizer had no `include`, so it bundled nothing. Update vitest to
  4.1.12 for its `importOriginal` fix under the optimizer; worker suites
  that factory-mock bullmq opt it out.
- Split type-checking across two runners (builder + worker, the rest)
  and run it incrementally with a cached tsbuildinfo; ignore
  `*.tsbuildinfo` repo-wide.
- Make turbo's `test` and `check-types` hashes cover the source of the
  internal packages they import (a no-op `transit` task chained through
  `^transit`). Before, a change to e.g. packages/business left builder's
  and worker's cached results valid and CI replayed them.
- Read the button label limit from a dependency-free flow-config
  subpath, boot MSW only in the business tests that mock HTTP, and walk
  each recurrence oracle rule once.
- Fix realtime closes issued during `open` (resync, overload): the
  upgrade runs inside `res.cork()`, so the TCP shutdown was skipped and
  clients saw `onclose` only ~16s later. Ends requested during the
  upgrade now run once the cork is released.
- Keep the realtime client's reconnect backoff growing when a short-lived
  connection receives a message before closing (a replay frame then a
  resync): only sustained uptime resets it now, not any message.
  Coming back online or to the tab retries at once (`reconnectNow`,
  which still honours a server overload retryAfter).

Tests with every workspace affected: >30 min (timed out) -> ~5.4 min.
Locally: business 160s -> 53s, builder 385s -> 250s, worker 136s -> 95s,
realtime ~65s -> ~5s.
@viethung0o0
viethung0o0 merged commit 6a09d85 into main Oct 27, 2026
16 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD pipeline changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants