Extract the desktop auto-update policy into a shell-neutral crate and add a GPUI feed backend

Closed
DE
2mo ago
+1653-354

Summary

Problem: ANLG-320 Phase 6 (updater). The auto-update behaviour that matters for users — install-at-open intent, meeting deferral, cached-<version>.bin handling and pruning, the download mutex, the newer-than-current guard — lived inside plugins/updater2 interleaved with tauri_plugin_updater calls and Tauri event emission, so GPUI could not reuse it.

Fix: Move that policy into a new crates/desktop-updater (anlg-desktop-updater) behind two small traits and make both shells adapters over it:

pub trait UpdateBackend { async fn check(&self) -> Result<Option<String>>; async fn download(&self, version, on_progress) -> Result<Vec<u8>>; fn install(&self, version, bytes) -> Result<()>; }
pub trait UpdateEvents  { fn available / downloading / progress / download_failed / ready }
pub struct Updater<B, E> { .. }  // check, has_cached_update, download, install_and_relaunch, tick(policy, install_at_open) -> bool
  • tick is the former check_and_download verbatim (same return-value semantics), now unit-tested with a mock backend (disabled, meeting active, check error, cached install, download failure, UpdateNotNewer).
  • plugins/updater2 becomes TauriUpdateBackend/TauriUpdateEvents over tauri_plugin_updater and the existing specta events; commands, events, store keys, macOS startup migration and generated bindings/permissions are unchanged.
  • GPUI apps/desktop-gpui/src/updater.rs: FeedUpdateBackend speaking tauri-plugin-updater's feed protocol ({{target}}/{{arch}}/{{current_version}} substitution, 204 → no update, platforms.<target>-<arch> manifest, semver-newer check, streamed download verified with minisign-verify against the configured pubkey). Endpoints/pubkey come from ANARLOG_UPDATER_ENDPOINTS/ANARLOG_UPDATER_PUBKEY at build time; the 30-minute tick is wired into the workspace with the automatic-updates setting (default on). install deliberately returns an error — replacing the running binary is per-platform work for a later PR — and meeting_active is false until GPUI has recording state.

Verification

  • cargo test --locked -p desktop-updater (7) + clippy --all-targets --no-deps -- -D warnings
  • cargo test --locked -p tauri-plugin-updater2; git diff --exit-code plugins/updater2/js plugins/updater2/permissions clean
  • /home/ubuntu/gpui-cargo.sh test --locked -p desktop-gpui (465, incl. manifest parsing for darwin/linux/windows keys, 204 handling, and the tauri-plugin-updater minisign test vector) + clippy -D warnings
  • rustfmt/dprint on changed files, git diff --check
  • Not exercised against a real release feed.

Link to Devin session: https://app.devin.ai/sessions/f83ed73d85c648fcbdbd041cd4f15720
Open in Devin Desktop: https://app.devin.ai/desktop/session/f83ed73d85c648fcbdbd041cd4f15720?variant=devin
Requested by: @ComputelessComputer