macOS updater: reuse unchanged files from the installed app (delta updates)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- macos, zig
- Domain
- desktop-dev, release
Research direction
Start with installDownloadedUpdate in src/platform/macos/appkit_host.m and the native update sign command to understand the current feed, archive-verification, staging, and install flow. The proposed path must add a separately signed delta feed, file manifests, base-version patch generation, staging, and whole-tree verification while retaining the full-ZIP fallback. Done means an applicable patch reuses byte-identical installed files, and any missing base, mismatch, or verification failure safely falls back to the full update.
Written by the indexing model from the issue text.
Description
The problem
The macOS updater downloads the whole app on every update. In installDownloadedUpdate (src/platform/macos/appkit_host.m), it checks the ZIP’s size and SHA-256 against the signed feed, extracts it with ditto, and swaps the bundle with mv. It never reuses a file from the installed copy, even when most of the bundle hasn’t changed. This is true in 0.11.0 and on current main.
That gets expensive for an app that ships large files that rarely change. Sage, a Native SDK 0.11.0 app, carries a pinned Ollama (local AI server) and a pinned Node.js in Contents/Resources. Its update ZIPs:
| Release | Update ZIP | Notes |
|---|---|---|
| 0.2.2 | 78 MB | before Ollama was bundled |
| 0.3.0 | 226 MB | first with Ollama |
| 0.6.0 | 225 MB | same Ollama as 0.3.0 |
About 148 MB of each update is the same Ollama files. Six updates have shipped since 0.3.0, so a user who installed them all downloaded the same Ollama bytes six times, about 0.9 GB.
The app can’t work around this on its own side. Moving the large files out of the bundle means the app has to download, check, and clean them up itself. It also takes them out from under the app’s code signature. The updater already knows both bundles, so it is the right place to skip the unchanged files.
The proposal
Add an optional delta path that reuses unchanged files from the installed bundle, and keep the full ZIP as the fallback.
What a release publishes
- The full update ZIP and
native-update.json, exactly as today. - A file list for the new bundle. It gives every file’s relative path, size, mode, and SHA-256, plus each symlink and its target.
- One patch ZIP for each recent base version. It holds only the files that are new or changed since that version.
- A second signed feed, such as
native-update-delta.json. It holds the file list’s URL, size, and SHA-256, and, for each patch, the base version, URL, size, and SHA-256.
The file list doesn’t fit in the existing payload. Sage’s bundle has 8,118 files, and max_payload_bytes is 32 KB. So the signed feed carries the list’s hash, and the list itself is a separate download.
The delta feed has to be a separate file. verifyEnvelope parses both the envelope and the payload with ignore_unknown_fields = false. A new field in native-update.json would make every installed 0.11.0 copy reject the feed, so those copies could never update again. A separate file leaves them on the full ZIP.
What the updater does
- Fetch and verify
native-update-delta.jsonwith the same key as the main feed. If it’s missing or has no patch for the installed version, use the full ZIP. - Download the file list and the matching patch, and check each against its signed size and SHA-256.
- Clone the installed bundle into the staging folder it already uses,
.<App>.app.native-update-<uuid>next to the app. APFSclonefilemakes this instant and uses no extra disk space. On another file system, copy it instead. - Extract the patch over the clone, then delete every file the list doesn’t name.
- Check the whole staged tree against the file list: paths, sizes, modes, symlink targets, and SHA-256. Any difference, such as a file someone changed in the installed copy, sends it back to the full ZIP.
- Run the checks it runs today: bundle ID, version, and the
codesignrequirement when the app has a team ID. - Swap the bundle with the same install script, so rollback stays as it is.
What native update sign gains
- A way to pass the update ZIPs of earlier releases, such as
--base <zip>given more than once. It writes the file list, one patch ZIP for each base, and the signed delta feed. - The same archive checks it runs today, on the new bundle.
Notes
- Unchanged files must be byte-identical. For Sage they are. The bundled Ollama files match the cached download byte for byte, because
codesign --deepleavesContents/Resourcesalone. Ad-hoc signing an unchanged Mach-O twice also gives identical bytes. - Skipped versions. A user who skips several releases may have no matching patch. Publishing patches against the last few versions covers most people, and the full ZIP covers the rest.
- Why not one asset per file. A GitHub release holds at most 1,000 assets, and an app like Sage has thousands of files. One patch ZIP per base version keeps the asset count small.
- What it saves. The most a delta can be is everything that isn’t Ollama, which was 78 MB at 0.2.2. It is smaller when Node and the agent’s dependencies don’t change either.
- 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
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
GUI: the space panel stays stale after a run stops with no spacePossibly taken @nikkexe0-del claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
xevrion/hatchzip#237 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
flathub/org.ardour.Ardour#89 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Javis603/token-monitor#1861 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day