feat(updater): add PinnedVersion config for pinning to a specific release#4
Merged
Conversation
…ease
Add Config.PinnedVersion field that locks the updater to an exact
release tag. When set, the updater fetches the release via
/releases/tags/{tag} instead of /releases/latest, applies it if
the current install differs, then idles — it will not chase newer
releases. Clear the field to resume auto-updating.
Includes:
- checkPinnedVersion() path in checkOnce() — early return when pinned
- fetchReleaseByTag() using the GitHub releases/tags/{tag} endpoint
- Refactored fetchLatestRelease() → fetchRelease(tag) internally
- 5 new tests covering: already-installed no-op, installs-when-different,
invalid-version error handling, by-tag fetch, tag-not-found error
- README updated with pinning usage examples
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Three new end-to-end tests exercising the full lifecycle: - TestE2E_PinnedVersionLifecycle: 5-step lifecycle covering pin, un-pin, downgrade pin, re-pin, already-pinned no-op - TestE2E_PinnedVersionStaysPinnedAcrossTicks: verifies that a pinned version does not auto-update across multiple ticks even when a newer release exists - TestE2E_NoPinFollowsLatest: verifies the default behaviour (no pin) still follows the latest release
Collaborator
|
✅ Merged cleanup complete.
🤖 matthew-pilot — merged-cleanup handler |
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
Adds a
PinnedVersionfield toConfigthat locks the updater to a specific release tag instead of always chasing/releases/latest.Why
Currently the updater can only auto-follow the latest release. There's no way to:
How
Config.PinnedVersion string— when set (e.g."v1.10.5"), the updater fetches that exact release viaGET /repos/{repo}/releases/tags/{tag}, installs it if different from current, then idles. Clear it to resume auto-updating.checkOnce()short-circuits tocheckPinnedVersion()when pinnedfetchReleaseByTag(tag)added alongside existingfetchLatestRelease()fetchRelease(tag)(empty tag →/latest)Tests
5 new tests, all passing:
TestCheckPinnedVersion_AlreadyInstalled— no network call when already on pinned versionTestCheckPinnedVersion_InstallsWhenDifferent— fetches and applies pinned releaseTestCheckPinnedVersion_InvalidVersion— unparseable pin logs error, doesn't panicTestFetchReleaseByTag— hits correct API endpointTestFetchReleaseByTag_NotFound— 404 on non-existent tag