Skip to content

fix: follow up on #907 version edge cases#921

Merged
jottakka merged 5 commits intomainfrom
fix/version-coherence-prerelease-metadata-fallback
Apr 17, 2026
Merged

fix: follow up on #907 version edge cases#921
jottakka merged 5 commits intomainfrom
fix/version-coherence-prerelease-metadata-fallback

Conversation

@jottakka
Copy link
Copy Markdown
Contributor

@jottakka jottakka commented Apr 17, 2026

Summary

  • make version coherence semver-aware so stable releases outrank matching pre-release versions (for example, 1.23 over 1.23-rc.1)
  • add regression tests for stable-vs-rc filtering behavior in version-coherence
  • reuse the same providerId metadata fallback in fetchAllToolkitsData as fetchToolkitData and add a consistency test for MailchimpMarketingApi
  • address reviewer concern about RC-vs-stable precedence by adding semver ordering tests (rc.10 > rc.2, numeric vs string identifiers, and prefix-length precedence)
  • address bugbot’s redundant fetch comment by preventing a second getToolkitMetadata(toolkitId) call in fetchToolkitData
  • add call-count regression tests proving single fetch does not re-fetch metadata while bulk fetch still performs toolkit-id lookup on metadata-map misses

Test plan

  • pnpm vitest run toolkit-docs-generator/tests/utils/version-coherence.test.ts toolkit-docs-generator/tests/sources/toolkit-data-source.test.ts

Made 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 compareVersions that 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. filterToolsByHighestVersion now keeps all tools semver-equivalent to the highest release (e.g. 1.0.0 and 1.0.0+build.1) instead of string-matching only.

Unifies and reuses the providerId-based metadata fallback for *Api toolkits via resolveProviderMetadata, applying it consistently in both fetchToolkitData and fetchAllToolkitsData, while avoiding redundant getToolkitMetadata(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.

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
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 17, 2026 5:51pm

Request Review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread toolkit-docs-generator/src/sources/toolkit-data-source.ts Outdated
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
Copy link
Copy Markdown
Contributor

@teallarson teallarson left a comment

Choose a reason for hiding this comment

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

that should do it

@jottakka jottakka merged commit dfd64d2 into main Apr 17, 2026
7 checks passed
@jottakka jottakka deleted the fix/version-coherence-prerelease-metadata-fallback branch April 17, 2026 23:29
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