Updater: always install the newest published version (#740) #744
Closed
charles
wants to merge 0 commits from
fix-740-updater-always-latest into textchat
pull from: fix-740-updater-always-latest
merge into: charles:textchat
charles:main
charles:camera
charles:dailyuse
charles:textchat
charles:fix-1008-idle-in-voice
charles:camera-21-acceptance
charles:feat-1000-app-sounds-output
charles:fix-1001-local-time
charles:camera-20-parity-list-for-the
charles:fix-931-silent-voices
charles:camera-15-ui-settings-voice-video
charles:camera-14-ui-camera-buttons-camera
charles:camera-16-ui-layout-with-cameras
charles:camera-17-core-toggle-camera-shortcut
charles:camera-13-ui-mirrored-video-and
charles:camera-12-appsfluxer-camera-runtime-and
charles:camera-10-capture-camera-on-linux
charles:camera-11-capture-camera-on-windows
charles:camera-9-voice-the-camera-track
charles:camera-7-core-the-own-camera
charles:camera-6-capture-camera-trait-mode
charles:camera-8-core-remote-cameras-tile
charles:camera-3-spike-a-camera-track
charles:camera-4-video-camera-formats-and
charles:camera-18-devserver-camera-scenario
charles:camera-1-spike-capture-linux
charles:camera-5-core-camera-ports-commands
charles:camera-2-spike-capture-windows
charles:camera-plan
charles:shell
charles:fix-925-keybinds-persist
charles:feat-934-935-stream-view
charles:feat-933-stream-output-device
charles:shell-44-acceptance
charles:feat-946-select-message-text
charles:shell-43-parity-list-for-the
charles:fix-589-black-band-linux-sender
charles:shell-37-ui-system-wide-shortcuts
charles:shell-ship
charles:fix-931-voices-silent-after-long-uptime
charles:shell-39-ui-settings-notifications
charles:shell-36-ui-settings-keybinds
charles:shell-16-core-autostart
charles:fix-923-late-publication-next-share
charles:fix-921-share-teardown-publish-race
charles:shell-1-spike-iced-daemon-hide
charles:shell-10-core-instance-messages-tasks
charles:shell-11-core-keybinds-actions-combos
charles:shell-13-core-badge-attention-sound
charles:shell-14-core-notification-settings-inactive
charles:shell-18-platform-desktop-entry-and
charles:shell-2-spike-tray-on-linux
charles:shell-3-spike-wayland-global-shortcuts
charles:shell-41-devserver-shell-scenario
charles:shell-5-spike-overlay-technique-for
charles:shell-6-core-shell-ports-settings
charles:shell-7-platform-settings-shell-keybinds
charles:shell-8-core-tray-model-and
charles:shell-9-core-window-rules-close
charles:fix-913-keep-awake-retry
charles:shell-35-ui-in-window-voice
charles:shell-sync-textchat
charles:shell-34-app-shortcuts-runtime
charles:fix-913-keep-screen-awake
charles:fix-910-deepfilter-windows-timing
charles:shell-33-app-shell-runtime
charles:shell-28-platform-shortcuts-on-wayland
charles:fix-910-deepfilter-late-frame
charles:shell-29-platform-shortcuts-by-direct
charles:shell-27-platform-shortcuts-on-x11
charles:shell-17-platform-single-instance
charles:shell-24-platform-badge-displays-and-24
charles:shell-26-platform-shortcuts-on-windows
charles:shell-21-platform-tray-on-linux
charles:shell-22-platform-tray-on-windows
charles:fix-908-flaky-stream-end-test
charles:shell-30-platform-wayland-activation
charles:shell-38-ui-settings-desktop
charles:shell-19-platform-autostart
charles:shell-25-platform-shortcut-back-end
charles:shell-23-platform-badge-displays-and
charles:shell-40-ui-companion-apps-control
charles:shell-31-statusapi-default-avatars
charles:shell-12-core-system-wide-shortcut
charles:shell-20-platform-tray-trait-icons
charles:shell-32-ui-daemon-window-lifecycle
charles:shell-4-spike-raising-a-wayland
charles:shell-15-core-status-payload-gaps
charles:fix-876-share-resolution-and-bars
charles:shell-42-packaging-windows-shortcuts-and
charles:fix-874-tests-must-not-notify
charles:fix-868-deepfilternet-start
charles:gamenight-plan
charles:fix-867-869-stream-end-soundboard-limits
charles:feat-229-windows-hardware-encoding
charles:fix-857-vaapi-hardware-encoding
charles:fix-849-inert-cards
charles:fix-848-pinned-messages-clickable
charles:shell-plan
charles:fix-764-nvenc-above-720p30
charles:serveradmin
charles:feat-780-forum-archived-filter
charles:serveradmin-35-acceptance
charles:feat-781-no-join-chime-with-entrance-sound
charles:feat-784-rejoin-voice-after-update
charles:fix-779-782-search-dropdown-paste-preview
charles:fix-783-781-dm-rail-entrance-sound
charles:serveradmin-34-parity-screenshots
charles:serveradmin-31-ui-channel-permissions
charles:fix-773-cargo-deny-advisories
charles:serveradmin-33-ui-sudo-delete-transfer
charles:serveradmin-28-ui-members-page
charles:serveradmin-26-ui-role-permissions
charles:serveradmin-30-ui-voice-overview-channel-invites
charles:serveradmin-fix-27-29
charles:serveradmin-25-ui-roles-tab
charles:serveradmin-27-ui-menus-moderation-modals
charles:serveradmin-29-ui-channel-settings
charles:fix-589-stream-top-strip-encode
charles:serveradmin-24-ui-moderation-invites-bans
charles:feat-760-version-in-title
charles:fix-751-stream-audio-pipewire
charles:serveradmin-20-core-menu-rows
charles:fix-752-linux-notification-panic
charles:serveradmin-17-core-overrides
charles:serveradmin-23-ui-community-settings-overview
charles:serveradmin-12-core-roles
charles:serveradmin-19-core-sudo-delete-transfer
charles:serveradmin-32-ui-sidebar-drag
charles:serveradmin-15-core-members-page
charles:serveradmin-16-core-channel-settings
charles:serveradmin-14-core-bans-invites
charles:fix-615-restore-on-stored-session-start
charles:serveradmin-22-runtime
charles:serveradmin-13-core-member-moderation
charles:serveradmin-18-core-channel-reorder
charles:fix-732-status-api-speaking
charles:serveradmin-10-core-permission-lists
charles:serveradmin-11-core-forms-community
charles:serveradmin-21b-devserver-channels-members-sudo
charles:serveradmin-4-api-community-roles-sudo
charles:serveradmin-9b-core-hierarchy-bulk-events
charles:serveradmin-21a-devserver-community-roles
charles:serveradmin-9a-core-ports
charles:serveradmin-8-form-widgets
charles:serveradmin-5-api-channels-members-bans
charles:serveradmin-7-settings-shell
charles:serveradmin-1-proto-community-roles
charles:serveradmin-3-proto-members-bans-invites
charles:serveradmin-6-reorder-widget
charles:serveradmin-2-proto-channel-admin
charles:fix-706-presence-after-reconnect
charles:fix-615-start-on-last-view
charles:feat-663-create-channel
charles:serveradmin-plan
charles:fix-662-long-text-wrap
charles:fix-660-661-menu-toolbar-paste-focus
charles:fix-620-forum-list-reactions
charles:fix-657-windows-console
charles:fix-622-emoji-in-names
charles:fix-smoke-645-648
charles:fix-614-install-location
charles:dailyuse-41-acceptance
charles:fix/597-copy-id
charles:dailyuse-40-parity-screenshots
charles:dailyuse-35-ui-quick-switcher-keybinds
charles:dailyuse-38-ui-profile-modal
charles:fix/voice-view
charles:fix/side-panel-composer
charles:dailyuse-37b-ui-composer-barriers-blocked
charles:fix/image-viewer
charles:fix/619-picker-flicker
charles:fix/editor-forum-edit
charles:dailyuse-32-ui-status-picker
charles:dailyuse-34b-ui-add-guild-invite-modal
charles:dailyuse-28-app-dailyuse-runtime
charles:dailyuse-36-ui-voice-badge-refusals
charles:fix/594-menu-placement-textchat
charles:fix/589-stream-top-strip
charles:fix/594-menu-placement
charles:dailyuse-39-ui-report-modal
charles:dailyuse-37a-ui-attachment-audio-group-icon
charles:dailyuse-24-core-notification-icon-passive
charles:fix/587-quiet-voice
charles:dailyuse-30-ui-notification-settings-modal
charles:dailyuse-31-ui-user-dm-menus
charles:dailyuse-22b-core-composer-barriers-blocked
charles:dailyuse-22a-core-mark-unread-attachments
charles:dailyuse-29-ui-channel-guild-menus
charles:dailyuse-18-core-user-dm-menus
charles:dailyuse-33-ui-confirm-friends-page
charles:dailyuse-22c-core-trusted-domains-hide-muted
charles:dailyuse-20-core-keyboard-navigation
charles:dailyuse-15-core-friends-blocking
charles:dailyuse-23-core-profile-report-flow
charles:dailyuse-19-core-quick-switcher
charles:dailyuse-14-core-status-idle-presence
charles:dailyuse-17-core-channel-guild-menus
charles:ci/27-linux-cache
charles:dailyuse-37c-ui-trust-links-hide-muted
charles:dailyuse-13-core-honour-mutes
charles:dailyuse-34a-ui-invite-cards-accept
charles:dailyuse-16b-core-create-invites-guilds
charles:dailyuse-12-core-notification-settings-mutes
charles:dailyuse-16a-core-invite-links
charles:dailyuse-25-audio-attachments
charles:dailyuse-21-core-voice-refusals
charles:dailyuse-11b-core-state-skeleton
charles:dailyuse-11a-core-dailyuse-ports
charles:dailyuse-26b-devserver-dailyuse-b
charles:dailyuse-26a-devserver-dailyuse-a
charles:dailyuse-4-api-settings-acks-reports
charles:dailyuse-5-api-relationships-invites-guilds
charles:dailyuse-27-platform-notification-idle
charles:dailyuse-10-highlight-languages
charles:fix-search-focus-hover-emoji
charles:dailyuse-8-context-menu-widget
charles:dailyuse-9-image-load-retry
charles:dailyuse-7-chat-navigation-persistence
charles:dailyuse-2-proto-relationships-invites-reports
charles:dailyuse-1-proto-notification-presence
charles:dailyuse-6-gateway-op12-presence
charles:textchat-next
charles:fix-stream-black
charles:fix-reactions-hover
charles:textchat-68-app-video-playback-runtime
charles:textchat-35-acceptance
charles:textchat-34-parity-screenshots
charles:textchat-74-app-updater-runtime
charles:textchat-67-ui-video-player
charles:textchat-stage-46-47
charles:textchat-47-ui-media-channel
charles:textchat-75-promote-stable-workflow
charles:textchat-46-ui-forum-composer
charles:textchat-73-ui-update-button
charles:textchat-64-media-playback-crate
charles:textchat-stage-43-48
charles:textchat-72-platform-updater
charles:textchat-44-ui-thread-view
charles:textchat-70-release-update-feed
charles:textchat-48-ui-announcements
charles:textchat-45-ui-forum-view
charles:textchat-71-core-updater
charles:textchat-43-ui-sidebar-links-notes
charles:textchat-stage-40
charles:textchat-42-app-channel-types-runtime
charles:textchat-39-core-forums
charles:textchat-40-core-announcements-thread-admin
charles:textchat-60-ui-entrance-sounds
charles:textchat-63-ffmpeg-lgpl-packaging
charles:textchat-stage-batch6
charles:textchat-69-proto-update-manifest
charles:textchat-61-app-soundboard-entrance-runtime
charles:textchat-52-app-audio-devices-runtime
charles:textchat-38-core-channel-routing
charles:soundboard-effect-emoji
charles:status-api-rebind
charles:textchat-28-ui-gif-picker
charles:textchat-41-devserver-channel-types
charles:voice-panel-soundboard
charles:textchat-29-ui-message-actions
charles:textchat-37-api-channel-types
charles:textchat-66-core-video-players
charles:autoupdate-plan
charles:textchat-33-ui-message-list-settings
charles:textchat-32-ui-dms
charles:textchat-62-rename-flaxative
charles:fix-chatcolumn-tree
charles:textchat-65-audio-media-source
charles:textchat-31-ui-threads
charles:textchat-stage-27
charles:textchat-30-ui-search-pins-inbox
charles:textchat-53-ui-audio-sources-menu
charles:textchat-27-ui-expression-picker
charles:textchat-57-core-entrance-library
charles:textchat-36-proto-channel-types
charles:textchat-26-ui-upload-tray
charles:textchat-59-ui-soundboard-popout-parity
charles:textchat-58-audio-sound-edit
charles:textchat-55-proto-api-entrance-library
charles:textchat-25-ui-composer
charles:textchat-56-core-soundboard-parity
charles:rename-video-plan
charles:textchat-stage-25
charles:textchat-stage-23-24
charles:soundboard-plan
charles:textchat-24-ui-message-row
charles:textchat-22-ui-attachments-media
charles:textchat-23-ui-embeds
charles:textchat-14-core-expressions
charles:textchat-21-app-textchat-runtime
charles:textchat-16-core-navigation-read
charles:textchat-17-core-search
charles:textchat-19-core-dms-settings
charles:textchat-stage-13-15-18
charles:textchat-54-livekit-stereo-audio
charles:textchat-50-core-stream-audio-sources
charles:textchat-12-core-uploads
charles:textchat-15-core-message-actions
charles:textchat-11-core-composer
charles:textchat-18-core-threads
charles:textchat-13-core-reactions
charles:textchat-51-audio-pipewire-devices
charles:textchat-49-capture-audio-targets
charles:audio-plan
charles:textchat-plan2
charles:textchat-20-devserver-textchat
charles:textchat-6-api-chat-endpoints
charles:textchat-10-core-chat-ports
charles:textchat-9-ui-code-highlighting
charles:textchat-3-proto-expressions-threads-prefs
charles:textchat-5-api-messages-uploads
charles:textchat-2-proto-chat-requests-events
charles:textchat-8-ui-inline-flow-emoji
charles:screenshare
charles:textchat-7-platform-files-clipboard
charles:textchat-1-proto-message-content
charles:textchat-4-emoji-crate
charles:screenshare-31-acceptance
charles:screenshare-29-parity-screenshots
charles:textchat-plan
charles:screenshare-24-ui-focus-layout
charles:screenshare-27-ui-stream-menu
charles:screenshare-30-packaging-ci
charles:screenshare-21-app-screenshare-runtime
charles:screenshare-22-ui-sidebar-live
charles:screenshare-23-ui-stream-tile
charles:screenshare-26-ui-source-picker
charles:screenshare-28-ui-screenshare-settings
charles:screenshare-13-core-previews
charles:screenshare-12-core-codec-negotiation
charles:screenshare-25-ui-share-controls
charles:screenshare-18-hw-encode-linux
charles:screenshare-19-spike-hw-encode-windows
charles:screenshare-11-core-stream-params
charles:screenshare-20-devserver-screenshare
charles:screenshare-10-core-go-live
charles:screenshare-17-voice-livekit-video
charles:screenshare-14-audio-capture-linux
charles:wip/screenshare-17
charles:screenshare-integration
charles:feat-user-profile
charles:fix-voice-join
charles:feat-entity-images
charles:screenshare-16-voice-video-session
charles:screenshare-9-core-watching
charles:screenshare-5-capture-windows
charles:fix-wire-livekit
charles:screenshare-4-capture-linux
charles:screenshare-15-audio-capture-windows
charles:fix-member-list
charles:screenshare-8-core-stream-ports
charles:fix-live-protocol
charles:screenshare-6-ui-video-widget
charles:screenshare-3-capture-crate
charles:fix-altcha-captcha
charles:screenshare-1-video-frames
charles:screenshare-7-proto-api-streams
charles:screenshare-2-spike-livekit-video
charles:voice
charles:voice-26-acceptance
charles:voice-23-voice-e2ee
charles:voice-25-packaging-ci
charles:voice-13-voice-livekit-interop
charles:voice-24-parity-screenshots
charles:voice-19-ui-soundboard
charles:voice-20-ui-participant-menu
charles:voice-22-ui-dm-calls
charles:voice-21-ui-voice-settings
charles:voice-18-ui-call-view
charles:voice-14-app-voice-runtime
charles:voice-10-core-soundboard
charles:voice-17-ui-voice-panel
charles:voice-9-core-voice-settings-advert
charles:voice-5-audio-clips-chimes
charles:voice-15-devserver-voice
charles:voice-8-core-live-room-volumes
charles:voice-11-core-calls-status
charles:voice-12-voice-session
charles:voice-4-audio-devices-mixer
charles:voice-16-ui-voice-sidebar
charles:voice-7-core-voice-connection
charles:foundation
charles:voice-2-proto-api-soundboard-rtc
charles:voice-6-core-voice-states
charles:voice-3-audio-dsp
charles:voice-1-proto-voice-gateway
charles:task/26-acceptance
charles:task/25-packaging-release
charles:task/24-screenshot-tests
charles:task/20-ui-message-list-composer
charles:task/22-ui-settings-parity
charles:task/18-ui-main-layout
charles:task/23-notifications
charles:task/17-ui-shell-login
charles:task/14-app-runtime
charles:ci/51-windows-disk-space
charles:task/12-platform-persistence
charles:task/13-devserver
charles:task/21-ui-avatar-image-cache
charles:task/10-core-messages-readstate
charles:task/9-core-guilds-channels
charles:task/7-gateway-machine-transport
charles:task/11-core-presence-ui
charles:task/19-ui-rich-text
charles:task/8-core-store-session
charles:task/16-ui-theme-fonts-icons
charles:task/15-status-api
charles:task/4-proto-gateway-events
charles:task/5-openapi-vendor-contract
charles:task/6-api-client
charles:task/3-proto-rest-models
charles:task/2-proto-primitives
charles:task/1-workspace-scaffold
No reviewers
Labels
Clear labels
bug
A bug found while working on something else; steps to reproduce and the commit seen on
ci
Build, CI runners and workflows
follow-up
Deferred reviewer finding, linked from the PR it came from
good-first-task
Small, well-scoped, no cross-crate knowledge needed
parity
Settings/behaviour parity with the Electron client
question
Design question that needs Charles; blocks its task until answered
ready-to-merge
Reviewer approved, foundation merged in, CI green on both runners; waiting for the orchestrator to merge
task
A plan task (one per Foundation plan task)
No labels
bug
ci
follow-up
good-first-task
parity
question
ready-to-merge
task
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
charles/fluxer-native!744
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-740-updater-always-latest"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #740
Cause
UpdateState::on_timerskipped the periodic check while an update wasDownloadingorReady, and the button / in-call "Restart" / install-on-quit applied whatever had been downloaded without looking at the feed again. So when release B came out after A had been downloaded, A was installed, and B was offered right after the restart.Fix (spec §4.5.1, new; §4.4, §5.1, §5.3, §7 updated)
DownloadingorReady. The last verified download is kept asUpdateState::staged.Applying):UpdateEvent::QuitDeadline.Quitting, the runtime keeps handling only update events until the store decides. It waits at mostQUIT_INSTALL_LIMIT(5 min), then sendsQuitDeadline, which installs the staged update.sweep_supersededafter each verified download. The dry-run installer drops older version folders too.sweep_superseded(target, newest)(shares its code withsweep_leftovers).newest(2026.0101.3).download_updatesdeletes the other*.nupkg/*.partialfiles only after the new package is verified and renamed into place. A failed download returns early and keeps the waiting package.get_update_pending_restartreturns the newest local full package. Velopack never replaces a waiting package by itself (auto-apply is off). So no Windows-specific code was needed, and no new imports were added inside cfg blocks.Verification
crates/fluxer-core/tests/update.rs: 14 new tests, covering:The 4 existing apply tests now expect the re-check first. 16 of these tests fail against the old
update.rs, run with stubs added only so they compile.crates/fluxer-platform/tests/update_apply.rs:a_newer_download_removes_the_superseded_staging_folder.apps/fluxer/tests/update_runtime.rs:devserver_update_flows_from_check_to_readyis extended:newestis published whileneweris ready, and the periodic check downloads it and replaces the ready one. Switching the feed back to the older version keeps the newest.apply_installs_a_version_published_after_the_ready_one,quit_installs_a_version_published_after_the_ready_one,quit_installs_the_ready_version_when_the_newer_one_does_not_come(a stalled download, 500 ms limit).crates/fluxer-ui/tests/update.rs:confirm_restart_modal_names_the_newer_release_downloading.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed. No goldens changed.Not verified
VelopackInstallercode is unchanged. The Windows CI runner will compile and lint it.🤖 Generated with Claude Code
Independent review of #744 (updater: always install the newest release)
I read the issue, the PR description, the spec changes and the diff without context, then ran the gate in a fresh worktree (
756a7257).Verdict: changes requested. The store's state machine is mostly sound. I found no state with no way out, no way to apply twice, no check → download loop, and no lost or doubled timers. The problems are elsewhere: the store and the installers can disagree about which file gets installed, Windows cannot replace a running download, and the new 5-minute wait on quit can hang the process and let two processes work on the same staging folder at once.
Blocking
B1. Windows: replacing a download in flight fails, and the abandoned download can delete the staged package.
Files:
apps/fluxer/src/update_rt.rs:513-541,crates/fluxer-platform/src/update/velopack.rs:212-256.CancelTokenonly stops waiting. Thevelopack-downloadthread keeps runningdownload_updates, which holds Velopack's packages lock (try_get_exclusive_lock, non-blocking, velopack 1.2.161locator.rs:337).download_updatesfails at once because the lock is held.Ready(A), retried 2 h later.Failederror modal.*.nupkg, including A's.VelopackInstaller.statestill points at A, soapply_on_exit(A)returnsFileNotFoundand nothing is installed.QuitDeadline: B is cancelled while A is applied. If B finishes during the few seconds of shutdown, A's package is gone.Nothing wrong gets installed, but "no Windows-specific code was needed" does not hold.
Fix: keep the join handle of the abandoned thread and wait for it before starting another download (or before
apply). Alternatively, never cancel a Velopack download and let the core wait for it.B2. The installer installs the last download that finished, not the one the store chose.
Files:
apps/fluxer/src/update_rt.rs:291-298(AppImage),crates/fluxer-core/src/update.rs:712-724.AppImageInstaller::downloadsetsself.stagedand runssweep_supersededwhenever a download finishes. The runtime drops the event for a cancelled or superseded download, but the installer state and the deleted folder stay.take_manifest'sUpToDatebranch setsReady(staged A)while B is stillDownloadingand pushes noCancelDownload. Two ways to get there: the feed moves back to A (a pulled nightly), or a transient404/Ok(None)during a check that runs while a slow B downloads (2 h interval, or a 15 min backoff).installer.staged = Band A's folder is swept.QuitDeadline) runsapply_staged, and the installer swaps in B, the release the feed withdrew.Downloader::downloadis only in the chunk loop. A cancel that arrives during hashing still renames the file, setsstagedand sweeps. With bad ordering (a late older download finishing after a newer one),stagedpoints to a file the newer download's sweep removed, and you getApplyFailed: missing.Fix:
CancelDownloadin theUpToDatebranch whenDownloading.stagedand sweeps.UpdateCommand::Applycarry the version, and have the installer apply exactly that version's file (fail if it is absent), so the store's decision is what runs.Missing test: a manifest that is up to date (or
Ok(None)) while B downloads with A staged. Today it is covered only forReady.B3. The 5-minute wait on quit: Ctrl-C cannot stop it, there is no single-instance guard, and the bound is too long.
Files:
apps/fluxer/src/runtime.rs:112,:866-870,:964-985,apps/fluxer/src/main.rs:292.supervisecatches the first Ctrl-C and stops listening. Tokio keeps its SIGINT handler installed, so every later Ctrl-C does nothing. A terminal user then waits up to 5 min (one re-check can already take up to 15 s connect + 60 s read;UpdateHttphas no total timeout) with no way out short of SIGKILL..flaxative-update-B/…part, both appending..partbefore P1 verified and renamed it. P2's late appends then land on the inode P1 is about to rename over the AppImage, so a verified file is altered after verification.Update.exeapplies intocurrent\while P2 runs from it. I did not verify whatUpdate.exedoes then, because it is not in the crate..part/ final file stays and is resumed or reused next run. It only means the quit-time install does not happen.Fix:
QuitDeadline.Minor
update.rs:514-518, 519-529. Sequence: click "Restart to update" (or "Restart" in a call), soApplying{relaunch:true}waits for its re-check; then close the window.Quittingdoes nothing becauseinstallable()is false inApplying, sorelaunch:truesurvives and the app restarts after the user quit. (ADownloading+ staged wait is switched tofalsebyQuitting, which is the right behaviour.)update.rs:1038-1046. The re-check before a click-install has no deadline beyond the HTTP timeouts. If it finds B, the user must wait for the whole download: the button does nothing onDownloading{user_started:true}, and there is no "install the ready one now". Consider the same deadline as on quit.update.rs:622-629, 951-964. "Check for updates" fails whileReady, so status becomesFailed{release: None}, and Dismiss givesIdlewhilestagedis stillSome.installable()is false, so quitting does not install the verified update, and the button stays hidden until the next periodic check (2 h). Same for a quit duringChecking{manual}. RestoringReady(staged)on dismiss is one line.Availablehides the staged update.update.rs:761-763. Withautomaticoff (or a newer release that isManual), a newer manifest turnsReady(A)intoAvailable(B), which hides A.Answers to the review checklist
QuitDeadline. No trap state, no double apply, never older than the running build orstagedin the store. Timers: every path schedules exactly one livenext_check. Stale ids are ignored, and the begin-apply check that takes over a background check's reply is handled. The problem is store/installer divergence (B1, B2).installable()is false) and quits at once. With a staged update, every quit makes one manifest fetch.sweep_superseded. It only touches.flaxative-update-<parsed version>directories next to the AppImage.DirEntry::file_typedoes not follow symlinks,remove_dir_alldoes not follow inner symlinks, and the version is a numericReleaseVersion, not text taken from the manifest. It cannot reach the running AppImage or anything outside. It can delete the folder the store still regards as staged (B2).download_updatescollects*.nupkg/*.partialbefore downloading and deletes them only after verifying and renaming. It returns early on failure and leaves the.partial.get_update_pending_restartreturns the newest full package only if it is newer than the installed version. What it omits is the non-blocking global lockdownload_updatestakes, which is the cause of B1.Applyinstalls andinstalled), which is good. The runtimeFakeInstallerhas the same "last finished wins" semantics and ignores cancel, so B1 and B2 cannot show up. Untested:UpToDate/Ok(None)during a replacement, a cancelled download finishing late, Ctrl-C during the quit wait, and two processes.Gate
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh worktree of756a7257: all steps passed, exit 0. Steps: ffmpeg, fmt, clippy, deny, core-isolation, parity, test, vendored-tests, screenshot-tests; livekit-interop skipped becauseFLUXER_LIVEKIT_TESTSis not 1.textchat_session_end_to_endpassed. (A first run was killed from outside the process duringtest; it had no failures up to then. The full rerun was green.) The gate is not a blocker.Verdict: changes requested (B1, B2, B3).
Answer to the review (commit
5897c7e9,origin/textchatmerged in first)FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed. I went with simplifying the design rather than patching each hole one by one.Blocking findings
B1 (Windows: a cancelled Velopack download keeps running).
VelopackUpdater::downloadreturnsCancelledat once and drops whatever Velopack finishes with. The next download first waits for the abandoned thread to end (IN_FLIGHT), so it cannot run into Velopack's non-blocking packages lock. Process exit is never held up by it.VelopackInstallerrecords a download only if it was not cancelled.preparere-reads what Velopack actually holds (get_update_pending_restart) and accepts only the version the store asked for.apply_on_exitand the process exiting. That is untestable here and described in spec §5.3.a_cancelled_download_finishing_late_is_never_installed(the real downloader, cancelled while hashing, both through theDownloaderand through the installer); the core testa_running_download_is_never_replaced_and_the_newer_one_follows. The Windows code itself cannot be built or run here.B2 (the installer installed the last download that finished, not the one the store chose).
UpdateCommand::Apply { version, relaunch }now names the version. Every installer installs exactly that version or returns an error.Downloader.UpdateCommand::Keep { version }once it has settled on the new staged update, and only then are the other folders removed (sweep_except).Ok(None), while a download runs changes nothing.Keep(staged)and every install path installs the staged update.not_newer_or_missing_manifests_while_a_newer_download_runs_change_nothing,a_release_withdrawn_while_it_downloads_is_never_installed;a_release_withdrawn_while_it_downloads_is_never_installed;the_appimage_installer_installs_exactly_the_version_asked_for(only B on disk:Apply(A)fails and leaves the AppImage untouched);keeping_one_update_removes_every_other_staging_folder.B3 (the 5-minute windowless wait on quit, Ctrl-C, two processes).
QUIT_INSTALL_LIMIT= 30 s after the quit began. A second Ctrl-C or SIGTERM ends the wait at once and installs the staged update. The runtime listens for those signals during that wait.Handle::quit_interrupter()does the same in tests.MANIFEST_TIMEOUT).UpdateLock: an exclusive file lock on.flaxative-update.lockin the installer's folder (next to the AppImage; for Velopack,<cache>/updates). It is taken before any download to the staging folder, before the start-up sweep and before any install. The OS releases it when the process ends, crash included. A process that cannot get it getsUpdateError::Busy, which the store handles silently.quit_with_a_newer_release_published_installs_the_ready_one_at_once(no check, no download, under 5 s);quit_waits_for_a_running_newer_download_and_installs_it;quit_installs_the_ready_version_when_the_newer_one_does_not_come_in_time;insisting_on_quitting_ends_the_wait_at_once;a_second_runtime_on_the_same_staging_folder_leaves_updating_to_the_first;a_slow_manifest_times_out_in_all;one_holder_at_a_time_and_released_on_drop;quitting_installs_the_ready_update_without_checking_or_downloading,quitting_waits_only_for_a_newer_download_already_running,another_copy_updating_is_silent.Minor findings
Quittingduring the button's re-check, or while waiting for its download, installs without relaunching. Test:closing_the_window_during_the_buttons_recheck_installs_without_relaunch.the_user_can_stop_the_newer_download_and_install_the_ready_update.Ready(staged), and quitting while the error is shown still installs the staged update. Test:a_failed_manual_check_does_not_hide_the_ready_update.Ready(staged)visible; the button then checks again and fetches the newer one. Test:a_newer_release_not_downloaded_in_the_background_keeps_the_ready_update_shown.Not covered
Windows/Velopack cannot be compiled or run here (ring's C build needs the MSVC SDK). The Windows CI run is the first build of
VelopackInstallerand the Velopack changes influxer-platform.🤖 Generated with Claude Code
Re-review of #744 at
5897c7e9(cold, fresh worktree)I read the core,
update_rt.rs,runtime.rs,fluxer-platform(lock.rs,velopack.rs,download.rs,http.rs,sweep.rs), the tests and the spec at5897c7e9. I checked the answer in comment 7849 against the code rather than taking it on trust. I could not compile thecfg(windows)code; it was read by hand. The tokio and velopack behaviour cited below comes from their crate sources in the cargo registry (tokio 1.54, velopack 1.2.161).Verdict: changes requested. On Linux, B2 and B3 are fixed, and the core state machine is now clean. One blocking problem is left. It is Windows-only and in code that has never been compiled: a Velopack download that is not cancelled, or the new
IN_FLIGHTwait, keeps the process alive after the window closes. That can also make Velopack give up on the install.Blocking
W1. Windows: a quit can leave a windowless process that does not exit, and the install on quit can fail with it.
Where:
crates/fluxer-platform/src/update/velopack.rs:229-233(theIN_FLIGHTwait);apps/fluxer/src/update_rt.rs:600-633(VelopackInstaller::downloadruns onspawn_blocking);crates/fluxer-core/src/update.rs:581-601(on_quitting);apps/fluxer/src/main.rs:77and:176(main's tokio runtime is dropped at the end ofmain).Why the process stays alive: dropping a tokio
Runtimewaits without limit for every runningspawn_blockingtask (tokio 1.54runtime/blocking/pool.rs:343,BlockingPool::drop→shutdown(None)).VelopackInstaller::downloadis such a task. Only its cancel token ends it early, and two paths never get there.IN_FLIGHTwait ignores cancel.let _ = abandoned.recv();blocks until the abandoned Velopack thread ends. Velopack'sHttpSourceis built without options, and ureq 3 then sets no timeout (velopackdownload.rs:95-102). A download that stalls (Wi-Fi change, sleep, dead TCP connection) can therefore block forever.recv(), and the UI shows "Downloading 0%" for as long as B lasts.CancelDownloadandQuitDeadlineset a token that nobody reads untilrecv()returns.QuitDeadlinesendsApply(A), andapply_on_exitstartsUpdate.exe, which waits up to 60 s for the process to exit (velopack.rsdoc). The process cannot exit while the blocking pool waits onrecv(). After 60 sUpdate.exegives up, so nothing is installed and a windowless process remains.on_quittingreturns at once when nothing is staged, or withautomaticoff and nothing asked for. It sends noCancelDownload, and droppingUpdateRuntimecancels nothing. The Velopack poll loop therefore runs until the whole download finishes, and the closed app stays in the process list until then. On a stall, that is forever.Linux is not affected: AppImage downloads are async tasks, dropped with the runtime.
Fixes, smallest first:
IN_FLIGHTwait, userecv_timeout(POLL)in a loop that also checkscanceland returnsCancelled.on_quitting(or the runtime'sUpdateRuntimedrop) cancel any download it is not going to wait for.mainwithruntime.shutdown_timeout(…)so blocking tasks can never hold the process.None of this has a test: there is no Windows build, and the
FakeInstalleris async.Minor
preparemakes a blocking Velopack disk read on the async executor. Where:update_rt.rs:664-678.VelopackInstaller::preparecallsupdater.pending()(get_update_pending_restart: listspackagesand reads the nupkg manifests) fromExecutor::apply_update. That breaksVelopackUpdater's own rule ("Every call blocks … run it on a blocking task"). It is short, but it runs on a runtime worker.keepis a no-op for Velopack. When the withdrawn C finishes,download_updateshas already deleted A's nupkg, soprepare(A)sees C and fails with "missing". Nothing wrong is installed, and the spec's §5.3 does say "otherwise the install fails". But the first install after a withdrawal fails once (Failed, Try again downloads A again). No test covers it.QuitDeadline, though safe. B is still downloading at 30 s and is abandoned. If it finishes during the ≤ ~10 s shutdown,download_updatesdeletes A's nupkg and also extracts B'sSquirrel.exeoverUpdate.exe.apply_on_exit(A)then returnsFileNotFound, orUpdate.execannot find the package. Nothing is installed this time, and next run'spending()gives B instantly. Suggestions: log it; or, afterQuitDeadlineon Velopack, skip the install when an abandoned download is in flight rather than racing it.UpdateLockwhileappimage::relaunchstarts the new one. The lock lives inUpdateRuntimeuntilrun()ends, and the fd isO_CLOEXEC, so it is not inherited. The new process's start-uptake_locktherefore fails ("another copy of the app is updating"), andsweep_leftoversis skipped for that run.update's lock beforeinstaller.apply) would make the log honest.Busyand settles silently. P1 then swaps the AppImage under P2. P2 finds the same release at its next check (2 h), downloads it again and swaps the same version over itself on quit. This wastes bandwidth only.update.rs:988-993.Busyon a user-started download (a click onAvailable) settles to Idle with no message, and the button disappears. Showing "another copy of Flaxative is updating" for user-started actions would be kinder.insistenceinstalls tokio's SIGINT and SIGTERM handlers, and they stay for the life of the process. After the wait ends, the rest of the shutdown (gateway ≤5 s, writes ≤5 s, install) ignores SIGINT and SIGTERM. The same holds for SIGINT from the first Ctrl-C (main.rs:292) or a window close onward. The remaining shutdown is bounded on Linux, so this matters only together with W1.Your checks
(a) State machine. I re-walked it with
Keep,withdrawn,look_againandBusy.Downloadingends throughDownloaded/QuitDeadline/ the skip click / a channel switch;Applyingends throughApplyorApplyFailed;Busysettles toReady(staged)orIdle.apply_after_checkandapply_after_downloadaretake()n; the quit loop stops onexit_for_updateor when nothing is waited for.look_againre-check and the before-install check each schedule a newnext_check. The id they replace is ignored when it fires, so there is never more than one live timer and none is lost.look_againis set only by a newer manifest, and one failure withoutlook_againreturns to rest.Busymakes no immediate retry.Keepis only sent fromon_downloaded, afterstagedchanged. It goes beforeApply, andKeep(None)only when nothing is staged, so it never sweeps the update about to be installed.withdrawnapplies only to a manifest (orUpToDate(Some)) below the running download. A 404 and "no asset for this platform" do not count, which is right.(b) The old blocking findings.
QuitDeadline), and with them W1.Apply{version}resolves todownloads[version]and must be a file;Downloader) and again in the installer;Keep.On Windows the outcome is "fail, never install wrong" (m2, m3).
ctrl_c).UpdateLock.(c) The lock.
flock/LockFileExlocks are released when the process dies; only an empty dotfile remains. Its name,.flaxative-update.lock, does not match the sweep's.flaxative-update-prefix, so the sweep never removes it.update_rt.rs:775).try_acquireerrors andtake_locklets it proceed, which is fine because such an install isManualwith nolock_dir. A missing folder is created.flockfalls into the same "proceed" path.(d) Signals. Nothing swallows Ctrl-C while the window is open or during the quit wait. After
supervisebreaks, and after the wait, SIGINT and SIGTERM are swallowed for the rest of a bounded shutdown (m7). The process can exit when the quit wait is not active on Linux. On Windows it cannot, while a Velopack download that was not cancelled is running (W1).(e) Tests.
FakeInstalleris now honest:keepdrops the others;applyinstalls the version named;Every Linux blocking scenario has a test that asserts what was installed, including the real
AppImageInstallerandDownloader: withdrawn, cancelled-late, exact version, quit at once, the quit wait and its deadline, insisting, two runtimes, a slow manifest. Not covered: the Windows paths (W1, m2, m3), and a test with no fake at all for a quit with nothing staged while a download runs.Gate
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciat5897c7e9: all steps passed, exit 0. Steps: ffmpeg, fmt, clippy, deny, core-isolation, parity, test, vendored-tests, screenshot-tests; livekit-interop skipped becauseFLUXER_LIVEKIT_TESTSis not 1.textchat_session_end_to_endpassed on the first run. This is a Linux gate only. Thecfg(windows)code (velopack.rsimp,VelopackInstaller) has not been compiled anywhere. I read it for type errors, cfg mistakes and unused imports and found none (VelopackUpdater: CloneandPendingUpdate::version()exist;fluxer_platform::{Paths, APP_NAME}are exported;Mutex<Option<Receiver<()>>>in a static isSync). The Windows CI run is still the first real compile.Verdict: changes requested. Blocking: W1.
Answer to the second review (commit
f5707964;origin/textchathad not moved)FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed (Linux). Thecfg(windows)code is still uncompiled. I re-read everycfg(windows)line of this PR by hand for types, imports, unused items and borrows. Windows-only imports stay inside the cfg blocks. The one helper both OSes share,off_the_executor, isallow(dead_code)only off Windows and has a Linux unit test.W1: a quit could leave a windowless process
All three fixes are in:
VelopackUpdater::downloadwaits for the abandoned download with arecv_timeout(POLL)loop that checks the new download's cancel token. When it is cancelled, it puts the abandoned receiver back and returnsCancelledat once.on_quittingsendsCancelDownloadfor every such download: nothing staged,automaticoff, or a manual download. It then settles. The runtime also cancels whatever still runs after the quit wait, andimpl Drop for UpdateRuntimecancels too.mainnow ends withruntime::shut_down_runtime(runtime, RUNTIME_SHUTDOWN_LIMIT)(shutdown_timeout, 3 s). It runs afterblock_on(supervisor), and the supervisor already awaits the runtime task to its end. That task still waits for the gateway close, the settings and cache writes (as before, ≤ 5 s each) and the install. Only blocking tasks still running after that are left behind.Tests:
quitting_stops_a_download_it_does_not_wait_for(background with nothing staged, a click, a manual download, a newer download withautomaticoff; a download the quit waits for is not stopped).quitting_during_a_stalled_first_download_returns_at_once(real downloader, the dev server's newUpdateFeed::stall_assets(true), nothing staged; asserts the cancel and that it returns in under 5 s).the_process_end_never_waits_for_a_hung_blocking_task(aspawn_blockingtask that never ends;shut_down_runtimereturns in under 2 s).Minor findings
m1:
VelopackInstaller::preparerunsupdater.pending()throughoff_the_executor(block_in_placeon a multi-threaded runtime, otherwise directly). I kept the check inpreparerather than moving it to the install after shutdown. A failure there still reaches the user as an error, instead of the app closing without relaunching. Test:blocking_work_runs_off_the_executor_on_any_runtime.m2, m3: no behaviour change. Spec §5.3 now states both exactly:
Each case has an INFO log line: in
VelopackInstaller::preparewhen Velopack holds another version, and inapplywhen an abandoned download is still running (velopack::abandoned_download_running()).m4, m5: no change, as agreed.
m6: my choice is to keep the button. A click whose download gets
Busyreturns toAvailable, so the button stays "Update available" and can be clicked again. No error is shown and there is an INFO log line. A background download that getsBusystill settles quietly. Test:another_copy_updating_is_silent.m7: after the quit wait,
exit_on_signalmakes Ctrl-C or SIGTERM end the process at once (exit code 130, with a warning in the log). The second-Ctrl-C handling is now shared code. Not tested: it would mean signalling the test process.Untested on Windows
The whole
cfg(windows)path is untested: theIN_FLIGHTcancel loop,abandoned_download_running,off_the_executoraroundpending(), and both INFO logs. The Windows CI run is the first compile.🤖 Generated with Claude Code
Third review of #744: only the
5897c7e9..f5707964deltaI read the delta cold and checked each claim of comment 7882 against the code. I also read every changed
cfg(windows)line the way the compiler andclippy -D warningswould.Verdict: approve. W1 is fixed. Nothing I approved before has regressed. Three minor points remain, none of them blocking.
Claims checked
IN_FLIGHTwait (velopack.rs:241-255). It is now arecv_timeout(POLL)loop. On cancel it puts the receiver back and returnsCancelled; a disconnected receiver ends the wait. It compiles as written: movingabandonedinto the static and then returning from inside the loop is accepted by the borrow checker.on_quitting(update.rs:583-600) sendsCancelDownloadfor every download it does not wait for: nothing staged,automaticoff and nothing asked, or a manual download. It then settles. A download that quit does wait for is untouched.cancel_download()after the quit wait (runtime.rs:924).Drop for UpdateRuntimecancels too.main.rs:176-180,runtime.rs:1016-1023).block_on(supervisor)only returns onceHandle::shutdownhas awaited the runtime task.installer.applyonspawn_blockingand awaited it. On Windows, that is whereapply_on_exitstartsUpdate.exe.shutdown_timeoutonly cuts blocking tasks that are still running after that. It cannot cut the install.shutdown_timeoutis called on the main thread, outside any async context, so it does not panic.off_the_executor.block_in_placeruns only for aMultiThreadflavour; any other flavour calls the work directly, so a current-thread runtime cannot panic. The only caller isExecutor::apply_update, which runs on a worker of the multi-thread runtime. It is never insidespawn_blockingor aLocalSet.Busywith nothing staged goes back toAvailable. With something staged it settles toReady. In the background it stays quiet. A test covers each case.exit_on_signal. Ctrl-C or SIGTERM after the quit wait callsprocess::exit(130). This exit cannot leave a half-written file:apply_on_exitonly startsUpdate.exe.At worst the write or the relaunch is lost, which is what the user asked for.
abandoned_download_runningand its call are bothcfg(windows);try_recvon the guard's&Receiveris fine;prepare, the temporary guard in thematchscrutinee is dropped before the store, andupdateris moved only after theFnOnceclosure;off_the_executorcarriesallow(dead_code)off Windows and is used by a unit test;Minor (not blocking)
velopack.rs:247-249. Scenario: download C is waiting on the abandoned B and is cancelled because a new download D starts. D'sin_flight().take()can run in the up-to-100 ms before C puts B's receiver back.download_updateswhile B still holds Velopack's lock, so D fails at once with a lock error. The user seesFailedif they started it; otherwise it is retried at the next check.Condvaror keep one global "abandoned" list instead of a single take-and-put-back slot.exit_on_signalexits with 130 for SIGTERM too (143 would be the convention). Cosmetic.Not verified
Evidence
cargo test -p fluxer-core --test update: 53 passed.cargo test -p fluxer --test update_runtime: 27 passed.cargo test -p fluxer --lib update_rt: 6 passed, includingblocking_work_runs_off_the_executor_on_any_runtime.Verdict: approve.
Approved on the third review; merged into
textchatby hand (the merge API returns 405); the commits are in the branch.Pull request closed