chore(ci): scope turbo cache by RUNNER_OS#1128
Merged
Merged
Conversation
Add RUNNER_OS to globalEnv so turbo cache entries are scoped per operating system. Without this, Windows and Linux CI runners share the same cache for tasks whose outputs are OS-sensitive (e.g. resolved symlink paths inside @sanity/cli-test:build's fixtures/** output), which has caused Windows-absolute symlink paths to be replayed on Linux runners and crashed fixture loading. Mirrors the existing NODE_VERSION scoping. Locally RUNNER_OS is unset, so this has no effect on local cache sharing.
|
Claude finished @gu-stav's task in 55s —— View job ReviewNo issues found.
Changeset: Not required. This is a CI/build-config change with no runtime impact on any package in
|
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (cd110e7) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.97 MB | -98 B, -0.0% |
| Bundled (gzip) | 2.06 MB | -24 B, -0.0% |
| Import time | 926ms | -1ms, -0.1% |
bin:sanity
| Metric | Value | vs main (cd110e7) |
|---|---|---|
| Internal (raw) | 1023 B | - |
| Internal (gzip) | 486 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 2.21s | -13ms, -0.6% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against main (cd110e7c)
| Metric | Value | vs main (cd110e7) |
|---|---|---|
| Internal (raw) | 96.3 KB | -723 B, -0.7% |
| Internal (gzip) | 22.7 KB | -44 B, -0.2% |
| Bundled (raw) | 21.61 MB | -723 B, -0.0% |
| Bundled (gzip) | 3.42 MB | -65 B, -0.0% |
| Import time | 873ms | +8ms, +0.9% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against main (cd110e7c)
| Metric | Value | vs main (cd110e7) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
Contributor
Coverage DeltaNo covered files changed in this PR. Overall Coverage
|
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.
Description
Follow-up to #1127. Scopes turbo cache entries by operating system to prevent cross-OS cache sharing.
Context
In #1127 we tracked down a CI flake where two
build.app.test.ts/build.studio.test.tscases crashed on Linux runners withENOENTwhile statting symlinks underpackages/@sanity/cli-test/fixtures/basic-app/node_modules/. The chain was:node_modulesinto the bundled fixtures dir (because of a path-splitting bug incopy-fixtures.ts).fs.cpresolved those symlinks to absolute Windows paths.turbo.jsondeclaresfixtures/**as a build output, so the Windows-absolute symlinks got cached.C:\a\cli\cli\...paths), and the symlinks became dangling on Linux.#1127 fixes the root cause (the copy-fixtures filter) and adds defensive handling in
testFixture. This PR addresses the deeper class of problem: build outputs can legitimately differ by OS (resolved symlinks, line endings, native binaries), so caches shouldn't be shared across operating systems.Change
Add
RUNNER_OStoglobalEnvinturbo.json. Since cache keys hash declared env vars, this gives Linux/Windows/macOS runners separate cache entries.This mirrors the existing
NODE_VERSIONentry — we already scope by Node version for the same reason.Locally
RUNNER_OSis unset, so the cache key gets the same empty value across machines and local sharing is unchanged.What to review
globalEnv.Testing
Note
Low Risk
Low risk: a single
turbo.jsonconfig change that only affects Turbo cache key hashing across OSes and doesn’t alter build/test logic.Overview
Scopes Turbo cache keys by operating system by adding
RUNNER_OStoglobalEnvinturbo.json, preventing cross-OS cache reuse for build outputs (e.g., cachedfixtures/**). This will cause one-time cache misses per OS but avoids replaying incompatible artifacts between Linux/Windows/macOS runners.Reviewed by Cursor Bugbot for commit 4304a63. Bugbot is set up for automated code reviews on this repo. Configure here.