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(tests): bound the image-cleaner nested vitest run by completion, not a 20s wall clock (#12349)
Adam Eivyec5da15aca70
diff --git a/scripts/imageCleanerCleanup.test.js b/scripts/imageCleanerCleanup.test.jsindex b311b21983..d74498f894 100644--- a/scripts/imageCleanerCleanup.test.js+++ b/scripts/imageCleanerCleanup.test.js@@ -1,17 +1,20 @@import { expect, it } from 'vitest';-import { spawnSync } from 'node:child_process';import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { dirname, join, resolve } from 'node:path';import { fileURLToPath } from 'node:url';-import { createVitestTempFixture, fixtureReadyFailureSource } from './lib/vitestTempRootFixture.js';+import { createVitestTempFixture, fixtureReadyFailureSource, runFixtureToCompletion } from './lib/vitestTempRootFixture.js';++// The nested run's own ceiling; the outer budget adds headroom so it is never tighter.+const RUN_CEILING_MS = 120000;// Hold the real clean route at its first publication write, then let a different// worker cancel the test. Its body must finish before its gallery is removed.-it('drains the image cleaner request before removing its cancelled fixture', () => {+it('drains the image cleaner request before removing its cancelled fixture', async () => {const host = mkdtempSync(join(tmpdir(), 'image-clean-cancel-'));try {- const { args, options } = createVitestTempFixture(host, 'server', '');+ const fixtureRun = createVitestTempFixture(host, 'server', '');+ const { args } = fixtureRun;const fixture = join(host, 'fixture');const ready = join(fixture, 'ready');const traceFile = join(fixture, 'trace.json');@@ -66,7 +69,7 @@ it('drains the image cleaner request before removing its cancelled fixture', ()args[args.indexOf('--maxWorkers') + 1] = '2';args.push('--bail=1', '--reporter=default', '--reporter=json', '--outputFile.json', resultsFile,'--reporter=junit', '--outputFile.junit', junitFile);- const result = spawnSync(process.execPath, args, options);+ const result = await runFixtureToCompletion(fixtureRun, RUN_CEILING_MS);const output = `${result.stdout}\n${result.stderr}`;expect(result.error, output).toBeUndefined();expect(result.status, output).toBe(1);@@ -89,4 +92,4 @@ it('drains the image cleaner request before removing its cancelled fixture', ()} finally {rmSync(host, { recursive: true, force: true });}-}, 25000);+}, RUN_CEILING_MS + 15000);diff --git a/scripts/lib/vitestTempRootFixture.js b/scripts/lib/vitestTempRootFixture.jsindex 51d7ac4432..8742a2a308 100644--- a/scripts/lib/vitestTempRootFixture.js+++ b/scripts/lib/vitestTempRootFixture.js@@ -107,6 +107,7 @@ it('controlled sibling failure', async ({ signal }) => {}const WATCH_READY_MS = 60000;+const FIXTURE_RUN_CEILING_MS = 120000;function killProcessTree(child) {if (!child.pid || child.exitCode !== null) return;@@ -121,6 +122,39 @@ function killProcessTree(child) {}}+/**+ * Run a fixture to completion. The only clock is one generous ceiling — a cold+ * import graph on a loaded host can take over a minute, so `createVitestTempFixture`'s+ * fixed `timeout` (kept for spawnSync callers) is dropped. Resolves like spawnSync's+ * result; `error` is set only when the ceiling is reached, after the whole detached+ * process group is killed.+ */+export function runFixtureToCompletion({ args, options }, ceilingMs = FIXTURE_RUN_CEILING_MS) {+ const { timeout: _bounded, ...spawnOptions } = options;+ return new Promise((resolve) => {+ const child = spawn(process.execPath, args, {+ ...spawnOptions,+ detached: process.platform !== 'win32',+ stdio: ['ignore', 'pipe', 'pipe'],+ });+ let stdout = '';+ let stderr = '';+ let error;+ child.stdout.setEncoding('utf8').on('data', (chunk) => { stdout += chunk; });+ child.stderr.setEncoding('utf8').on('data', (chunk) => { stderr += chunk; });+ const timer = setTimeout(() => {+ error = new Error(`fixture run exceeded ${ceilingMs}ms`);+ killProcessTree(child);+ }, ceilingMs);+ child.once('error', (spawnError) => { error = spawnError; });+ child.once('close', (status) => {+ clearTimeout(timer);+ killProcessTree(child); // reap any worker the run left in its group+ resolve({ status, stdout, stderr, error });+ });+ });+}+/*** Run the real workspace config under `vitest --watch`, edit the config to force* a restart ("Restarting due to config changes"), and hand the restarted run's