fix(cli,vite): surface resolved @svelte-vitals/core version for drift detection - #150
Conversation
… 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>
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds a readCoreVersion() helper to both the CLI and Vite packages, surfacing the resolved ChangesCore version drift reporting
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
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
📒 Files selected for processing (20)
.changeset/silly-rules-glow.mddocs/src/content/docs/guides/choosing-a-package.mddocs/src/content/docs/guides/cli.mddocs/src/content/docs/guides/dev-overlay.mddocs/src/content/docs/ja/guides/choosing-a-package.mddocs/src/content/docs/ja/guides/cli.mddocs/src/content/docs/ja/guides/dev-overlay.mdpackages/cli/src/bin.tspackages/cli/src/index.tspackages/cli/src/version.tspackages/cli/test/version.test.tspackages/core/src/reporter/html.tspackages/core/test/html-report.test.tspackages/vite/src/plugin.tspackages/vite/src/ui/middleware.tspackages/vite/src/ui/serve.tspackages/vite/src/version.tspackages/vite/test/ui-middleware.test.tspackages/vite/test/ui-serve.test.tspackages/vite/test/version.test.ts
- 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>
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).
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'sminimumReleaseAge) resolved one to an older core than the other — with no visible signal to notice it.svelte-vitals --versionnow prints the resolved@svelte-vitals/coreversion alongside its own, e.g.0.20.0 (core 0.21.0). Resolved viaimport.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./__svelte-vitals/) footer now showscore vX.Y.Znext to its own version, for direct comparison against the CLI's--versionoutput. The CLI's--reporter htmloutput shows the same.@svelte-vitals/core'sbuildHtmlDocument/formatHtmlReportmetaparam gains an optionalcoreVersionfield (backward compatible — existing callers without it render unchanged).minimumReleaseAgeexample.Test plan
pnpm build/pnpm typecheck/pnpm test/pnpm lintall pass acrosscore,cli,vite,mcppnpm --filter docs buildsucceeds (new ja anchor links resolve)readCoreVersion()in bothcliandviteversion.ts, HTML topbar rendering with/withoutcoreVersionincore'shtml-report.test.ts, and dashboard rendering invite'sui-serve.test.ts/ui-middleware.test.tsnode 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
Documentation