Repository navigation
fix(clean): remove the workspaces' node_modules too (npm's babylon lockfile count was missing) - #223
Merged
Merged
Conversation
… lockfile count exists
clean_node_modules only removed the root node_modules. On babylon, vlt (and
pnpm, bun, the yarns) also write packages/*/node_modules; vlt fills them with
symlinks into the root node_modules/.vlt store, which dangle once the root is
removed and survive every clean, including clean_all. When npm then installs
with those present, it records them in package-lock.json as empty entries
("packages/x/node_modules/foo": {}) and the next install from that lockfile
fails with "Invalid Version: " (semver.eq in Node.canDedupe). That is why
npm's babylon lockfile process count has been missing since #218: the
counted install's warmup starts after every other tool has run, while the
timed npm runs come first and never see the leftovers.
Remove every node_modules directory in the project (hidden directories,
the tools' own stores, excepted), keep the counted install's output in
<pm>-process-count-output.log and print it when the install fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 18 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This branch was previously deployed
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.
The bug
Since #218, npm's process count in the babylon
lockfilevariation is missing. In run 44250431401 (job "Run Benchmarks (babylon, lockfile)"), the counted install exited 1 about 2 s after starting:npm's timed
lockfileinstalls in the same job passed, and babyloncachehas npm's count.Root cause
clean_node_modulesremoved only the rootnode_modules. On babylon, vlt (and pnpm, bun, the yarns) also writepackages/*/node_modules; vlt fills 84 of them with symlinks into the rootnode_modules/.vltstore, e.g.Once the root is removed they dangle, and nothing cleaned them: not the prepares, not
clean_all(git checkout -- packages/only restores tracked files). 452 such symlinks were left in the fixture after vlt's timed run.When npm then installs without a lockfile with those present, it records them in
package-lock.jsonas empty entries and leaves them in place; the next install from that lockfile throws. Captured by keeping the counted install's output (and the npm debug log):Minimal reproduction on a two-workspace project with dangling vlt-style symlinks in
packages/*/node_modules:npm installexits 0 and writesinto the lockfile;
rm -rf node_modules && npm installthen fails withInvalid Version:.That is why only the counted install failed: the counted installs run after every tool's timed runs, so npm's warmup (which writes the lockfile) started from vlt's leftovers, while npm's timed runs come first and never see them. It also means that, in the
lockfileandcachevariations, every tool after npm started its timed runs from whatever earlier tools had put in the workspaces'node_modules.The fix
clean_node_modulesremoves everynode_modulesdirectory in the project, not only the root one. Hidden directories (.aube,.upm-store, ...) are the tools' own stores and are skipped;clean_package_manager_filesremoves them whole. Thenode_modulesvariations don't callclean_node_modulesin their prepares, so they are unchanged.process-count.shkeeps the counted install's output in<pm>-process-count-output.logand prints it when the install fails, so the next failure explains itself.clean_node_modules, and a note in METHODOLOGY.md that earlier babylonlockfile/cachenumbers started from other tools' workspacenode_modules.Verified
Inside an isolated namespace (fresh tmpfs
$HOME,vlt.jsonpointed at registry.npmjs.org),BENCH_INCLUDE=npm,vlt BENCH_WARMUP=0 BENCH_RUNS=1 bash suite/scripts/variations/lockfile.sh ... babylon lockfile:main: reproduces CI exactly —Warning: strace'd install exited with 1 for npm, vlt counted 7. With npm alone (no vlt leftovers) npm counts fine, which matches babyloncacheand the pre-fix(process-count): lockfile, node_modules and cache variations count each tool from its own state #218 shared pass.npm started 1 processes,vlt started 6 processes,process-count.jsonhas both.node --test suite/scripts/: 35 pass (34 + the new one).🤖 Generated with Claude Code