Sort stellar_cli_versions by version after every mutation#13
Closed
fnando wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
Updates scripts/release-prepare.sh to keep builds.json deterministic by sorting the stellar_cli_versions array by semantic version after every mutation, so backfilled/refresh releases don’t leave the array in a non-monotonic order.
Changes:
- In
add_cli_entry, append the new entry and immediatelysort_by(.version | split(".") | map(tonumber)). - In
extend_cli_entry, update the matched entry and then re-sortstellar_cli_versionsby numeric semver.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Updates
scripts/release-prepare.shso bothadd_cli_entryandextend_cli_entrysortstellar_cli_versionsby semantic version (numericMAJOR.MINOR.PATCH) after writing tobuilds.json, rather than relying on insertion order.Why
Without an explicit sort, entries land in the order they're added, which can produce a non-monotonic
stellar_cli_versionsarray — e.g. backfilling an older CLI release after a newer one leaves the file out of order. Sorting on every mutation keepsbuilds.jsondeterministic and easy to scan regardless of the order releases are prepared.Notes
.version | split(".") | map(tonumber), so versions compare numerically (10.0.0 > 9.0.0) instead of lexicographically.jqpipeline that performs the mutation, so the file is written once.