Fix mike version sorting#171
Merged
llucax merged 7 commits intofrequenz-floss:v0.x.xfrom Nov 3, 2023
Merged
Conversation
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
For the same major and minor, pre-releases were sorted as newer than stable releases, but this is not correct. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
There are 2 main reasons for this: 1. Parsing the mike versions is less future proof, as if more fields are added to the JSON in the future, we'll remove them from the output, making the sorting more bug prone and more costly to maintain. 2. Avoiding the extra wrapping in `sort_mike_versions()` makes it easier to test, as otherwise we need to do the extra wrapping in tests, wrapping that is really not related to sorting so it adds noise to the tests. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
We are going to add more wrapped test cases, so it is better to use a more explicit name. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
matthias-wende-frequenz
approved these changes
Nov 3, 2023
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.
For the same major and minor, pre-releases were sorted as newer than stable releases, but this is not correct. This PR fixes that.
It also makes the sorting of the
versions.jsonfile more robust, as it doesn't parse and re-serialize the version object, but instead only uses theversionfield for sorting, and the rest of the fields are dumping verbatim without any rewriting.This means that if new versions of
mikeadd more fields to the JSON, we won't need to update the sorting code, as it will just work.