Skip to content

feat: add desktop auto-update flow and settings controls#29

Merged
alhaymex merged 1 commit intomainfrom
feat/auto-update
Mar 19, 2026
Merged

feat: add desktop auto-update flow and settings controls#29
alhaymex merged 1 commit intomainfrom
feat/auto-update

Conversation

@alhaymex
Copy link
Copy Markdown
Owner

@alhaymex alhaymex commented Mar 19, 2026

  • add UpdateManager with launch-time checks, download/apply actions, and RPC endpoints
  • add Settings UI + React hooks for auto-update toggle, check/download/install states
  • configure release asset publishing and updater base URL for GitHub-hosted artifacts

Summary by CodeRabbit

New Features

  • Added automatic update checking on application launch
  • Added toggle in settings to enable/disable automatic updates
  • Added manual update check capability with status display showing current and available versions
  • Added update download and installation workflow with error handling
  • Application now retrieves updates from GitHub releases

- add UpdateManager with launch-time checks, download/apply actions, and RPC endpoints
- add Settings UI + React hooks for auto-update toggle, check/download/install states
- configure release asset publishing and updater base URL for GitHub-hosted artifacts
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2b132e40-f858-4ce4-8427-b6fedaec51fc

📥 Commits

Reviewing files that changed from the base of the PR and between 4a8346e and 2a5032b.

📒 Files selected for processing (12)
  • .github/workflows/release.yml
  • apps/desktop/electrobun.config.ts
  • apps/desktop/src/bun/index.ts
  • apps/desktop/src/bun/rpc.ts
  • apps/desktop/src/bun/runtime.ts
  • apps/desktop/src/bun/utils/engine-manager.ts
  • apps/desktop/src/bun/utils/update-manager.ts
  • apps/desktop/src/mainview/hooks/useUpdates.ts
  • apps/desktop/src/mainview/lib/rpcClient.ts
  • apps/desktop/src/mainview/screens/Settings.tsx
  • apps/desktop/src/shared/rpc.ts
  • apps/desktop/src/shared/types.ts

📝 Walkthrough

Walkthrough

This PR adds a comprehensive automatic update system to the desktop application. It introduces an UpdateManager service that handles checking, downloading, and applying updates from GitHub releases, integrates it into the application runtime, exposes update operations through RPC handlers, and updates the Settings UI with auto-update toggles and update status controls.

Changes

Cohort / File(s) Summary
Type definitions and RPC schema
apps/desktop/src/shared/types.ts, apps/desktop/src/shared/rpc.ts
Added AppUpdateStatus and AppUpdateState types to model update lifecycle states; extended AppRPCSchema with four new RPC endpoints: setAutoUpdate, getUpdateState, checkForUpdates, and applyUpdate.
Update manager and runtime integration
apps/desktop/src/bun/utils/update-manager.ts, apps/desktop/src/bun/runtime.ts
Introduced UpdateManager class that orchestrates update state, checks for updates with connectivity verification, downloads updates, and applies them; integrated it into AppRuntime with initialization and accessor methods.
RPC handler and client layer
apps/desktop/src/bun/rpc.ts, apps/desktop/src/mainview/lib/rpcClient.ts
Added RPC request handlers in the Bun process that delegate to UpdateManager; added corresponding RPC client methods in the frontend for invoking update operations.
Frontend update UI and hooks
apps/desktop/src/mainview/hooks/useUpdates.ts, apps/desktop/src/mainview/screens/Settings.tsx
Introduced useUpdateState and useUpdateActions React Query hooks; refactored Settings component to display update status, auto-update toggle, and contextual update/install buttons with error handling.
Configuration and infrastructure
.github/workflows/release.yml, apps/desktop/electrobun.config.ts, apps/desktop/src/bun/index.ts, apps/desktop/src/bun/utils/engine-manager.ts
Updated GitHub release workflow to upload all artifacts from apps/desktop/artifacts/*; added release.baseUrl config pointing to GitHub releases; triggered auto-update on application launch; redirected engine binary URLs from Vercel to GitHub releases.

Sequence Diagram(s)

sequenceDiagram
    participant React as React UI
    participant RPC as RPC Handler
    participant UM as UpdateManager
    participant Net as Network
    participant Updater as Updater API
    
    rect rgba(100, 150, 200, 0.5)
    Note over React,Updater: Check For Updates Flow
    React->>RPC: checkForUpdates(autoDownload)
    RPC->>UM: checkForUpdates()
    UM->>UM: syncAutoUpdateSetting()
    UM->>Net: HEAD request to base URL
    Net-->>UM: connectivity status
    UM->>Updater: checkForUpdate()
    Updater-->>UM: update available?
    UM->>UM: update state to "available"
    opt autoDownload enabled
        UM->>Updater: downloadUpdate()
        Updater-->>UM: download progress/complete
        UM->>UM: update state to "ready"
    end
    UM-->>RPC: AppUpdateState
    RPC-->>React: update state
    end
    
    rect rgba(200, 150, 100, 0.5)
    Note over React,Updater: Apply Update Flow
    React->>RPC: applyUpdate()
    RPC->>UM: applyUpdate()
    UM->>Updater: updateInfo()
    Updater-->>UM: confirm ready
    UM->>Updater: applyUpdate()
    Updater-->>UM: success
    UM-->>RPC: { accepted: true }
    RPC-->>React: confirmation
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #22: Introduced the runtime, index, and RPC scaffolding that this PR builds upon by adding UpdateManager integration and update-specific RPC handlers.

Poem

🐰 A rabbit's wish, now update complete,
With GitHub releases, so neat and sweet,
Auto-updates hop along with care,
No stale versions anywhere,
Fresh as lettuce, always fair! 🥬

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-update
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@alhaymex alhaymex merged commit 6f4d2f5 into main Mar 19, 2026
4 of 5 checks passed
@alhaymex alhaymex deleted the feat/auto-update branch March 19, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant