Skip to content

fix(cache): exclude node_modules/.vite-temp from cache input tracking#1096

Open
fengmk2 wants to merge 15 commits intomainfrom
fix-1095
Open

fix(cache): exclude node_modules/.vite-temp from cache input tracking#1096
fengmk2 wants to merge 15 commits intomainfrom
fix-1095

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Mar 22, 2026

Summary

  • Bump vite-task to 8c3cc35e which merges synthetic task's input config in inherited cache path
  • Add !node_modules/.vite-temp/** negative input glob to Pack and Build subcommands
  • Add comprehensive snap tests for cache behavior

Vite writes transient compiled config files to node_modules/.vite-temp/ during builds. These files were tracked by fspy as both read and written, causing a read-write overlap that prevented caching ("not cached because it modified its input").

The fix has two parts:

  1. vite-task (#292): Merge synthetic task's input config into parent's input_config in the Inherited cache path, resolving globs relative to workspace root
  2. vite-plus (this PR): Pass !node_modules/.vite-temp/** negative glob via EnabledCacheConfig.input on Pack and Build subcommands

Snap tests added

Test Verifies
command-pack-monorepo vp run cache hit, sub-dir cache hit, source change cache miss, direct vp pack not cached
vp-build-cache vp run build cache hit, direct vp build not cached
vp-build-cache-monorepo monorepo vp run cache hit, sub-dir cache hit, source change cache miss, direct vp build not cached
vp-pack-cache-disabled cache: false disables caching for vp pack
vp-build-cache-disabled cache: false disables caching for vp build

Test plan

  • cargo check passes
  • cargo test passes for all vite-plus crates
  • All snap tests pass locally (pack + build, cache hit/miss/disabled, direct command not cached)
  • CI passes on all platforms (Linux, Mac, Windows)

Closes #1095

🤖 Generated with Claude Code

@netlify
Copy link

netlify bot commented Mar 22, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 3531d03
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69c35b4dc52c9a0008b94dab

@fengmk2 fengmk2 marked this pull request as draft March 22, 2026 11:31
Copy link
Member Author

fengmk2 commented Mar 23, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

fengmk2 added 10 commits March 25, 2026 11:27
Add snap tests to verify vp build caching works correctly:
- vp-build-cache: single package build cache hit
- vp-build-cache-monorepo: monorepo with two packages, both hit cache
Remove ignoredPlatforms and ls commands so tests run on all platforms.
Add negative input glob `!node_modules/.vite-temp/**` to Pack and Build
subcommands to exclude Vite's transient config files from fspy tracking.
Bump vite-task to 8c3cc35e which merges synthetic task input config in
the inherited cache path.

Closes #1095
@fengmk2 fengmk2 requested a review from branchseer March 25, 2026 03:32
@fengmk2 fengmk2 self-assigned this Mar 25, 2026
@fengmk2 fengmk2 changed the title fix: cache miss on repeated pack builds fix(cache): exclude node_modules/.vite-temp from cache input tracking Mar 25, 2026
@fengmk2 fengmk2 marked this pull request as ready for review March 25, 2026 03:35
fengmk2 added 4 commits March 25, 2026 11:38
vite-task now accepts unknown flags as task arguments via
trailing_var_arg, so `vp run --yolo` is valid instead of an error.
Test that cache works when first build is from sub dir and second
from root, and vice versa. Ensures cache is shared between root
and sub workspace invocations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache miss on repeated pack builds: task modifies its own input

1 participant