From 0a6dd76fafdca14b6c40dcdeaaff8ea05db9bb62 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:03:37 +0000 Subject: [PATCH] Revert per-file NODE_COMPILE_CACHE in subprocess script tests Offline VM measurement (source-9mta_zay vs baseline source-3551_k_3) showed per-file empty NODE_COMPILE_CACHE directories slowed the 4-way parallel script tests from 39.87s to 41.29s and caused three 5000ms timeouts from concurrent cold V8 bytecode writes. Contract-Neutral: Test-only revert removing experimental NODE_COMPILE_CACHE from four test files; production scripts and build behavior are unchanged. Change-source: pulse-maintainer --- .../__tests__/build-embed-assets.test.mjs | 13 ++----------- .../__tests__/check-bundle-size.test.mjs | 13 ++----------- .../__tests__/form-label-audit.test.mjs | 10 ++-------- .../__tests__/solidSerialization.test.ts | 18 +++--------------- 4 files changed, 9 insertions(+), 45 deletions(-) diff --git a/frontend-modern/scripts/__tests__/build-embed-assets.test.mjs b/frontend-modern/scripts/__tests__/build-embed-assets.test.mjs index 4e25a097a3..f8e6d34049 100644 --- a/frontend-modern/scripts/__tests__/build-embed-assets.test.mjs +++ b/frontend-modern/scripts/__tests__/build-embed-assets.test.mjs @@ -15,16 +15,11 @@ import { import os from 'node:os'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -import { afterAll, afterEach, describe, expect, it } from 'vitest'; +import { afterEach, describe, expect, it } from 'vitest'; import { completeBuild } from './build-output-fixture.mjs'; const repository = fileURLToPath(new URL('../../../', import.meta.url)); const roots = []; -// Keep every invocation a fresh process running the real CLI/helper, but do -// not recompile jsdom's identical dependency graph for every fixture. Node's -// cache contains bytecode, never module state or validation results. -const compileCache = mkdtempSync(path.join(os.tmpdir(), 'pulse-embed-build-bytecode-')); -const childEnv = { ...process.env, NODE_COMPILE_CACHE: compileCache }; const previousFiles = completeBuild({ 'assets/previous.js': 'console.log("previous successful frontend");\n', 'docs/previous.md': 'Previously usable help.\n', @@ -156,7 +151,7 @@ syncBuiltinESMExports(); const result = spawnSync( process.execPath, [...args, path.join(root, 'frontend-modern', 'scripts', name)], - { cwd: root, env: childEnv, encoding: 'utf8', timeout: 15_000 }, + { cwd: root, encoding: 'utf8', timeout: 15_000 }, ); expect(result.error).toBeUndefined(); expect(result.signal).toBeNull(); @@ -183,10 +178,6 @@ afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }); }); -afterAll(() => { - rmSync(compileCache, { recursive: true, force: true }); -}); - describe.each([true, false])('frontend producer with previous output: %s', (previous) => { it.each([ { name: 'complete-looking nonzero output', code: 17, reason: /exited with code 17/ }, diff --git a/frontend-modern/scripts/__tests__/check-bundle-size.test.mjs b/frontend-modern/scripts/__tests__/check-bundle-size.test.mjs index 9233458a98..e1ccf284d4 100644 --- a/frontend-modern/scripts/__tests__/check-bundle-size.test.mjs +++ b/frontend-modern/scripts/__tests__/check-bundle-size.test.mjs @@ -7,14 +7,10 @@ import os from 'node:os'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { gzipSync } from 'node:zlib'; -import { afterAll, afterEach, describe, expect, it } from 'vitest'; +import { afterEach, describe, expect, it } from 'vitest'; const checker = fileURLToPath(new URL('../check-bundle-size.mjs', import.meta.url)); const temporaryRoots = []; -// Keep every invocation a fresh process running the real CLI, without -// recompiling jsdom's identical dependency graph on every fixture. -const compileCache = mkdtempSync(path.join(os.tmpdir(), 'pulse-bundle-check-bytecode-')); -const childEnv = { ...process.env, NODE_COMPILE_CACHE: compileCache }; const digest = (content, algorithm = 'sha384') => `${algorithm}-${createHash(algorithm).update(content).digest('base64')}`; const inventoryError = @@ -84,7 +80,6 @@ function fixture(algorithm = 'sha384') { const result = spawnSync(process.execPath, [script], { encoding: 'utf8', cwd: root, - env: childEnv, timeout: 15000, }); expect(result.error).toBeUndefined(); @@ -103,10 +98,6 @@ afterEach(() => { while (temporaryRoots.length) rmSync(temporaryRoots.pop(), { recursive: true, force: true }); }); -afterAll(() => { - rmSync(compileCache, { recursive: true, force: true }); -}); - describe('complete asset budget inventory', () => { // Deterministic incompressible content makes each nested asset alone exceed // the unchanged 10 kB fixture total, independently of minifier/clock state. @@ -161,7 +152,7 @@ describe('complete asset budget inventory', () => { const result = spawnSync( process.execPath, [path.join(f.root, 'scripts/check-bundle-size.mjs'), '--update-baseline'], - { encoding: 'utf8', cwd: f.root, env: childEnv, timeout: 15000 }, + { encoding: 'utf8', cwd: f.root, timeout: 15000 }, ); expect(result.error).toBeUndefined(); expect(result.signal).toBeNull(); diff --git a/frontend-modern/scripts/__tests__/form-label-audit.test.mjs b/frontend-modern/scripts/__tests__/form-label-audit.test.mjs index 2d619aecea..8a12a62279 100644 --- a/frontend-modern/scripts/__tests__/form-label-audit.test.mjs +++ b/frontend-modern/scripts/__tests__/form-label-audit.test.mjs @@ -3,19 +3,17 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { afterAll, afterEach, describe, expect, it } from 'vitest'; +import { afterEach, describe, expect, it } from 'vitest'; const auditPath = path.join(process.cwd(), 'scripts', 'form-label-audit.mjs'); const temporaryRoots = []; -const compileCache = fs.mkdtempSync(path.join(os.tmpdir(), 'pulse-form-label-bytecode-')); -const childEnv = { ...process.env, NODE_COMPILE_CACHE: compileCache }; const runAudit = (source) => { const root = fs.mkdtempSync(path.join(os.tmpdir(), 'pulse-form-label-audit-')); temporaryRoots.push(root); fs.mkdirSync(path.join(root, 'src', 'nested'), { recursive: true }); fs.writeFileSync(path.join(root, 'src', 'nested', 'Fixture.tsx'), source); - return spawnSync(process.execPath, [auditPath], { cwd: root, env: childEnv, encoding: 'utf8' }); + return spawnSync(process.execPath, [auditPath], { cwd: root, encoding: 'utf8' }); }; afterEach(() => { @@ -25,10 +23,6 @@ afterEach(() => { document.body.replaceChildren(); }); -afterAll(() => { - fs.rmSync(compileCache, { recursive: true, force: true }); -}); - describe('form label audit', () => { it.each(['wrapped', 'targeted'])( 'rejects a %s hidden-only field that the native label cannot control', diff --git a/frontend-modern/src/security/__tests__/solidSerialization.test.ts b/frontend-modern/src/security/__tests__/solidSerialization.test.ts index 8c55e88064..15e7757b56 100644 --- a/frontend-modern/src/security/__tests__/solidSerialization.test.ts +++ b/frontend-modern/src/security/__tests__/solidSerialization.test.ts @@ -1,23 +1,15 @@ // @vitest-environment node import { execFileSync } from 'node:child_process'; -import { mkdtempSync, readFileSync, rmSync } from 'node:fs'; -import os from 'node:os'; -import path from 'node:path'; +import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; -import { afterAll, describe, expect, it } from 'vitest'; +import { describe, expect, it } from 'vitest'; const fixture = fileURLToPath(new URL('./solidSerialization.fixture.cjs', import.meta.url)); -const compileCache = mkdtempSync(path.join(os.tmpdir(), 'pulse-solid-ser-bytecode-')); -const childEnv = { ...process.env, NODE_COMPILE_CACHE: compileCache }; const lock = JSON.parse( readFileSync(new URL('../../../package-lock.json', import.meta.url), 'utf8'), ) as { packages: Record }; -afterAll(() => { - rmSync(compileCache, { recursive: true, force: true }); -}); - // vite-plugin-solid deliberately adds browser conditions to Vitest workers, // even node-environment tests. A plain Node child exercises the actual server // export without changing the app/test resolver or mocking its Serializer. @@ -41,11 +33,7 @@ describe('actual Solid resource serialization consumer', () => { 'no-scripts', ])('preserves %s on the exact committed graph', (name) => { const result = JSON.parse( - execFileSync(process.execPath, [fixture, name], { - encoding: 'utf8', - env: childEnv, - timeout: 10_000, - }), + execFileSync(process.execPath, [fixture, name], { encoding: 'utf8', timeout: 10_000 }), ) as { case: string; passed: boolean; versions: Record }; expect(result.case).toBe(name); expect(result.passed).toBe(true);