Repository navigation
fix: pnpm's node_modules/.package-map.json no longer counts as a hand edit - #6608
Merged
Merged
Conversation
…not a hand edit pnpm writes .package-map.json at the node_modules root on install. After an install Stim did not run, the edit check counted it as an edit and kept finished worktrees at every pressure. Exclude it with the other root state files and drop it from recorded edits. Fixes #6603
janicduplessis
marked this pull request as ready for review
November 28, 2026 00:25
janicduplessis
enabled auto-merge (squash)
November 28, 2026 00:26
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.
Description
A finished linked worktree is never removed automatically if
pnpm installran in it after Stim recorded its own install, for examplestim worktree warmfollowed bypnpm install. Every maintenance pass keeps it with "its node_modules: 1 file in it changed after its install (.package-map.json)", at every pressure level.pnpm writes
node_modules/.package-map.jsonitself during install (pnpm 11 and 12). Once the stamp is newer than Stim's record, the edit check measures root files against the old record. A root file belongs to no package, so it counts as an edit.excludedFromEditsalready skipped the stamps and.pnpm-workspace-state*.json, but not this file. LLP 0002 already says a package manager's state files are not edits, so no decision doc changes.On the maintainer's MacBook on 2026-11-27, 10 of the 11 worktrees that
stim gc --dry-runlisted aswould remove-worktreewere kept for this file while the disk was at high.Solution
.package-map.jsonat the node_modules root now counts as package-manager state. The root-file rule is pulled intopackageManagerState, which also filters recordedknownedits, the same way.binentries are already dropped. Without that filter, a record that an acting pass wrote before this fix would still keep the tree.Worst case: a hand edit made to
node_modules/.package-map.jsonitself is no longer protected. pnpm regenerates that file on every install.Test plan
dependency-edits.integration.test.tsfail onmainand pass here:.package-map.jsonand rewrites the stamp..package-map.jsonas an edit.dependencyEditsHoldagainst the real home, on the 8 kept.worktrees/64xxand6548-cow-cloneworktrees:null(removable).6548-cow-cloneis still kept for 14 changed files insidecow-clone'sprebuilds/. That is a different case and I left it alone.Fixes #6603