macOS updater: let the app show update progress and choose when to restart
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- macos, typescript, zig
- Domain
- api, desktop-dev
Research direction
Start in the macOS updater’s download timer, stock-sheet progress UI, and installDownloadedUpdate path, then trace the existing app.check-for-updates command and PlatformServices.checkForUpdates API. Define the update-state machine and app-facing configuration before wiring Zig, TypeScript, and built-in command/event surfaces. Done means progress is determinate, app-driven check/download/cancel/install flows work, staged bundles are validated and cleaned up, and the documented state and error behavior are covered by tests.
Written by the indexing model from the issue text.
Description
#169 asked for update effects the app controls: check, download, download progress, and install and relaunch. The updater from #398 does the checks and the swap, but it gives the app none of those effects. This issue is about that missing part.
The problem
After the user clicks Install Update, the macOS updater shows a sheet on the app's window until the whole ZIP has downloaded. The sheet's progress bar is indeterminate. The sheet is also window-modal, so the app can't be used while the download runs. A large update takes minutes, and the app looks frozen. When the download finishes, the updater checks it, starts the install script, and quits the app right away. This is true in 0.11.1 and on current main.
The app can't change any of this. Its only hook is the reserved app.check-for-updates command, or PlatformServices.checkForUpdates. It gets no event when an update is found, while it downloads, or when it is ready. It also can't start the download or the restart itself.
Sage, a Native SDK 0.11.1 app, has a 230 MB update ZIP. We'd like its updates to work like they do in many Mac apps. A sidebar item reads Install update. Clicking it downloads the ZIP in the background while the item shows progress. Then the item reads Restart to update, and the user restarts when they're ready.
The updater already has most of what this needs:
- The signed feed gives
archive_bytes. updateDownloadLimitTimerFiredalready readscountOfBytesReceivedevery 0.1 seconds, to cap the download size.installDownloadedUpdatealready checks and stages the new bundle before it starts the install script.
The proposal
1. A real progress bar in the stock sheet
This is the smallest change. Make the sheet's NSProgressIndicator determinate, with maxValue set to archive_bytes, and update it from the timer that already runs. Apps that keep the stock sheets get real progress with no work.
2. An update API for apps
Let an app turn off the stock sheets and drive the updater itself, for example with "updates": { "ui": "app" } in app.json. With it on, the updater shows no sheets, and the app gets:
- A state it can read and subscribe to:
idle,checking,available(version and release notes),downloading(bytes received and total bytes),ready(version), andfailed(an error code and message). - Four calls:
check(quiet or user-initiated),download(starts the download in the background),cancel, andinstall(swaps in the staged bundle and relaunches).
A WebView page could reach these as built-in commands, such as native-sdk.updates.check, native-sdk.updates.download, native-sdk.updates.cancel, native-sdk.updates.install, and native-sdk.updates.state, plus an event when the state changes. A TypeScript core could get a Cmd for each call and a Sub for the state. A Zig core could get matching PlatformServices functions and an app event.
ready would mean every check in installDownloadedUpdate has passed: size, SHA-256, extraction, one top-level .app, bundle ID and version, and the codesign requirement when the app has a team ID. The staged bundle waits in the folder the updater already uses, .<App>.app.native-update-<uuid> next to the app, until the app calls install.
Notes
- No feed changes. All of this happens in the installed app, so the signed feed and
native update signstay as they are. That matters becauseverifyEnveloperejects unknown fields, and installed copies must keep reading the feed. - Quitting with an update ready. If the user quits without restarting, the updater could swap in the new bundle as the app quits, without reopening it. Or it could keep the staged bundle for the next launch. Either works, as long as the app knows which one happens.
- Leftover staging folders. If the app quits or crashes while an update is staged, the next launch should delete the staging folder, or reuse it if it still matches the newest feed.
- The app's quit path.
installshould quit through the normal terminate path, asinstallDownloadedUpdatedoes today. Apps can then stop their child processes and save their state first. - Why not in the app. An app can already check the feed with
updater.verifyEnvelopeand the ZIP withnative_sdk_update_verify_archive. But it would still need its own downloader, staging folder, cleanup, and copy of the install script. The updater already does this safely, and two copies of the swap logic would drift apart.
- Dominant language
- Zig
- Stars
- 7.9k
- Forks
- 335
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 147
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel-labs/native
-
Per-view widget layout budget (1024 nodes) drops whole frames on real multi-pane app viewsPossibly taken @slicenferqin claimed this 100 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vercel-labs/native#408 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
vercel-labs/native#387 ·
Maintainers usually reply within 1 day
-
macOS: the window frame event reports the frame size where everything else expects the content sizeOpen
Difficulty 1/5 Under an hour Newbie friendliness 84/100
vercel-labs/native#355 ·
Maintainers usually reply within 1 day
-
cef.zig: InstallResult.archive_path leaks on successPossibly taken @versecafe claimed this 206 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vercel-labs/native#32 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
vercel-labs/native#957 ·
Maintainers usually reply within 1 day
All issues in vercel-labs/native
Similar issues
-
v3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pluginkollektiv/antispam-bee#952 ·
Maintainers usually reply within 1 day
-
area: middleware enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
config: reject Proxy-Authorization and Proxy-Authenticate in server headersPossibly taken @haseemajaz claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
rohitgollarahalli/mcpx#38 · 1 comment ·
Maintainers usually reply within 1 day
-
area: API good first issue size/xs
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
DahanItamar/DockNest#354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100