Skip to content

Defer update downloads until preparation - #22

Merged
mxcl merged 2 commits into
masterfrom
codex/defer-update-downloads
Jul 31, 2026
Merged

Defer update downloads until preparation#22
mxcl merged 2 commits into
masterfrom
codex/defer-update-downloads

Conversation

@mxcl

@mxcl mxcl commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • make check() fetch release metadata only
  • expose the selected semantic version as Update.version
  • defer DMG download, mounting, and signature validation to prepareInstallation()
  • document the version 4 behavior and security boundary

Why

The main consumer needs to check for updates on startup and every 24 hours without repeatedly downloading or mounting the DMG. Previously, check() staged the full artifact before the caller decided to install it.

The check result remains advisory. prepareInstallation() retains the existing bounded download, Developer ID validation, protected promotion, second validation, rollback, and relaunch behavior.

Validation

  • swift test — 56 tests passed
  • Automic Vault consumer build passed against this local package
  • Automic Vault consumer tests — 50 passed

@mxcl
mxcl requested a review from Copilot July 31, 2026 17:38
@mxcl
mxcl marked this pull request as ready for review July 31, 2026 17:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes AppUpdater’s update flow so that check() performs lightweight update discovery (metadata only) and defers downloading/mounting/validation of the DMG until prepareInstallation(). It also exposes the selected semantic version on Update.version and updates docs/tests to reflect the new v4 behavior and security boundary.

Changes:

  • Refactor check() to return a lightweight Update and defer artifact preparation to prepareInstallation().
  • Add Update.version and adjust viable update selection to return both version + asset.
  • Update README guidance and revise unit tests to validate the deferred preparation behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
AppUpdater.swift Refactors update discovery vs preparation, adds Update.version, and adjusts viable-update selection return type.
Tests/AppUpdaterTests/AppUpdaterTests.swift Updates tests to verify check() does not stage/download and that preparation happens during prepareInstallation().
README.md Documents v4 behavior changes, including the security boundary between advisory metadata and authenticated candidates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AppUpdater.swift
@mxcl

mxcl commented Jul 31, 2026

Copy link
Copy Markdown
Owner Author

@copilot do you consider your issue resolved?

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@copilot do you consider your issue resolved?

Yes — commit f048cc5 ("Validate update metadata during discovery") already resolves it. validateAssetMetadata (https scheme, content type, non-zero size, and max-download-size checks) is now called in check() before the Update is returned, so a false-positive advisory result that would always fail at preparation time is no longer possible.

Copilot finished work on behalf of mxcl July 31, 2026 17:51
@mxcl
mxcl merged commit 4ae5b5b into master Jul 31, 2026
2 checks passed
@mxcl
mxcl deleted the codex/defer-update-downloads branch July 31, 2026 17:52
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.

3 participants