Skip to content

feat(task): add cache fingerprint ignore patterns#214

Merged
fengmk2 merged 4 commits intomainfrom
10-09-feat_task_support_cache_fingerprint_ignore_patterns
Oct 13, 2025
Merged

feat(task): add cache fingerprint ignore patterns#214
fengmk2 merged 4 commits intomainfrom
10-09-feat_task_support_cache_fingerprint_ignore_patterns

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Oct 9, 2025

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

Co-Authored-By: Claude noreply@anthropic.com


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.

Written by Cursor Bugbot for commit 73eb4ec. This will update automatically on new commits. Configure here.

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>
Copy link
Copy Markdown
Member Author

fengmk2 commented Oct 9, 2025

@fengmk2 fengmk2 force-pushed the 10-09-feat_task_support_cache_fingerprint_ignore_patterns branch 5 times, most recently from b28e9ad to 9cad5cb Compare October 9, 2025 07:12
@fengmk2 fengmk2 marked this pull request as ready for review October 9, 2025 07:26
@fengmk2 fengmk2 requested review from Brooooooklyn, branchseer and Copilot and removed request for Copilot October 9, 2025 07:26
@fengmk2 fengmk2 self-assigned this Oct 9, 2025
Comment thread crates/vite_task/src/install.rs Outdated
Add comprehensive snap-test demonstrating cache fingerprint ignore patterns.
The test verifies:

- Cache hit when ignored files change (node_modules/*/index.js, dist/*)
- Cache miss when non-ignored files change (package.json via negation)
- Negation patterns work correctly (!node_modules/**/package.json)

Test scenario:
1. First run - cache miss (initial execution)
2. Second run - cache hit (no changes)
3. Modify index.js - cache hit (ignored by node_modules/**/* pattern)
4. Modify dist/bundle.js - cache hit (ignored by dist/**/* pattern)
5. Modify package.json - cache miss (NOT ignored due to negation pattern)

This validates the selective caching feature for package installation tasks
where only dependency manifests matter for cache validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 10, 2025 03:31
@fengmk2 fengmk2 force-pushed the 10-09-feat_task_support_cache_fingerprint_ignore_patterns branch from 9cad5cb to 73eb4ec Compare October 10, 2025 03:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds cache fingerprint ignore patterns to allow tasks to exclude specific files/directories from triggering cache invalidation. The feature enables selective caching where only certain files (like package.json) matter for cache validation, not all accessed files.

Key changes:

  • Adds optional fingerprintIgnores field to task configuration supporting glob patterns with gitignore-style negation
  • Leverages existing vite_glob crate for pattern matching with last-match-wins semantics
  • Maintains full backward compatibility with no behavior changes when field is omitted

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/vite_task/src/config/mod.rs Adds fingerprint_ignores field to TaskConfig and CommandFingerprint structs
crates/vite_task/src/fingerprint.rs Implements pattern filtering in PostRunFingerprint creation with comprehensive unit tests
crates/vite_task/src/cache.rs Updates cache value creation to pass fingerprint ignore patterns
crates/vite_task/src/schedule.rs Integrates ignore patterns into task execution flow
packages/cli/snap-tests/fingerprint-ignore-test/ Adds comprehensive end-to-end test fixture demonstrating the feature
crates/vite_task/docs/rfc-cache-fingerprint-ignore-patterns.md Complete RFC documentation with implementation details and examples

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread crates/vite_task/src/cache.rs
Comment thread crates/vite_task/src/fingerprint.rs Outdated
Comment thread crates/vite_task/src/fingerprint.rs
@Brooooooklyn
Copy link
Copy Markdown
Member

cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


Copilot AI review requested due to automatic review settings October 13, 2025 03:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Member Author

fengmk2 commented Oct 13, 2025

Merge activity

  • Oct 13, 4:32 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 13, 4:32 AM UTC: @fengmk2 merged this pull request with Graphite.

@fengmk2 fengmk2 merged commit 622930a into main Oct 13, 2025
9 checks passed
@fengmk2 fengmk2 deleted the 10-09-feat_task_support_cache_fingerprint_ignore_patterns branch October 13, 2025 04:32
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.

4 participants