Repository navigation
fix(cache): fingerprint only whether node_modules/.modules.yaml exists - #850
Merged
Merged
Conversation
Hashing a redacted copy of pnpm's modules manifest still missed the cache when fields that vary across machines changed, such as packageManager, pendingBuilds, virtualStoreOnly and skipped. Vite, which reads the file in every cached vite build and vitest task, uses only virtualStoreDir, which was already left out. The other fields describe node_modules, whose files tasks read and are tracked. Fingerprint only whether the file exists, like files in node_modules/.bin, and remove the JSON/YAML parsing and the redaction machinery it needed, including vt's serde_norway dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wan9chi
force-pushed
the
fix/modules-yaml-existence-only
branch
from
October 13, 2026 07:26
2f156fb to
f465a92
Compare
fspy benchmarklinuxmacoswindows |
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.
Motivation
#823 hashes pnpm's
node_modules/.modules.yamlwithoutprunedAt,storeDir,virtualStoreDirandlinkedSkills. What's left protects little and still causes needless misses:vite buildandvitesttask reads the file because Vite reads it while resolving its config (packages/vite/src/node/server/index.ts). Vite reads onlyvirtualStoreDir, to add pnpm's global virtual store to the dev server'sserver.fs.allow, inside a try/catch for non-pnpm projects.virtualStoreDiris already left out of the hash, so the hash protects nothing Vite uses, and forvite buildthe file doesn't affect the output.node_modules, which tasks already read. In pnpm 11 they arehoistedDependencies,hoistPattern,publicHoistPattern,hoistedLocations,nodeLinker,included,skipped,injectedDeps,layoutVersion,virtualStoreDirMaxLength,pendingBuilds,ignoredBuilds,allowBuilds,packageManagerandvirtualStoreOnly. When they change in a way that matters, the files a task reads innode_moduleschange too, and those reads are tracked.'node_modules/.modules.yaml' modified:packageManager: the version of the pnpm that installedpendingBuilds: filled afterpnpm install --ignore-scriptsvirtualStoreOnly: set afterpnpm fetchskipped: differs between glibc and musl for platform packages under the same cache keyChanges
node_modules/.modules.yamlis now fingerprinted only by whether it exists, the same treatment fix(cache): fingerprint only whether files in node_modules/.bin exist #824 gives files innode_modules/.bin. A missing manifest still differs from an existing one, since tools detect pnpm by the file existing (Vite's try/catch, which-pm).node_modulesdiffering no longer misses. The examples fix(cache): leave noisy fields of pnpm's .modules.yaml out of its fingerprint #823 named are LavaMoat's allow-scripts check (pendingBuilds/ignoredBuilds), which-pm's pnpm version, and Nx'shoistedDependencies. These rarely run inside cached vp tasks, and in realistic casesnode_modulesdiffers too.vt'sserde_norwaydependency. Both files are hashed as empty content without being read, which is the hash files innode_modules/.binalready had, so their cache entries stay valid.pnpm_modules_manifeste2e fixture now shows that changing the manifest's content keeps the cache hit and removing it misses.🤖 Generated with Claude Code