feat: wk update is version-aware - #17
Merged
Merged
Conversation
Until now `wk update` piped install.sh to sh and let install.sh resolve /releases/latest. If that redirect was still pointing at the running version (e.g. mid release-plz promotion of the next release), install.sh would dutifully reinstall the same version and the only signal the user saw was install.sh's own "Installing wk vX" line — which looks like success but is actually a silent no-op. This burned us right after v0.0.8 was published: `wk update` printed "Installing wk v0.0.7" while v0.0.8 was still being promoted, and there was no way to tell that nothing had actually changed. Resolve the target tag in `wk update` itself, before invoking the installer: - If pin (`--version`) is set, use it; otherwise read the redirect from /releases/latest exactly once. - If the resolved version equals CARGO_PKG_VERSION, short-circuit with "✓ wk X.Y.Z is the latest — nothing to do" and skip the binary shuffle entirely. `--force` overrides for users who want to reinstall the same tag (broken file, swapped dirs, etc.). - Otherwise emit a `· updating wk vA → vB` line up front, run install.sh with `WK_VERSION` pinned to the resolved tag (so install.sh doesn't re-resolve and potentially pick a different release), and on success print `✓ wk updated to vB.` Side benefit: pinning WK_VERSION removes the second redirect read inside install.sh, so the two halves of the update can't disagree. Tests cover the v-prefix helper used to feed install.sh. 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
Until now
wk updatepipedinstall.shtoshand let install.sh resolve/releases/latestitself. If that redirect was still pointing at the running version (e.g. mid release-plz promotion of the next release), install.sh would dutifully reinstall the same version and the only signal the user saw was install.sh's own `Installing wk vX` line. That looks like success but is actually a silent no-op — exactly what burned us when v0.0.8 was published: `wk update` reported `Installing wk v0.0.7` while v0.0.8 was still being promoted, with no way to tell nothing had actually changed.This PR resolves the target tag in
wk updateitself, before handing off to the installer:--versionis set, use it; otherwise read the/releases/latestredirect exactly once.CARGO_PKG_VERSION, print `✓ wk X.Y.Z is the latest — nothing to do` and skip the rename-aside / installer dance entirely.--forcefor users who want to reinstall the same tag (broken file, swapped dirs).WK_VERSIONto install.sh with the tag we just resolved so it doesn't re-resolve/releases/latestand pick a different version than the one we told the user about. (This also collapses two redirect reads into one.)Tests cover the small
v-prefix helper that builds theWK_VERSIONvalue handed to install.sh.Test plan
cargo build --releasecleancargo fmt --all -- --checkcleancargo clippy --all-targets -- -D warningscleancargo test— 32 passed (2 new)wk update --helpshows--forcewk update --checkreports current vs latestwk updateshows thevA → vBline and short-circuits cleanly when re-run after success.Followup
This works alongside #15 (atomic draft-release promotion). With #15 merged,
/releases/latestonly ever points at a fully-built release, so the silent-no-op race shrinks toward zero. This PR is still worth landing for the clearer UX even after that — the no-op short-circuit and explicit version framing make the command self-explanatory.🤖 Generated with Claude Code