Alpha and beta releases sort above the final release
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
The sort lives in comparisonVersionString() in src/Repository/ReleasesCollection.php, which rewrites -beta.1 style suffixes into numeric parts that version_compare() then misranks. Start by removing #[Skip] from ReleasesCollectionTest::sortByVersionPutsPreReleasesBelowFinalRelease and running vendor/bin/testo --filter=sortByVersionPutsPreReleasesBelowFinalRelease. Done when that test passes and final releases sort above rc, beta and alpha, including upper-case -RC. Check #49 first, since replacing the release lookup could remove this code.
Written by the indexing model from the issue text.
Description
Description
ReleasesCollection::sortByVersion() ranks alpha and beta pre-releases above the final release of the same version. Sorting v2024.1.0-alpha.1, v2024.1.0, v2024.1.0-beta.1, v2024.1.0-rc.1 gives:
v2024.1.0-beta.1
v2024.1.0-alpha.1
v2024.1.0
v2024.1.0-rc.1
Expected: v2024.1.0, v2024.1.0-rc.1, v2024.1.0-beta.1, v2024.1.0-alpha.1.
get-binary and download-protoc-binary install the first release of the sorted list that passes the stability filter. With --stability=beta (or lower) they pick the beta over the final release that is already out.
comparisonVersionString() replaces -<stability> with .<weight>.. v2024.1.0-beta.1 therefore compares as v2024.1.0.2..1, and version_compare() ranks it above v2024.1.0 because it has more numeric parts. Lower-case -rc tags are left untouched (the stability is RC), so they happen to sort correctly. Upper-case -RC tags have the same problem as beta and alpha. #2 was about the order among pre-releases.
Steps to reproduce
- Remove
#[Skip]fromReleasesCollectionTest::sortByVersionPutsPreReleasesBelowFinalRelease. - Run
vendor/bin/testo --filter=sortByVersionPutsPreReleasesBelowFinalRelease.
Additional context
The release lookup may be replaced by DLoad in #49, in which case this code goes away.
- Dominant language
- PHP
- Stars
- 30
- Forks
- 15
- Avg merge
- 45m
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from roadrunner-php/cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
roadrunner-php/cli#69 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
roadrunner-php/cli#68 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
roadrunner-php/cli#67 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
roadrunner-php/cli#62 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
roadrunner-php/cli#61 ·
Maintainers usually reply within 1 day
All issues in roadrunner-php/cli
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
smarty-php/smarty#1215 ·
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ProfessionalWiki/NeoWiki#1637 ·
Maintainers usually reply within 1 day