From eab2b48f2c9a536453411d9bde2c8c5867f57162 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Wed, 22 Apr 2026 16:31:29 -0400 Subject: [PATCH] docs(test-bucket): document slowTests addition criteria Reviewer flagged that the manual `slowTests` array silently degrades `test:fast` if new subprocess/server/timer tests are added without being declared slow (no literal `dist/` means auto-detection misses them). Interim fix: explicit 5-rule criteria block in the script so contributors know when to add a test. Enforcement (automated perf-budget warning in push-ci.yml) tracked in issue #1071. --- scripts/run-test-bucket.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/run-test-bucket.js b/scripts/run-test-bucket.js index 4cd682d6..52981bac 100644 --- a/scripts/run-test-bucket.js +++ b/scripts/run-test-bucket.js @@ -6,9 +6,18 @@ const { spawnSync } = require('node:child_process'); const rootDir = path.resolve(__dirname, '..'); const candidateRoots = ['tests/unit', 'tests/integration', 'tests/npm']; -// Keep this list in sync with any newly added dist-dependent or long-running -// tests. `tests/unit/scripts/run-test-bucket.test.js` verifies every path here -// exists so bucket drift fails loudly instead of silently slowing `test:fast`. +// Add a `.ts` test to `slowTests` when ANY of these apply: +// 1. It spawns a child process (CLI, bun test, node, gh, etc.). +// 2. It binds a port, starts a server, or talks to localhost. +// 3. It reads a real file from `dist/` or the repo root at runtime. +// 4. It waits on a timer > 500ms or a filesystem watcher. +// 5. A single run consistently takes > 1500ms on reference hardware. +// Tests that literally reference `dist/` in source are auto-forced slow by +// `readsBuiltDist`. This list is the manual catch-all for `.ts` tests that +// meet the criteria above without the literal `dist/` string. +// `tests/unit/scripts/run-test-bucket.test.js` verifies every path here exists +// (catches deletion drift) but CANNOT detect new undeclared slow tests. +// Automated perf-budget enforcement tracked in issue #1071. const slowTests = [ 'tests/integration/cursor-daemon-lifecycle.test.ts', 'tests/integration/proxy/daemon-lifecycle.test.ts',