Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(ci): pin Next.js sandbox cache key, drop poisoning restore-keys fallback (#2945)

EJ Hammond6e1cc4e66331
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bf1a6e6bcd..1389a72144 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -208,10 +208,12 @@ jobs:
uses: actions/cache@v5
with:
path: apps/sandbox/.next/cache
+ # No restore-keys fallback — see deploy.yml for the full rationale.
+ # The Next.js module cache bakes in @xds/core's resolved export graph,
+ # so a loose fallback can restore a cache built against a different
+ # export shape and silently produce wrong builds (broke #2941's
+ # post-merge deploy). A changed key yields a cold (safe) rebuild.
key: nextjs-sandbox-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/core/dist/**') }}
- restore-keys: |
- nextjs-sandbox-${{ hashFiles('pnpm-lock.yaml') }}-
- nextjs-sandbox-
- name: Build Storybook
if: needs.check-scope.outputs.docsite_only != 'true'
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 91b7b675f7..e5c5c826ca 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -98,10 +98,20 @@ jobs:
uses: actions/cache@v5
with:
path: apps/sandbox/.next/cache
+ # IMPORTANT: no restore-keys fallback. The key is pinned to the
+ # @xds/core dist hash because the Next.js module cache bakes in the
+ # resolved export graph of @xds/core. A loose restore-keys fallback
+ # (e.g. "nextjs-sandbox-<lock>-") would let a build restore a cache
+ # produced against a DIFFERENT export shape. That is exactly what
+ # broke the post-merge deploy of the XDS un-prefix migration (#2941):
+ # the migration changed core's exports (bare names, new subpaths), the
+ # exact key missed, and restore-keys fell back to a pre-migration
+ # cache whose compiled modules still expected XDS*-prefixed exports —
+ # producing "'Text' is not exported from '@xds/core/Text'" and
+ # "Element type is invalid ... undefined" prerender failures.
+ # A changed key now yields a COLD cache (safe rebuild) instead of a
+ # poisoned warm one.
key: nextjs-sandbox-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/core/dist/**') }}
- restore-keys: |
- nextjs-sandbox-${{ hashFiles('pnpm-lock.yaml') }}-
- nextjs-sandbox-
- name: Build Sandbox
run: pnpm -F @xds/sandbox build