Close two holes left by the update-install bypass - #118
Merged
Conversation
`quitAndInstall` reports nothing when an install fails - it just does not quit - and the handler was reporting success either way, so one failed update left `closeConfirmed` set for the rest of the session and the next close took the interview with it silently. That is the failure the guard exists to stop, so `rearmCloseGuardIfStillRunning()` puts it back unless `before-quit` has fired. Keyed on `quitting` rather than a window count: re-arming a quit that is under way would veto the close it just approved. And `UpdateNotification` was reading `hasHistory` through `useSaveHistoryGuard`, which subscribes to the app state - a new object several times a second during an interview. The component re-rendered and re-armed its status effect on every ASR partial to answer a question it only asks on a click. It reads the flag over `appState.get()` at that click instead, which is also where the flag is derived rather than one broadcast behind. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #115/#117 after a second review pass on
mainpost-merge.Guard never re-armed after a failed install
autoUpdaterService.quitAndInstall()reports whether it started an install (true/false), butelectron-updater's ownquitAndInstall(false, true)says nothing when the install itself fails downstream - it simply does not quit. The handler was returningsuccess: truefor "started" regardless, soallowNextClose()stayed set with nothing ever putting it back.Concretely: update downloads, user clicks Restart, the install fails for any reason (disk permissions, AV interference, whatever), the app is still running - and now sits there with the close guard permanently disarmed. The next Clear or Start still asks, but the window closes without a word, silently dropping whatever interview follows.
rearmCloseGuardIfStillRunning()schedules a check 5s out and puts the guard back unlessbefore-quitfired in that window. Keyed on thequittingflag rather than a window count, since re-arming a quit that legitimately started would veto the close it had just approved.UpdateNotificationwas subscribed to app state for no reasonIt read
hasHistorythroughuseSaveHistoryGuard, which subscribes to the full app-state broadcast - during an interview, a new object several times a second (every ASR partial, every streamed token). That re-renderedUpdateNotificationon the same cadence, which re-ran its status effect and itslastStatusRefbookkeeping constantly, for a flag it only needs once, on a button click that happens at most a few times per app lifetime.Now reads
hasHistoryviaelectron.appState.get()at the moment the Restart/Open Installer button is clicked - which is also where the flag is derived, rather than a broadcast tick behind.Checks
pnpm lint, bothtscconfigs,pnpm build,pnpm test:mainpass locally.test/save-history.test.mjsgains source-level checks for the re-arm path and forUpdateNotificationno longer importinguseSaveHistoryGuard.🤖 Generated with Claude Code