Skip to content

fix(turbo): bust cli-test build cache when fixtures change#1145

Open
gu-stav wants to merge 1 commit into
mainfrom
fix/cli-test-fixture-cache-key
Open

fix(turbo): bust cli-test build cache when fixtures change#1145
gu-stav wants to merge 1 commit into
mainfrom
fix/cli-test-fixture-cache-key

Conversation

@gu-stav
Copy link
Copy Markdown
Member

@gu-stav gu-stav commented May 29, 2026

@sanity/cli-test bundles its test fixtures by copying them from the repo-root fixtures/ via copy:fixtures at build time.

The generic build task only keys its cache on files inside the package, so editing a repo-root fixture leaves cli-test's cache key unchanged. turbo then replays a stale bundled copy and tests run against an outdated fixture — a silent, confusing failure mode (the test reads a fixture that no longer matches what's on disk).

Fix: give @sanity/cli-test#build an explicit input set that includes $TURBO_ROOT$/fixtures and pnpm-workspace.yaml (the catalog copy:fixtures also reads), so fixture edits invalidate the cache.


Note

Low Risk
CI/cache configuration only; no runtime product or security behavior changes.

Overview
Adds a Turbo override for @sanity/cli-test#build so cache keys include repo-root fixtures/** and pnpm-workspace.yaml, not only files inside the package.

That way edits to shared fixtures (copied in at build via copy:fixtures) invalidate the build cache instead of reusing a stale bundled copy during CI.

Reviewed by Cursor Bugbot for commit d22456c. Bugbot is set up for automated code reviews on this repo. Configure here.

`@sanity/cli-test` bundles its test fixtures by copying them from the
repo-root `fixtures/` via `copy:fixtures` at build time. The generic
`build` task only keys its cache on files inside the package, so editing
a repo-root fixture left the cache key unchanged and turbo replayed a
stale bundled copy — tests then ran against an outdated fixture.

Key cli-test's build on `$TURBO_ROOT$/fixtures` and the workspace catalog
(also read by `copy:fixtures`) so fixture edits invalidate it.
@claude
Copy link
Copy Markdown

claude Bot commented May 29, 2026

Claude finished @gu-stav's task in 1m 24s —— View job


Claude Review

  • Read turbo.json change
  • Inspect @sanity/cli-test build setup (copy:fixtures, package.json, scripts/copy-fixtures.ts)
  • Check Turbo config patterns elsewhere in the repo for consistency
  • Verify changeset requirement

Findings

No blocking issues. The override correctly mirrors the two repo-root paths that scripts/copy-fixtures.ts actually reads: fixtures/ (line 18) and pnpm-workspace.yaml (line 79). $TURBO_DEFAULT$ keeps the package's own files in the hash, and node_modules is .gitignored at the root so the broader fixtures/** glob won't accidentally pull installed deps into the cache key.

A couple of notes worth confirming, but not blocking:

  • Outputs narrowed vs. the generic build. The generic task lists .next/**, !.next/cache/**, .sanity/**, lib/** in addition to dist/** and fixtures/**. Turbo overrides the whole task definition (no merge), so dropping those is fine here — @sanity/cli-test only produces dist/ and fixtures/ — but it does mean future build-output additions in this package would need to be added here too. Worth a one-line comment in turbo.json if you want a hint for the next person.
  • build:types is unaffected. It only emits .d.ts from src/, so fixture changes correctly don't invalidate it.

Changeset

Not needed. This is build/CI cache configuration only — no runtime or public API change. The fix(ci): prefix matches the scope.
• Branch: fix/cli-test-fixture-cache-key

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

📦 Bundle Stats — @sanity/cli

Compared against main (7d2118d4)

@sanity/cli

Metric Value vs main (7d2118d)
Internal (raw) 2.1 KB -
Internal (gzip) 799 B -
Bundled (raw) 10.97 MB -
Bundled (gzip) 2.06 MB -
Import time 824ms -8ms, -1.0%

bin:sanity

Metric Value vs main (7d2118d)
Internal (raw) 1023 B -
Internal (gzip) 486 B -
Bundled (raw) 9.87 MB -
Bundled (gzip) 1.77 MB -
Import time 1.93s -40ms, -2.0%

🗺️ 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 (7d2118d4)

Metric Value vs main (7d2118d)
Internal (raw) 96.3 KB -
Internal (gzip) 22.7 KB -
Bundled (raw) 21.64 MB -
Bundled (gzip) 3.43 MB -
Import time 785ms -13ms, -1.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 — create-sanity

Compared against main (7d2118d4)

Metric Value vs main (7d2118d)
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.

@gu-stav gu-stav marked this pull request as ready for review May 29, 2026 16:14
@gu-stav gu-stav requested a review from a team as a code owner May 29, 2026 16:15
@gu-stav gu-stav changed the title fix(ci): bust cli-test build cache when repo-root fixtures change fix(ci): bust cli-test build cache when fixtures change May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Delta

No covered files changed in this PR.

Overall Coverage

Metric Coverage
Statements 84.3% (±0%)
Branches 74.3% (±0%)
Functions 84.2% (±0%)
Lines 84.8% (±0%)

@gu-stav gu-stav changed the title fix(ci): bust cli-test build cache when fixtures change fix(turbo): bust cli-test build cache when fixtures change May 29, 2026
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.

1 participant