Skip to content

Include Node version in CI setup cache key#120

Merged
aarsilv merged 1 commit into
mainfrom
aarsilv/ffesupport-731/ci-cache-key-node-version
May 26, 2026
Merged

Include Node version in CI setup cache key#120
aarsilv merged 1 commit into
mainfrom
aarsilv/ffesupport-731/ci-cache-key-node-version

Conversation

@aarsilv
Copy link
Copy Markdown
Contributor

@aarsilv aarsilv commented May 26, 2026

FFESUPPORT-731 · stacked on #118

Summary

The composite setup action caches **/node_modules keyed on OS + yarn.lock hash only. If a node_modules cache built under a different Node version were restored, packages with native bindings could load mismatched ABI binaries — and because the cache-hit path skips the install step, deps wouldn't get rebuilt.

Captures the resolved Node version (node -v) into a step output, then includes it in both the primary cache key and the restore-keys prefix. Bumping Node now busts the cache automatically instead of relying on lockfile churn.

Pre-existing best-practice gap, not a regression from #118 — flagged by Copilot as a low-confidence observation during the #118 review.

Notes

Minimal-change variant. Caching Yarn's download cache instead of node_modules would be the more robust pattern, but that's a bigger restructure best handled as a separate ticket if we want it.

Test plan

  • CI green on this branch.
  • Cache hit on a re-run of the same commit (key matches → restore).
  • Verified key changes when Node version changes (by inspection — node -v output is captured in the key).

🤖 Generated with Claude Code

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the resolved Node version into the composite setup action's cache key so the node_modules cache is invalidated when the Node version changes, preventing potential native-binding ABI mismatches on cache restore.

Changes:

  • Adds a node-info step that captures node -v output.
  • Includes the Node version in both the primary cache key and the restore-keys prefix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Base automatically changed from aarsilv/ffesupport-728/address-vulnerabilities to main May 26, 2026 11:59
The composite setup action caches `**/node_modules` keyed on OS +
`yarn.lock` hash only. If a `node_modules` cache built under a
different Node version were restored, packages with native bindings
could load mismatched ABI binaries — and because the cache-hit path
skips the install step, deps wouldn't get rebuilt.

Capture the resolved Node version (`node -v`) into a step output, then
include it in both the primary cache key and the `restore-keys` prefix.
That way, bumping Node automatically busts the cache instead of relying
on lockfile churn to do it incidentally.

Stays with `actions/setup-node@v3` and `actions/cache@v3` — this is the
minimal-change variant. Caching Yarn's download cache instead of
`node_modules` would be the more robust pattern, but that's a bigger
restructure for a separate ticket if we want it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aarsilv aarsilv force-pushed the aarsilv/ffesupport-731/ci-cache-key-node-version branch from 3b91940 to 960844e Compare May 26, 2026 12:07
@aarsilv aarsilv merged commit 4e9bd47 into main May 26, 2026
@aarsilv aarsilv deleted the aarsilv/ffesupport-731/ci-cache-key-node-version branch May 26, 2026 12:21
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.

3 participants