Skip to content

fix(api): use numeric version sorting for artifact versions - #83

Open
prathamesh04 wants to merge 1 commit into
dbpedia:mainfrom
prathamesh04:fix/version-sorting-v2
Open

fix(api): use numeric version sorting for artifact versions#83
prathamesh04 wants to merge 1 commit into
dbpedia:mainfrom
prathamesh04:fix/version-sorting-v2

Conversation

@prathamesh04

Copy link
Copy Markdown

Description

The previous implementation used lexicographic sorting for version URLs, which produces incorrect results for semver-style version IDs.

Problem

Lexicographic sorting:

  • Input: ['2.10.0', '2.9.0', '2.1.0']
  • Result: '2.9.0' (wrong - 9 > 10 in string comparison)

Numeric sorting:

  • Input: ['2.10.0', '2.9.0', '2.1.0']
  • Result: '2.10.0' (correct - 10 > 9 numerically)

Changes

  • Added helper function that extracts version segment from URL and parses as numeric tuple
  • Falls back to lexicographic comparison for non-standard formats (e.g., date-based versions)
  • No new dependencies required (pure Python implementation)

Testing

  • Verified with semver-style versions: 2.10.0 > 2.9.0 > 2.1.0
  • Verified with date-based versions: 2022.12.01 > 2022.11.01 (lexicographic still works)
  • Verified with mixed formats

Fixes #70

The previous implementation used lexicographic sorting for version URLs,
which produces incorrect results for semver-style version IDs:

  Lexicographic: ['2.9.0', '2.10.0', '2.1.0'] -> '2.9.0' (wrong)
  Numeric:       ['2.10.0', '2.9.0', '2.1.0'] -> '2.10.0' (correct)

This fix extracts the version segment from each URL and parses it as a
numeric tuple for proper semantic version comparison. Falls back to
lexicographic comparison for non-standard formats.

Fixes dbpedia#70
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 59 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 Plus

Run ID: 23506d6a-900b-440a-8652-3ebbbf99cb11

📥 Commits

Reviewing files that changed from the base of the PR and between ce39277 and 7c1282d.

📒 Files selected for processing (1)
  • databusclient/api/download.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@prathamesh04

Copy link
Copy Markdown
Author

cc @Integer-Ctrl @DhanashreePetare @JJ-Author

This PR fixes the version sorting bug (Issue #70). The previous implementation used lexicographic sorting which gives wrong results for semver-style versions (e.g., 2.9.0 > 2.10.0). This fix uses numeric tuple comparison for proper semantic version ordering.

@prathamesh04

prathamesh04 commented Jul 29, 2026

Copy link
Copy Markdown
Author

Hey @Integer-Ctrl @DhanashreePetare @JJ-Author — I've added a testing video demonstrating the numeric version sorting fix. The fix correctly handles semver-style versions (e.g., 2.10.0 > 2.9.0) and falls back to lexicographic for date-based formats. All unit tests pass. Would appreciate a review when you get a chance. Thanks!
Video:
Screencast from 2026-07-29 18-04-36.webm

@prathamesh04

Copy link
Copy Markdown
Author

Hi @Integer-Ctrl @DhanashreePetare — gentle bump on this one. It fixes the semver version-sorting bug (Issue #70): lexicographic sorting mis-orders versions like 2.10.0 vs 2.9.0, and this uses numeric component comparison instead. I'm preparing my GSoC 2027 application with DBpedia and would appreciate a review when you have a moment. Thanks!

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.

bug: lexicographic version sort returns wrong "latest" version for semver-style version IDs

1 participant