Repository navigation
fix(ci): pin Next.js sandbox cache key, drop poisoning restore-keys fallback - #2945
Merged
Merged
Conversation
…allback The Next.js build cache (apps/sandbox/.next/cache) bakes in the resolved export graph of @xds/core. The cache key included the @xds/core dist hash, but the loose restore-keys fallback (nextjs-sandbox-<lock>- and nextjs-sandbox-) let a build restore a cache produced against a DIFFERENT export shape. This broke the post-merge deploy of the XDS un-prefix migration (#2941): - The migration changed core's exports (bare names canonical, new ./astryx.css and ./naming subpaths), changing hashFiles('packages/core/dist/**'). - On main, the exact cache key missed (no main-ref cache had the new dist hash; the post-migration caches were PR-ref scoped and unreadable from main). - restore-keys fell back to a pre-migration main cache (built ~6h earlier) whose compiled Next modules still expected XDS*-prefixed exports. - next build reused those stale modules against bare-name source, producing 'Text' is not exported from '@xds/core/Text' and 'Element type is invalid ... undefined' prerender failures (e.g. /pages/butter-palette). - The PR CI build passed because its PR-scoped cache was built post-migration and was therefore consistent. Removing restore-keys makes a changed key yield a COLD cache (correct, slightly slower rebuild) instead of a poisoned warm one. Applied to both deploy.yml and ci.yml.
ejhammond
requested review from
cixzhang,
imdreamrunner,
josephfarina,
marie-lucas,
nynexman4464 and
thedjpetersen
as code owners
June 19, 2026 19:02
|
@ejhammond must be a member of the Meta Open Source team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
Contributor
🚀 Vercel Preview Deployment
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
approved these changes
Jun 19, 2026
cixzhang
pushed a commit
that referenced
this pull request
Jun 21, 2026
…allback (#2945) The Next.js build cache (apps/sandbox/.next/cache) bakes in the resolved export graph of @xds/core. The cache key included the @xds/core dist hash, but the loose restore-keys fallback (nextjs-sandbox-<lock>- and nextjs-sandbox-) let a build restore a cache produced against a DIFFERENT export shape. This broke the post-merge deploy of the XDS un-prefix migration (#2941): - The migration changed core's exports (bare names canonical, new ./astryx.css and ./naming subpaths), changing hashFiles('packages/core/dist/**'). - On main, the exact cache key missed (no main-ref cache had the new dist hash; the post-migration caches were PR-ref scoped and unreadable from main). - restore-keys fell back to a pre-migration main cache (built ~6h earlier) whose compiled Next modules still expected XDS*-prefixed exports. - next build reused those stale modules against bare-name source, producing 'Text' is not exported from '@xds/core/Text' and 'Element type is invalid ... undefined' prerender failures (e.g. /pages/butter-palette). - The PR CI build passed because its PR-scoped cache was built post-migration and was therefore consistent. Removing restore-keys makes a changed key yield a COLD cache (correct, slightly slower rebuild) instead of a poisoned warm one. Applied to both deploy.yml and ci.yml.
cixzhang
pushed a commit
that referenced
this pull request
Jun 21, 2026
…allback (#2945) The Next.js build cache (apps/sandbox/.next/cache) bakes in the resolved export graph of @xds/core. The cache key included the @xds/core dist hash, but the loose restore-keys fallback (nextjs-sandbox-<lock>- and nextjs-sandbox-) let a build restore a cache produced against a DIFFERENT export shape. This broke the post-merge deploy of the XDS un-prefix migration (#2941): - The migration changed core's exports (bare names canonical, new ./astryx.css and ./naming subpaths), changing hashFiles('packages/core/dist/**'). - On main, the exact cache key missed (no main-ref cache had the new dist hash; the post-migration caches were PR-ref scoped and unreadable from main). - restore-keys fell back to a pre-migration main cache (built ~6h earlier) whose compiled Next modules still expected XDS*-prefixed exports. - next build reused those stale modules against bare-name source, producing 'Text' is not exported from '@xds/core/Text' and 'Element type is invalid ... undefined' prerender failures (e.g. /pages/butter-palette). - The PR CI build passed because its PR-scoped cache was built post-migration and was therefore consistent. Removing restore-keys makes a changed key yield a COLD cache (correct, slightly slower rebuild) instead of a poisoned warm one. Applied to both deploy.yml and ci.yml.
This branch had an error being 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.
Problem
The post-merge
deployjob for the XDS un-prefix migration (#2941) failed at Build Sandbox with:Attempted import error: 'Text' is not exported from '@xds/core/Text'(theme-showcase)Error: Element type is invalid ... got: undefinedprerendering/pages/butter-palette…even though the same commit's PR CI build passed (byte-identical tree).
Root cause: poisoned Next.js build cache via
restore-keysfallbackapps/sandbox/.next/cachebakes in the resolved export graph of@xds/core. The cache key correctly includedhashFiles('packages/core/dist/**'), but the looserestore-keysfallback defeated it:Sequence:
./astryx.css,./namingsubpaths) → newpackages/core/dist/**hash → new cache key.main, the exact key missed. GitHub Actions caches are ref-scoped: the post-migration caches existed only onrefs/pull/2941/merge, unreadable frommain.restore-keysfell back to a pre-migrationmaincache (built ~6h earlier) whose compiled Next modules still expectedXDS*-prefixed exports.next buildreused those stale modules against the new bare-name source → the import/prerender failures above.(Confirmed empirically: deleting the stale
main-refnextjs-sandbox-*caches and re-running the deploy builds clean.)Fix
Remove the
restore-keysfallback in bothdeploy.ymlandci.yml. The key still keys on the lock + core dist hashes, so a change now yields a cold cache (a correct, slightly slower rebuild) instead of a poisoned warm one.Risk
Low. Worst case is a one-time cold Next build whenever
pnpm-lock.yamlor@xds/coredist changes — which is exactly when reusing the cache is unsafe.