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

fix: add sweepStrayTempRoots cleanup to htmlComposition preflight test (#9044)

[._.]/ Adam Eivyb3cf83850bc5
diff --git a/server/services/htmlComposition/renderComposition.preflight.test.js b/server/services/htmlComposition/renderComposition.preflight.test.js
index 24c724ef83..39ae41c8fc 100644
--- a/server/services/htmlComposition/renderComposition.preflight.test.js
+++ b/server/services/htmlComposition/renderComposition.preflight.test.js
@@ -3,11 +3,11 @@
// Chrome/ffmpeg retry assertion in index.test.js: it mocks the browser and
// encoder so it can assert the *reason* the retry stays cheap — encoding is
// never reached — without paying for a real render.
-import { describe, expect, it, vi } from 'vitest';
+import { describe, expect, it, vi, afterAll } from 'vitest';
import { mkdir, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { randomUUID } from 'node:crypto';
-import { lazyTempDataRoot, makePathsProxy } from '../../lib/mockPathsDataRoot.js';
+import { lazyTempDataRoot, makePathsProxy, cleanupTempDataRoots, sweepStrayTempRoots } from '../../lib/mockPathsDataRoot.js';
vi.mock('../../lib/fileUtils.js', async importOriginal => makePathsProxy(await importOriginal(), {
dataRoot: () => lazyTempDataRoot('portos-html-composition-preflight-'),
@@ -55,4 +55,9 @@ describe('renderComposition delivery preflight', () => {
expect(encodeComposition).not.toHaveBeenCalled();
});
+
+ afterAll(async () => {
+ cleanupTempDataRoots();
+ await sweepStrayTempRoots('portos-html-composition-preflight-');
+ });
});
diff --git a/server/test/runTempRoot.js b/server/test/runTempRoot.js
index 123d395315..86867b6620 100644
--- a/server/test/runTempRoot.js
+++ b/server/test/runTempRoot.js
@@ -70,21 +70,10 @@ const VITEST_INTERNAL_SCRATCH_DIR = /^[A-Za-z0-9_-]{21}$/;
const KNOWN_THIRD_PARTY_CLI_SCRATCH = new Set(['node-compile-cache']);
// A leak this file is NOT the right place to fix: `server/services/
-// htmlComposition/*` is a different work area's tree (#9032 was explicitly
-// scoped out of it), and its `renderComposition.preflight.test.js` leaves a
-// real, non-empty `portos-html-composition-preflight-*` directory behind —
-// confirmed by direct inspection, not a false positive. Tracked in #9044,
-// which names the fix (the same `sweepStrayTempRoots()` helper that already
-// closed the identical symptom in two other real-ffmpeg/real-browser
-// suites). Remove this entry once #9044 lands.
-//
-// `mediaJobQueue-test-` (server/services/mediaJobQueue/index.test.js) is
-// the same "not the right place to fix" case as the htmlComposition entry
-// above — that tree is a different work area, out of scope for #9032 —
-// seen leaking on a Windows CI shard. Tracked in #9046. Remove this entry
-// once #9046 lands.
+// mediaJobQueue/index.test.js` is a different work area, out of scope for
+// #9032 — seen leaking on a Windows CI shard. Tracked in #9046. Remove
+// this entry once #9046 lands.
const KNOWN_PENDING_LEAKS = new Set([
- 'portos-html-composition-preflight-',
'mediaJobQueue-test-',
]);