Skip to content

Complete the launcher update task only when the download lands - #208

Merged
Pixnop merged 1 commit into
devfrom
fix/updater-and-popup-review-findings
Aug 22, 2026
Merged

Complete the launcher update task only when the download lands#208
Pixnop merged 1 commit into
devfrom
fix/updater-and-popup-review-findings

Conversation

@Pixnop

@Pixnop Pixnop commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #200 from Zaldaryon's review batch. The launcher update task had two routes to completed: the update-downloaded event, and a progress tick reading 100. Since progress is rounded up, a 99.6 percent tick reported 100 and completed the task while bytes were still moving, and on Windows while the installer signature was still being verified, so a later verification failure would flip an already-completed task back to failed.

The progress listener's completion arm is gone. update-downloaded was already completing the task and is now the only thing that can. Math.round stays: flooring would hide the symptom without removing the second route, and with no tick able to complete anything, a bar reading 100 for the last moment is honest rather than misleading. The existing test that asserted completion on a final tick of 100 encoded the bug and now asserts the opposite; reinstating the deleted arm fails it.

Two notes on the rest of that review batch. #199 is not here: Zaldaryon fixed it in #210 at the same place this branch originally did (the shared readModDetail guard), so that commit was dropped rather than duplicated. #201 needs no change and is closed with the reasoning: electron-updater's constructor attaches its own error listener before our code runs and autoUpdater.logger is assigned at module scope outside the guard, so errors always reach the redacting logger; our listener only resets download state and drives UI, and when canAutoUpdate refuses there is no flow for it to act on, since checkForUpdates is only called in the ok branch and both DOWNLOAD_UPDATE and UPDATE_AND_RESTART refuse on flags only settable from listeners inside the guarded registration.

… lands (#200)

The main process rounds the download percentage before it reaches the renderer,
so a tick at 99.6 percent arrived as 100 and the task listener treated that as
the download finishing. Bytes were still moving at that point, and on Windows
the last stretch overlaps the installer signature check, so the task list could
show Completed while the update was not yet on disk.

The progress listener now only ever moves the bar. update-downloaded, which
fires when electron-updater has the verified file, is the only route to the
completed state.
@Pixnop
Pixnop force-pushed the fix/updater-and-popup-review-findings branch from 18b99dd to ff14943 Compare August 22, 2026 12:15
@Pixnop Pixnop changed the title fix: three findings from the update and mod-popup reviews Complete the launcher update task only when the download lands Aug 22, 2026

@Zaldaryon Zaldaryon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out ff14943 in an isolated worktree: typecheck, lint:ci, format:check all clean, and the targeted test file passes 14 of 14 including the new one pinning the fix.

The removal is the whole fix and it is correct: update-downloaded was already completing the task through its own listener, so deleting the progress-tick completion arm leaves exactly one route to completed, closing the race this PR describes without touching the rounding it deliberately leaves alone. The updated test asserts the state that matters, progress at 100 with the task still in-progress and no Discard button, then fires the downloaded event and checks completion, which is a stronger assertion than the one it replaced.

No blocking findings. Approving.

@Pixnop
Pixnop merged commit 01842ee into dev Aug 22, 2026
7 checks passed
@Pixnop
Pixnop deleted the fix/updater-and-popup-review-findings branch August 22, 2026 12:42
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.

2 participants