Skip to content

ci: cache yarn build-state and install-state#3521

Merged
QuantumExplorer merged 2 commits into
v3.1-devfrom
claude/ci-expand-yarn-cache
Apr 23, 2026
Merged

ci: cache yarn build-state and install-state#3521
QuantumExplorer merged 2 commits into
v3.1-devfrom
claude/ci-expand-yarn-cache

Conversation

@QuantumExplorer
Copy link
Copy Markdown
Member

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, EBADF races — see #3519) can bite.

What was done?

Expanded the cache path to 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/cache tolerates 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:

  1. Cache-hit install runs are faster (fewer postinstall scripts executed).
  2. .yarn/build-state.yml appears in the cached archive.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 17 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 69c7c3e0-bb18-46e0-8410-990683199a11

📥 Commits

Reviewing files that changed from the base of the PR and between b771a17 and cfc6037.

📒 Files selected for processing (1)
  • .github/actions/nodejs/action.yaml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ci-expand-yarn-cache

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added this to the v3.1.0 milestone Apr 23, 2026
@thepastaclaw
Copy link
Copy Markdown
Collaborator

thepastaclaw commented Apr 23, 2026

Review Gate

Commit: cfc60377

  • Debounce: 23m ago (need 30m)

  • CI checks: builds passed, 0/2 tests passed

  • CodeRabbit review: comment found

  • Off-peak hours: off-peak (11:22 PM PT Wednesday)

  • Run review now (check to override)

@QuantumExplorer
Copy link
Copy Markdown
Member Author

Reviewed AI based PR

@QuantumExplorer QuantumExplorer merged commit 61e3bbc into v3.1-dev Apr 23, 2026
34 checks passed
@QuantumExplorer QuantumExplorer deleted the claude/ci-expand-yarn-cache branch April 23, 2026 06:23
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.

2 participants