Skip to content

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

test: let the browser suites pass the temp-leak guard on Linux Chrome (#10312)

[._.]/ Adam Eivy7758d78781f7
diff --git a/scripts/vitestTempRootSetup.js b/scripts/vitestTempRootSetup.js
index fd6eb96925..3e8de601b2 100644
--- a/scripts/vitestTempRootSetup.js
+++ b/scripts/vitestTempRootSetup.js
@@ -17,7 +17,18 @@ const VITEST_INTERNAL_SCRATCH_DIR = /^[A-Za-z0-9_-]{21}$/;
// its lookup cache to $TMPDIR, which is our owned root. It is toolchain-owned
// output, not fixture data: match the exact cache name only, so a real leaked
// fixture is still reported.
-const TOOLCHAIN_CACHE_PREFIXES = new Set(['xcrun_db']);
+const TOOLCHAIN_CACHE_PREFIXES = new Set([
+ 'xcrun_db',
+ // Linux Chrome/Chromium create `[.]com.google.Chrome.<random>` (or
+ // `org.chromium.Chromium.`) scratch directories in $TMPDIR and remove them only
+ // on a clean exit; the owned test browsers are terminated, so they linger. They
+ // are browser-owned, not fixture data, and surface once a real-Chrome suite runs
+ // under this guard on Linux (#10312). Exact browser prefixes only.
+ 'com.google.Chrome.',
+ '.com.google.Chrome.',
+ 'org.chromium.Chromium.',
+ '.org.chromium.Chromium.',
+]);
export function groupLeakPrefix(name) {
return name.replace(/[0-9a-zA-Z]{6,}$/, '') || name;
diff --git a/scripts/vitestTempRootSetup.test.js b/scripts/vitestTempRootSetup.test.js
index 7b6e5a44b9..0aeaff4e1f 100644
--- a/scripts/vitestTempRootSetup.test.js
+++ b/scripts/vitestTempRootSetup.test.js
@@ -26,6 +26,26 @@ describe('vitestTempRootSetup teardown', () => {
return result;
}
+ it('ignores browser-owned Chrome scratch directories but still fails on a leaked fixture beside them', () => {
+ const browserOnly = runTeardown((root) => {
+ for (const name of ['com.google.Chrome.aB3dE9', '.com.google.Chrome.xY7zQ2', '.org.chromium.Chromium.k9L2mN']) {
+ mkdirSync(join(root, name));
+ writeFileSync(join(root, name, 'sock'), 'x');
+ }
+ });
+ expect(browserOnly.warnings).toEqual([]);
+ expect(browserOnly.exitCode).toBeUndefined();
+
+ const withFixture = runTeardown((root) => {
+ mkdirSync(join(root, 'com.google.Chrome.aB3dE9'));
+ writeFileSync(join(root, 'com.google.Chrome.aB3dE9', 'sock'), 'x');
+ mkdirSync(join(root, 'mv-review-browser-Abc123'));
+ writeFileSync(join(root, 'mv-review-browser-Abc123', 'data.json'), '{}');
+ });
+ expect(withFixture.warnings).toEqual(['⚠️ test temp leak: mv-review-browser- ×1']);
+ expect(withFixture.exitCode).toBe(1);
+ });
+
it('ignores the macOS xcrun cache but still fails on a real leaked fixture', () => {
const clean = runTeardown((root) => writeFileSync(join(root, 'xcrun_db'), 'cache'));
expect(clean.warnings).toEqual([]);
diff --git a/server/routes/musicVideoProductionReview.browser.test.js b/server/routes/musicVideoProductionReview.browser.test.js
index 926bb1228a..33014ae467 100644
--- a/server/routes/musicVideoProductionReview.browser.test.js
+++ b/server/routes/musicVideoProductionReview.browser.test.js
@@ -7,7 +7,7 @@ import { join, resolve } from 'node:path';
import { execFileSync, spawn } from 'node:child_process';
import { chromium } from 'playwright-core';
import { createRequire } from 'node:module';
-import { makePathsProxy, lazyTempDataRoot, cleanupTempDataRoots } from '../lib/mockPathsDataRoot.js';
+import { makePathsProxy, lazyTempDataRoot, cleanupTempDataRoots, sweepStrayTempRoots } from '../lib/mockPathsDataRoot.js';
import { errorMiddleware } from '../lib/errorHandler.js';
import { browserSuiteCanRun } from '../lib/browserSuiteGate.js';
@@ -41,6 +41,8 @@ afterAll(async () => {
await _cleanupTestBrowser({ browser, proc, cleanup: () => {} });
if (server) await new Promise(resolve => server.close(resolve));
cleanupTempDataRoots();
+ // A just-killed Chrome helper can recreate the data root after removal; CI's Linux run left one (#10312).
+ await sweepStrayTempRoots('mv-review-browser-');
});
describe.skipIf(!canRun)('production review in a real browser (Chrome, ffmpeg and client dependencies required)', () => {