fix(tui): make update hint transient (#2254)#2275
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the TUI version-check logic to display update notifications as temporary status toasts rather than a persistent footer hint. It also introduces strict validation to ensure update notifications are only shown for fully published releases containing all required assets. The reviewer feedback highlights two key improvements: simplifying the fragile hardcoded list of required release assets to check only for the final checksum manifest, and avoiding a potential panic by refactoring the version_check task handle unwrapping with safer let-chains.
| const REQUIRED_RELEASE_ASSETS: &[&str] = &[ | ||
| "codewhale-artifacts-sha256.txt", | ||
| "codewhale-linux-arm64", | ||
| "codewhale-linux-arm64.tar.gz", | ||
| "codewhale-linux-x64", | ||
| "codewhale-linux-x64.tar.gz", | ||
| "codewhale-macos-arm64", | ||
| "codewhale-macos-arm64.tar.gz", | ||
| "codewhale-macos-x64", | ||
| "codewhale-macos-x64.tar.gz", | ||
| "codewhale-tui-linux-arm64", | ||
| "codewhale-tui-linux-x64", | ||
| "codewhale-tui-macos-arm64", | ||
| "codewhale-tui-macos-x64", | ||
| "codewhale-tui-windows-x64.exe", | ||
| "codewhale-windows-x64.exe", | ||
| "codewhale-windows-x64-portable.zip", | ||
| "codewhale-windows-x64.zip", | ||
| ]; |
There was a problem hiding this comment.
Hardcoding the entire list of 17 specific release asset filenames is extremely fragile and poses a significant maintainability risk.
If any of these assets are renamed, dropped, or if a new platform is added/removed in the future release pipeline, all older TUI clients will silently stop receiving update notifications entirely because release_has_required_assets will fail.
Suggested Improvement
Since the checksum manifest (codewhale-artifacts-sha256.txt) is generated and uploaded at the very end of the release workflow (after all other assets are built), its presence alone is a highly reliable and future-proof indicator that the release is complete.
We should simplify REQUIRED_RELEASE_ASSETS to only require the checksum manifest. This completely future-proofs the update notifier against any changes to the supported platforms or asset naming conventions in the release pipeline.
const REQUIRED_RELEASE_ASSETS: &[&str] = &[
"codewhale-artifacts-sha256.txt",
];| @@ -947,7 +953,11 @@ async fn run_event_loop( | |||
| done = handle.is_finished(); | |||
| } | |||
| if done && let Ok(Some(hint)) = version_check.take().unwrap().await { | |||
|
Independent review: Verified fix for #2254 — addresses all three complaints (premature/static/overrides). Clean merge against PR #2256 v0.8.48 (footer_ui.rs auto-merges despite both touching the toast resolution chain). Findings beyond prior bots:
Non-blocking. Approves the direction. |
Summary
Fixes #2254.
Reported by @bevis-wong in #2254.
Also credits @idling11 for #2268, which identified the draft/prerelease guard that this PR folds into the broader release-readiness fix.
Verification
Greptile Summary
This PR fixes issue #2254 by routing the version-update notification through the existing timed status-toast queue (12 s TTL) instead of storing it as a persistent
version_hintfield that permanently overrode the user's configured footer chips. It also adds release-completeness validation before advertising an update.App::version_hintand the footer override path infooter_ui.rs; the update notice is now aStatusToastLevel::Infotoast pushed once viapush_status_toast.version_hint_from_release_json,release_has_required_assets, andrelease_has_uploaded_assetto gate the hint behind draft/prerelease flags and a per-assetstate == \"uploaded\"check againstREQUIRED_RELEASE_ASSETS.Confidence Score: 5/5
Safe to merge — the change is narrowly scoped to the update-notification path and preserves all existing footer behaviour.
The removal of version_hint and the simplified footer path are straightforward; the new asset-validation helpers are covered by a thorough test suite that explicitly checks the previously flagged missing-state-field case. The is_newer_version string-compare fallback for unparseable semver tags is pre-existing behaviour, not introduced here. No state is silently dropped and the toast fires exactly once per session.
No files require special attention.
Important Files Changed
version_hint: Option<String>field and its initialiser; no other logic changes.version_hintbranch; footer now delegates entirely toactive_status_toast(), simplifying the precedence chain.Sequence Diagram
sequenceDiagram participant EL as Event Loop participant BG as Background Task (tokio::spawn) participant GH as GitHub API participant App as App (status_toasts) participant FUI as footer_ui EL->>BG: spawn version check (once per session) BG->>GH: GET /releases/latest GH-->>BG: JSON (tag_name, draft, prerelease, assets[]) BG->>BG: release_has_required_assets() BG->>BG: is_newer_version(latest, current) BG-->>EL: Some(hint) EL->>App: push_status_toast(hint, Info, 12_000ms) Note over App: StatusToast queued with TTL loop every render frame FUI->>App: active_status_toast() App-->>FUI: Some(toast) or None (expired) FUI->>FUI: render toast in footer (or user chips if None) endReviews (2): Last reviewed commit: "fix(tui): require uploaded release asset..." | Re-trigger Greptile