macOS updater: reuse unchanged files from the installed app (delta updates)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- macos, zig
- Ambito
- desktop-dev, release
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Zig
- Stelle
- 7.9k
- Fork
- 335
- Merge medio
- 10h 33m
- PR unite (30g)
- 147
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vercel-labs/native
-
Per-view widget layout budget (1024 nodes) drops whole frames on real multi-pane app viewsForse già presa @slicenferqin l’ha presa 100 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
vercel-labs/native#408 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
vercel-labs/native#387 ·
I maintainer di solito rispondono entro 1 giorno
-
macOS: the window frame event reports the frame size where everything else expects the content sizeAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
vercel-labs/native#355 ·
I maintainer di solito rispondono entro 1 giorno
-
cef.zig: InstallResult.archive_path leaks on successForse già presa @versecafe l’ha presa 206 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
vercel-labs/native#32 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
vercel-labs/native#957 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel-labs/native
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
GUI: the space panel stays stale after a run stops with no spaceForse già presa @nikkexe0-del l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
xevrion/hatchzip#237 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
flathub/org.ardour.Ardour#89 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Javis603/token-monitor#1861 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno