fix: follow up on #907 version edge cases#921
Merged
Conversation
Ensure version coherence prefers stable releases over matching pre-release tags, and make fetchAll toolkit metadata resolution use the same providerId fallback path as single-toolkit fetches. Made-with: Cursor
Reduce comparator complexity while preserving semver precedence behavior for stable and pre-release versions. Made-with: Cursor
Extract optional prerelease part comparison so the semver helper stays readable and below complexity warning thresholds. Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b0b1485. Configure here.
Fix redundant metadata lookups in fetchToolkitData and add regression tests for semver prerelease ordering plus metadata lookup behavior across single and bulk toolkit paths. Made-with: Cursor
Address review findings from six parallel reviewers:
- Use compareVersions for filter equality so semver-equal tools (e.g. @1.0.0 vs @1.0.0+build.1) no longer get silently dropped.
- Replace localeCompare("en") with ASCII byte ordering per SemVer 2.0.0 §11.4.2 so mixed-case prerelease tags rank correctly.
- Replace ambiguous best === "" sentinel with a null sentinel in getHighestVersion.
- Drop the allowToolkitIdLookup flag and lift the toolkit-id retry into the fetchAllToolkitsData call site; shared helper now only owns the *Api provider-id fallback.
- Inline single-use compareOptionalPrereleasePart and simplify comparePrereleaseIdentifier with typeof narrowing.
- Add regression tests: direct-map-hit no-relookup, patch-only version diff, ASCII prerelease ordering, string-vs-string prerelease, all-unversioned tools, semver-equal tools with differing build metadata.
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
1.23over1.23-rc.1)version-coherencefetchAllToolkitsDataasfetchToolkitDataand add a consistency test forMailchimpMarketingApirc.10 > rc.2, numeric vs string identifiers, and prefix-length precedence)getToolkitMetadata(toolkitId)call infetchToolkitDataTest plan
pnpm vitest run toolkit-docs-generator/tests/utils/version-coherence.test.ts toolkit-docs-generator/tests/sources/toolkit-data-source.test.tsMade with Cursor
Note
Medium Risk
Changes toolkit version-selection logic (SemVer prerelease/build precedence) and metadata resolution fallback, which can alter which tools/metadata are emitted in generated docs. Covered by new regression tests, but affects core selection behavior across single and bulk fetch paths.
Overview
Makes version coherence SemVer-precedence aware by introducing a proper
compareVersionsthat orders stable releases above matching pre-releases, compares prerelease identifiers correctly (numeric vs string, prefix length), and treats build metadata as ordering-ignored but equivalence-preserving.filterToolsByHighestVersionnow keeps all tools semver-equivalent to the highest release (e.g.1.0.0and1.0.0+build.1) instead of string-matching only.Unifies and reuses the providerId-based metadata fallback for
*Apitoolkits viaresolveProviderMetadata, applying it consistently in bothfetchToolkitDataandfetchAllToolkitsData, while avoiding redundantgetToolkitMetadata(toolkitId)calls in the single-toolkit path and only doing per-toolkit lookups in bulk when the batch metadata map misses.Adds targeted tests covering SemVer edge cases (stable vs rc, rc ordering, ASCII ordering, build metadata equivalence) and metadata lookup consistency/call-count behavior for both single and bulk fetches.
Reviewed by Cursor Bugbot for commit 5528dcd. Bugbot is set up for automated code reviews on this repo. Configure here.