Skip to content

ci: bench infrastructure and combined size + perf PR report - #793

Merged
harlan-zw merged 9 commits into
mainfrom
ci/schema-org-bundle-size
Jun 27, 2026
Merged

harlan-zw merged 9 commits into
mainfrom
ci/schema-org-bundle-size

Conversation

@harlan-zw

@harlan-zw harlan-zw commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Bench infrastructure and CI reporting: a single PR comment that tracks bundle size and performance for every PR, so size and perf regressions are caught the same way across core, Vue, React and Schema.org.

Self-contained (sources + workflows). Because GitHub does not run pull_request CI on a branch that edits workflow files, this PR intentionally carries the workflow changes; its own bundle-size run is degraded for that reason, which is expected.

Bundle tracking

  • Manifest-driven (bench/bundle/bundles.ts): one list of { id, name, category, dist path } that the analyzer and the last.json writer both iterate, so adding a bundle is one entry.
  • Tracks 12 bundles: Core, Vue and React each get a Minimal (useHead floor) and, where it matters, a Full profile (useHead + useSeoMeta + useScript). Full is the only profile that catches growth in useSeoMeta / useScript / plugins, since those tree-shake out of a useHead-only entry. Plus the Schema.org client surfaces.
  • Each profile is a standalone single-entry build so rollup doesn't code-split the shared core into a chunk the analyzer would miss.
  • CI diffs the PR dist against a snapshot of the base-branch dist (BASE_DIST) instead of per-bundle file copies.

Combined PR comment

  • Verdict line first, then only the bundles/benches that moved; the full breakdown is collapsed in <details>.
  • A missing baseline (the base ref predates a bundle) reads as 🆕 new, never a red regression. Sub-100-byte gz deltas render in bytes so they don't collapse to 0 kB.
  • Footer pins the baseline ref + commit + date; last.json on main stays the longitudinal record.

