ci: cache yarn build-state and install-state#3521
Conversation
The Setup Node.JS action currently caches only .yarn/unplugged. Two other yarn-berry state files meaningfully reduce install time and install-flakiness surface area, but aren't cached today: - .yarn/build-state.yml tracks which unplugged packages have had their postinstall scripts run successfully. Without it, even on a cache hit, yarn re-runs every native build — which is exactly when transient failures like EBADF races can bite. - .yarn/install-state.gz is yarn's compressed resolution/link state; including it lets yarn skip cold-start hydration work. Both are derived from yarn.lock, so the existing cache key is fine. actions/cache tolerates missing paths at save time, so first-run behavior is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 17 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review GateCommit:
|
|
Reviewed AI based PR |
Issue being fixed or feature implemented
The Setup Node.JS composite action (
.github/actions/nodejs/action.yaml) currently caches only.yarn/unplugged. On a cache hit, native-module packages already exist on disk — but yarn still re-runs every postinstall build script because it has no record of which ones previously succeeded. This is exactly the window where transient install failures (npm registry blips,EBADFraces — see #3519) can bite.What was done?
Expanded the cache
pathto also include:.yarn/build-state.yml— yarn-berry tracks per-package postinstall success here. Caching it lets yarn skip re-running builds across runs with matching lockfiles..yarn/install-state.gz— yarn's compressed resolution/link state. Caching it lets yarn skip cold-start hydration.Both files are derived from
yarn.lock, so the existing cache key (hashFiles('yarn.lock')) stays correct.actions/cachetolerates missing paths at save time, so first-run behavior is unchanged and no explicit guards are needed.How Has This Been Tested?
Config-only change. Validation comes from observing on subsequent PRs that:
.yarn/build-state.ymlappears in the cached archive.Breaking Changes
None.
Checklist: