Software updates
Fluid moves users to a newer app version through a guarded cycle: find a release, ask for approval, download and check the app, replace the running copy, and relaunch it. The cycle keeps the current app available as a rollback copy and restores it if the new copy cannot start. This page complements App experience, Application lifecycle and menu bar, and Release highlights.
Update lifecycle
The update lifecycle joins release discovery, user choice, installation, and restart into one operation. SimpleUpdater owns the lifecycle while settings, the menu bar, and the app delegate provide entry points for users and app startup.
flowchart TD
A[Startup or user request] --> B[Discover release]
B --> C{New release for selected channel?}
C -- No --> D[Show result for manual checks]
C -- Yes --> E[Show update offer or status]
E --> F{User installs?}
F -- Later --> G[Snooze offer]
F -- Install Now --> H[Download and extract bundle]
H --> I[Validate identity, version, build, and signature]
I --> J[Back up current app]
J --> K[Exchange app bundles]
K --> L[Launch new app]
L --> M{New app stays running?}
M -- Yes --> N[Finalize and request termination]
M -- No --> O[Restore previous app]
Release discovery
Release discovery reads the Fluid GitHub release feed and selects the highest valid semantic version for the chosen channel. Stable checks exclude pre-release builds; the beta setting includes them. The selected release must also provide an app asset whose name matches the repository and version. (Sources/…/SimpleUpdater.swift• L58-72, Sources/…/SimpleUpdater.swift• L674-686, Sources/…/SimpleUpdater.swift• L810-855)
Automatic checks run at launch and then on an hourly timer when enabled. The settings store records the last check, so the launch and timer paths do not run a check until the one-hour interval has passed. Manual checks bypass that waiting period and report “no update” or an error to the user. (Sources/…/AppDelegate.swift• L118-122, Sources/…/AppDelegate.swift• L446-478, Sources/…/SettingsStore.swift• L2761-2815)
The channel choice is part of the result. If the user changes the stable or beta choice while a check or offer is active, the updater discards that result instead of installing a release from the old channel. (Sources/…/SimpleUpdater.swift• L451-459, Sources/…/SimpleUpdater.swift• L461-515)
References: Sources/…/SimpleUpdater.swift• L58-72 Sources/…/SimpleUpdater.swift• L674-686 Sources/…/SimpleUpdater.swift• L810-855 Sources/…/AppDelegate.swift• L446-478 Sources/…/SettingsStore.swift• L2761-2815
Update prompts
Update prompts give the user control without taking focus from the current task. An automatic offer can be disabled while the update remains visible in settings and the top bar; a manual check always presents its result. (Sources/…/UpdatePromptPresenter.swift• L3-17, Sources/…/SettingsView.swift• L383-481)
The offer has two choices. “Install Now” starts the guarded installation, while “Later” snoozes that version for 24 hours. A newer version can still prompt during that period. Repeated offers are merged so a newer release replaces stale text instead of creating duplicate panels. (Sources/…/SimpleUpdater.swift• L540-562, Sources/…/SettingsStore.swift• L2817-2853, Sources/…/UpdatePromptPresenter.swift• L18-48)
Before installation, the updater checks that the selected version and channel still match the current release. If the feed changed, it asks the user to review the new offer rather than silently installing a different release. (Sources/…/SimpleUpdater.swift• L648-661, Sources/…/SimpleUpdater.swift• L564-583)
References: Sources/…/UpdatePromptPresenter.swift• L3-17 Sources/…/UpdatePromptPresenter.swift• L18-48 Sources/…/SimpleUpdater.swift• L540-583 Sources/…/SettingsStore.swift• L2817-2853 Sources/…/SettingsView.swift• L383-481
Installation pipeline
Installation is a single guarded operation. An operation gate prevents two installs or a rollback from changing the app at the same time. The updater clears discovery state, dismisses offers, shows install status, and keeps the operation active until the replacement process has either recovered or completed. (Sources/…/SimpleUpdater.swift• L44-56, Sources/…/SimpleUpdater.swift• L591-610)
After the release is checked again, the updater downloads the matching archive into temporary space and extracts an app bundle. It does not replace the installed app until the bundle checks and the current-app backup both succeed. (Sources/…/SimpleUpdater.swift• L620-672, Sources/…/SimpleUpdater.swift• L688-730, Sources/…/SimpleUpdater.swift• L1084-1138)
The installation path runs disk and security work away from the main app actor. This keeps the user interface responsive while preserving a clear handoff from the visible install state to the relaunch step. (Sources/…/SimpleUpdater.swift• L1084-1097, Sources/…/SimpleUpdater.swift• L1163-1191)
References: Sources/…/SimpleUpdater.swift• L44-56 Sources/…/SimpleUpdater.swift• L591-610 Sources/…/SimpleUpdater.swift• L620-672 Sources/…/SimpleUpdater.swift• L688-730 Sources/…/SimpleUpdater.swift• L1084-1097 Sources/…/SimpleUpdater.swift• L1163-1191
Bundle safety
Bundle safety prevents a malformed or untrusted download from becoming the next running Fluid process. Validation applies to the downloaded app, the installed app, and rollback copies, with a stricter trust rule for downloaded releases.
Bundle validation
The validator checks that the candidate is a real app bundle for Fluid and that its metadata matches the approved release. It also checks the signed contents, signing identity, team, and required application metadata before returning a validated bundle. (Sources/…/UpdateBundleValidator.swift• L48-77, Sources/…/UpdateBundleValidator.swift• L79-154)
Downloaded releases require an approved Developer ID signature. Existing apps and rollback copies may use the approved installed-app signing policy, but the broader policy is not used for a downloaded release. This separates release trust from checks on local recovery material. (Sources/…/UpdateBundleValidator.swift• L21-44, Sources/…/SimpleUpdater.swift• L336-341, Sources/…/SimpleUpdater.swift• L1117-1121)
Validation also binds the candidate to the selected identity and version. A mismatch stops the operation before the installed app changes. (Sources/…/UpdateBundleValidator.swift• L135-154)
References: Sources/…/UpdateBundleValidator.swift• L21-44 Sources/…/UpdateBundleValidator.swift• L48-77 Sources/…/UpdateBundleValidator.swift• L79-154 Sources/…/SimpleUpdater.swift• L336-341 Sources/…/SimpleUpdater.swift• L1117-1121
Application replacement
Application replacement changes the app bundle in place while protecting against concurrent processes and partial file moves. The replacement transaction stages a copy, checks that both app identities are unchanged, and uses an exchange that leaves the installed app in place if the exchange fails. (Sources/…/UpdateAppReplacement.swift• L4-7, Sources/…/UpdateAppReplacement.swift• L85-150)
Replacement transaction
The transaction has three outcomes. A prepared transaction can be discarded without touching the installed app, a committed transaction can be finalized after a successful relaunch, and a committed transaction can be recovered by exchanging the old app back into place. (Sources/…/UpdateAppReplacement.swift• L60-74, Sources/…/UpdateAppReplacement.swift• L153-200)
The transaction owns a process-shared lock and a marked staging area. The lock prevents another Fluid process from starting a second replacement, while the marker lets the updater identify and remove only its own abandoned staging data. (Sources/…/UpdateAppReplacement.swift• L93-117, Sources/…/UpdateAppReplacement.swift• L217-229, Sources/…/UpdateAppReplacement.swift• L252-285)
References: Sources/…/UpdateAppReplacement.swift• L4-7 Sources/…/UpdateAppReplacement.swift• L60-74 Sources/…/UpdateAppReplacement.swift• L85-150 Sources/…/UpdateAppReplacement.swift• L153-200 Sources/…/UpdateAppReplacement.swift• L217-229
Relaunch recovery
After the exchange, the old process opens a new instance from the same app path. A short grace period lets the new process start before the old process cleans the staging area. If the new process cannot start or exits too soon, the old process restores the previous bundle and reports the failure. (Sources/…/SimpleUpdater.swift• L1193-1218, Sources/…/SimpleUpdater.swift• L1236-1257)
Cleanup failure does not undo a successful update. The updater records the cleanup warning while retaining the durable rollback backup, so a later attempt can still recover the prior version. (Sources/…/SimpleUpdater.swift• L1211-1232, Sources/…/UpdateAppReplacement.swift• L184-200)
References: Sources/…/SimpleUpdater.swift• L1193-1232 Sources/…/SimpleUpdater.swift• L1236-1257 Sources/…/UpdateAppReplacement.swift• L163-200
Rollback backups
Rollback backups preserve the last installed app before each replacement. The updater stores them in Fluid application support, selects the newest backup with a different version, and keeps up to three backups after cleanup. (Sources/…/SimpleUpdater.swift• L177-200, Sources/…/SimpleUpdater.swift• L879-912, Sources/…/SimpleUpdater.swift• L927-957)
Backup creation
The backup path validates the running app before and after copying it. It publishes the copy only after those checks succeed, so a failed backup leaves the installed app untouched and does not create a false rollback point. (Sources/…/UpdateRollbackBackup.swift• L36-93)
The current app is backed up before the new app is committed. If a later step fails, temporary backup and staging material is removed when possible; retained recovery files are reported instead of being hidden. (Sources/…/SimpleUpdater.swift• L1114-1161)
References: Sources/…/UpdateRollbackBackup.swift• L3-5 Sources/…/UpdateRollbackBackup.swift• L36-93 Sources/…/SimpleUpdater.swift• L177-200 Sources/…/SimpleUpdater.swift• L879-912 Sources/…/SimpleUpdater.swift• L927-957 Sources/…/SimpleUpdater.swift• L1114-1161
Rollback operation
Rollback uses the same replacement and relaunch path as an update, but it accepts the selected backup as the incoming app. It validates the backup as an installed app, keeps the backup protected during cleanup, and relaunches Fluid on the restored version. (Sources/…/SimpleUpdater.swift• L194-241, Sources/…/SimpleUpdater.swift• L1163-1215)
Settings and the menu bar expose rollback only when a usable backup exists. The user confirms the action before the app replaces itself and reports success or failure after the operation starts. (Sources/…/SettingsView.swift• L502-549, Sources/…/SimpleUpdater.swift• L194-241, Sources/…/MenuBarManager.swift• L1016-1070)
References: Sources/…/SimpleUpdater.swift• L194-241 Sources/…/SimpleUpdater.swift• L1163-1215 Sources/…/SettingsView.swift• L502-549 Sources/…/MenuBarManager.swift• L1016-1070
Termination scheduling
Termination scheduling gives the new app time to start and gives the old app time to save state before it quits. The scheduler requests termination through the main run loop so app termination work can continue, including history writes handled by the app delegate. (Sources/…/UpdateTerminationScheduler.swift• L3-15, Sources/…/AppDelegate.swift• L132-148)
Restart handoff
The replacement flow launches the new process first, waits for a short startup grace period, then finalizes the swap and requests the old process to terminate. The app delegate treats an update restart as a special termination path so it does not shut down runtimes in a way that blocks the relaunch. (Sources/…/SimpleUpdater.swift• L1196-1232, Sources/…/UpdateTerminationScheduler.swift• L3-15, Sources/…/AppDelegate.swift• L150-180)
References: Sources/…/SimpleUpdater.swift• L1196-1232 Sources/…/UpdateTerminationScheduler.swift• L3-15 Sources/…/AppDelegate.swift• L150-180
Superseded instance retirement
Older fixed builds can leave the outgoing app process stuck after an update. On first launch, the new copy finds only older processes running from the same bundle path, asks them to quit, and force-quits only those that remain after the allowed grace period. (Sources/…/UpdateTerminationScheduler.swift• L18-90, Sources/…/AppDelegate.swift• L98-104)
References: Sources/…/UpdateTerminationScheduler.swift• L18-90 Sources/…/AppDelegate.swift• L98-104
Change checklist
When these files or sections are changed, remember to consider these:
- Keep release channel changes aligned across settings state, check cancellation, candidate selection, and the visible update offer.
- Keep the release asset naming rule aligned with the release process. A valid release without a matching asset cannot install.
- Keep bundle identity, version, build, and signing policy checks aligned between downloaded apps, installed apps, and rollback backups.
- Preserve the order of backup, bundle exchange, relaunch, and final cleanup. Moving cleanup earlier can remove the only recovery copy.
- Keep the termination scheduler and app delegate termination path aligned so history and runtime shutdown can finish before the old process exits.
- Keep rollback backup retention aware of the backup currently needed by an in-flight update or rollback.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The release feed returns no valid candidate or no matching app asset | Discovery or installation stops without changing the app | Semantic-version filtering and asset-name matching |
| The downloaded bundle has the wrong identity, version, build, or signature | The candidate is rejected before replacement | Full bundle metadata and code-sign validation |
| The installed app changes during preparation | The operation stops instead of overwriting another app state | Process-shared lock plus identity revalidation |
| Backup creation fails | Nothing is replaced | Backup validation and publish-before-commit order |
| The new app does not stay running after launch | The previous app is restored and the user sees an update failure | Recovery exchange after failed relaunch |
| Termination blocks on the main queue | The old process can remain stuck with update UI visible | Run-loop termination request and bounded superseded-instance retirement |
Key files
| File | Why to read it |
|---|---|
| Sources/…/SimpleUpdater.swift | Main update coordinator for discovery, prompts, download, installation, rollback, and relaunch |
| Sources/…/UpdateBundleValidator.swift | Trust and identity boundary for every app bundle |
| Sources/…/UpdateAppReplacement.swift | Transaction that stages, exchanges, recovers, and finalizes app bundles |
| Sources/…/UpdateRollbackBackup.swift | Durable backup creation before replacement |
| Sources/…/UpdateTerminationScheduler.swift | Safe termination request and retirement of stuck older instances |
| Sources/…/UpdatePromptPresenter.swift | Non-modal update offer and result presentation |
| Sources/…/SettingsStore.swift | Update preferences, check timing, and prompt snooze state |
| Sources/…/AppDelegate.swift | Startup checks, periodic checks, and termination behavior during restart |
| Sources/…/SettingsView.swift | User controls for automatic updates, beta builds, manual checks, and rollback |
| Sources/…/MenuBarManager.swift | Menu bar entry points for update checks and rollback |