Improve update release channels#2145
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for updating to beta releases by introducing a --beta flag to the update command, utilizing the semver crate to compare versions and determine if an update is necessary. The review feedback highlights a high-severity issue where the new update_is_needed check unconditionally blocks updates, which breaks the ability to force-reinstall or downgrade when using a custom mirror via environment variables. It is recommended to bypass this check when a custom mirror is configured.
| if !update_is_needed(current_version, latest_tag)? { | ||
| println!("Already up to date; no download needed."); | ||
| return Ok(()); | ||
| } |
There was a problem hiding this comment.
Unconditionally enforcing the update_is_needed check will break the ability to force-reinstall or downgrade to a specific version when using a custom mirror via DEEPSEEK_TUI_RELEASE_BASE_URL (and DEEPSEEK_TUI_VERSION).\n\nWhen a mirror is configured, the tool should bypass the version comparison check so that the user-specified version is always downloaded and installed. We should only enforce the update_is_needed check when fetching releases directly from GitHub.
if release_base_url_from_env().is_none() && !update_is_needed(current_version, latest_tag)? {\n println!("Already up to date; no download needed.");\n return Ok(());\n }
Summary
Tests
Greptile Summary
This PR introduces stable and beta release channels for
codewhale update, adds semver-based version comparison to skip redundant downloads, and includes focused unit tests for the new logic.ReleaseChannel,FetchedRelease, andReleaseSourcetypes are added toupdate.rs;run_updatenow accepts abeta: boolflag wired to a new--betaCLI argument inlib.rs.fetch_latest_beta_release_from_urlscans the/releases?per_page=100list for the first tag containing "beta";update_is_neededusessemverto guard against redundant downloads and cross-channel downgrades.--betais used, addressing a concern from the previous review thread.Confidence Score: 5/5
Safe to merge; the channel-switching and downgrade-prevention logic is well-tested and the previous review concerns have been addressed.
The core version-comparison logic in update_is_needed handles the key edge cases (stable-to-beta channel switch, cross-version downgrade prevention, RC vs beta disambiguation) and every case is backed by a unit test. The remaining observations are quality improvements rather than present defects.
crates/cli/src/update.rs — specifically the stable-channel branch of update_is_needed and the mirror-source early-exit path.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[codewhale update] -->|--beta flag| B{ReleaseChannel} B -->|Stable| C[fetch /releases/latest] B -->|Beta| D[fetch /releases?per_page=100] C --> E{Mirror env set?} D --> E E -->|Yes: Mirror| F[release_from_mirror_base_url] F --> G{channel == Beta?} G -->|Yes| H[Print mirror warning] G -->|No| I[Proceed to download] H --> I E -->|No: GitHub| J[update_is_needed?] J -->|No: already current| K[Exit: no download needed] J -->|Yes| I I --> L[Download checksum manifest] L --> M[Download + verify binaries] M --> N[Replace binaries atomically]Reviews (3): Last reviewed commit: "Prevent beta update downgrades" | Re-trigger Greptile