Repository navigation
Description
Problem Statement
When RAxML-GUI finds an update and the user clicks Yes in Found Updates, nothing visible happens until Install Updates appears. On a slow connection that can take minutes. The user can't tell whether the download is running, stuck, or broken. The user may start a run that dies when the app quits to install, or may quit the app and drop the download. Progress existed before the shell migration (through electron-progressbar). It was removed because that library needs Node in its window, and the standing rule keeps nodeIntegration off, context isolation on, and sandbox on.
Solution
During the Update download (the stretch from accepting Found Updates until Install Updates appears), the main page shows a small modal dialog titled Downloading update. It has a progress bar, a percent, and one status line. The Dock (macOS) or taskbar (Windows, Linux) icon shows the same progress. The dialog can't be dismissed. When the download finishes, the native Install Updates dialog takes over as it does today. If the download fails, the dialog closes, the Dock/taskbar bar clears, and the existing native error box appears. This works on all three packaged targets: macOS zip, Windows NSIS, and Linux AppImage. It covers both full and differential downloads.
User Stories
- As a user who clicked Yes in Found Updates, I want a dialog to appear at once, so that I know my choice was accepted.
- As a user waiting for the first bytes, I want an animated (indeterminate) bar with "Starting…" and "Connecting to the update server…", so that I know the app is working before any progress figures arrive.
- As a user downloading an update, I want a bar that fills with the download and a rounded percent beside it, so that I can judge how long is left.
- As a user downloading an update, I want the status line to say "RAxML-GUI will quit and install when the download finishes.", so that I'm not surprised when the app closes.
- As a user, I want the dialog to have no close button and to ignore Escape, so that I can't hide it and then start a run that dies when the app quits to install.
- As a user, I want the dialog titled Downloading update, so that I know what it is at a glance.
- As a user whose differential download falls back to a full one, I want the status line to read "Retrying with the full download…" when the bar jumps back, so that the backwards jump doesn't look like a bug.
- As a user whose download reaches 100%, I want the status line to read "Download complete. Preparing to install…", so that I know the next step is the install.
- As a user whose download is so fast that only the 100% event arrives, I want the dialog to go straight to the complete state, so that it never shows a misleading partial value.
- As a user, I want the native Install Updates dialog to appear after the download as it does today, so that the install flow I know is unchanged.
- As a user who switched to another app, I want the Dock or taskbar icon to show download progress, so that I can follow it without bringing RAxML-GUI to the front.
- As a user who minimised RAxML-GUI, I want the Dock/taskbar bar to keep updating, so that I can follow progress while the page is hidden.
- As a macOS or Windows user, I want the Dock/taskbar bar to be indeterminate while connecting, so that it matches the dialog's connecting state.
- As a Linux user, I want the taskbar bar to stay empty while connecting and then fill with the download, so that my desktop isn't sent a state it can't show.
- As a user whose download finishes, I want the Dock/taskbar bar to clear, so that no stale progress stays on the icon.
- As a user whose download fails, I want the dialog to close, so that I'm not left staring at a stuck bar.
- As a user whose download fails, I want the Dock/taskbar bar to clear, so that the icon doesn't suggest a download is still running.
- As a user whose download fails, I want the same native error box as today, so that I see what went wrong.
- As a macOS user who closed the main window during the download and then reopened it from the Dock, I want the reopened page to show the dialog at the current progress, so that I don't lose track of the download.
- As a macOS user who reopened the window, I want the Dock bar to show the current progress again, so that the icon and the dialog agree.
- As a macOS user with no window open during the download, I want the app to leave the window closed, so that a background download doesn't force a window on me.
- As a macOS user with no window open, I want Install Updates to still appear when the download finishes, so that the update still installs.
- As a Windows or Linux user who closes the main window during the download, I want the app to quit as it does today, with no prompt, so that closing behaves the way I expect. The next launch offers the update again.
- As a user whose page reloads mid-download (for example from the reload menu item), I want the dialog to come back at the current progress, so that a reload doesn't hide the download.
- As a user who clicked No in Found Updates, I want no dialog and no Dock/taskbar bar, so that declining changes nothing.
- As a user with no update available, I want no dialog and no bar, so that launch stays quiet.
- As a user, I want the dialog to show no byte counts, so that I'm not misled by differential totals that count only the bytes fetched.
- As a maintainer, I want one log line when the download starts and one when it finishes or fails, so that support logs show the outcome without one line per progress event.
- As a maintainer, I want the rejection from starting the download caught, so that a failed download doesn't also throw an unhandled rejection to Sentry. The
errorlistener already reports it. - As a maintainer, I want the page to stay free of Node (
nodeIntegrationoff, context isolation on, sandbox on), so that the security rule holds. - As a maintainer, I want progress to reach the page through
rendererBridgelike every other main-to-page event, so that there is one bridge pattern to learn. - As a maintainer, I want no second window, renderer entry, or preload, so that packaging stays as it is.
- As a maintainer, I want the progress listener registered before the download starts, so that
electron-updaterattaches its progress reporting at all. - As a maintainer, I want Vitest coverage of the main-side state and bar calls, so that the behaviour is pinned without an update server.
- As a maintainer, I want preload proofs for the new subscription and the one-shot call, so that the bridge contract is checked in a real Electron launch.
- As a maintainer, I want a page test of the dialog's four texts, so that the copy and the state handling are pinned.
Implementation Decisions
Update download state (main-held). The main process holds the current Update download state. It has five values, in this shape:
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 firedThe type lives where both sides can import it, beside the other rendererBridge types in common.
Transitions:
- Yes in Found Updates:
idle→connecting. - A
download-progressevent: the state becomesdownloadingwith that event'spercent. When the new percent is lower than the previous one, the state becomesrestarted, which stays sticky for the rest of the download. Apercentof 100 counts asdownloadingat 100 untilupdate-downloadedfires. update-downloaded: the state becomesdone.errorwhile the state is notidle: the state goes back toidle.
The page shows 100% as the complete text even before update-downloaded fires. This covers user story 9.
Updates module (main). It keeps checkForUpdates as it is. listenForUpdates gains a third argument, a function that returns the current main window or null, because on macOS the window comes and goes. Each state change does three things: it updates the held state, sends the state to that window's page through a new event channel when a window exists, and applies the Dock/taskbar value to that window:
connecting: indeterminate (setProgressBar(2)).downloadingandrestarted:percent / 100.doneandidle: clear (setProgressBar(-1)).- Linux: skip the indeterminate value, because Linux can't show it. The bar stays untouched until the first event.
The download-progress listener is registered inside listenForUpdates at setup time, before any download can start. The module also exposes a getter for the held state, which the one-shot handler uses.
On Yes: set the state to connecting, log one start line, then call downloadUpdate() and catch its rejection, swallowing it the way checkForUpdates does.
On error during a download, in this order:
- Set the state to
idle. - Send
idleto the page, which closes the dialog. There is no separate failure event. - Call
setProgressBar(-1). - Show the existing native error box, unchanged.
Log one line when the download ends, whether it finishes or fails. Keep the existing per-event logs (checking, available, not available, error, downloaded). Don't log progress events.
Main entry. It passes a window getter (the existing mainWindow variable) to listenForUpdates. When it creates a window, it applies the held state's Dock/taskbar value to the new window, so a reopened macOS window gets the bar back.
Renderer bridge, following docs/agents/renderer-bridge.md:
- New subscription
onUpdateDownload(listener)on a new channel, using the existingonEventpattern. It returns an unsubscribe, allows more than one listener, and putsidon the payload. The payload is theUpdateDownloadstate. - New one-shot call
getUpdateDownload()on a new channel (ipcMain.handle, likegetVersion). It resolves the held state. The page calls it once when it starts, so a reloaded or reopened page shows the dialog at the current state. - Channel names go in the shared ipc constants and are imported by the preload and main.
RendererBridgeand the globalWindowtyping gain both methods.
Page.
- The store holds the latest
UpdateDownloadstate, seeded once fromgetUpdateDownload()and updated byonUpdateDownload. Wire this up where the store already starts its other bridge listeners. - A new
UpdateDownloadDialogcomponent, rendered on the main page, reads that state. It is open whenever the status is notidle. - It uses an MUI
DialogwithmaxWidth="xs",disableEscapeKeyDown, no close button, and a backdrop click that does nothing. The title is Downloading update.
What the dialog shows (copy fixed by the prototype in #390):
| State | Bar | Percent text | Status line |
|---|---|---|---|
connecting |
indeterminate LinearProgress |
"Starting…" | "Connecting to the update server…" |
downloading (<100) |
determinate, value=percent |
rounded percent, e.g. "42%" | "RAxML-GUI will quit and install when the download finishes." |
restarted (<100) |
determinate | rounded percent | "Retrying with the full download…" |
percent 100, or done |
determinate at 100 | "100%" | "Download complete. Preparing to install…" |
No bytes are shown anywhere.
Unchanged:
- The Found Updates and Install Updates native dialogs and their copy.
autoDownload = false,autoInstallOnAppQuit = false, and thequitAndInstallhand-off.- Window close behaviour on every platform.
pageWindowPreferences.- No new dependency.
Testing Decisions
A good test drives the outside of a seam and asserts what the user or the next layer sees: the bar values sent to the window, the payloads sent to the page, the dialog's text. It doesn't assert internal variables or call order inside a component. All three seams already exist, and the spec adds none.
-
Vitest on the updates module. Use the existing fake updater, plus a fake window recording
setProgressBarandwebContents.send. Assert:- after Yes, the bar gets
2(on a non-Linux platform) and the page getsconnecting; - each
download-progressevent sets the bar topercent / 100and sendsdownloading; - a lower percent sends
restarted; update-downloadedsendsdoneand sets the bar to-1;errormid-download sendsidle, sets the bar to-1, then shows the error box, in that order;- a rejected
downloadUpdate()produces no unhandled rejection; - with a getter returning
null, nothing throws and the held state still advances; - on Linux the indeterminate
2is never sent.
Two existing tests must change. Rewrite "Yes downloads the update with no window, bar, or percent" into the behaviour above. Rewrite or delete the source-scan test "the shell opens no update progress window" (it forbids
download-progress), keeping itselectron-progressbarabsence checks. Prior art: the existing tests in that file. - after Yes, the bar gets
-
Preload proofs. Add one subscription proof file for
onUpdateDownload(subscribe: true, with adownloadingpayload includingid) and one one-shot proof forgetUpdateDownload. The existing launch in the preload test walks them. Prior art: theonUnhandledErrorandgetVersionproof files. -
Page test. Render the page with
installBridgestubbingonUpdateDownloadandgetUpdateDownload. Pushconnecting,downloading42,restarted10, anddone, and assert the title, the percent text, and the status line for each. Pushidleand assert the dialog is gone. Also cover the startup ask: agetUpdateDownloadthat resolvesdownloadingopens the dialog without any event. Prior art: the unhandled error page test, and the version store test for the one-shot ask. -
No e2e. There is no update server to point a built app at.
Out of Scope
- Cancelling a download in flight. A started download keeps running.
- A confirmation prompt when a Windows or Linux user closes the window mid-download.
- Forcing a window open on macOS when none exists during a download.
- Showing bytes, speed, or time remaining.
- A separate update window, a second renderer entry, or a second preload.
- A menu item to check for updates manually.
- Any change to the Found Updates or Install Updates dialogs.
- Logging individual progress events.
Further Notes
- Map: Map: update download progress #387. Decisions: Does electron-updater report download progress on every target #388 (electron-updater reports progress on every target, full and differential, if the listener is registered before
downloadUpdate()), Where download progress shows: its own window or the main page #389 (in-page dialog plussetProgressBar), What the download progress looks like #390 (variant A, copy), Update download with no main window on macOS #391 (no-window macOS, reopen asks once, Dock bar states), Failure, tests and logging for the update download #392 (failure order, tests, logging). - Throwaway prototype of the dialog: branch
prototype/update-download-progress. Screenshots are on What the download progress looks like #390. Don't merge it. electron-updatercaveats from Does electron-updater report download progress on every target #388 that the state model absorbs: a download under 1 s sends only the 100% event, and a cached update sends no progress and firesupdate-downloadeddirectly. In both cases the page goes fromconnectingstraight to the complete text.- Glossary term: Update download. Avoid "update progress" and "download window".
Activity
jtklein-agents commentedon Nov 27, 2026
Shipped upstream in AntonelliLab#528 (2dbadc8).