turborepo
39c49344 - feat: Add incremental task caching (#12531)

Commit
16 days ago
feat: Add incremental task caching (#12531) > [!NOTE] > This is an experiment and we're not documenting it yet. We want to learn about what this might look like. Use at your own risk. ## Summary Adds incremental cache partitions that persist tool-managed incremental state (e.g. `.tsbuildinfo`, Rust `target/incremental/`) across runs via remote cache. On cache misses, turbo restores prior incremental state before the tool runs, enabling faster re-execution. Gated behind `futureFlags.incrementalTasks`. - New `incremental` field on task definitions in `turbo.json` - `IncrementalTaskCache` in `turborepo-run-cache` handles fetch/upload lifecycle - Cache keys use SHA-256 with length-prefixed encoding (prevents separator collisions) - Sequential fetch (deterministic last-write-wins overlap), concurrent upload - 30s fetch / 60s upload timeouts prevent slow cache from blocking tasks - Graceful degradation: all failures are warnings, never task failures ### Notable design decisions - **Upload on every success**: This might be overdoing it, but we are going to try and find out to see what it looks like. ### How to test 1. Enable the feature flag: `"futureFlags": { "incrementalTasks": true }` in root `turbo.json` 2. Add `incremental` to a task: ```json "check-types": { "incremental": [{ "outputs": ["tsconfig.tsbuildinfo"] }] } ``` 3. Run the task twice — second run on a cache miss should log "incremental state restored" 4. Test with `--force` (skips fetch, still uploads), `--no-cache` (disables entirely), `--remote-only` (skips local file check)
Author
Parents
Loading