Skip to content

ci: omit unchanged bundle size scenarios#7856

Merged
schiller-manuel merged 1 commit into
mainfrom
ci-bundlesize
Jul 19, 2026
Merged

ci: omit unchanged bundle size scenarios#7856
schiller-manuel merged 1 commit into
mainfrom
ci-bundlesize

Conversation

@schiller-manuel

@schiller-manuel schiller-manuel commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Bundle-size benchmark reports now distinguish between unchanged scenarios, changed scenarios, and scenarios without baseline data.
    • Reports clearly indicate when changes do not affect bundle size or when no scenarios were measured.
    • Missing baseline comparisons are displayed with an “n/a” value while retaining relevant scenario results.
  • Tests

    • Added automated coverage for unchanged results, baseline comparisons, and missing baseline data.

@schiller-manuel
schiller-manuel requested a review from a team as a code owner July 19, 2026 10:09
@nx-cloud

nx-cloud Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit bceaf8c

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 35s View ↗
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 4m 39s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-19 10:17:40 UTC

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The bundle-size PR report now omits unchanged metrics, handles missing baselines and empty measurements, and adds Node unit tests with Nx task wiring.

Changes

Bundle-size reporting

Layer / File(s) Summary
Report filtering and rendering
scripts/benchmarks/bundle-size/pr-report.mjs
Unchanged baseline metrics are excluded, missing baselines are tracked, and Markdown output covers unchanged, unmeasured, changed, and missing-baseline scenarios.
Report tests and Nx execution
scripts/benchmarks/bundle-size/pr-report.test.mjs, benchmarks/bundle-size/package.json
Adds fixture-based tests for the report cases and exposes them through a Node test script and Nx test:unit target.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: omitting unchanged bundle size scenarios from CI benchmark reports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci-bundlesize

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

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 6 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/router-plugin 1.168.22 → 1.168.23 Changeset
@tanstack/react-start 1.168.31 → 1.168.32 Dependent
@tanstack/react-start-rsc 0.1.30 → 0.1.31 Dependent
@tanstack/router-vite-plugin 1.167.22 → 1.167.23 Dependent
@tanstack/solid-start 1.168.31 → 1.168.32 Dependent
@tanstack/start-plugin-core 1.171.23 → 1.171.24 Dependent
@tanstack/vue-start 1.168.30 → 1.168.31 Dependent

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/benchmarks/bundle-size/pr-report.test.mjs (1)

72-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Good coverage for filtering scenarios; missing test for the empty-metrics branch.

Tests correctly validate the unchanged/changed/no-baseline scenarios. However, the metrics.length === 0 branch ('No bundle-size scenarios were measured.' in pr-report.mjs) isn't exercised by any test, despite being part of the reworked conditional in this PR.

✅ Suggested additional test
test('renders a placeholder message when no scenarios were measured', async () => {
  const current = currentJson([])
  const report = await generateReport({ current })

  assert.equal(
    report,
    '<!-- bundle-size-benchmark -->\n## Bundle Size Benchmarks\n\nNo bundle-size scenarios were measured.\n',
  )
})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/benchmarks/bundle-size/pr-report.test.mjs` around lines 72 - 131, Add
a test in pr-report.test.mjs covering generateReport with currentJson([]) and no
baseline, asserting the exact placeholder output “No bundle-size scenarios were
measured.” and the existing report header.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/benchmarks/bundle-size/pr-report.mjs`:
- Around line 271-280: Update the skip condition in the metrics loop to compare
every displayed metric value—raw, gzip, brotli, and initial—against the
corresponding baseline data, so a row is skipped only when all measured values
are unchanged. Preserve the existing row-generation behavior for any metric with
a change.

---

Nitpick comments:
In `@scripts/benchmarks/bundle-size/pr-report.test.mjs`:
- Around line 72-131: Add a test in pr-report.test.mjs covering generateReport
with currentJson([]) and no baseline, asserting the exact placeholder output “No
bundle-size scenarios were measured.” and the existing report header.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eb168601-89ae-4450-9cbf-367f523db217

📥 Commits

Reviewing files that changed from the base of the PR and between 49f6863 and bceaf8c.

