Skip to content

Track the Update download in main and show it on the Dock/taskbar icon #394

Done

Description

@jtklein-agents

Parent

#393

What to build

During an Update download (from Yes in Found Updates until Install Updates appears), the main process tracks the download state and the Dock (macOS) or taskbar (Windows, Linux) icon shows its progress. No page dialog yet; that is the next ticket.

Main holds one UpdateDownload state, a type that lives in common beside the other rendererBridge types so the page can import it later:

type UpdateDownload =
  | { status: 'idle' }                           // not started / reset after failure
  | { status: 'connecting' }                     // Yes clicked, no progress event yet
  | { status: 'downloading'; percent: number }
  | { status: 'restarted'; percent: number }     // differential fell back to full
  | { status: 'done' };                          // update-downloaded fired

Transitions: Yes → connecting; each download-progress → downloading with its percent, or restarted (sticky for the rest of the download) when the percent drops; update-downloaded → done; error while not idle → idle.

listenForUpdates takes a third argument, a getter for the current main window or null. Each state change applies the bar to that window: connecting indeterminate (2, skipped on Linux), downloading/restarted percent / 100, done/idle cleared (-1). The download-progress listener is registered at setup, before any download can start. The module exposes a getter for the held state. The main entry passes its window getter and applies the held state's bar to each window it creates, so a reopened macOS window gets the bar back.

On Yes: set connecting, log one start line, call downloadUpdate() and swallow its rejection (the error listener already reports it). On error mid-download, in order: set idle, clear the bar, show the existing native error box unchanged. Log one line when the download finishes or fails; no per-progress logs.

Unchanged: the Found Updates and Install Updates dialogs, autoDownload/autoInstallOnAppQuit, quitAndInstall, window close behaviour, pageWindowPreferences, no new dependency.

Acceptance criteria

  • UpdateDownload type exported from common beside the rendererBridge types
  • After Yes, the window's bar gets 2 on a non-Linux platform; on Linux 2 is never sent
  • Each download-progress sets the bar to percent / 100; a lower percent moves the state to restarted, which stays sticky
  • update-downloaded sets the state to done and the bar to -1
  • error mid-download sets the state to idle, the bar to -1, then shows the error box, in that order
  • A rejected downloadUpdate() produces no unhandled rejection
  • With a window getter returning null, nothing throws and the held state still advances
  • A newly created main window gets the held state's bar value
  • One log line at download start, one at finish or failure; no progress-event logs
  • Vitest covers the above with the existing fake updater and a fake window recording setProgressBar
  • The test "Yes downloads the update with no window, bar, or percent" is rewritten to this behaviour; the source-scan test "the shell opens no update progress window" drops its download-progress ban and keeps its electron-progressbar absence checks

Activity

  1. added
    ready-for-agent
    on Nov 27, 2026
  2. jtklein-agents commented on Nov 27, 2026

    @jtklein-agents
    OwnerAuthor

    Merged into spec/393-update-download-progress via #397.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions