Repository navigation
Skip pnpm install in env setup when node_modules already matches - #3433
Merged
Merged
Conversation
Copy-on-write environments arrive with node_modules already installed; hash the install inputs into node_modules so setup can skip a no-op install. Fresh worktrees and changed lockfiles still install as before. Co-Authored-By: Claude Fable 5.1 <[email protected]>
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
.bb-env-setup.shrunspnpm installon every new environment. For a fresh git worktree that is necessary, but copy-on-write environments (reflink copy or Btrfs snapshot of the checkout, via thebtrfs-cowprovider plugin) arrive withnode_modulesalready installed, and the install is a 5 to 15 s no-op.This change hashes the install inputs (
pnpm-lock.yaml,pnpm-workspace.yaml,package.json,.npmrc) and stores the hash atnode_modules/.bb-env-setup-install-hashafter a successful install. On the next run, if the stamp matches andnode_modules/.pnpmexists, the install is skipped.Because the stamp lives inside
node_modules, it travels with a copied tree and disappears with a fresh worktree, so worktree provisioning is unchanged.Behavior
Measured on a reflink copy of this repo (Linux, Btrfs):
node_modules(fresh worktree)Other notes:
pnpm installno longer writes a stamp, so the next environment retries. The hook still exits 0 in every case, as before.sha256sumnorshasumis available.sh .bb-env-setup.shin the project checkout once seeds it for copies made from it.🤖 Generated with Claude Code