Skip to content

fix(shared): compare peer version minors and patch floors numerically - #1297

Open
deepanshupal wants to merge 6 commits into
pingdotgg:mainfrom
deepanshupal:fix/shared-numeric-peer-versions
Open

deepanshupal wants to merge 6 commits into
pingdotgg:mainfrom
deepanshupal:fix/shared-numeric-peer-versions

Conversation

@deepanshupal

@deepanshupal deepanshupal commented Oct 8, 2026 •

Copy link
Copy Markdown

What changed

semverLite compares minor strings lexically for caret ranges and doesn't enforce the patch floor for caret/tilde ranges. For example:

  • semverLite("^7.2.0", "7.10.0") returns false, despite the installed minor being newer.
  • semverLite("^7.10.0", "7.2.0") returns true, despite the installed minor being older.
  • semverLite("^7.2.5", "7.2.4") and the equivalent tilde range return true below the required patch.

This helper is used by the React, Solid, Vue and Expo peer dependency checks. The fix compares numeric minor/patch values, adds 11 regression/boundary cases and a patch changeset for @uploadthing/shared.

The existing major-version and short-version behavior is preserved. This is a focused correction to the lightweight helper, not a replacement with a full semver implementation.

Verification

  • The new test file fails on the original source: 4 failures, 7 passes.
  • With the fix, all 42 shared tests pass across 5 files.
  • @uploadthing/shared typecheck and lint pass, after building its workspace MIME dependency.
  • Prettier passes on the touched files; git diff --check passes.

I did not run the full workspace test suite or workspace-wide typecheck.

Summary by CodeRabbit

  • Bug Fixes
    • Peer dependency checks now correctly enforce minor and patch version requirements for caret and tilde ranges, including multi-digit minor versions.
    • Versions below the required patch level are no longer accepted.

@vercel

vercel Bot commented Oct 8, 2026

Copy link
Copy Markdown

@deepanshupal is attempting to deploy a commit to the Ping Labs Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c781f1d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@uploadthing/shared Patch
@uploadthing/expo Patch
@uploadthing/react Patch
@uploadthing/solid Patch
@uploadthing/svelte Patch
uploadthing Patch
@uploadthing/vue Patch
@uploadthing/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a368486-64c2-4bef-9a06-e6b754b3a00e
📥 Commits

Reviewing files that changed from the base of the PR and between 2656a9a and c781f1d.

📒 Files selected for processing (3)
  • .changeset/quiet-versions-compare.md
  • packages/shared/src/utils.ts
  • packages/shared/test/semver.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

semverLite now compares minor and patch versions for caret and tilde requirements. Tests cover version boundaries and exact matches. A patch changeset records the update.

Changes

Peer dependency version comparison

Layer / File(s) Summary
Caret and tilde version checks
packages/shared/src/utils.ts, packages/shared/test/semver.test.ts, .changeset/quiet-versions-compare.md
Caret checks require a matching major and a sufficient minor and patch version. Tilde checks require matching major and minor versions and a sufficient patch version. Tests cover version boundaries and exact matches. The changeset describes the update.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to c781f

The peer-version comparison is corrected for the inspected Expo requirement, with focused boundary tests and a matching changeset. No introduced merge-blocking issue was identified.

Architecture Summary

Architecture risk: 🔵 Low · up to c781f

The change affects 1 system.

Changed systems: packages/shared

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/shared (library) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/shared/src/utils.ts: semverLite now checks the checked version’s minor and patch against the required version for caret requirements, treating missing components as zero; it still rejects mismatched majors. This replaces the prior conditional minor check and unconditional acceptance after it.
  • observed — Modified behavior in packages/shared/src/utils.ts: For tilde requirements, semverLite now requires the checked patch to be at least the required patch, with missing patches treated as zero. Previously, matching major and minor versions were sufficient.
  • observed — Modified behavior in packages/shared/test/semver.test.ts: Adds semverLite tests asserting caret ranges accept compatible versions and reject lower or higher-major versions; tilde ranges accept patch updates but reject lower patches and minor updates; and exact versions match only themselves.
  • observed — Modified behavior in .changeset/quiet-versions-compare.md: Adds a patch changeset for @uploadthing/shared and a release note describing the peer dependency version-check changes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: numeric comparison of peer dependency minor versions and patch floors in the shared package.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes semantic version comparison in peer dependency checks.

The PR appears safe to merge.

What we checked:

  • Different major versions stay rejected: Both range branches reject different major versions before checking the minor or patch floor.

Reviews (1) · Last reviewed commit: "chore: correct changeset path" · Reviewed by Greptile

This branch has not been deployed

No deployments
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