Repository navigation
feat(cache): share a task's remote cache entries between platforms with cache.remote.crossPlatform - #1004
Draft
fengmk2 wants to merge 2 commits into
Draft
feat(cache): share a task's remote cache entries between platforms with cache.remote.crossPlatform#1004fengmk2 wants to merge 2 commits into
cache.remote.crossPlatform#1004fengmk2 wants to merge 2 commits into
Conversation
…th `cache.remote.crossPlatform`
Every remote key starts with a header that names the OS and the
architecture, so an entry that Linux CI stores is never fetched on macOS,
even for a task whose outputs are the same on every platform. A task can
now set `cache: { remote: { crossPlatform: true } }`. Its remote keys then
have an empty OS and architecture, which no platform has. The default
keys and the local cache don't change.
Closes #926
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fspy benchmarklinuxmacoswindows |
…apshots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Every remote key starts with a header that names the OS and the architecture, so an entry that Linux CI stores is never fetched on a developer's Mac. This is true even for a task whose outputs are the same on every platform, such as a code generator that runs on Node.js. Teams whose CI and developers use different platforms get few remote hits. Today the only workaround is a server that rewrites each key's header, which depends on the key's private encoding and applies to every task at once (#926).
Changes
Config. A task's
cache.remotetakestrue,false, or an object.trueis the same as{}. The object has one setting,crossPlatform, which defaults tofalse:Like the rest of remote caching, the field is parsed but left out of the public types.
Keys. With
crossPlatform: true, both remote keys (keyandsecondary_key) start with a header that has an empty OS and architecture. No platform has an empty name, so these keys never equal a platform's keys. The cache schema version and the remote value format stay in the header. A fallback's key is decoded with the same header, so its miss reason still works.Unchanged. Tasks without
crossPlatformkeep the same keys as before. The local cache doesn't depend on the setting. A fetched entry is still checked against the fetching machine's inputs, and the rest of the key (the program, its arguments, its working directory, its envs, and its input and output globs) must still match. Turning the setting on or off changes the task's remote keys one time.Built-in tools. A built-in tool's cache settings merge into the settings of the task that runs it. The tool uses the remote cache only if both allow it, and shares its entries between platforms if either one sets
crossPlatform. Vite+'s built-ins don't setremotetoday, socrossPlatformon a task like"lint": "vp lint"applies to the tool.Built-in tools still put absolute paths in their arguments (#717), so their keys can still differ between machines.
Closes #926
🤖 Generated with Claude Code