fix(update): stage-and-swap the Desktop rebuild so a failed pack never removes the working app
`hermes update` → `hermes desktop --build-only` → `npm run pack` packed electron-builder's output IN PLACE: before-pack.mjs wipes `release/<platform>-unpacked` (or the mac `Hermes.app`) before the Electron unpack/asar/rename, so any failure after that point — corrupt cached zip, blocked download, missing dep, disk full — left the user with NO app and the update reporting "partially complete" over an empty release/ (#86443). Fix the class, not the predicate: cmd_gui now passes `-c.directories.output=apps/desktop/.staging-<pid>-<ts>` to the pack, runs the existing verification (packaged-exe probe, macOS re-sign, Windows PE integrity gate) against the STAGED tree, and only then promotes it: `release/<unpacked>` → `.previous`, `<staging>/<unpacked>` → `release/<unpacked>`, drop `.previous`. A rename failure between the two steps restores `.previous`. On any failure the staging dir is removed and the live app is untouched. - `_purge_electron_build_cache` / `_ensure_desktop_exe_launchable` / `_desktop_macos_relaunchable_fixup` take the output dir so the corrupt-zip retry purge and the integrity self-heal only ever clear the staging tree, never `release/*-unpacked`. - `.gitignore` the staging dir so a killed build cannot dirty the checkout. - Docs: updating.md describes the stage-and-swap Desktop rebuild step. Live repro (real `_rebuild_desktop_after_update` → real `hermes desktop --build-only` subprocess, fake npm whose pack wipes appOutDir then fails): before — `release/linux-unpacked/hermes` gone after the failed rebuild; after — marker intact, no `.staging-*` left, rebuild returns False; a passing pack swaps the new app into `release/`. Closes #86443 Co-authored-by: AIalliAI <285906080+AIalliAI@users.noreply.github.com> Co-authored-by: deathxdefeat <deathxdefeat@users.noreply.github.com>
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -109,6 +109,9 @@ apps/shared/src/**/*.js
|
||||
apps/shared/src/**/*.js.map
|
||||
apps/shared/src/**/*.d.ts
|
||||
apps/desktop/release/
|
||||
# stage-and-swap Desktop rebuild output (#86443); removed after the swap, but
|
||||
# a killed build must not leave the checkout dirty
|
||||
apps/desktop/.staging-*/
|
||||
*.tsbuildinfo
|
||||
|
||||
# Web UI assets — synced from @nous-research/ui at build time via
|
||||
|
||||
Reference in New Issue
Block a user