test(benchmarks): profile unmodified React Link bundles - #8323
test(benchmarks): profile unmodified React Link bundles#8323schiller-manuel wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe stable link-performance runner now uses a shared cache-based staging helper. A new worker test verifies that emitted JavaScript is not retranspiled by SWC. The README documents the staging location and loader behavior. ChangesLink-performance staging
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This benchmark-only change adds cache-backed staging and worker-loading coverage without changing production behavior, so it is ready to merge with normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 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 |
231787b to
dfc59a2
Compare
|
View your CI Pipeline Execution ↗ for commit 9b957f3
☁️ Nx Cloud last updated this comment at |
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
🚀 Changeset Version Preview7 package(s) bumped directly, 22 bumped as dependents. 🟩 Patch bumps
|
dfc59a2 to
ee7de43
Compare
c019c22 to
fd0c7f2
Compare
fd0c7f2 to
95e18fe
Compare
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:
We converted the static import { createClientScenario, createSsrScenario } in stable-worker.ts to dynamic imports deferred until after the bundle is successfully loaded. This fixes the worker crash caused by @swc-node/register's ESM resolver failing to find @tanstack/history (transitively required by ./scenario) at worker startup when forked with the workspace root as cwd. Because the new test's fake bundle throws on import, the ./scenario dynamic import is never reached, allowing the worker to start cleanly and return the expected error response.
Tip
✅ We verified this fix by re-running @benchmarks/react-link-performance:test:unit.
diff --git a/benchmarks/client-nav/link-performance/stable-worker.ts b/benchmarks/client-nav/link-performance/stable-worker.ts
index d98679dc..a8e32386 100644
--- a/benchmarks/client-nav/link-performance/stable-worker.ts
+++ b/benchmarks/client-nav/link-performance/stable-worker.ts
@@ -1,5 +1,4 @@
import { pathToFileURL } from 'node:url'
-import { createClientScenario, createSsrScenario } from './scenario'
import type { LinkScenario } from './scenario'
import type { WorkerRequest, WorkerResponse } from './worker-protocol'
import type * as ClientApp from './src/client'
@@ -36,12 +35,14 @@ async function handle(request: WorkerRequest) {
if (app.serverEnvironment !== false) {
throw new Error('Expected a production client bundle')
}
+ const { createClientScenario } = await import('./scenario')
scenario = createClientScenario(app, request.caseId)
} else {
const app: typeof SsrApp = await import(bundleUrl.href)
if (app.serverEnvironment !== true) {
throw new Error('Expected a production SSR bundle')
}
+ const { createSsrScenario } = await import('./scenario')
scenario = createSsrScenario(app, request.caseId)
}
scenarios[request.variant] = scenario
Or Apply changes locally with:
npx nx-cloud apply-locally dPaJ-U327
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
Keep comparison snapshots in SWC's existing node_modules exclusion so emitted JavaScript is not retranspiled and source-map positions remain valid. Preserve asynchronous ESM loading and add a failing-before source-integrity regression. Four-replica identical-bundle calibration: client shared-params CPU +0.92% [-4.14%, +6.24%], wall +1.03% [-4.55%, +6.93%]; SSR CPU +0.17% [-6.32%, +7.11%], wall +0.15% [-6.44%, +7.21%]. Intervals include zero; no speedup is claimed. Production code is unchanged; baseline React Router gzip is 85797/89379 bytes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
95e18fe to
9b957f3
Compare
🎯 Changes
Add staging support that measures unmodified React Link bundles and verifies stable worker behavior.
This is PR 8 of a stacked series and is based on
optimize-link-vue-subscriptions.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit
Documentation
Tests
Refactor