Extract the desktop auto-update policy into a shell-neutral crate and add a GPUI feed backend
Closed
DE
2mo ago+1653+1653+0123456789012345678901234567890123456789-354-354-012345678901234567890123456789
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
tickis the formercheck_and_downloadverbatim (same return-value semantics), now unit-tested with a mock backend (disabled, meeting active, check error, cached install, download failure,UpdateNotNewer).plugins/updater2becomesTauriUpdateBackend/TauriUpdateEventsovertauri_plugin_updaterand the existing specta events; commands, events, store keys, macOS startup migration and generated bindings/permissions are unchanged.- GPUI
apps/desktop-gpui/src/updater.rs:FeedUpdateBackendspeaking tauri-plugin-updater's feed protocol ({{target}}/{{arch}}/{{current_version}}substitution, 204 → no update,platforms.<target>-<arch>manifest, semver-newer check, streamed download verified withminisign-verifyagainst the configured pubkey). Endpoints/pubkey come fromANARLOG_UPDATER_ENDPOINTS/ANARLOG_UPDATER_PUBKEYat build time; the 30-minute tick is wired into the workspace with the automatic-updates setting (default on).installdeliberately returns an error — replacing the running binary is per-platform work for a later PR — andmeeting_activeisfalseuntil GPUI has recording state.
Verification
cargo test --locked -p desktop-updater(7) + clippy--all-targets --no-deps -- -D warningscargo test --locked -p tauri-plugin-updater2;git diff --exit-code plugins/updater2/js plugins/updater2/permissionsclean/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