Commit 622930a
authored
feat(task): add cache fingerprint ignore patterns (#214)
Allow tasks to exclude specific files/directories from cache fingerprint
calculation using glob patterns with gitignore-style negation support.
This enables selective caching for tasks like package installation where
only dependency manifests (package.json) matter for cache validation,
not implementation files. Cache hits occur when ignored files change.
Key features:
- Optional fingerprintIgnores field accepts glob patterns
- Negation patterns (!) to include files within ignored directories
- Leverages existing vite_glob crate for pattern matching
- Fully backward compatible (defaults to None)
Example:
```
{"fingerprintIgnores": ["node_modules/**","!node_modules/**/package.json"]}
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude [noreply@anthropic.com](mailto:noreply@anthropic.com)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds gitignore-style glob patterns to filter post-run fingerprint inputs, wiring config through execution and caching to control cache invalidation.
>
> - **Core fingerprinting**:
> - `PostRunFingerprint::create()` filters `path_reads` via `vite_glob::GlobPatternSet`, honoring negation and order of `fingerprint_ignores`.
> - **Config/Fingerprint**:
> - Add `TaskConfig.fingerprint_ignores?: Option<Vec<Str>>`.
> - Include `fingerprint_ignores` in `CommandFingerprint` to affect cache keys.
> - Propagate in `ResolvedTaskConfig::resolve_command()` and builtin resolver.
> - **Caching/Execution flow**:
> - `CommandCacheValue::create()` and `schedule.rs` pass `fingerprint_ignores` to post-run fingerprint creation.
> - Bump task cache DB `user_version` to `3` and adjust migration handling.
> - **Tests/Fixtures**:
> - Extensive unit tests for pattern filtering and cache-key sensitivity; add fixture and CLI snap-test demonstrating ignore/negation behavior.
> - **Docs**:
> - Add RFC documenting schema, behavior, examples, and implementation details.
>
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 73eb4ec. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 096aca2 commit 622930a
15 files changed
Lines changed: 1210 additions & 7 deletions
File tree
- crates/vite_task
- docs
- fixtures/fingerprint-ignore-test
- src
- config
- packages/cli/snap-tests/fingerprint-ignore-test
Lines changed: 491 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | | - | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
116 | | - | |
117 | | - | |
| 120 | + | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
148 | 157 | | |
149 | 158 | | |
150 | 159 | | |
| 160 | + | |
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
| |||
157 | 167 | | |
158 | 168 | | |
159 | 169 | | |
| 170 | + | |
160 | 171 | | |
161 | 172 | | |
162 | 173 | | |
163 | 174 | | |
164 | 175 | | |
165 | 176 | | |
166 | 177 | | |
167 | | - | |
| 178 | + | |
| 179 | + | |
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
| |||
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
| 194 | + | |
182 | 195 | | |
183 | 196 | | |
184 | 197 | | |
| |||
245 | 258 | | |
246 | 259 | | |
247 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
248 | 268 | | |
249 | 269 | | |
250 | 270 | | |
| |||
256 | 276 | | |
257 | 277 | | |
258 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
259 | 283 | | |
260 | 284 | | |
261 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
| 527 | + | |
527 | 528 | | |
528 | 529 | | |
529 | 530 | | |
| |||
615 | 616 | | |
616 | 617 | | |
617 | 618 | | |
| 619 | + | |
618 | 620 | | |
619 | 621 | | |
620 | 622 | | |
| |||
737 | 739 | | |
738 | 740 | | |
739 | 741 | | |
| 742 | + | |
740 | 743 | | |
741 | 744 | | |
742 | 745 | | |
| |||
803 | 806 | | |
804 | 807 | | |
805 | 808 | | |
| 809 | + | |
806 | 810 | | |
807 | 811 | | |
808 | 812 | | |
| |||
0 commit comments