Commit 150bff4
authored
perf(tests): trim sweep, copilot, and timer-bound suites; run three CI shards (#7375)
* perf(ci): run apps/sim as three test shards
* chore(deps): drop unused @types/mdx devDependency from apps/docs
Nothing in apps/docs imports mdx/types or a bare *.mdx module; the
generated .source imports carry a ?collection= suffix that the *.mdx
wildcard does not match, and @types/mdx still resolves transitively via
@mdx-js/mdx for fumadocs. The docs type-check passes without the direct
edge.
* perf(tests): move DOM-free jsdom suites to the node environment
Audited the 229 test files declaring @vitest-environment jsdom. 217 need a
real DOM (React rendering, TipTap/ProseMirror, window/document/localStorage,
DOMParser, ProgressEvent) and stay on jsdom; 12 exercise pure logic (yjs
collab-doc conversion, http tool URL building, panel editor store, log
utils, attachment upload, headless TipTap table commands, terminal-session
tooltip helpers) and now run on node, skipping the jsdom boot.
Dropped one redundant test in apply-streamed-markdown.test.ts: the
hand-rolled one-shot peer case is a strict subset of the NON-OVERLAPPING
two-peer test in apply-streamed-markdown.concurrent.test.ts, which also
asserts CRDT convergence and exactly-once survival of the peer edit.
* perf(tests): drive retry backoff and scheduled flushes with fake timers
Real sleeps and repeated setup were the run-phase cost in seven files:
- tools/index.test.ts: `retryDelayMs: 0` falls through to the 500ms default, so
every retry test slept for real. Fake the clock for the retry describe.
- embeddings/client.test.ts: two retry tests waited the 1s initial backoff.
- hosted-key-rate-limiter.test.ts: the queue-head test slept two 200ms polls;
the abort test slept 20ms wall clock and asserted on Date.now.
- event-buffer.test.ts: sleep(60)/sleep(5) waited on the 15ms flush timer.
- events.attribution.test.ts: walked and read the whole app twice, serially.
Walk once in a beforeAll with batched concurrent reads.
- sso-trust.test.ts: imported the Better Auth graph in each of three tests.
Import once in a beforeAll that carries the 30s budget.
- markdown-parse.test.ts: the one-shot helper built and destroyed a tiptap
Editor per document; reuse one across the 400-seed property corpus.
No production timing constants, corpus sizes, or assertions changed.
* perf(tests): drop the executable tool registry and full block map from non-sweep tests
The vitest suite is bounded by module loading, and the biggest single cost is a
test file opting out of the global `@/tools/registry` or `@/blocks/registry`
mock. Trim that where the test never needed the whole thing:
- `lib/internal/tool-operations/registry.server.test.ts` checked registration
against `getToolIds()` but still imported the executable registry for one
sweep. That sweep — every operation-backed tool has no `request` and a
registered handler — is the in-process half of the transport partition, so
it moves next to the external-URL sweep in `tools/request-transport.test.ts`,
which already pays for the registry. Handler loads now run in parallel.
Collect 12.5s -> 0.1s, run 6s -> 4.3s; request-transport unchanged (~8s).
- New `partialBlockRegistry` in `@sim/testing/mocks/block-registry.mock`
builds the `@/blocks/registry-maps` shape from the block modules a test
actually reads, so the real registry code runs over those blocks alone.
Applied to the six non-sweep tests that unmocked the block registry for one
or two blocks (webhook, slack, whatsapp, condition/function,
knowledge/start_trigger): collect 3-8s -> 0.05-2s each. Registry sweeps
keep the real map.
- `tools/index.test.ts` retry cases set `retryDelayMs: 0`, which the retry
config replaces with the 500ms default; `1` is the smallest delay honored.
Run 4.0s -> 0.45s.
- `tools/metadata.test.ts` collects sweep offenders into one assertion instead
of one `expect` per registry entry, and indexes ids once. Run 1.1s -> 0.03s.
- The `vi.unmock('@/tools/registry')` in the search-replace tests was dead:
nothing in their graph imports the registry any more, and all 106 tests pass
without it, contrary to the comment that claimed eight would fail.
* perf(tests): stop copilot handler tests from loading the executor, block, and trigger registries
The router test stubs every handler implementation module so the handler map
binds without loading the executor and block registry; the 90s timeout goes.
Handler, VFS, payload, and request tests mock the execution-side leaves and
catalog registries they never exercise. Source edges that dragged in barrels
for a single symbol now import the defining module: the Mothership block icon
from @sim/emcn/icons, contract schemas from their contract file, and autolayout
constants from new @sim/workflow-renderer/dimensions and /note-content subpaths.
lib/copilot: 141 files, per-file collect+run 74.2s -> 37.4s, wall 19.1s -> 15.0s
router.test.ts: 15.1s -> 0.45s
* fix(tests): import ContractBodyInput from the contract types module
* fix(tests): bind the real cancellation handler in the router test; mock the narrowed contract path
* fix(emcn): wait for focus restoration instead of a fixed 20ms sleep in the modal test1 parent 78780c9 commit 150bff4
58 files changed
Lines changed: 483 additions & 234 deletions
File tree
- .github/workflows
- apps
- docs
- sim
- app/workspace/[workspaceId]
- files/components/file-viewer/rich-markdown-editor
- collaboration
- home/components/mothership-view/components/resource-content/components/terminal-session
- logs
- w/[workflowId]/utils
- blocks/blocks
- executor/utils
- hooks/queries
- lib
- auth
- collab-doc
- copilot
- chat
- request
- go
- handlers
- lifecycle
- server
- tool-executor
- tools
- handlers
- workflow
- server/blocks
- vfs
- core/rate-limiter/hosted-key
- embeddings
- environment
- execution
- function-execution/application
- guardrails
- internal/tool-operations
- table
- workflows
- autolayout
- blocks
- canonical
- migrations
- operations
- sanitization
- search-replace
- stores/panel/editor
- tools
- http
- packages
- emcn/src/components/modal
- testing/src/mocks
- workflow-renderer
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
216 | 217 | | |
217 | | - | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
| |||
250 | 255 | | |
251 | 256 | | |
252 | 257 | | |
253 | | - | |
| 258 | + | |
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| |||
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
262 | | - | |
| 267 | + | |
263 | 268 | | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
267 | 272 | | |
268 | 273 | | |
269 | | - | |
| 274 | + | |
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 0 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | 160 | | |
196 | 161 | | |
197 | 162 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 9 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | | - | |
| 26 | + | |
23 | 27 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments