forestui icon indicating copy to clipboard operation
forestui copied to clipboard

Update checks have no HTTP timeout, and persistent failures are silent while re-downloading every launch

Open flipbit03 opened this issue 3 months ago • 1 comments

Found during the review of #34 (see the "out of scope" section there); the code landed in #32.

Two related robustness gaps in src/version_check.rs:

1. No timeout on either reqwest client (:116 release lookup, :173 asset download — both reqwest::Client::new()). On a network that accepts the TCP connection but never responds (unresponsive corporate proxy, captive gateway dropping packets after SYN-ACK), the background update task parks forever. The failure is never cached — write_cache only runs on success — so every launch spawns another永-hanging task holding a socket, and the user never sees an update notification because latest_version() never resolves.

Fix: Client::builder().timeout(...) — something like 10 s for the version lookup and a more generous cap (60–120 s) for the asset download. A connect_timeout too.

2. Persistent, actionable failures are silent — and expensive. check_for_update does if let Ok(Some(..)), dropping every Err. The silence is deliberate for the offline case, and right for it — but a persistent failure is different: with an unwritable install dir (e.g. FORESTUI_INSTALL_DIR=/usr/local/bin, root-owned, which install.sh supports), install_from downloads the complete multi-MB asset and then fails at the staged write — on every single launch, forever. The user is never told an update exists or that installing it failed, and the bandwidth is spent each start.

Fix sketch: distinguish transient from persistent errors. On a failure after a successful version lookup (i.e. we know an update exists but could not install it), (a) still write the version cache so the download is not retried before the next release/cache expiry, and (b) surface one notification — "forestui vX is available but could not be installed: " — which fits the existing philosophy: being offline is not the user's problem, but a permissions error is theirs to fix and invisible today.

flipbit03 avatar Aug 15 '26 13:08 flipbit03

Groomed for the ship-a-thon train (slot 2) — one PR with #36/#37. Timeouts: ~10s (+connect timeout) on the version lookup, ~90s on the asset download. Persistent post-lookup failure surfaces one notification ("vX available but could not be installed: "); the version cache is already written at that point so no re-download before expiry. Deliberately NOT caching failed lookups: it's one cheap API call, and caching failures would delay update detection by 24h once connectivity returns.

flipbit03 avatar Aug 15 '26 22:08 flipbit03