You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(ci): shard tests for ≤60s per ubuntu job; parallelize quality checks
Cut the monolithic test job (single ~190s vitest run, gated by a 170s cluster
file; 12-29min on CI) into parallel, wall-time-balanced shards so each
ubuntu-latest job's `vitest run` step stays ≤60s — verified on real CI
(48 ubuntu shards run 15-59s).
Test sharding (scripts/run-shard.js, driven by the CI matrix):
- Fork-heavy packages split via vitest --shard: cluster→3, egg→2, mock→2,
schedule→4, security→2, plus redis/multipart/development standalone; each
capped with --maxWorkers so forked egg cluster processes don't oversubscribe
the CPU and time out.
- The light remainder is greedy bin-packed by per-dir cpu weight into 8 rest-*
shards so heavy dirs land on separate shards.
- Long single test files split by `describe` block (no semantic change, no
removed cases) so vitest can parallelize them: cluster app_worker/agent_worker/
https/master.others, mock cluster, schedule worker/subscription/immediate,
egg watcher, development override.
- macОС/Windows have ~5-slot runner concurrency, so they run the whole suite as
one job per (os,node) instead of fanning out (which would queue ~9 batches).
Quality job split into a parallel matrix (lint/typecheck/fmtcheck/build/site) so
the slowest check — not their sum — bounds wall time.
Latent bugs fixed along the way:
- tegg controller ControllerMetaManager.test.ts intentionally triggers a
duplicate-proto error that polluted the process-global registry under
isolate:false, failing sibling files; isolated that project (isolate:true).
- clean-dist used `ut run clean --workspaces` which aborts the && chain (root has
no clean script) → scripts/clean-dist.js.
- typecheck/pretest used `ut run <self> --workspaces`, which includes the root
and recurses infinitely → scripts/run-workspaces.js (concurrent, root-bin PATH).
- Windows runner images no longer set %HOME%, breaking egg_loader getHomedir;
export HOME=%USERPROFILE% on windows test jobs.
- egg-bin runs without --coverage to stay ≤60s (no threshold; report only).
CI test jobs reduced 132→~56 to avoid flooding scarce macos/windows queues.
Windows flakes absorbed by --retry. No test semantics changed or cases removed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+39-2Lines changed: 39 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,18 +28,55 @@ Egg is maintained as a utoo monorepo.
28
28
29
29
### Local CI
30
30
31
-
Run tests **without building first**. The CI workflow (`ut install → ut run ci`) never runs `build` before tests. If `dist/` directories exist from a prior build, tegg plugin tests will fail with `duplicate proto` errors because globby scans both `src/*.ts` and `dist/*.js`, loading the same decorated class twice.
31
+
Run tests **without building first**. The CI test jobs run `ut run pretest`
32
+
(clean dist + per-workspace pretest) then a vitest shard; they never `build`
33
+
before tests. If `dist/` directories exist from a prior build, tegg plugin tests
34
+
will fail with `duplicate proto` errors because globby scans both `src/*.ts` and
35
+
`dist/*.js`, loading the same decorated class twice. `scripts/clean-dist.js`
36
+
(run by `ut run clean-dist`) removes every `dist/` for you.
32
37
33
-
When you see `duplicate proto` failures locally:
38
+
When you see `duplicate proto` failures locally, run `ut run clean-dist` (or the
39
+
equivalent find below) and re-run:
34
40
35
41
```bash
36
42
find tegg packages plugins tools -name dist -type d \
0 commit comments