[engine] PurityLint: Load ESLint once in beforeAll so a cold start under load cannot time out the first case
This commit is contained in:
@@ -12,7 +12,7 @@ and **how to apply it**.
|
||||
| [`art.md`](art.md) | 2 | The image pipeline. |
|
||||
| [`code.md`](code.md) | 2 | TypeScript, Svelte, async ordering, Rust. |
|
||||
| [`technical.md`](technical.md) | 5 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 4 | What makes a test worth having, and how a passing test lies. |
|
||||
| [`testing.md`](testing.md) | 5 | What makes a test worth having, and how a passing test lies. |
|
||||
| `privacy.md` | none yet | What could leave the device or make a person findable. (The geocell finding is in the review, not here: it was caught before it cost anything.) |
|
||||
| [`process.md`](process.md) | 2 | Workflow, commits, credentials, honesty about what shipped. |
|
||||
|
||||
|
||||
@@ -58,3 +58,18 @@ arrives. Then it fails for the first time on the author's machine, with the auth
|
||||
|
||||
**How to apply it.** When a test branches on content that does not exist yet, fill the
|
||||
content temporarily, run the suite, restore it, and record the run in the review.
|
||||
|
||||
## A one-time cold start is charged to the first case
|
||||
|
||||
**What happened.** On 2026-11-01, with the machine at 80% CPU, `pnpm test` failed one engine
|
||||
case: `purity-lint.test.ts` › *reports Date.now()*, timed out at 5 s. The snippet was fine.
|
||||
The first `eslint.lintText` call loads the whole config and typescript-eslint, and vitest
|
||||
charged that load to whichever case ran first. The fix is a `beforeAll` that lints an
|
||||
empty file once, with its own 60 s timeout.
|
||||
|
||||
**Why it bit.** A suite that passes on a quiet machine can still hide a fixed cost inside one
|
||||
case. It fails only under load, and then it looks like a bug in the code that case tests.
|
||||
|
||||
**How to apply it.** When the first case of a file loads something heavy (a linter, a
|
||||
compiler, a browser), load it in `beforeAll` with an explicit timeout. If only the first case
|
||||
of a file times out, suspect a cold start before suspecting the code.
|
||||
|
||||
Reference in New Issue
Block a user