fix(version-check, install): use /tags endpoint, pick highest semver#25
Merged
fix(version-check, install): use /tags endpoint, pick highest semver#25
Conversation
GitHub's REST `/repos/{owner}/{repo}/releases` list endpoint has
eventual-consistency lag — a release published minutes ago can be
missing from it for hours, even though the underlying release object
is reachable directly via `/releases/tags/<tag>` and shows up in `gh
release list` (GraphQL). When this happens both the in-binary
`version_check` and `scripts/install.sh` silently report the previous
version as latest, so freshly-released bug fixes don't roll out.
Switches both to read `/repos/.../tags?per_page=100`. Tag refs reflect
the moment they're pushed — same source the release pipeline tags
from, so they can't disappoint us. GitHub's tag ordering isn't
guaranteed to be by version, so we collect all `<tool>-v*` tags and
pick the highest semver instead of trusting the first item.
Side-effect cleanup: extracts `parse_semver` to module scope so
`is_newer` and the new highest-version picker share parsing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Today's release of `tb-pr-v0.1.1` exposed a quiet failure mode: GitHub's REST `/repos/.../releases` list endpoint is eventually consistent, and a release published 30+ minutes ago can still be missing from it. Both `toolbox-core::version_check` and `scripts/install.sh` use that endpoint, so a freshly-tagged version silently reports as "(latest)" against the previous one, and `install.sh` happily redownloads the older binary.
This switches both call sites to the `/tags` endpoint, which reflects the ref the moment it's pushed. GitHub's tag ordering isn't guaranteed to be by version, so we now collect all `-v*` tags and pick the highest semver instead of trusting the first item from a list endpoint.
Bonus cleanup: extracts `parse_semver` to module scope so `is_newer` and the new `pick_highest_version` share parsing.
Test plan
🤖 Generated with Claude Code