Skip to content

fix(cli,vite): surface resolved @svelte-vitals/core version for drift detection - #150

Merged
oekazuma merged 3 commits into
mainfrom
fix/core-version-drift-visibility
Jul 8, 2026
Merged

oekazuma merged 3 commits into
mainfrom
fix/core-version-drift-visibility

Conversation

@oekazuma

@oekazuma oekazuma commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

svelte-vitals (CLI) and @svelte-vitals/vite (Vite plugin / dev overlay) are versioned independently, but both are thin wrappers around @svelte-vitals/core, which actually implements the rules. Nothing surfaced which core version each was running, so the two could silently disagree on findings whenever a lockfile/registry cooldown (e.g. pnpm's minimumReleaseAge) resolved one to an older core than the other — with no visible signal to notice it.

  • svelte-vitals --version now prints the resolved @svelte-vitals/core version alongside its own, e.g. 0.20.0 (core 0.21.0). Resolved via import.meta.resolve('@svelte-vitals/core') at runtime (core stays an external, unbundled dependency), so it reflects the actually-installed package, not whatever was bundled in.
  • The dev overlay's dashboard (/__svelte-vitals/) footer now shows core vX.Y.Z next to its own version, for direct comparison against the CLI's --version output. The CLI's --reporter html output shows the same.
  • @svelte-vitals/core's buildHtmlDocument/formatHtmlReport meta param gains an optional coreVersion field (backward compatible — existing callers without it render unchanged).
  • Documented the version-drift footgun (en + ja) in the dev-overlay and choosing-a-package guides, including the minimumReleaseAge example.

Test plan

  • pnpm build / pnpm typecheck / pnpm test / pnpm lint all pass across core, cli, vite, mcp
  • pnpm --filter docs build succeeds (new ja anchor links resolve)
  • Added unit tests: readCoreVersion() in both cli and vite version.ts, HTML topbar rendering with/without coreVersion in core's html-report.test.ts, and dashboard rendering in vite's ui-serve.test.ts/ui-middleware.test.ts
  • Manually ran node packages/cli/dist/bin.js --version → 0.20.0 (core 0.21.0)
  • pnpm check:publish (attw --pack) not runnable locally (no npm on this machine) — verify in CI

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • The CLI version command now shows both the app version and the resolved core version.
    • The dev overlay footer now displays the core version alongside the UI version when available.
  • Documentation

    • Clarified that packages are versioned independently and may resolve different core versions.
    • Added guidance for checking and comparing version drift when CLI and overlay results differ.

… detection

svelte-vitals (CLI) and @svelte-vitals/vite are versioned independently and
both wrap @svelte-vitals/core, but nothing showed which core version each
was actually running — so the CLI and the dev overlay could silently
disagree on findings whenever a lockfile/registry cooldown (e.g. pnpm's
minimumReleaseAge) resolved one to an older core than the other.

`svelte-vitals --version` now prints the resolved core version alongside
its own (`0.20.0 (core 0.21.0)`), and the dev overlay's dashboard footer
shows the same `core vX.Y.Z` for direct comparison. Also documents the
version-drift footgun in the en/ja guides.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oekazuma, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ab7303d-a0af-4af4-9f2b-59f32f46f37e

📥 Commits

Reviewing files that changed from the base of the PR and between f0af627 and ea90a6d.

📒 Files selected for processing (7)
  • .changeset/silly-rules-glow.md
  • .changeset/tame-lions-jog.md
  • packages/cli/src/install/index.ts
  • packages/cli/src/install/package-manager.ts
  • packages/cli/test/install/run.test.ts
  • packages/cli/test/version.test.ts
  • packages/vite/test/version.test.ts
📝 Walkthrough

Walkthrough

This PR adds a readCoreVersion() helper to both the CLI and Vite packages, surfacing the resolved @svelte-vitals/core version. The CLI --version flag and HTML reports now display this core version, the dev overlay dashboard footer shows it, and documentation (English/Japanese) explains version drift between packages.

Changes

Core version drift reporting

Layer / File(s) Summary
CLI readCoreVersion and --version output
packages/cli/src/version.ts, packages/cli/src/bin.ts, packages/cli/src/index.ts, packages/cli/test/version.test.ts
Adds readCoreVersion() resolving the installed core package's version, updates --version output to include it, passes coreVersion into the HTML reporter call, and adds tests.
Core HTML reporter coreVersion badge
packages/core/src/reporter/html.ts, packages/core/test/html-report.test.ts
Extends renderTopbar, buildHtmlDocument, and formatHtmlReport signatures with optional coreVersion, conditionally rendering a "core v..." badge, with backward-compatibility tests.
Vite plugin readCoreVersion and dashboard wiring
packages/vite/src/version.ts, packages/vite/src/plugin.ts, packages/vite/src/ui/middleware.ts, packages/vite/src/ui/serve.ts, packages/vite/test/*
Adds readCoreVersion(), threads coreVersion through installUiMiddleware and renderDashboard, and adds tests verifying dashboard displays the core version.
Documentation of version drift
.changeset/silly-rules-glow.md, docs/src/content/docs/guides/*, docs/src/content/docs/ja/guides/*
Documents independent package versioning, the new --version output format, and adds a "Version drift" section explaining CLI/dev-overlay discrepancies.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • oekazuma/svelte-vitals#47: Directly touches the same HTML reporter functions (buildHtmlDocument/formatHtmlReport/renderTopbar) that this PR extends with coreVersion.
  • oekazuma/svelte-vitals#49: Touches the same Vite dashboard rendering pipeline (ui/serve.ts/ui/middleware.ts) that this PR extends to pass and display the core version.
🚥 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 clearly states the main change: surfacing the resolved core version in CLI/Vite to detect version drift.
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.

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.

@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

🤖 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 @.changeset/silly-rules-glow.md:
- Around line 2-4: The changeset version for `@svelte-vitals/core` is too low for
the public API addition. Update the entry for `@svelte-vitals/core` from patch to
minor, and keep the other package bumps as-is, since the HTML reporter API now
exposes the new coreVersion field via buildHtmlDocument and formatHtmlReport.

In `@packages/cli/test/version.test.ts`:
- Around line 10-17: The readCoreVersion test is too weak because the current
regex still accepts the fallback value, so it cannot prove the installed
`@svelte-vitals/core` was actually resolved. Update the assertion in
version.test.ts within the readCoreVersion spec to explicitly reject the
fallback returned on resolution failure (the '"0.0.0"' path) while still
validating a semver-shaped version, using readCoreVersion as the target symbol
to locate the test.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c8f53eef-bc29-4419-89a0-2411d441442c

📥 Commits

Reviewing files that changed from the base of the PR and between 8b6cf6b and f0af627.

📒 Files selected for processing (20)
  • .changeset/silly-rules-glow.md
  • docs/src/content/docs/guides/choosing-a-package.md
  • docs/src/content/docs/guides/cli.md
  • docs/src/content/docs/guides/dev-overlay.md
  • docs/src/content/docs/ja/guides/choosing-a-package.md
  • docs/src/content/docs/ja/guides/cli.md
  • docs/src/content/docs/ja/guides/dev-overlay.md
  • packages/cli/src/bin.ts
  • packages/cli/src/index.ts
  • packages/cli/src/version.ts
  • packages/cli/test/version.test.ts
  • packages/core/src/reporter/html.ts
  • packages/core/test/html-report.test.ts
  • packages/vite/src/plugin.ts
  • packages/vite/src/ui/middleware.ts
  • packages/vite/src/ui/serve.ts
  • packages/vite/src/version.ts
  • packages/vite/test/ui-middleware.test.ts
  • packages/vite/test/ui-serve.test.ts
  • packages/vite/test/version.test.ts

Comment thread .changeset/silly-rules-glow.md Outdated
Comment thread packages/cli/test/version.test.ts
oekazuma and others added 2 commits July 9, 2026 00:12
- Bump the @svelte-vitals/core changeset from patch to minor: buildHtmlDocument/
  formatHtmlReport are public API and gained a new optional coreVersion field.
- Strengthen the readCoreVersion tests (cli + vite): the prior semver-shape regex
  also matched '0.0.0', the resolution-failure fallback, so it couldn't prove
  @svelte-vitals/core was actually resolved. Now asserts equality against
  packages/core/package.json's real version instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…stall

`svelte-vitals install` silently ran `pnpm add -D @svelte-vitals/vite` (or the
equivalent for the detected package manager) with no version pinned, so
whatever the resolver picked — including an older release than expected, e.g.
under pnpm's minimumReleaseAge cooldown — was invisible. Read the version back
from node_modules after a successful install and log it, tying into the
version-drift visibility work in #150.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@oekazuma
oekazuma merged commit bda3ffd into main Jul 8, 2026
7 checks passed
@oekazuma
oekazuma deleted the fix/core-version-drift-visibility branch July 8, 2026 15:18
oekazuma added a commit that referenced this pull request Jul 8, 2026
Resolves conflicts with PR #150 (core version drift visibility): coreVersion
threading and the routeBadges/store integration are combined — renderDashboard
and buildHtmlDocument accept both, installUiMiddleware takes (server, config,
version, store, coreVersion?). Dropped the now-obsolete docs paragraph claiming
component-scoped rules never appear in the dev overlay (the whole-project
static layer now surfaces them); kept the new Version drift section (en/ja).
oekazuma added a commit that referenced this pull request Jul 10, 2026
… parallel session

021 (dev dashboard whole-project, PR #152) and 022 (MCP categories input,
PR #149; renumbered from 020 to resolve the collision with the parallel
session's 020-reusable-github-action plan). Index rows updated with merge
outcomes including the #150 conflict resolution.
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.

1 participant