Skip to content

CLDSRV-955: Cache node_modules instead of yarn download cache#6227

Open
tcarmet wants to merge 2 commits into
development/9.3from
improvement/CLDSRV-955/node-modules-cache
Open

CLDSRV-955: Cache node_modules instead of yarn download cache#6227
tcarmet wants to merge 2 commits into
development/9.3from
improvement/CLDSRV-955/node-modules-cache

Conversation

@tcarmet

@tcarmet tcarmet commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Speeds up CI by caching the installed dependency tree between runs instead of only the package-manager download cache. Because several dependencies compile TypeScript at install time, previous runs re-cloned, recompiled and relinked them on every job despite a "cache hit"; now a warm cache skips that work entirely and jobs reuse the prior install.

Measured impact (warm run vs a development/9.3 baseline)

Job dependency setup before after (warm) job wall time
lint 61s 9s 116s → 49s
unit-tests 54s 10s 114s → 64s
file-ft-tests 84s 41s 750s → 722s
  • ~43–52s of dependency setup saved per job, across ~15 jobs (4 inline + ~11 functional via the setup-ci composite action).
  • Jobs run in parallel, so end-to-end wall time drops modestly (critical-path bound, ~30–40s), but total CI compute falls ~10 min per run and the short feedback jobs (lint, unit) are >2× faster.
  • Cache key is ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}; a lockfile bump invalidates it and the next run repopulates.

See the pinned comparison comment for full details.

Replace `cache: yarn` (which only caches the yarn download dir) with an
actions/cache on node_modules keyed by the yarn.lock hash, and make the
yarn install / typescript steps conditional on a cache miss. Because the
git dependencies compile TypeScript at install time, a warm cache now
skips the clone, tsc build and relink entirely.

Applied to the setup-ci composite action (used by all functional jobs)
and the lint, async-migration-report, unit-tests and cleanup-gcp-buckets
jobs.
@bert-e

bert-e commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hello tcarmet,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

The Fix Version/s in issue CLDSRV-955 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.3.14

  • 9.4.0

Please check the Fix Version/s of CLDSRV-955, or the target
branch of this pull request.

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.99%. Comparing base (055ae1b) to head (9351e6c).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph
see 1 file with indirect coverage changes

@@                 Coverage Diff                 @@
##           development/9.3    #6227      +/-   ##
===================================================
+ Coverage            84.93%   84.99%   +0.05%     
===================================================
  Files                  206      206              
  Lines                13366    13366              
===================================================
+ Hits                 11353    11360       +7     
+ Misses                2013     2006       -7     
Flag Coverage Δ
file-ft-tests-null-compat 62.98% <ø> (-5.92%) ⬇️
kmip-ft-tests 28.28% <ø> (ø)
mongo-v0-ft-tests 69.60% <ø> (-0.03%) ⬇️
mongo-v1-ft-tests 69.58% <ø> (-0.03%) ⬇️
multiple-backend 36.77% <ø> (ø)
s3c-ft-tests-v0 64.11% <ø> (ø)
s3c-ft-tests-v0-null-compat 64.17% <ø> (ø)
s3c-ft-tests-v1 64.09% <ø> (ø)
sur-tests 36.64% <ø> (ø)
sur-tests-inflights 37.67% <ø> (ø)
unit 70.50% <ø> (ø)
utapi-v2-tests 34.55% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tcarmet tcarmet marked this pull request as ready for review July 10, 2026 00:04
The prettier check formats whole changed files; touching action.yaml
brought its pre-existing double-quoted name/description into scope.
Reformat them to single quotes to match the prettier style.
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The cache key doesn't include the Node.js version. Since this project has native addons (leveldown, node-gyp-build), a Node version bump (e.g. 22.23.1 → 22.x.y) without a yarn.lock change would serve node_modules compiled for the old version, risking segfaults or load failures.

The comment on line 33 already notes native addons as the reason for including runner.os — the same reasoning applies to the Node version. Same fix needed in tests.yaml (lines 94, 142, 162, 1117).

Suggested change
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
key: ${{ runner.os }}-node-22.23.1-modules-${{ hashFiles('yarn.lock') }}

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