Performance (directional)

  • bench/perf-ci.mjs runs on the base and PR builds on the same runner (variance cancels) and prints JSON: SSR render wall-time (mean ms + 95% margin of error) and retained heap.
  • A change is surfaced only past a gate: time |Δ| > max(10%, 2×RME); memory |Δ| > 512 KiB. Otherwise it reads "no significant change". Informational and non-blocking, never a required check.
  • The memory harness (bench/memory/ssr.mjs) and the SSR e2e bench tweaks live here too, consolidating all bench + CI-reporting infra in one place (this is why perf: optimize SSR hot paths #794 is now purely src/ changes; the two no longer depend on each other).

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds Schema.org bundle-size coverage, shared bundle reporting and update tooling, new benchmark entrypoints and build configs, SSR memory benchmarks, and related CI/workflow updates.

Changes

Bundle tooling, benchmarks, and CI

Layer / File(s) Summary
Bundle reporting plumbing
bench/bundle/*
The bundle metadata list, report generator, analyzer wrapper, update script, and baseline JSON now read and compare bundle artifacts through shared bundle metadata.
Schema.org bundle entries
bench/bundle/schema-org-build.config.ts, bench/bundle/src/schema-org/*
The Schema.org benchmark config now builds imports and vue-meta entries, and the new entry modules export derived counts and resolver metadata.
Benchmark entries and configs
bench/bundle/*client*, bench/bundle/*react*, bench/bundle/*vue*
The client, React, and Vue benchmark entry files and build configs now cover minimal and full bundle variants, alias package outputs to local dist files, and log raw and gzipped bundle sizes after builds.
Memory benchmark helpers
bench/utils/perf.ts, bench/memory/ssr.mjs, bench/ssr-memory.test.ts, eslint.config.js
The shared perf helpers, SSR memory benchmark, Vitest memory test, and ESLint ignore rule add memory sampling, GC forcing, SSR head rendering loops, heap delta checks, and benchmark file ignores.
SSR hook cleanup
bench/ssr-harlanzw-com-e2e.bench.ts, bench/ssr-harlanzw-no-schema-e2e.bench.ts, packages/vue/test/bench/ssr-harlanzw-no-schema-e2e.bench.ts
The SSR bench hook handlers in the e2e benches are changed from async callbacks to synchronous callbacks.
CI and scripts
package.json, .github/workflows/bundle-size.yml, .github/workflows/write-bundle-size.yml
The bundle-size scripts and workflows add Schema.org and React bundle-size checks, pin Bun setup, and change the PR comment payload to use the analyzer output directly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I hopped through bundles, light and small,
Then measured mem and sizes all.
Schema blooms and scripts now sing,
With Bun pinned tight on orderly spring.
🐇📦

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title is concise and accurately summarizes the bench infrastructure and combined bundle-size/perf reporting changes.
Description check ✅ Passed The description covers the required type of change and detailed description sections, with only the linked issue section omitted.
✨ 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/schema-org-bundle-size

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.

❤️ Share

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

harlan-zw added a commit that referenced this pull request Jun 27, 2026
Keeps this PR focused on SSR hot-path optimizations and the memory harness.
The schema-org bench sources and bundle-size script move to #793, which also
carries the matching workflow steps.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bench/bundle/analyze.ts (1)

106-165: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Don’t silently hide the new CI rows when the extra base args are missing.

The workflow contract shown in .github/workflows/bundle-size.yml:59-75 still passes only one Schema.org base file, so args[5] and args[6] stay undefined here. That makes Lines 148-165 skip both new Schema.org rows entirely in CI, which means the PR comment still won’t report the new bundles.

Suggested fix
-  const baseSchemaOrg = args[4] && schemaOrg ? fs.readFileSync(args[4]) : null
-  const baseSchemaOrgImports = args[5] && schemaOrgImports ? fs.readFileSync(args[5]) : null
-  const baseSchemaOrgVueMeta = args[6] && schemaOrgVueMeta ? fs.readFileSync(args[6]) : null
+  const baseSchemaOrg = args[4] && schemaOrg ? fs.readFileSync(args[4]) : null
+  const baseSchemaOrgImports = args[5] && schemaOrgImports ? fs.readFileSync(args[5]) : null
+  const baseSchemaOrgVueMeta = args[6] && schemaOrgVueMeta ? fs.readFileSync(args[6]) : null
...
-    ...(schemaOrgImports && baseSchemaOrgImports
+    ...(schemaOrgImports
       ? [{
           name: 'Schema.org Imports',
           size: schemaOrgImports.length,
           gzippedSize: zlib.gzipSync(schemaOrgImports).length,
-          baseSize: baseSchemaOrgImports.length,
-          baseGzippedSize: zlib.gzipSync(baseSchemaOrgImports).length,
+          baseSize: baseSchemaOrgImports?.length ?? 0,
+          baseGzippedSize: baseSchemaOrgImports ? zlib.gzipSync(baseSchemaOrgImports).length : 0,
         }]
       : []),
-    ...(schemaOrgVueMeta && baseSchemaOrgVueMeta
+    ...(schemaOrgVueMeta
       ? [{
           name: 'Schema.org Vue Meta',
           size: schemaOrgVueMeta.length,
           gzippedSize: zlib.gzipSync(schemaOrgVueMeta).length,
-          baseSize: baseSchemaOrgVueMeta.length,
-          baseGzippedSize: zlib.gzipSync(baseSchemaOrgVueMeta).length,
+          baseSize: baseSchemaOrgVueMeta?.length ?? 0,
+          baseGzippedSize: baseSchemaOrgVueMeta ? zlib.gzipSync(baseSchemaOrgVueMeta).length : 0,
         }]
       : []),
🤖 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 `@bench/bundle/analyze.ts` around lines 106 - 165, The new Schema.org bundle
rows are being skipped when only the first base file is passed, so update the
row-building logic in analyze.ts to still emit the Schema.org-related entries
even when args[5] and args[6] are missing. Use the existing symbols
baseSchemaOrg, baseSchemaOrgImports, baseSchemaOrgVueMeta, schemaOrg,
schemaOrgImports, and schemaOrgVueMeta to locate the conditional spread blocks,
and change them so CI reports the new rows instead of hiding them when extra
baseline inputs are undefined.
🤖 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 @.github/workflows/bundle-size.yml:
- Line 57: The workflow step using oven-sh/setup-bun is still pinned to the
mutable v2 tag instead of a full commit SHA. Update the bundle-size workflow to
reference the specific commit hash for setup-bun so the action is fully pinned
and consistent with the repo’s pinning policy.
- Around line 41-46: The bundle-size workflow step is not resilient on the first
PR that introduces schema-org bundle size testing, because after checkout to the
base ref the new test script and build config are missing. Update the workflow
logic around the pnpm test:schema-org-bundle-size invocation and the cp for
bench/bundle/dist/schema-org/schema-org/minimal.mjs so the base-branch run skips
or tolerates missing schema-org artifacts, while still producing the other
baseline files needed by the later analyze step.

---

Outside diff comments:
In `@bench/bundle/analyze.ts`:
- Around line 106-165: The new Schema.org bundle rows are being skipped when
only the first base file is passed, so update the row-building logic in
analyze.ts to still emit the Schema.org-related entries even when args[5] and
args[6] are missing. Use the existing symbols baseSchemaOrg,
baseSchemaOrgImports, baseSchemaOrgVueMeta, schemaOrg, schemaOrgImports, and
schemaOrgVueMeta to locate the conditional spread blocks, and change them so CI
reports the new rows instead of hiding them when extra baseline inputs are
undefined.
🪄 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: bdc8f120-6fca-447a-9696-0d3cc24e4e44

📥 Commits

Reviewing files that changed from the base of the PR and between ba1d574 and 53b76c6.

📒 Files selected for processing (9)
  • .github/workflows/bundle-size.yml
  • .github/workflows/write-bundle-size.yml
  • bench/bundle/analyze.ts
  • bench/bundle/last.json
  • bench/bundle/schema-org-build.config.ts
  • bench/bundle/src/schema-org/imports.ts
  • bench/bundle/src/schema-org/vue-meta.ts
  • bench/bundle/update.ts
  • package.json

Comment thread .github/workflows/bundle-size.yml Resolved
Comment thread .github/workflows/bundle-size.yml Resolved
Tracks the schema-org client bundle (minimal, imports, vue-meta) in the
bundle-size analyzer and stats writer so the schema-org surface is reported
alongside core and Vue. Pairs with the workflow steps already in this PR.
- analyze.ts: always emit the schema-org rows when the PR builds those bundles,
  falling back to a 0 baseline when the base ref lacks them (read base files
  defensively instead of throwing on a missing path)
- bundle-size.yml: tolerate a base ref that predates the schema-org build config,
  pass the imports/vue-meta baselines, and pin setup-bun to a commit SHA
@harlan-zw
harlan-zw force-pushed the ci/schema-org-bundle-size branch from 53b76c6 to 42f3f79 Compare June 27, 2026 01:25
@harlan-zw

Copy link
Copy Markdown
Collaborator Author

Addressed the review:

  • analyze.ts (Major): the Schema.org rows now render whenever the PR builds those bundles, with the baseline falling back to 0 when the base ref predates them (base files are read via fs.existsSync instead of throwing on a missing path). Imports/Vue Meta no longer get hidden when only the minimal baseline is passed.
  • bundle-size.yml (base resilience): the base-branch run now tolerates a ref without the schema-org build config (|| true on the build + conditional cp), and passes the imports/vue-meta baselines to the analyzer so all three rows get a real diff once a baseline exists.
  • setup-bun pin: pinned to 0c5077e (v2) to match the repo's SHA-pinning policy.

Also rebased onto main to clear the last.json conflict (kept main's updated vueServer baseline, re-added the schema-org keys).

@github-actions

github-actions Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size

✅ No notable changes · 🆕 8 new bundles tracked

All bundles (12)
Bundle Gzipped Raw
Core
Client (Minimal) 4.6 kB 11.2 kB ✅
Client (Full) 7.8 kB 20 kB 🆕
Server (Minimal) 4.4 kB 10.8 kB ✅
Vue
Vue Client (Minimal) 5.1 kB 12.3 kB ✅
Vue Client (Full) 8.6 kB 21.9 kB 🆕
Vue Server (Minimal) 4.9 kB 11.8 kB ✅
React
React Client (Minimal) 5 kB 12.2 kB 🆕
React Client (Full) 8.4 kB 21.5 kB 🆕
React Server (Minimal) 4.7 kB 11.4 kB 🆕
Schema.org
Schema.org (Minimal) 9.4 kB 25.7 kB 🆕
Schema.org Imports 0.1 kB 0.1 kB 🆕
Schema.org Vue Meta 0.4 kB 0.8 kB 🆕

⚡ Performance (directional)

✅ No significant change (within CI noise)

All benchmarks (2)
Benchmark PR Δ RME
SSR render (medium) 0.345 ms ~ noise ±5.9%
SSR heap retained -129.5 KiB ~ noise —

Baseline: main @ 8221da7 · 2026-06-26 · gzipped is the headline size metric · perf is directional (shared-runner, gated)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 @.github/workflows/bundle-size.yml:
- Around line 41-50: The bundle-size workflow currently masks real schema-org
baseline failures by using unconditional fallbacks in the base build step.
Update the logic around the `pnpm test:schema-org-bundle-size` and the
subsequent `cp` commands in the bundle-size job so the zero-baseline fallback is
only used when the schema-org bundle config is actually missing, not when the
base branch build or copy step genuinely fails. Keep failures from
`bench/bundle/analyze.ts`-relevant artifact generation fatal for existing
schema-org bundles, and only allow the missing-config case to continue.
🪄 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: 5bd8fd22-23d4-4dff-8763-857b46a8d841

📥 Commits

Reviewing files that changed from the base of the PR and between 53b76c6 and 42f3f79.

📒 Files selected for processing (9)
  • .github/workflows/bundle-size.yml
  • .github/workflows/write-bundle-size.yml
  • bench/bundle/analyze.ts
  • bench/bundle/last.json
  • bench/bundle/schema-org-build.config.ts
  • bench/bundle/src/schema-org/imports.ts
  • bench/bundle/src/schema-org/vue-meta.ts
  • bench/bundle/update.ts
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • bench/bundle/last.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • bench/bundle/src/schema-org/vue-meta.ts
  • package.json
  • .github/workflows/write-bundle-size.yml
  • bench/bundle/src/schema-org/imports.ts

Comment thread .github/workflows/bundle-size.yml Outdated
Comment on lines +41 to +50
# base ref may predate the schema-org bundle config; tolerate its absence so the
# other baselines are still produced and the new rows show as a fresh bundle
pnpm test:schema-org-bundle-size || true
cp bench/bundle/dist/client/client/minimal.mjs /tmp/base-client.mjs
cp bench/bundle/dist/server/server/minimal.mjs /tmp/base-server.mjs
cp bench/bundle/dist/vue-server/vue-server/minimal.mjs /tmp/base-vue-server.mjs
cp bench/bundle/dist/vue-client/vue-client/minimal.mjs /tmp/base-vue-client.mjs
cp bench/bundle/dist/schema-org/schema-org/minimal.mjs /tmp/base-schema-org.mjs || true
cp bench/bundle/dist/schema-org/schema-org/imports.mjs /tmp/base-schema-org-imports.mjs || true
cp bench/bundle/dist/schema-org/schema-org/vue-meta.mjs /tmp/base-schema-org-vue-meta.mjs || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Don't swallow real base-branch schema-org failures.

This fixes the introductory PR case, but the unconditional || true also hides genuine baseline breakages after this workflow exists on the base branch. In that case bench/bundle/analyze.ts falls back to a zero baseline, so CI reports a “new” schema-org bundle instead of failing on the broken base build. Gate the fallback on the schema-org config actually being absent, and keep real build/copy failures fatal.

Suggested change
-          pnpm test:schema-org-bundle-size || true
+          if [ -f bench/bundle/schema-org-build.config.ts ]; then
+            pnpm test:schema-org-bundle-size
+            cp bench/bundle/dist/schema-org/schema-org/minimal.mjs /tmp/base-schema-org.mjs
+            cp bench/bundle/dist/schema-org/schema-org/imports.mjs /tmp/base-schema-org-imports.mjs
+            cp bench/bundle/dist/schema-org/schema-org/vue-meta.mjs /tmp/base-schema-org-vue-meta.mjs
+          fi
           cp bench/bundle/dist/client/client/minimal.mjs /tmp/base-client.mjs
           cp bench/bundle/dist/server/server/minimal.mjs /tmp/base-server.mjs
           cp bench/bundle/dist/vue-server/vue-server/minimal.mjs /tmp/base-vue-server.mjs
           cp bench/bundle/dist/vue-client/vue-client/minimal.mjs /tmp/base-vue-client.mjs
-          cp bench/bundle/dist/schema-org/schema-org/minimal.mjs /tmp/base-schema-org.mjs || true
-          cp bench/bundle/dist/schema-org/schema-org/imports.mjs /tmp/base-schema-org-imports.mjs || true
-          cp bench/bundle/dist/schema-org/schema-org/vue-meta.mjs /tmp/base-schema-org-vue-meta.mjs || true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# base ref may predate the schema-org bundle config; tolerate its absence so the
# other baselines are still produced and the new rows show as a fresh bundle
pnpm test:schema-org-bundle-size || true
cp bench/bundle/dist/client/client/minimal.mjs /tmp/base-client.mjs
cp bench/bundle/dist/server/server/minimal.mjs /tmp/base-server.mjs
cp bench/bundle/dist/vue-server/vue-server/minimal.mjs /tmp/base-vue-server.mjs
cp bench/bundle/dist/vue-client/vue-client/minimal.mjs /tmp/base-vue-client.mjs
cp bench/bundle/dist/schema-org/schema-org/minimal.mjs /tmp/base-schema-org.mjs || true
cp bench/bundle/dist/schema-org/schema-org/imports.mjs /tmp/base-schema-org-imports.mjs || true
cp bench/bundle/dist/schema-org/schema-org/vue-meta.mjs /tmp/base-schema-org-vue-meta.mjs || true
# base ref may predate the schema-org bundle config; tolerate its absence so the
# other baselines are still produced and the new rows show as a fresh bundle
if [ -f bench/bundle/schema-org-build.config.ts ]; then
pnpm test:schema-org-bundle-size
cp bench/bundle/dist/schema-org/schema-org/minimal.mjs /tmp/base-schema-org.mjs
cp bench/bundle/dist/schema-org/schema-org/imports.mjs /tmp/base-schema-org-imports.mjs
cp bench/bundle/dist/schema-org/schema-org/vue-meta.mjs /tmp/base-schema-org-vue-meta.mjs
fi
cp bench/bundle/dist/client/client/minimal.mjs /tmp/base-client.mjs
cp bench/bundle/dist/server/server/minimal.mjs /tmp/base-server.mjs
cp bench/bundle/dist/vue-server/vue-server/minimal.mjs /tmp/base-vue-server.mjs
cp bench/bundle/dist/vue-client/vue-client/minimal.mjs /tmp/base-vue-client.mjs
🤖 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 @.github/workflows/bundle-size.yml around lines 41 - 50, The bundle-size
workflow currently masks real schema-org baseline failures by using
unconditional fallbacks in the base build step. Update the logic around the
`pnpm test:schema-org-bundle-size` and the subsequent `cp` commands in the
bundle-size job so the zero-baseline fallback is only used when the schema-org
bundle config is actually missing, not when the base branch build or copy step
genuinely fails. Keep failures from `bench/bundle/analyze.ts`-relevant artifact
generation fatal for existing schema-org bundles, and only allow the
missing-config case to continue.

- verdict line up top (grew / smaller / no notable changes + new-bundle count)
- only changed bundles surface in a top table; full per-category breakdown is
  collapsed in a <details>
- a missing baseline now reads as a 🆕 new bundle instead of a red +X regression
- sub-100-byte gz deltas render in bytes so they don't collapse to '0 kB'
- footer shows the baseline ref + commit + date for cross-PR context
- noise floor (16 B gz) keeps minifier jitter from showing as a change
Comment thread bench/bundle/analyze.ts Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
bench/bundle/analyze.ts (2)

242-260: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the same zero-baseline fallback in local mode.

The local Schema.org Imports / Vue Meta rows are still gated on last.json keys, so the first bun bench/bundle/analyze.ts run after adding those bundles hides them instead of marking them new. statusOf() already supports a zero baseline, so local mode should default missing last.schemaOrg* entries to 0 as well.

Suggested fix
-...(schemaOrgImports && last.schemaOrgImports
+...(schemaOrgImports
   ? [{
       name: 'Schema.org Imports',
       size: schemaOrgImports.length,
       gzippedSize: zlib.gzipSync(schemaOrgImports).length,
-      baseSize: last.schemaOrgImports.size,
-      baseGzippedSize: last.schemaOrgImports.gz,
+      baseSize: last.schemaOrgImports?.size ?? 0,
+      baseGzippedSize: last.schemaOrgImports?.gz ?? 0,
     }]
   : []),

Apply the same pattern to schemaOrgVueMeta.

🤖 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 `@bench/bundle/analyze.ts` around lines 242 - 260, The local Schema.org bundle
rows are incorrectly hidden when the baseline file has no matching entry,
instead of showing them as new. Update the logic in analyze.ts where the
`Schema.org Imports` row is built (and apply the same pattern to
`schemaOrgVueMeta`) so local mode falls back to a zero baseline when
`lastStats.schemaOrgImports` or `lastStats.schemaOrgVueMeta` is missing,
matching the behavior already supported by `statusOf()`.

123-131: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fail when a tracked current Schema.org bundle is missing.

These reads make the current PR artifacts optional, so if test:schema-org-bundle-size stops emitting imports.mjs or vue-meta.mjs, the CI comment just drops that row instead of surfacing the regression. The base files should stay optional; the current build outputs should not.

Suggested fix
+function readCurrent(file: string) {
+  return fs.readFileSync(path.resolve(__dirname, file))
+}
+
-const schemaOrg = fs.existsSync(path.resolve(__dirname, 'dist/schema-org/schema-org/minimal.mjs'))
-  ? fs.readFileSync(path.resolve(__dirname, 'dist/schema-org/schema-org/minimal.mjs'))
-  : null
+const schemaOrg = readCurrent('dist/schema-org/schema-org/minimal.mjs')
+const schemaOrgImports = readCurrent('dist/schema-org/schema-org/imports.mjs')
+const schemaOrgVueMeta = readCurrent('dist/schema-org/schema-org/vue-meta.mjs')
🤖 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 `@bench/bundle/analyze.ts` around lines 123 - 131, The current Schema.org
bundle reads in analyze.ts are treating PR artifacts as optional, which can hide
regressions when tracked outputs disappear. Update the schemaOrgImports and
schemaOrgVueMeta handling so the current build outputs are required and the
script fails explicitly if those files are missing, while keeping the base
bundle reads optional. Use the existing analyze.ts schemaOrg file checks as the
location to enforce this behavior.
🤖 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 @.github/workflows/bundle-size.yml:
- Around line 65-67: The shell step that builds BASE_LABEL is interpolating
github.base_ref directly inside a quoted echo, which can break if the branch
name contains special characters. Update the workflow step to pass
github.base_ref through env and use printf when writing to GITHUB_ENV, keeping
the existing sha/date logic in the same step.

---

Outside diff comments:
In `@bench/bundle/analyze.ts`:
- Around line 242-260: The local Schema.org bundle rows are incorrectly hidden
when the baseline file has no matching entry, instead of showing them as new.
Update the logic in analyze.ts where the `Schema.org Imports` row is built (and
apply the same pattern to `schemaOrgVueMeta`) so local mode falls back to a zero
baseline when `lastStats.schemaOrgImports` or `lastStats.schemaOrgVueMeta` is
missing, matching the behavior already supported by `statusOf()`.
- Around line 123-131: The current Schema.org bundle reads in analyze.ts are
treating PR artifacts as optional, which can hide regressions when tracked
outputs disappear. Update the schemaOrgImports and schemaOrgVueMeta handling so
the current build outputs are required and the script fails explicitly if those
files are missing, while keeping the base bundle reads optional. Use the
existing analyze.ts schemaOrg file checks as the location to enforce this
behavior.
🪄 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: 54acd9bd-e1ec-4046-87e4-672cd38854f4

📥 Commits

Reviewing files that changed from the base of the PR and between 42f3f79 and 73363bd.

📒 Files selected for processing (2)
  • .github/workflows/bundle-size.yml
  • bench/bundle/analyze.ts

Comment on lines +65 to +67
sha=$(git rev-parse --short "${{ github.event.pull_request.base.sha }}")
date=$(git show -s --format=%cs "${{ github.event.pull_request.base.sha }}")
echo "BASE_LABEL=${{ github.base_ref }} @ $sha · $date" >> "$GITHUB_ENV"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant workflow section with line numbers.
sed -n '55,75p' .github/workflows/bundle-size.yml

# Probe Git refname rules for characters mentioned in the review comment.
python3 - <<'PY'
import subprocess, shlex

candidates = [
    "main",
    'feature"quote',
    "feature'single",
    "feature space",
    "feature:colon",
    "feature[bracket]",
    "feature\\backslash",
]

for ref in candidates:
    p = subprocess.run(
        ["git", "check-ref-format", "--branch", ref],
        text=True,
        capture_output=True,
    )
    print(f"{ref!r}: rc={p.returncode}")
    if p.stdout:
        print("  stdout:", p.stdout.strip())
    if p.stderr:
        print("  stderr:", p.stderr.strip())
PY

Repository: unjs/unhead

Length of output: 1578


Avoid interpolating github.base_ref directly in this shell step. A valid branch name can include ", which can break the quoted echo and corrupt the $GITHUB_ENV write. Pass it through env: and use printf instead.

🧰 Tools
🪛 zizmor (1.26.1)

[error] 67-67: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 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 @.github/workflows/bundle-size.yml around lines 65 - 67, The shell step that
builds BASE_LABEL is interpolating github.base_ref directly inside a quoted
echo, which can break if the branch name contains special characters. Update the
workflow step to pass github.base_ref through env and use printf when writing to
GITHUB_ENV, keeping the existing sha/date logic in the same step.

Source: Linters/SAST tools

…infra PR

Consolidates all benchmark + CI-reporting infrastructure here so the combined
size+perf report has its inputs in one place. The memory harness (ssr.mjs,
perf.ts, ssr-memory.test.ts), the e2e bench async->sync tweaks, and the
test:memory script move out of the src-only perf PR (#794).
harlan-zw added a commit that referenced this pull request Jun 27, 2026
Bench + CI-reporting infra (memory harness, e2e bench tweaks, test:memory)
moves to the bench infrastructure PR (#793) to avoid a circular dependency
between the two.
- bundles.ts: single source of truth (id, name, category, dist path) that
  analyze.ts and update.ts both iterate; adding a bundle is now one entry
- bundle-report.ts: pure collect + render module (no import-time side effects)
  so the combined report can reuse it; analyze.ts is a thin runner
- CI now diffs the PR dist against a full base-branch dist via BASE_DIST instead
  of per-bundle positional args
- add Full profiles (useHead + useSeoMeta + useScript) for core/vue/react as
  standalone single-entry builds, the only entry that catches useSeoMeta/useScript
  growth since the minimal floor tree-shakes them away
- add React client+server tracking to mirror Vue
- regenerate last.json baseline with all 12 bundles
- bundle-size.yml: build core/vue/react/schema-org for base and PR; snapshot the
  base dist to /tmp/base-dist and pass it via BASE_DIST (replaces per-bundle cp +
  positional args). Base build tolerates configs the base ref predates.
- write-bundle-size.yml: build react bundles before updating last.json; pin setup-bun

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
bench/bundle/react-client-build.config.ts (1)

21-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Factor the shared bundle-config boilerplate into a helper.

The unhead/* alias table and gzip-size reporter are now repeated across multiple bundle configs (bench/bundle/client-build.config.ts:32-45, bench/bundle/client-full-build.config.ts:13-33, and this file). Centralizing them would reduce drift the next time package entrypoints or reporting format change.

Also applies to: 48-53

🤖 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 `@bench/bundle/react-client-build.config.ts` around lines 21 - 31, The bundle
config still repeats the shared `unhead/*` alias entries and gzip-size reporter
setup, so move that boilerplate into a common helper and reuse it here and in
the other bundle config files. Update the `alias.entries` setup and the reporter
wiring in this config to call the shared helper instead of duplicating the
`unhead/client`, `unhead/server`, `unhead/plugins`, `unhead/scripts`,
`unhead/utils`, and `unhead` mappings and the gzip-size output formatting.
🤖 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 @.github/workflows/bundle-size.yml:
- Around line 39-48: The bundle-size workflow is swallowing failures for
established baseline jobs, so the snapshot step can proceed after a real
regression and hide missing baseline files. Update the bundle-size step in the
workflow to stop ignoring errors for the existing baselines by removing the
unconditional tolerance from `test:bundle-size` and `test:vue-bundle-size`,
while keeping conditional handling only for jobs that may not exist on the base
ref such as `test:react-bundle-size` and `test:schema-org-bundle-size`.

In `@bench/bundle/bundles.ts`:
- Around line 17-29: The tracked bundle entries in BUNDLES are still optional,
so missing outputs won’t fail the build. Update the BundleSpec definitions for
the tracked artifacts in the BUNDLES array to set required: true, matching the
behavior expected by collectBundleData() and update.ts so CI fails when a
tracked current artifact is not emitted.

In `@bench/bundle/src/react-client/full.ts`:
- Around line 8-31: The App component is returning the provider component itself
instead of rendering the hook usage inside it, so the Unhead hooks run without
provider context. Update App to wrap the existing useHead, useSeoMeta, and
useScript calls within <UnheadProvider> and return its rendered children, using
the App and UnheadProvider symbols to locate the fix.

In `@bench/memory/ssr.mjs`:
- Around line 68-99: The memory benchmark in measure() uses console.table, which
is being flagged by the repo console rule. Either exclude bench/memory/ssr.mjs
from the lint target or add a scoped local no-console disable around the
console.table call, keeping the change near measure() so the benchmark can still
print its results without failing eslint.

In `@bench/ssr-memory.test.ts`:
- Around line 59-65: The SSR memory benchmark test is using console.table
directly, which trips lint and blocks the suite from passing. Remove the
console.table call from the test and, if you still need local diagnostics, move
the output behind a debug-only path or switch it to the project’s approved
logger inside ssr-memory.test.ts.

---

Nitpick comments:
In `@bench/bundle/react-client-build.config.ts`:
- Around line 21-31: The bundle config still repeats the shared `unhead/*` alias
entries and gzip-size reporter setup, so move that boilerplate into a common
helper and reuse it here and in the other bundle config files. Update the
`alias.entries` setup and the reporter wiring in this config to call the shared
helper instead of duplicating the `unhead/client`, `unhead/server`,
`unhead/plugins`, `unhead/scripts`, `unhead/utils`, and `unhead` mappings and
the gzip-size output formatting.
🪄 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: ab32c795-a341-4b07-a846-4f2eaf4e533c

📥 Commits

Reviewing files that changed from the base of the PR and between 73363bd and 8b64844.

📒 Files selected for processing (27)
  • .github/workflows/bundle-size.yml
  • .github/workflows/write-bundle-size.yml
  • bench/bundle/analyze.ts
  • bench/bundle/bundle-report.ts
  • bench/bundle/bundles.ts
  • bench/bundle/client-build.config.ts
  • bench/bundle/client-full-build.config.ts
  • bench/bundle/last.json
  • bench/bundle/react-client-build.config.ts
  • bench/bundle/react-client-full-build.config.ts
  • bench/bundle/react-server-build.config.ts
  • bench/bundle/src/client/full.ts
  • bench/bundle/src/react-client/full.ts
  • bench/bundle/src/react-client/minimal.ts
  • bench/bundle/src/react-server/minimal.ts
  • bench/bundle/src/schema-org/vue-meta.ts
  • bench/bundle/src/vue-client/full.ts
  • bench/bundle/update.ts
  • bench/bundle/vue-client-build.config.ts
  • bench/bundle/vue-client-full-build.config.ts
  • bench/memory/ssr.mjs
  • bench/ssr-harlanzw-com-e2e.bench.ts
  • bench/ssr-harlanzw-no-schema-e2e.bench.ts
  • bench/ssr-memory.test.ts
  • bench/utils/perf.ts
  • package.json
  • packages/vue/test/bench/ssr-harlanzw-no-schema-e2e.bench.ts
💤 Files with no reviewable changes (2)
  • bench/bundle/client-build.config.ts
  • bench/bundle/vue-client-build.config.ts
✅ Files skipped from review due to trivial changes (1)
  • bench/bundle/last.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • bench/bundle/src/schema-org/vue-meta.ts
  • package.json

Comment on lines +39 to +48
# the base ref may predate some bundle configs (react, full, schema-org);
# tolerate their absence so the other baselines are still produced and the
# new bundles surface as fresh rather than failing the run
pnpm test:bundle-size || true
pnpm test:vue-bundle-size || true
pnpm test:react-bundle-size || true
pnpm test:schema-org-bundle-size || true
# snapshot the whole base dist; analyze.ts diffs PR dist against it by path
rm -rf /tmp/base-dist
cp -r bench/bundle/dist /tmp/base-dist

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Don't ignore failures for the established baseline jobs.

test:bundle-size and test:vue-bundle-size are existing baselines. With || true, this step still snapshots bench/bundle/dist into /tmp/base-dist after a real failure, and the analyzer then treats missing files as zero baselines instead of failing the regression check. Only jobs that may not exist on the base ref should be conditional.

Suggested change
-          pnpm test:bundle-size || true
-          pnpm test:vue-bundle-size || true
-          pnpm test:react-bundle-size || true
-          pnpm test:schema-org-bundle-size || true
+          pnpm test:bundle-size
+          pnpm test:vue-bundle-size
+          if [ -f bench/bundle/react-client-build.config.ts ]; then
+            pnpm test:react-bundle-size
+          fi
+          if [ -f bench/bundle/schema-org-build.config.ts ]; then
+            pnpm test:schema-org-bundle-size
+          fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# the base ref may predate some bundle configs (react, full, schema-org);
# tolerate their absence so the other baselines are still produced and the
# new bundles surface as fresh rather than failing the run
pnpm test:bundle-size || true
pnpm test:vue-bundle-size || true
pnpm test:react-bundle-size || true
pnpm test:schema-org-bundle-size || true
# snapshot the whole base dist; analyze.ts diffs PR dist against it by path
rm -rf /tmp/base-dist
cp -r bench/bundle/dist /tmp/base-dist
# the base ref may predate some bundle configs (react, full, schema-org);
# tolerate their absence so the other baselines are still produced and the
# new bundles surface as fresh rather than failing the run
pnpm test:bundle-size
pnpm test:vue-bundle-size
if [ -f bench/bundle/react-client-build.config.ts ]; then
pnpm test:react-bundle-size
fi
if [ -f bench/bundle/schema-org-build.config.ts ]; then
pnpm test:schema-org-bundle-size
fi
# snapshot the whole base dist; analyze.ts diffs PR dist against it by path
rm -rf /tmp/base-dist
cp -r bench/bundle/dist /tmp/base-dist
🤖 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 @.github/workflows/bundle-size.yml around lines 39 - 48, The bundle-size
workflow is swallowing failures for established baseline jobs, so the snapshot
step can proceed after a real regression and hide missing baseline files. Update
the bundle-size step in the workflow to stop ignoring errors for the existing
baselines by removing the unconditional tolerance from `test:bundle-size` and
`test:vue-bundle-size`, while keeping conditional handling only for jobs that
may not exist on the base ref such as `test:react-bundle-size` and
`test:schema-org-bundle-size`.

Comment thread bench/bundle/bundles.ts
Comment on lines +17 to +29
export const BUNDLES: BundleSpec[] = [
{ id: 'client', name: 'Client (Minimal)', category: 'Core', file: 'client/client/minimal.mjs', required: true },
{ id: 'clientFull', name: 'Client (Full)', category: 'Core', file: 'client-full/client/full.mjs' },
{ id: 'server', name: 'Server (Minimal)', category: 'Core', file: 'server/server/minimal.mjs', required: true },
{ id: 'vueClient', name: 'Vue Client (Minimal)', category: 'Vue', file: 'vue-client/vue-client/minimal.mjs', required: true },
{ id: 'vueClientFull', name: 'Vue Client (Full)', category: 'Vue', file: 'vue-client-full/vue-client/full.mjs' },
{ id: 'vueServer', name: 'Vue Server (Minimal)', category: 'Vue', file: 'vue-server/vue-server/minimal.mjs', required: true },
{ id: 'reactClient', name: 'React Client (Minimal)', category: 'React', file: 'react-client/react-client/minimal.mjs' },
{ id: 'reactClientFull', name: 'React Client (Full)', category: 'React', file: 'react-client-full/react-client/full.mjs' },
{ id: 'reactServer', name: 'React Server (Minimal)', category: 'React', file: 'react-server/react-server/minimal.mjs' },
{ id: 'schemaOrg', name: 'Schema.org (Minimal)', category: 'Schema.org', file: 'schema-org/schema-org/minimal.mjs' },
{ id: 'schemaOrgImports', name: 'Schema.org Imports', category: 'Schema.org', file: 'schema-org/schema-org/imports.mjs' },
{ id: 'schemaOrgVueMeta', name: 'Schema.org Vue Meta', category: 'Schema.org', file: 'schema-org/schema-org/vue-meta.mjs' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Mark the tracked outputs as required.

collectBundleData() and update.ts only fail on a missing current artifact when required is set. With these entries left optional, a PR build can stop emitting a tracked bundle and CI will just drop that row/key instead of failing, which defeats the new tracking this PR adds.

Suggested change
 export const BUNDLES: BundleSpec[] = [
   { id: 'client', name: 'Client (Minimal)', category: 'Core', file: 'client/client/minimal.mjs', required: true },
-  { id: 'clientFull', name: 'Client (Full)', category: 'Core', file: 'client-full/client/full.mjs' },
+  { id: 'clientFull', name: 'Client (Full)', category: 'Core', file: 'client-full/client/full.mjs', required: true },
   { id: 'server', name: 'Server (Minimal)', category: 'Core', file: 'server/server/minimal.mjs', required: true },
   { id: 'vueClient', name: 'Vue Client (Minimal)', category: 'Vue', file: 'vue-client/vue-client/minimal.mjs', required: true },
-  { id: 'vueClientFull', name: 'Vue Client (Full)', category: 'Vue', file: 'vue-client-full/vue-client/full.mjs' },
+  { id: 'vueClientFull', name: 'Vue Client (Full)', category: 'Vue', file: 'vue-client-full/vue-client/full.mjs', required: true },
   { id: 'vueServer', name: 'Vue Server (Minimal)', category: 'Vue', file: 'vue-server/vue-server/minimal.mjs', required: true },
-  { id: 'reactClient', name: 'React Client (Minimal)', category: 'React', file: 'react-client/react-client/minimal.mjs' },
-  { id: 'reactClientFull', name: 'React Client (Full)', category: 'React', file: 'react-client-full/react-client/full.mjs' },
-  { id: 'reactServer', name: 'React Server (Minimal)', category: 'React', file: 'react-server/react-server/minimal.mjs' },
-  { id: 'schemaOrg', name: 'Schema.org (Minimal)', category: 'Schema.org', file: 'schema-org/schema-org/minimal.mjs' },
-  { id: 'schemaOrgImports', name: 'Schema.org Imports', category: 'Schema.org', file: 'schema-org/schema-org/imports.mjs' },
-  { id: 'schemaOrgVueMeta', name: 'Schema.org Vue Meta', category: 'Schema.org', file: 'schema-org/schema-org/vue-meta.mjs' },
+  { id: 'reactClient', name: 'React Client (Minimal)', category: 'React', file: 'react-client/react-client/minimal.mjs', required: true },
+  { id: 'reactClientFull', name: 'React Client (Full)', category: 'React', file: 'react-client-full/react-client/full.mjs', required: true },
+  { id: 'reactServer', name: 'React Server (Minimal)', category: 'React', file: 'react-server/react-server/minimal.mjs', required: true },
+  { id: 'schemaOrg', name: 'Schema.org (Minimal)', category: 'Schema.org', file: 'schema-org/schema-org/minimal.mjs', required: true },
+  { id: 'schemaOrgImports', name: 'Schema.org Imports', category: 'Schema.org', file: 'schema-org/schema-org/imports.mjs', required: true },
+  { id: 'schemaOrgVueMeta', name: 'Schema.org Vue Meta', category: 'Schema.org', file: 'schema-org/schema-org/vue-meta.mjs', required: true },
 ]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const BUNDLES: BundleSpec[] = [
{ id: 'client', name: 'Client (Minimal)', category: 'Core', file: 'client/client/minimal.mjs', required: true },
{ id: 'clientFull', name: 'Client (Full)', category: 'Core', file: 'client-full/client/full.mjs' },
{ id: 'server', name: 'Server (Minimal)', category: 'Core', file: 'server/server/minimal.mjs', required: true },
{ id: 'vueClient', name: 'Vue Client (Minimal)', category: 'Vue', file: 'vue-client/vue-client/minimal.mjs', required: true },
{ id: 'vueClientFull', name: 'Vue Client (Full)', category: 'Vue', file: 'vue-client-full/vue-client/full.mjs' },
{ id: 'vueServer', name: 'Vue Server (Minimal)', category: 'Vue', file: 'vue-server/vue-server/minimal.mjs', required: true },
{ id: 'reactClient', name: 'React Client (Minimal)', category: 'React', file: 'react-client/react-client/minimal.mjs' },
{ id: 'reactClientFull', name: 'React Client (Full)', category: 'React', file: 'react-client-full/react-client/full.mjs' },
{ id: 'reactServer', name: 'React Server (Minimal)', category: 'React', file: 'react-server/react-server/minimal.mjs' },
{ id: 'schemaOrg', name: 'Schema.org (Minimal)', category: 'Schema.org', file: 'schema-org/schema-org/minimal.mjs' },
{ id: 'schemaOrgImports', name: 'Schema.org Imports', category: 'Schema.org', file: 'schema-org/schema-org/imports.mjs' },
{ id: 'schemaOrgVueMeta', name: 'Schema.org Vue Meta', category: 'Schema.org', file: 'schema-org/schema-org/vue-meta.mjs' },
export const BUNDLES: BundleSpec[] = [
{ id: 'client', name: 'Client (Minimal)', category: 'Core', file: 'client/client/minimal.mjs', required: true },
{ id: 'clientFull', name: 'Client (Full)', category: 'Core', file: 'client-full/client/full.mjs', required: true },
{ id: 'server', name: 'Server (Minimal)', category: 'Core', file: 'server/server/minimal.mjs', required: true },
{ id: 'vueClient', name: 'Vue Client (Minimal)', category: 'Vue', file: 'vue-client/vue-client/minimal.mjs', required: true },
{ id: 'vueClientFull', name: 'Vue Client (Full)', category: 'Vue', file: 'vue-client-full/vue-client/full.mjs', required: true },
{ id: 'vueServer', name: 'Vue Server (Minimal)', category: 'Vue', file: 'vue-server/vue-server/minimal.mjs', required: true },
{ id: 'reactClient', name: 'React Client (Minimal)', category: 'React', file: 'react-client/react-client/minimal.mjs', required: true },
{ id: 'reactClientFull', name: 'React Client (Full)', category: 'React', file: 'react-client-full/react-client/full.mjs', required: true },
{ id: 'reactServer', name: 'React Server (Minimal)', category: 'React', file: 'react-server/react-server/minimal.mjs', required: true },
{ id: 'schemaOrg', name: 'Schema.org (Minimal)', category: 'Schema.org', file: 'schema-org/schema-org/minimal.mjs', required: true },
{ id: 'schemaOrgImports', name: 'Schema.org Imports', category: 'Schema.org', file: 'schema-org/schema-org/imports.mjs', required: true },
{ id: 'schemaOrgVueMeta', name: 'Schema.org Vue Meta', category: 'Schema.org', file: 'schema-org/schema-org/vue-meta.mjs', required: true },
]
🤖 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 `@bench/bundle/bundles.ts` around lines 17 - 29, The tracked bundle entries in
BUNDLES are still optional, so missing outputs won’t fail the build. Update the
BundleSpec definitions for the tracked artifacts in the BUNDLES array to set
required: true, matching the behavior expected by collectBundleData() and
update.ts so CI fails when a tracked current artifact is not emitted.

Comment on lines +8 to +31
export function App() {
useHead({
title: 'Test',
titleTemplate: '%s | Site',
meta: [
{ name: 'description', content: 'Test' },
],
link: [
{ rel: 'icon', href: '/favicon.ico' },
],
})

useSeoMeta({
title: 'Test',
description: 'Test description',
ogTitle: 'Test',
ogDescription: 'Test description',
ogImage: '/og.png',
twitterCard: 'summary_large_image',
})

useScript({ src: '/analytics.js' })

return UnheadProvider

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -i 'client.*' packages/react
rg -n -C3 'UnheadProvider|useHead|useSeoMeta|useScript' packages/react
ast-grep outline packages/react --match UnheadProvider --view expanded

Repository: unjs/unhead

Length of output: 50367


Wrap the hook usage in <UnheadProvider>. return UnheadProvider returns the component function, so these hooks run without provider context and useScript will throw if this fixture is rendered.

🤖 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 `@bench/bundle/src/react-client/full.ts` around lines 8 - 31, The App component
is returning the provider component itself instead of rendering the hook usage
inside it, so the Unhead hooks run without provider context. Update App to wrap
the existing useHead, useSeoMeta, and useScript calls within <UnheadProvider>
and return its rendered children, using the App and UnheadProvider symbols to
locate the fix.

Comment thread bench/memory/ssr.mjs Resolved
Comment thread bench/ssr-memory.test.ts
Comment on lines +59 to +65
console.table([{
name: result.name,
runs: result.runs,
durationMs: Math.round(result.durationMs * 100) / 100,
heapUsedDelta: formatBytes(result.delta.heapUsed),
rssDelta: formatBytes(result.delta.rss),
}])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Drop console.table from the test.

Line 59 is already failing lint, so this suite cannot merge green in its current form. If you want local diagnostics, gate them behind a debug path or use an allowed logger.

🧰 Tools
🪛 GitHub Check: lint

[failure] 59-59:
Unexpected console statement. Only these console methods are allowed: warn, error

🤖 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 `@bench/ssr-memory.test.ts` around lines 59 - 65, The SSR memory benchmark test
is using console.table directly, which trips lint and blocks the suite from
passing. Remove the console.table call from the test and, if you still need
local diagnostics, move the output behind a debug-only path or switch it to the
project’s approved logger inside ssr-memory.test.ts.

Source: Linters/SAST tools

- ignore bench/**/*.mjs (standalone --expose-gc harnesses that import built dist,
  use process/console and top-level await by design)
- perf.ts: import process from node:process
- ssr-memory.test.ts: allow the informational console.table
…ment

- perf-ci.mjs: standalone --expose-gc harness; prints JSON for SSR render wall-time
  (mean ms + 95% RME over sampled batches) and retained heap over a fixed run
- perf-report.ts: only surfaces a change past the gate (time |Δ| > max(10%, 2×RME);
  memory |Δ| > 512 KiB, since retained heap hovers near zero), framed as directional
- report.ts: one combined comment (size + perf), replacing analyze.ts as the CI
  comment generator (analyze.ts stays for local bundle-only runs)
- bundle-size.yml: run the harness on base and PR (same runner) and feed both JSONs
  to report.ts via BASE_PERF / PR_PERF
@harlan-zw harlan-zw changed the title ci: track schema-org bundle size in bundle-size workflows ci: bench infrastructure and combined size + perf PR report Jun 27, 2026
@harlan-zw
harlan-zw merged commit b68cdc1 into main Jun 27, 2026
7 checks passed
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