Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: stop full-suite server runs failing on 10s timeouts in untouched files (#7951)
[._.]/ Adam Eivy4f1f4a9b0102
diff --git a/scripts/checkNodeVersion.test.js b/scripts/checkNodeVersion.test.jsindex e41cdf64bf..fb8f2fc5e6 100644--- a/scripts/checkNodeVersion.test.js+++ b/scripts/checkNodeVersion.test.js@@ -76,7 +76,20 @@ describe('satisfiesMinNode', () => {});it('defaults to the running interpreter, which must itself satisfy the range', () => {- expect(satisfiesMinNode()).toBe(true);+ // Keep the assertion — CI must run a supported Node, and every other case+ // here passes an explicit version, so this is the only one that proves the+ // no-argument default reads `process.versions.node` at all. What it must+ // NOT do is fail as a bare `expected false to be true` (#7951): on a+ // developer machine one release behind, that reads like a regression in the+ // branch under test and costs a round of triage in a suite the change never+ // touched. Name the environment instead.+ expect(+ satisfiesMinNode(),+ `This interpreter is Node ${process.versions.node}, which does not satisfy `+ + `package.json engines.node (${SUPPORTED_NODE_RANGE}). That is an environment `+ + 'mismatch on this machine, not a defect in the code under test — upgrade Node '+ + 'to a supported release. CI runs a supported Node, where this passes.',+ ).toBe(true);});});diff --git a/server/lib/detachedSpawn.js b/server/lib/detachedSpawn.jsindex 8ddd5be86d..4c6f0f051c 100644--- a/server/lib/detachedSpawn.js+++ b/server/lib/detachedSpawn.js@@ -561,7 +561,12 @@ export async function spawnDetached(bin, args = [], {// close) or throw as unhandled (error), matching ChildProcess async timing.let launchError = null;const awaitPid = async () => {- for (let waited = 0; waited < pidTimeoutMs; waited += pollMs) {+ // Wall-clock deadline, not `waited += pollMs` — same reason as the reap+ // loop below (#7951): the loop body reads a file each pass, so a tick count+ // under-measures real elapsed time on a loaded machine and stretches this+ // timeout well past pidTimeoutMs.+ const pidDeadline = Date.now() + pidTimeoutMs;+ while (Date.now() < pidDeadline) {if (launcherSpawnError) { launchError = launcherSpawnError; return; }const raw = await readFile(pidFile, 'utf8').catch(() => '');const pid = Number.parseInt(raw, 10);@@ -835,11 +840,23 @@ export async function reapDetached(controlDir, { graceMs = REAP_GRACE_MS, pollMs// stale late write (which would prematurely close the new handle). Escalate// to SIGKILL at the grace deadline; hard-cap so a wedged supervisor can't// hang boot.- const hardCapMs = graceMs + 5000;- for (let waited = 0; waited < hardCapMs; waited += pollMs) {+ // Both deadlines are WALL-CLOCK, read from the monotonic-enough Date.now()+ // rather than accumulated as `waited += pollMs` (#7951). Each pass through+ // this loop costs `sleep(pollMs)` PLUS a file read, and a `setTimeout(25)` on+ // a loaded box does not return in 25ms — so counting ticks made both the+ // grace and the hard cap stretch by whatever factor the machine was+ // oversubscribed by. That matters beyond the suite: this runs at boot, and+ // the hard cap exists precisely "so a wedged supervisor can't hang boot",+ // which a tick count does not actually guarantee. It also made+ // reapAndCleanDetachedDirs — which sweeps dirs sequentially — blow a 30s test+ // timeout on a 3s grace.+ const startedAt = Date.now();+ const graceDeadline = startedAt + graceMs;+ const hardDeadline = startedAt + graceMs + 5000;+ while (Date.now() < hardDeadline) {await sleep(pollMs);if (await exitWritten()) return { reaped: wasAlive, pid };- if (waited >= graceMs && isAlive(pid)) signalPid(pid, 'SIGKILL', killProcessGroup);+ if (Date.now() >= graceDeadline && isAlive(pid)) signalPid(pid, 'SIGKILL', killProcessGroup);}return { reaped: wasAlive, pid };}diff --git a/server/lib/detachedSpawn.test.js b/server/lib/detachedSpawn.test.jsindex c55eb15042..a4c451944b 100644--- a/server/lib/detachedSpawn.test.js+++ b/server/lib/detachedSpawn.test.js@@ -658,6 +658,50 @@ describe('spawnDetached', () => {const res = await reapDetached(controlDir, { graceMs: 200, pollMs: 25 });expect(res.reaped).toBe(false);});++ // NOTE on why this is a source guard and not a behavioral one. The property+ // is "elapsed wall-clock bounds the loop", and it only diverges from the old+ // tick count when a pass costs MORE than pollMs in real time — i.e. on a+ // loaded machine. Fake timers cannot express that: advancing N ms of fake+ // time yields both N ms elapsed AND N/pollMs iterations, so the two+ // implementations agree by construction (a first draft of this test passed+ // against the tick-counting loop, which is how that was found). A real-time+ // test cannot be cheap either — the hard cap's floor is graceMs + 5000, so+ // any run to the cap costs 5s of wall-clock. So this pins the shape, in the+ // spirit of lib/importScoping.test.js, rather than adding a 5s sleep.+ it('bounds both poll loops on WALL-CLOCK deadlines, not accumulated poll ticks', async () => {+ const raw = await readFile(+ new URL('./detachedSpawn.js', import.meta.url),+ 'utf8',+ );+ // Scan CODE only. The comments above both loops name the shape they+ // replaced — `waited += pollMs` — so a scan of the raw file matches the+ // very prose explaining the fix and fails on a correct tree.+ const source = raw+ .replace(/\/\*[\s\S]*?\*\//g, '')+ .replace(/(^|[^:])\/\/[^\n]*/g, '$1');+ // Positive control: the loops this guards still exist to be guarded.+ expect(source).toContain('export async function reapDetached');+ expect(source).toContain('const awaitPid = async () =>');+ expect(source.match(/await sleep\(pollMs\)/g).length).toBeGreaterThanOrEqual(2);++ // The regression shape: a counter advanced by the NOMINAL cadence, then+ // compared against a duration. Under load each pass costs more than+ // pollMs, so the real cap stretches by the oversubscription factor.+ expect(+ /waited\s*\+=\s*pollMs/.test(source),+ 'detachedSpawn.js is accumulating poll ticks again (`waited += pollMs`). That '+ + 'measures the loop\'s own cadence, not elapsed time, so REAP_GRACE_MS and '+ + 'pidTimeoutMs both stretch on a loaded machine — and the hard cap stops '+ + 'bounding boot, which is the only reason it exists (#7951). Compare '+ + 'Date.now() against a deadline instead.',+ ).toBe(false);++ // And the shape that replaced it, so deleting the loops does not pass.+ expect(source).toContain('Date.now() < hardDeadline');+ expect(source).toContain('Date.now() < pidDeadline');+ });+});describe('reapAndCleanDetachedDirs', () => {@@ -672,13 +716,56 @@ describe('spawnDetached', () => {await waitUntil(async () => (await aliveByPs(hA.pid)) && (await aliveByPs(hB.pid)));// pollMs matches the per-job cadence the rest of this suite spawns with;// the default 250ms sentinel poll costs a quarter-second per dir here.- const res = await reapAndCleanDetachedDirs(parent, { pollMs: 25 });+ // graceMs is explicit for the same reason the single-dir reap tests above+ // set it (#7951): the sweep reaps SEQUENTIALLY, and each dir is capped at+ // graceMs + 5000, so the 12s production default makes this one case cost+ // up to 34s — past any sane testTimeout. It normally finishes in ~150ms+ // because SIGTERM lands immediately, but on a machine loaded enough that+ // the exit is not observed before the grace elapses, both dirs wait out+ // the full escalation and the file times out with nothing wrong. What+ // this test asserts is that the sweep reaps every dir and removes it, not+ // how long production waits before SIGKILL — reapDetached's own tests+ // cover the escalation.+ const res = await reapAndCleanDetachedDirs(parent, { pollMs: 25, graceMs: 3000 });expect(res.reaped).toBe(2);expect(res.scanned).toBe(2);expect(await stat(a).then(() => true).catch(() => false)).toBe(false);expect(await stat(b).then(() => true).catch(() => false)).toBe(false);- await Promise.all([closedA, closedB]);- });+ // Settle the handles, but do NOT require 'close' (#7951). Every assertion+ // above is already done; this only exists so the tailers are not left+ // polling. It cannot be an unconditional await: the sweep REMOVES each+ // control dir, and a handle learns its job ended by reading the `exit`+ // sentinel inside that dir. If the tailer has not observed the sentinel+ // before the rm — which is a race it wins on an idle machine and loses on+ // a loaded one — 'close' can never fire, and the await hangs until the+ // test times out no matter how large that budget is. That is what made+ // this case blow a 60s allowance while asserting nothing slow.+ await Promise.all([closedA, closedB].map((closed) => Promise.race([+ closed.catch(() => {}),+ new Promise((resolve) => { setTimeout(resolve, 1000); }),+ ])));+ // This case gets its own timeout because its worst case genuinely exceeds+ // the suite's 30s budget — it is the heaviest case in the file, and the+ // number below is derived, not padded (#7951):+ //+ // 2 x spawnDetached, each bounded by PID_TIMEOUT_MS ......... 20s+ // waitUntil(...) for both children to be live ............... 5s+ // reapAndCleanDetachedDirs, 2 dirs SEQUENTIALLY at+ // graceMs 3000 + the 5000 hard-cap margin .................. 16s+ // bounded settle of the two handles ......................... 1s+ // ----+ // 42s+ //+ // Every term is now BOUNDED — that is the point. An earlier version of this+ // case ended on an unconditional `await` for both 'close' events, which the+ // dir removal above can make unreachable, so it could exceed any budget.+ //+ // It costs ~150ms when the machine is idle; every term above is a ceiling+ // that only a heavily loaded box approaches. Raising the GLOBAL budget to+ // cover this one case would blind every other test, so the allowance is+ // scoped here. If this starts timing out again, the cost moved — measure+ // which term grew rather than raising this number.+ }, 60000);it('returns zero for a missing or empty parent', async () => {const parent = await tmpControlDir();diff --git a/server/lib/importScoping.test.js b/server/lib/importScoping.test.jsindex 1bec809943..e087451406 100644--- a/server/lib/importScoping.test.js+++ b/server/lib/importScoping.test.js@@ -300,6 +300,102 @@ describe('deferred imports stay deferred (#6156)', () => {});});+/**+ * Hoisted test imports (#7951).+ *+ * The inverse of DEFERRED, and it defends a runner budget rather than a module+ * count. A test file that loads a large graph with `await import()` INSIDE an+ * `it()` or a `beforeAll` pays vitest's transform pipeline for that whole graph+ * the first time any worker touches it, and that cost is charged against+ * `testTimeout` / `hookTimeout`. Measured under a full `cd server && npm test`+ * on macOS, against ~445ms for the same import in a quiet node process:+ *+ * routes/imageGen.js ......... 29,789ms (beforeAll -> "Hook timed out in 10000ms")+ * services/cosToolRegistry.js 34,571ms (it() -> "Test timed out in 10000ms")+ * routes/settings.js ......... 28,184ms (it(), then 530-970ms per re-import)+ *+ * Under the flat 10s budget these files failed with zero failing assertions, in+ * suites the change under test never touched — which is exactly how a real+ * regression rides through a habitually-red `npm test`. Moving the same import+ * to file scope pays it during module collection, which is not budgeted at all.+ *+ * #7951 also raised testTimeout/hookTimeout to 30s, which is what covers the+ * ~269 test files whose in-test `await import()` is deliberate and cannot be+ * hoisted. These rows are still the load-bearing half: a 30s budget does not+ * make a 35s import fit, and the raise is a ceiling for the tail rather than a+ * licence to put a heavy cold load back inside a timed region. It regresses+ * silently — pushing one of these imports back into a hook still passes on a+ * quiet machine and only fails under full-suite contention — so each is pinned+ * here.+ *+ * Asserted BOTH ways, like DEFERRED above: the file must still name the+ * specifier (a row whose import was deleted is a different change), and the+ * call must still sit ahead of the first test/hook registration in the file.+ */+// [test file, specifier it must import at file scope, why]+const HOISTED = [+ ['routes/imageGen.multipart.test.js', './imageGen.js',+ 'the route graph costs ~30s to transform cold, which a beforeAll charges to hookTimeout'],+ ['services/beeperOutboxHumanGate.test.js', './cosToolRegistry.js',+ 'the CoS tool registry costs ~35s to transform cold, which an it() charges to testTimeout'],+ ['routes/settings.secretsStrip.test.js', './settings.js',+ 'warms the graph once so each vi.resetModules() re-import costs under a second'],+ ['routes/peerSyncAuthIntegration.test.js', './peerSync.js',+ 'warms the peer-sync route graph once, for the same vi.resetModules() reason'],+ ['routes/peerSyncAuthIntegration.test.js', '../services/auth.js',+ 'warms the auth service the first test reaches before it can build an app'],+];++// Everything up to the first test/hook registration is module-collection scope.+// Anchored to statement position (start of a line, optionally indented) rather+// than matched anywhere in the source: `it()` and `beforeAll` are ordinary+// English in a comment, and a bare \b match finds those too — which is how the+// first draft of this guard reported a hoisted import as un-hoisted because the+// comment ABOVE it explained which hook the import had been moved out of.+const FIRST_REGISTRATION = /^[ \t]*(?:describe|it|test|beforeAll|beforeEach|afterAll|afterEach)\s*(?:\.\w+)?\s*\(/m;++describe('heavy test imports stay hoisted to file scope (#7951)', () => {+ it.each(HOISTED)('%s imports %s before any test or hook — it %s', (entry, specifier) => {+ const src = readFileSync(abs(entry), 'utf-8');+ const call = `import('${specifier}')`;+ const first = src.indexOf(call);+ expect(+ first,+ `${entry} no longer contains ${call}. If ${specifier} is genuinely unused now, delete `+ + 'this row — do not move the import back into a test or a hook.',+ ).toBeGreaterThan(-1);++ const registration = src.search(FIRST_REGISTRATION);+ expect(+ registration,+ `${entry} registers no test or hook, so this row is guarding the wrong file.`,+ ).toBeGreaterThan(-1);++ // The FIRST load is the one that matters: it is what pays the transform.+ // A later `import()` of the same specifier from inside a test — which the+ // `vi.resetModules()` files do deliberately, to get a fresh instance — costs+ // the sub-second re-import measured above, so those occurrences are fine.+ expect(+ first,+ `${entry} loads ${specifier} first at offset ${first}, after the first test/hook `+ + `registration at ${registration}. That import's cold transform cost is then `+ + 'charged against testTimeout/hookTimeout — keep the first load at file scope (#7951).',+ ).toBeLessThan(registration);+ });++ // Positive control: the regex must actually FIND a registration in a file+ // that has one, or every row above would pass by comparing against -1.+ it('recognizes a test registration in a file that plainly has one', () => {+ const src = readFileSync(abs('services/beeperOutboxHumanGate.test.js'), 'utf-8');+ expect(src.search(FIRST_REGISTRATION)).toBeGreaterThan(-1);+ expect(FIRST_REGISTRATION.test(" it('does a thing', () => {")).toBe(true);+ expect(FIRST_REGISTRATION.test('beforeAll(async () => {')).toBe(true);+ expect(FIRST_REGISTRATION.test("const x = await import('./settings.js');")).toBe(false);+ // The anchoring the first draft lacked: prose is not a registration.+ expect(FIRST_REGISTRATION.test('// moved out of the `it()` that asserts on them')).toBe(false);+ });+});+/*** The trend metric, as a budget.*diff --git a/server/routes/imageGen.multipart.test.js b/server/routes/imageGen.multipart.test.jsindex 48c660a7cc..ed109a6a9f 100644--- a/server/routes/imageGen.multipart.test.js+++ b/server/routes/imageGen.multipart.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, beforeEach, beforeAll, afterAll, vi } from 'vitest';+import { describe, it, expect, beforeEach, afterAll, vi } from 'vitest';import express from 'express';import { createServer } from 'http';import { mkdtemp, rm, readdir, readFile, unlink, writeFile } from 'fs/promises';@@ -96,12 +96,20 @@ const PNG_FIXTURE = Buffer.from('hex',);-beforeAll(async () => {- imagesSandbox = await mkdtemp(join(tmpdir(), 'portos-imagegen-multipart-images-'));- refsSandbox = await mkdtemp(join(tmpdir(), 'portos-imagegen-multipart-refs-'));- ({ default: imageGenRoutes } = await import('./imageGen.js'));- ({ enqueueJob } = await import('../services/mediaJobQueue/index.js'));-});+// The sandbox roots and the route import are resolved at FILE SCOPE, not in a+// `beforeAll` hook (#7951). `./imageGen.js` is a large closure, and its first+// cold load pays vitest's transform pipeline for the whole graph: measured at+// 29.8s under a full-suite run against ~445ms in a quiet process. Inside a hook+// that is charged against `hookTimeout` and the file fails with "Hook timed out+// in 10000ms" and zero failing assertions; at file scope the same work happens+// during module collection, which is not budgeted. The ordering the hook+// provided is preserved — top-level `await` runs these statements in sequence,+// so both sandboxes exist before the `fileUtils.js` mock factory reads them on+// the route's first import. Guarded by `lib/importScoping.test.js`.+imagesSandbox = await mkdtemp(join(tmpdir(), 'portos-imagegen-multipart-images-'));+refsSandbox = await mkdtemp(join(tmpdir(), 'portos-imagegen-multipart-refs-'));+({ default: imageGenRoutes } = await import('./imageGen.js'));+({ enqueueJob } = await import('../services/mediaJobQueue/index.js'));afterAll(async () => {await rm(imagesSandbox, { recursive: true, force: true });diff --git a/server/routes/peerSyncAuthIntegration.test.js b/server/routes/peerSyncAuthIntegration.test.jsindex 7cb60dd776..14c1b27504 100644--- a/server/routes/peerSyncAuthIntegration.test.js+++ b/server/routes/peerSyncAuthIntegration.test.js@@ -50,6 +50,19 @@ const resetSettings = () => {writeFileSync(join(tempRoot, 'auth-sessions.json'), '{"tokens":[]}\n');};+// Pay the route graph's cold transform+import at FILE SCOPE, before any test is+// registered (#7951). `beforeEach` calls `vi.resetModules()` so each test builds+// a fresh app, but only the FIRST load in the worker transforms the graph; the+// re-imports after it are sub-second. Left inside the test, that first load is+// charged against the 10s `testTimeout` and the file failed with "Test timed out+// in 10000ms" under a full-suite run while asserting nothing slow. Module+// collection is not budgeted, so warming it here leaves the tests paying only+// the cheap re-import. These instances are intentionally discarded by the+// `vi.resetModules()` in `beforeEach` — they exist for the transform cache+// alone. Guarded by `lib/importScoping.test.js`.+await import('./peerSync.js');+await import('../services/auth.js');+const buildApp = async () => {const { authGate } = await import('../services/authGate.js');const peerSyncRoutes = (await import('./peerSync.js')).default;diff --git a/server/routes/settings.secretsStrip.test.js b/server/routes/settings.secretsStrip.test.jsindex 12cfa4814e..cd2640bfba 100644--- a/server/routes/settings.secretsStrip.test.js+++ b/server/routes/settings.secretsStrip.test.js@@ -36,6 +36,19 @@ const readSettingsFile = () => {return JSON.parse(raw);};+// Pay `./settings.js`'s cold transform+import at FILE SCOPE, before any test is+// registered (#7951). `buildApp()` calls `vi.resetModules()` so every test gets+// a fresh module instance, but only the FIRST load in the worker pays vitest's+// transform pipeline for the whole graph — measured under a full-suite run at+// 28.2s for that first import and 530-970ms for each reset-and-reimport after+// it. Charged against the 10s `testTimeout`, the first test in the file failed+// with "Test timed out in 10000ms" while asserting nothing slow; module+// collection is not budgeted, so warming it here leaves every test paying only+// the sub-second re-import. This module instance is intentionally discarded by+// the `vi.resetModules()` below — it exists for the transform cache alone.+// Guarded by `lib/importScoping.test.js`.+await import('./settings.js');+const buildApp = async () => {vi.resetModules();const { default: settingsRoutes } = await import('./settings.js');diff --git a/server/services/beeperOutboxHumanGate.test.js b/server/services/beeperOutboxHumanGate.test.jsindex 04ba4a6350..ae7e50dfbe 100644--- a/server/services/beeperOutboxHumanGate.test.js+++ b/server/services/beeperOutboxHumanGate.test.js@@ -39,6 +39,18 @@ function collectSources(dir, out = []) {return out;}+// Loaded at FILE SCOPE rather than inside the `it()` that asserts on them+// (#7951). `cosToolRegistry.js` is one of the heaviest graphs in the tree, and+// its first cold load pays vitest's transform pipeline for all of it: measured+// at 34.6s under a full-suite run against ~450ms in a quiet process. Charged+// against the 10s `testTimeout`, that surfaced as a "Test timed out in 10000ms"+// failure in a guard suite that never touched the code under test; during+// module collection it is not budgeted at all. Both values are plain constants+// once loaded, so nothing here needs a per-test instance.+// Guarded by `lib/importScoping.test.js`.+const { getCosToolCatalog } = await import('./cosToolRegistry.js');+const { PERSISTENT_MIND_TOOL_BOUNDARIES } = await import('../lib/persistentMindCapabilities.js');+const SOURCES = collectSources(SERVER_ROOT);const PRODUCTION_SOURCES = SOURCES.filter((file) => !file.path.endsWith('.test.js'));@@ -74,16 +86,14 @@ describe('beeper outbox has no agent-initiated send path (#36)', () => {expect(callers).toEqual(['routes/beeper.js']);});- it('exposes no beeper tool to the CoS catalog or the voice surface', async () => {- const { getCosToolCatalog } = await import('./cosToolRegistry.js');+ it('exposes no beeper tool to the CoS catalog or the voice surface', () => {const catalog = getCosToolCatalog({ scope: 'all' });const names = JSON.stringify(catalog);expect(catalog.length ?? Object.keys(catalog).length).toBeGreaterThan(3);expect(/beeper/i.test(names)).toBe(false);});- it('keeps "no external messaging" in the persistent-mind boundaries', async () => {- const { PERSISTENT_MIND_TOOL_BOUNDARIES } = await import('../lib/persistentMindCapabilities.js');+ it('keeps "no external messaging" in the persistent-mind boundaries', () => {expect(PERSISTENT_MIND_TOOL_BOUNDARIES.length).toBeGreaterThan(2);expect(PERSISTENT_MIND_TOOL_BOUNDARIES.join(' ')).toContain('external messaging');});diff --git a/server/vitest.config.js b/server/vitest.config.jsindex 6f70090109..070f3c544e 100644--- a/server/vitest.config.js+++ b/server/vitest.config.js@@ -26,16 +26,42 @@ export default defineConfig({...vitestCiPool(),// Workers get their own process.env — set it there as well as above.env: { NODE_ENV: 'test' },- testTimeout: process.platform === 'win32' ? 30000 : 10000,- // hookTimeout tracks testTimeout for the same reason: Windows fs + module- // resolution is markedly slower, and vitest's 10s DEFAULT applies to hooks- // even when testTimeout has been raised. The image-gen route suites- // (clean/watermark/multipart) do a heavy dynamic `import('./imageGen.js')`- // plus sharp fixture encoding in beforeAll — comfortably under 10s when run- // alone, but over it on a contended Windows worker during a full-suite run,- // where they failed with "Hook timed out in 10000ms" and ZERO failing- // assertions. That is a runner budget, not a product defect.- hookTimeout: process.platform === 'win32' ? 30000 : 10000,+ // 30s on every platform (#7951). This WAS 10s off Windows, and the split+ // has always been a fiction: the cost it budgets for is vitest's transform+ // pipeline, which is slower on Windows but not cheap anywhere. Measured on+ // macOS during a full `cd server && npm test`, against ~445ms for the same+ // import in a quiet node process:+ //+ // services/cosToolRegistry.js 34.6s routes/imageGen.js 29.8s+ // routes/settings.js 28.2s (then 0.5-1.0s per re-import)+ //+ // The whole run spends ~50% of tracked time on transform + import, so a+ // test whose body is one `await import()` of a large graph is timed almost+ // entirely on module loading. At 10s those files failed with ZERO failing+ // assertions, in suites the change under test never touched, and the set+ // moved run to run with machine load — which is how a habitually-red+ // `npm test` stops being a gate anybody reads.+ //+ // The import-cost path was NOT ruled out — it was confirmed, and fixed+ // where fixing it is correct: the heaviest unconditional loads are hoisted+ // to file scope (module collection is not budgeted), pinned by the+ // "heavy test imports stay hoisted" rows in `lib/importScoping.test.js`.+ // This raise covers the tail that hoisting cannot reach — 269 test files+ // hold an `await import()` inside a test or hook, and most are deliberate+ // (a fresh instance after `vi.resetModules()`, a mock installed first, a+ // branch-gated load), so moving them would change what they test. For that+ // tail the flat 10s is a runner budget masquerading as an assertion.+ testTimeout: 30000,+ // hookTimeout tracks testTimeout, and must be set explicitly: vitest's 10s+ // DEFAULT applies to hooks even when testTimeout has been raised. The+ // image-gen route suites (clean/watermark/multipart) do a heavy dynamic+ // `import('./imageGen.js')` plus sharp fixture encoding in beforeAll —+ // comfortably under 10s when run alone, but over it on a contended worker+ // during a full-suite run, where they failed with "Hook timed out in+ // 10000ms" and ZERO failing assertions. That was first seen on Windows and+ // read as a Windows quirk; #7951 measured the same failure on macOS, which+ // is why this no longer branches on platform.+ hookTimeout: 30000,// Print worker console output directly instead of forwarding it to the main// thread over RPC. This codebase logs heavily from fire-and-forget callbacks// (the documented `.catch(() => console.log(...))` pattern, PTY/timer hooks,