Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chat: fix comparison of prerelease versions #2772

Merged
merged 4 commits into from
Jul 30, 2024
Merged

Conversation

cebtenzzre
Copy link
Member

@cebtenzzre cebtenzzre commented Jul 29, 2024

Ordering before this PR (not deterministic, but this is one possibility):

foo
fooa
foob
2.0
2.0.0 (greater than 2.0)
2.0.99-dev99
2.0.99-blah
2.0.99-dev0
2.0.99-rc20
2.0.99-rc2
2.0.99-rc11
2.0.99-rc10
2.0.99-rc1
2.0.99-post1
2.0.99
2.1.0-rc1
2.1.0
3.0.0-dev0
3.0.0
3.0.1-dev1
3.0.1-dev0
3.0.1
3.1.0
4.1.0

Ordering after this PR:

foo
fooa
foob
2.0.0
2.0 (equal to 2.0.0)
2.0.99-dev0
2.0.99-dev99
2.0.99-rc1
2.0.99-rc2
2.0.99-rc10
2.0.99-rc11
2.0.99-rc20
2.0.99
2.0.99-blah
2.0.99-post1
2.1.0-rc1
2.1.0
3.0.0-dev0
3.0.0
3.0.1-dev0
3.0.1-dev1
3.0.1
3.1.0
4.1.0

The order is now deterministic as it never ignores any part of the version. Pre-release versions compare as less than the stable releases that come after. This means we shouldn't use post-release suffixes (e.g. v3.1.1-web_search_beta_2 after v3.1.1) unless we can agree on what pre-release and post-release suffixes look like (maybe -dev and -rc are the only pre-release suffixes?) We agreed to use -devX and -rcX for pre-releases and treat everything else as a post-release.

This PR also fixes an assertion failure caused by the combination of #2759 and #2762.

This isn't such a problem for official stable releases, but for
development versions (-dev0) and prereleases (-rc1), the version syntax
needs to be parsed more carefully.

Signed-off-by: Jared Van Bortel <[email protected]>
3.0.0 is actually the same version as 3.0.

Signed-off-by: Jared Van Bortel <[email protected]>
@cebtenzzre cebtenzzre requested a review from manyoso July 29, 2024 23:00
@cebtenzzre cebtenzzre marked this pull request as ready for review July 29, 2024 23:00
@cebtenzzre cebtenzzre merged commit 6b8e0f7 into main Jul 30, 2024
6 of 12 checks passed
@cebtenzzre cebtenzzre deleted the jared/fix-vercmp branch July 30, 2024 17:20
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