Include Yarn install state when restoring cache#66
Merged
Conversation
f534848 to
895b452
Compare
Both clients use a bespoke Yarn plugin for installing preview builds, which are prerelease versions of libraries that engineers can generate and use. This plugin works by modifying internal resolutions in order to map packages from the `@metamask` NPM scope to the `@metamask-previews` scope (along with a special preview version). In the extension, we have found that this plugin does not seem to work in CI. More specifically, if one job runs this workflow and caches `node_modules`, when another job runs this workflow again to restore `node_modules` from cache, attempting to run a Yarn command fails (the preview build is not found). Caching `node_modules` does not seem to be sufficient to restore the mapping of resolutions that the plugin needs to work correctly. We need to also cache and restore `.yarn/install-state.gz`.
895b452 to
3585ea0
Compare
Gudahtt
reviewed
Apr 29, 2026
HowardBraham
approved these changes
Apr 29, 2026
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
Both clients use a bespoke Yarn plugin for installing preview builds, which are prerelease versions of libraries that engineers can generate and use. This plugin works by modifying Yarn resolutions in memory in order to map packages from the
@metamaskNPM scope to a special version within the@metamask-previewsscope.In the extension, we have found that this plugin does not seem to work in CI. More specifically, if one job runs this workflow and caches
node_modules, when another job runs this workflow again to restorenode_modulesfrom cache, attempting to run a Yarn command fails (the preview build is not found). Cachingnode_modulesdoes not seem to be sufficient to restore the mapping of resolutions that the plugin needs to work correctly. We need to also cache and restore.yarn/install-state.gz.References
See this Slack thread for more information: https://consensys.slack.com/archives/C094GV3E7SB/p1777056238889789
Note
Medium Risk
Touches the shared composite GitHub Action used for dependency setup/caching, so any mistake can impact CI reliability and cache behavior across repos. Change is straightforward (adds one file to cache paths) with low security/data risk.
Overview
Ensures Yarn’s install metadata is preserved across CI runs by caching/restoring
.yarn/install-state.gzalongside**/node_modulesin all workspace cache restore/save steps (including the fast “skip setup” lookup).Updates the related step name/comment to reflect that both
node_modulesand Yarn install state are now restored, improving reliability for workflows that depend on Yarn’s internal resolution state.Reviewed by Cursor Bugbot for commit c4346cc. Bugbot is set up for automated code reviews on this repo. Configure here.