Skip to content

fix(AutoUpdater): atomic install to avoid removing Synapse.app on copy failure#186

Merged
dep merged 1 commit intomainfrom
cursor/recent-commits-critical-bugs-9cda
Mar 31, 2026
Merged

fix(AutoUpdater): atomic install to avoid removing Synapse.app on copy failure#186
dep merged 1 commit intomainfrom
cursor/recent-commits-critical-bugs-9cda

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Mar 31, 2026

Summary

Fixes a data-loss / app-removal bug in the new GitHub DMG auto-updater: the installer deleted /Applications/Synapse.app before copying the new bundle. If copyItem failed (disk full, permission, interrupted I/O), the user could be left without a working Synapse install.

Changes

  • SynapseAppInstaller: Copy the mounted .app to a hidden staging name next to the destination (same volume), then use FileManager.replaceItemAt(_:withItemAt:...) to swap in place when an existing app is present; otherwise moveItem to the final path. Staging is removed on failure via defer.
  • AutoUpdater.copyApp: Delegates to SynapseAppInstaller.installBundle.
  • Tests: AutoUpdaterTests covers fresh install, replace-in-place, and “missing source leaves destination intact”.

Validation

  • Added unit tests for SynapseAppInstaller (temp dirs; no /Applications access required).
  • CI: xcodebuild test on macOS (per repo workflow) should run these tests.

Branch: cursor/recent-commits-critical-bugs-9cda

Open in Web View Automation 

…pp on copy failure

- Stage Synapse.app beside destination, then replaceItemAt for in-place swap
- Prevents data loss when copy/move fails after deleting the existing app
- Add SynapseAppInstaller tests for fresh install, replace, and failed source

Co-authored-by: Danny Peck <dannypeck@gmail.com>
@dep dep marked this pull request as ready for review March 31, 2026 19:32
@dep dep merged commit 9c3af04 into main Mar 31, 2026
4 checks passed
@dep dep deleted the cursor/recent-commits-critical-bugs-9cda branch March 31, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants