fix: disable Node's compile cache for the server test run (#9051) - #9058
Merged
Merged
Conversation
node-compile-cache still turned up rarely in the run-scoped vitest temp root even after #9050 isolated the one confirmed real-CLI spawn (npmGlobalBin.js's `npm prefix -g`) into its own TMPDIR. The cache is process-wide (NODE_COMPILE_CACHE env, or a CLI calling module.enableCompileCache() on itself), not tied to one call site, so no single spawn helper's isolation could be proven to cover every child that might inherit the run's TMPDIR. Set NODE_DISABLE_COMPILE_CACHE=1 tree-wide for the test run instead (server/vitest.config.js, main process and worker env) - honored since Node v22.1, within this repo's supported range. Remove the now-unneeded KNOWN_THIRD_PARTY_CLI_SCRATCH allowlist entry from server/test/runTempRoot.js so a recurrence fails the run again. Document the new env var in envExampleDrift.test.js's INHERITED_ENV allowlist.
atomantic
force-pushed
the
claim/issue-9051
branch
from
September 28, 2026 08:12
898ccd4 to
1c3103f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node-compile-cachestill turned up rarely in the run-scoped vitest temp root (server/test/runTempRoot.js) even after #9050 isolated the one confirmed real-CLI spawn (npmGlobalBin.js'snpm prefix -g) into its own throwaway TMPDIR. Node's module compile cache is process-wide — written wheneverNODE_COMPILE_CACHEis set or a CLI callsmodule.enableCompileCache()on itself (recent npm/npx builds do) — so no single spawn helper's TMPDIR isolation can be proven to cover every child process that might inherit the test run's TMPDIR.server/vitest.config.jsnow setsNODE_DISABLE_COMPILE_CACHE=1in both the main process env and every worker'stest.env, so any child process — isolated TMPDIR or not — never writes the cache in the first place. Honored since Node v22.1, within this repo's supported engines range (^22.22.2 || ^24.15.0 || >=26.0.0).KNOWN_THIRD_PARTY_CLI_SCRATCHallowlist (the set, its usage, and its leak-report note) fromserver/test/runTempRoot.js— a recurrence now fails the run again instead of being silently allowlisted.server/envExampleDrift.test.js'sINHERITED_ENVallowlist (a Node-provided switch, not a user-facing setting).Test plan
cd server && node_modules/.bin/vitest run(full suite, twice) — both green: 2541 passed / 2 skipped, no⚠️ test temp leak: node-compile-cacheline. The only reported leaks are the two pre-existingKNOWN_PENDING_LEAKSentries (tracked separately in htmlComposition preflight test leaks a real temp directory past the strict run-root check #9044 and mediaJobQueue test leaks a real temp directory on Windows CI past the strict run-root check #9046), which this change does not touch.npm run pregate— passed.Closes #9051