perf(ci): persist V8 compile cache across test jobs#6009
Conversation
Deploying egg-v3 with
|
| Latest commit: |
f1889ed
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8a804420.egg-v3.pages.dev |
| Branch Preview URL: | https://feat-ci-node-compile-cache.egg-v3.pages.dev |
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds Node.js compile cache support to three GitHub Actions CI jobs, clears compile-cache env vars before manifest tests, and makes one subscription test wait longer on CI. ChangesNode Compile Cache CI and Test Isolation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
Dependency limit exceeded — report not shown. This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report. Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard. Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account. |
Deploying egg with
|
| Latest commit: |
f1889ed
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ba5977da.egg-cci.pages.dev |
| Branch Preview URL: | https://feat-ci-node-compile-cache.egg-cci.pages.dev |
Set NODE_COMPILE_CACHE on the test, test-egg-bin and test-egg-scripts jobs and restore/save that directory with actions/cache, so Node's V8 compile cache survives within a run (shared by vitest workers and forked child processes) and across runs. Internally the cache is keyed by source hash + Node version, so stale restored entries are safely ignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
f913829 to
d1ac887
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #6009 +/- ##
=======================================
Coverage 81.94% 81.94%
=======================================
Files 677 677
Lines 20651 20651
Branches 4099 4099
=======================================
+ Hits 16922 16923 +1
Misses 3215 3215
+ Partials 514 513 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
enableCompileCache() intentionally respects an externally-set NODE_COMPILE_CACHE (early-returns), so the new job-wide CI NODE_COMPILE_CACHE made the 'set env vars' assertion read the CI path instead of the auto-set .egg/compile-cache path. Clear the ambient compile-cache env vars in a beforeEach so these tests exercise the auto-set path from a clean slate; the existing afterEach restores them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The `cluster - subscription` test forks an egg cluster (agent + 1 worker) and asserts the `interval` (4000ms) and `cron` (*/5s) schedules each log at least once. It only waited `sleep(5000)`, leaving ~1s of slack for the forked agent/worker boot + IPC + log flush. On busy CI runners (notably Windows, which is not skipped here unlike schedule-plugin/safe-timers) the task occasionally fires zero times in the window, producing the flaky `expected 0 to be greater than or equal to 1`. Widen the CI wait to 10s, matching the existing `customTypeError.test.ts` mitigation, so the 4000ms interval reliably fires at least once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Enable Node's on-disk V8 compile cache (
NODE_COMPILE_CACHE) for the three test jobs (test,test-egg-bin,test-egg-scripts) and persist it withactions/cache:env.NODE_COMPILE_CACHE: ${{ runner.temp }}/node-compile-cacheso the value is inherited by vitest workers and any forked child processes, not just the top-level process.Cache Node compile cachestep (pinnedactions/cache@0057852…# v4, the same pin already used for the utoo store) keyednode-compile-cache-${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('pnpm-workspace.yaml', '**/package.json') }}with graduatedrestore-keys, so the cache survives within a run (shared across processes) and across runs.typecheckis intentionally excluded — it runstsgo/oxlint/tsdown(Rust), not Node module execution, so there is nothing for the V8 compile cache to help.Safety: Node validates each cache entry by source hash + Node version, so a stale restored entry is simply ignored (cache miss → recompile + rewrite). The change is low-risk and fully reversible.
Honest measurement (please validate on CI before marking ready)
Opened as draft because the local benefit I could measure is ~0 and the CI/Windows benefit is unverified:
egg-bin testrun, which populates 1346 cache files / 7.7 MB) showed no measurable speedup — warm-cache runs landed inside the no-cache noise band (20.3–22.4s), and were marginally slower due toflushCompileCachewrite overhead on exit.transform 1.51s+import 1.56sof a 2.9s run), plus process spawn — and the compile cache only caches the V8 compilation of already-transpiled JS, not the transform itself.How to validate: compare the test-job step durations run-over-run (the existing
Report parallelism metricsjob already surfaces CI timing), and/or check cache hit-rate in the Actions cache UI. Keep if it helps a platform; drop the env+step if not.Scope note
This does not touch
tools/egg-bin/test/coffee.ts, which forks the egg-bin CLI ~109× with a freshly-builtenvthat does not passNODE_COMPILE_CACHEthrough — so the compile cache does not currently reach those forks. That (and the Windowstest-egg-binslowdown generally) is being investigated separately on a Windows machine and is out of scope for this PR.🤖 Generated with Claude Code
Summary by CodeRabbit