Files
hermes-agent/apps/bootstrap-installer
kshitijk4poor d3b1e43005 fix(installer): never brick the install when a self-update swap fails
The macOS self-update bundle swap (install_macos_app_update, added in
#38296) could leave the user with NO app installed. If moving the
existing /Applications/Hermes.app aside failed, the code deleted the
running app outright and set moved_old=false; if the subsequent move of
the freshly built bundle into place then also failed, the rollback was
gated on moved_old (now false) and skipped — leaving the target deleted
with no replacement.

Extract the swap into swap_in_new_bundle() with a strict invariant: on
ANY failure path the target is left pointing at a working bundle (either
the original, rolled back, or untouched) and is never deleted with no
replacement. Also clean up the staged .hermes-update-new copy on the
failure paths instead of orphaning it.

Add unit tests covering the happy path, the rollback-on-install-failure
path, and the catastrophic both-moves-fail path. The catastrophic-path
test was verified to FAIL against the old code ("original app must NOT
be deleted on failure") and pass against the fix.
2026-06-03 12:01:31 -07:00
..
2026-05-31 17:46:56 -05:00
2026-05-31 17:46:56 -05:00
2026-05-31 17:46:56 -05:00
2026-05-31 17:46:56 -05:00