📒 Files selected for processing (3)
  • benchmarks/bundle-size/package.json
  • scripts/benchmarks/bundle-size/pr-report.mjs
  • scripts/benchmarks/bundle-size/pr-report.test.mjs

Comment on lines +271 to +280
const metrics = current.metrics || []
const rows = []

for (const metric of current.metrics || []) {
for (const metric of metrics) {
const baselineValue = baseline.benchesByName.get(metric.id)

if (Number.isFinite(baselineValue) && metric.gzipBytes === baselineValue) {
continue
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the file structure first, then inspect the relevant slice.
ast-grep outline scripts/benchmarks/bundle-size/pr-report.mjs --view expanded || true

echo '--- relevant lines ---'
sed -n '240,340p' scripts/benchmarks/bundle-size/pr-report.mjs

Repository: TanStack/router

Length of output: 4428


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect how baseline and rows are constructed, and where the "does not affect bundle size" message is emitted.
rg -n "benchesByName|get\\(|rawBytes|brotliBytes|initialGzipBytes|does not affect bundle size|metric\\.gzipBytes|baselineValue" scripts/benchmarks/bundle-size/pr-report.mjs

Repository: TanStack/router

Length of output: 1198


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,240p' scripts/benchmarks/bundle-size/pr-report.mjs

Repository: TanStack/router

Length of output: 6049


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('scripts/benchmarks/bundle-size/pr-report.mjs')
text = p.read_text()
for needle in [
    'metric.gzipBytes === baselineValue',
    'does not affect bundle size',
    'rawBytes',
    'brotliBytes',
    'initialGzipBytes',
]:
    print(f'-- {needle} --')
    for i, line in enumerate(text.splitlines(), 1):
        if needle in line:
            print(f'{i}: {line}')
PY

Repository: TanStack/router

Length of output: 572


Rows can disappear when only non-gzip metrics change scripts/benchmarks/bundle-size/pr-report.mjs:271-280

The skip check only compares metric.gzipBytes to the baseline. Since the table also shows raw, brotli, and initial, a PR can report “does not affect bundle size in any measured scenario” even when those displayed values changed. Consider including them in the change check, or remove them if gzip is the only signal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/benchmarks/bundle-size/pr-report.mjs` around lines 271 - 280, Update
the skip condition in the metrics loop to compare every displayed metric
value—raw, gzip, brotli, and initial—against the corresponding baseline data, so
a row is skipped only when all measured values are unchanged. Preserve the
existing row-generation behavior for any metric with a change.

@pkg-pr-new

pkg-pr-new Bot commented Jul 19, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7856

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7856

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7856

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7856

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7856

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7856

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7856

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7856

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7856

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7856

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7856

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7856

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7856

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7856

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7856

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7856

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7856

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7856

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7856

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7856

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7856

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7856

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7856

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7856

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7856

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7856

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7856

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7856

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7856

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7856

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7856

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7856

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7856

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7856

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7856

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7856

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7856

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7856

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7856

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7856

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7856

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7856

commit: bceaf8c

@codspeed-hq

codspeed-hq Bot commented Jul 19, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 7 improved benchmarks
❌ 1 regressed benchmark
✅ 172 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server server-fn-churn (react) 270.9 KB 281.8 KB -3.85%
Memory mem server peak-large-page (react) 1,841 KB 955.1 KB +92.77%
Memory mem server error-paths not-found (vue) 626.3 KB 380 KB +64.83%
Memory mem server serialization-payload (react) 5.3 MB 3.4 MB +53.9%
Memory mem server streaming-peak chunked (vue) 13.6 MB 11.1 MB +22.5%
Simulation client-route-tree-scale navigation loop (react) 77.1 ms 74.1 ms +4.05%
Memory mem server error-paths unmatched (react) 274.9 KB 264.4 KB +3.96%
Memory mem server error-paths not-found (react) 277.2 KB 266.8 KB +3.9%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ci-bundlesize (bceaf8c) with main (49f6863)

Open in CodSpeed

@schiller-manuel
schiller-manuel merged commit edf5575 into main Jul 19, 2026
25 of 26 checks passed
@schiller-manuel
schiller-manuel deleted the ci-bundlesize branch July 19, 2026 20:34
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