@lenne.tech/nest-server 11.36.1 → 11.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -233,10 +233,33 @@ pnpm run check:mutations # apply every registered mutation, r
233
233
  pnpm run check:mutations -- --id=<id> # one mutation
234
234
  pnpm run check:mutations -- --list # the registry, without running anything
235
235
  pnpm run check:mutations -- --allow-dirty # when the fix and its evidence share a working tree
236
+ pnpm run check:mutations -- --jobs=4 # N mutations at a time (default: 2, or 4 on >=12 cores)
236
237
  ```
237
238
 
238
239
  Not part of `pnpm run check` — it edits source and re-runs whole e2e suites. It belongs in review
239
- and on the publish path. Between runs the registry is kept from rotting by
240
+ and on the publish path.
241
+
242
+ ### The cost is vitest's cold start, not the tests
243
+
244
+ Worth knowing before optimising the wrong thing: the specs behind all 29 e2e mutations add up to
245
+ **~40 seconds**. The step takes ~740s. The remaining ~700s is paying vitest's startup — process
246
+ spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 49 times.
247
+ That work is largely single-threaded I/O and barely scales with cores: the full registry measures
248
+ **744s on a 12-core laptop and 777s on a 4-vCPU CI runner**.
249
+
250
+ So it parallelises well, and `--jobs` does exactly that: **744s → 399s (1.87×) at 4 jobs**. Verified
251
+ by diffing all 49 verdicts against a sequential run — a parallel mode that changes a verdict is not
252
+ an optimisation, it is a broken safety net.
253
+
254
+ **A mutation writes into the source tree**, which is why N cannot simply run at once: two mutations
255
+ in one tree would see each other's edits and the specs would answer about a source state nobody
256
+ registered. Each worker therefore gets its own `git worktree`, with `node_modules` symlinked from
257
+ the main checkout (pnpm's internal links are relative, so one symlink serves every worktree).
258
+
259
+ That isolation has a consequence: a worktree is at **HEAD**, so parallel mode tests COMMITTED code.
260
+ When `src/` or `tests/` is dirty — or `--allow-dirty` is passed — the run says so and falls back to
261
+ sequential. A fast answer about the wrong source is worse than a slow answer about the right one.
262
+ `tests/unit/mutation-jobs-planning.spec.ts` pins that decision. Between runs the registry is kept from rotting by
240
263
  `tests/unit/regression-evidence.spec.ts`, which asserts every `find` still matches its target
241
264
  **exactly once**: a stale mutation would silently become a no-op, and a no-op "confirms" evidence
242
265
  that was never checked.
package/FRAMEWORK-API.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lenne.tech/nest-server — Framework API Reference
2
2
 
3
- > Auto-generated from source code on 2026-08-22 (v11.36.1)
3
+ > Auto-generated from source code on 2026-08-22 (v11.36.2)
4
4
  > File: `FRAMEWORK-API.md` — compact, machine-readable API surface for Claude Code
5
5
 
6
6
  ## CoreModule.forRoot()
@@ -0,0 +1,67 @@
1
+ # Migration Guide: 11.36.1 → 11.36.2
2
+
3
+ ## Overview
4
+
5
+ | Category | Details |
6
+ |----------|---------|
7
+ | **Breaking Changes** | None |
8
+ | **New Features** | `check:mutations --jobs=N` — the regression-evidence gate now runs several mutations at once (§1) |
9
+ | **Bugfixes** | None affecting runtime |
10
+ | **Migration Effort** | **None.** Tooling-only release; nothing in `src/` changed |
11
+
12
+ ---
13
+
14
+ ## Quick Migration
15
+
16
+ ```bash
17
+ pnpm update @lenne.tech/nest-server@11.36.2
18
+ ```
19
+
20
+ That is the whole migration. This release changes no framework code, no configuration and no public
21
+ API — `src/` is untouched. It is published so consuming projects stay on a current version and pick
22
+ up the maintenance below.
23
+
24
+ ---
25
+
26
+ ## 1. Faster regression-evidence gate (framework repo only)
27
+
28
+ Relevant if you run `pnpm run check:mutations`, or maintain a fork of this repo's tooling.
29
+
30
+ `scripts/check-mutations.mjs` can now run several mutations in parallel:
31
+
32
+ ```bash
33
+ pnpm run check:mutations # auto: 2 workers, or 4 on a machine with >= 12 cores
34
+ pnpm run check:mutations -- --jobs=4 # explicit
35
+ pnpm run check:mutations -- --jobs=1 # force the previous sequential behaviour
36
+ ```
37
+
38
+ **Measured: 744s → 399s (1.87×) at 4 jobs.** All 49 verdicts were diffed against a sequential run
39
+ and are identical — a parallel mode that changes a verdict is a broken safety net, not a speedup.
40
+
41
+ **Why it was slow in the first place, since it is easy to optimise the wrong thing:** the specs
42
+ behind all 29 e2e mutations add up to about 40 seconds. The rest is paying vitest's cold start once
43
+ per mutation, 49 times. That work is largely single-threaded I/O and barely scales with cores — the
44
+ registry measures 744s on a 12-core laptop and 777s on a 4-vCPU CI runner.
45
+
46
+ **How the isolation works.** A mutation writes into the source tree, so N cannot simply run at once:
47
+ two mutations in one tree would see each other's edits. Each worker gets its own `git worktree`, with
48
+ `node_modules` symlinked from the main checkout. A worktree is checked out at **HEAD**, so parallel
49
+ mode tests committed code — when `src/` or `tests/` is dirty, or `--allow-dirty` is passed, the run
50
+ prints why and falls back to sequential.
51
+
52
+ ---
53
+
54
+ ## 2. Dependency maintenance
55
+
56
+ `@vitest/ui` was removed: no script passes `--ui` and no config imports it. Development-only, no
57
+ runtime effect.
58
+
59
+ ---
60
+
61
+ ## Troubleshooting
62
+
63
+ | Symptom | Cause | Fix |
64
+ |---------|-------|-----|
65
+ | `check:mutations` prints "(sequential: …)" | `src/` or `tests/` is dirty, or `--allow-dirty` was passed | Intended — a worktree at HEAD would test different code. Commit or stash to get the fast path |
66
+ | `check:mutations` seems slower than before | More workers than cores helps nothing; each worker starts a vitest that forks again | Lower `--jobs`, or leave it unset and let it size itself |
67
+ | A stale worktree is left behind | The run was killed with SIGKILL | `git worktree prune` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "11.36.1",
3
+ "version": "11.36.2",
4
4
  "description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
5
5
  "keywords": [
6
6
  "node",
@@ -185,7 +185,6 @@
185
185
  "@types/nodemailer": "8.0.1",
186
186
  "@types/passport": "1.0.17",
187
187
  "@vitest/coverage-v8": "4.1.11",
188
- "@vitest/ui": "4.1.11",
189
188
  "ansi-colors": "4.1.3",
190
189
  "bullmq": "6.2.0",
191
190
  "find-file-up": "2.0.1",