Skip to content

fix: don't cache shipItLauncher errors across update checks#316

Merged
MarshallOfSound merged 1 commit into
mainfrom
sam/fix-shipitlauncher-error-cache
May 3, 2026
Merged

fix: don't cache shipItLauncher errors across update checks#316
MarshallOfSound merged 1 commit into
mainfrom
sam/fix-shipitlauncher-error-cache

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Collaborator

Fixes #315.

_shipItLauncher wrapped +[SQRLShipItLauncher launchPrivileged:] in replayLazily, which buffers terminal events. If the first subscription errored — the user cancelling the auth prompt (errAuthorizationCanceled / -60006) or a transient SMJobSubmit failure — every subsequent check replayed that error without re-invoking launchPrivileged:. Each interval would re-download, re-verify, write ShipItState.plist, hit the cached error, and delete the staged update, until process restart.

Replaces replayLazily with a doCompleted: flag: success is still memoized (the launchd job dict is update-agnostic; ShipIt re-reads ShipItState.plist after waitForTermination, so submit-once-per-process was already the contract), but errors fall through and retry on the next subscription.

The sole consumer is then: so the dropped value-replay is a no-op (+launchPrivileged: returns [RACSignal empty] on success anyway).

Two new tests:

  • should not re-submit the launchd job after a successful launch — locks in the existing invariant
  • should retry the launch on the next subscription after an error — fails on main, passes here

_shipItLauncher wrapped +[SQRLShipItLauncher launchPrivileged:] in
replayLazily, which buffers terminal events. If the first subscription
errored — the user cancelling the auth prompt (errAuthorizationCanceled)
or a transient SMJobSubmit failure — every subsequent check replayed
that error without re-invoking launchPrivileged:. Each interval tick
would download, verify, write ShipItState.plist, hit the cached error,
and delete the staged update, until process restart.

Replace replayLazily with a doCompleted: flag so success is still
memoized (the launchd job dict is update-agnostic and ShipIt re-reads
ShipItState.plist after waitForTermination) but errors fall through and
retry on the next subscription.

Adds two tests: one locks in the existing submit-once-on-success
invariant, the other reproduces the cached-error bug.
@MarshallOfSound MarshallOfSound enabled auto-merge (squash) May 3, 2026 10:59
@MarshallOfSound MarshallOfSound merged commit 24817d0 into main May 3, 2026
9 checks passed
@MarshallOfSound MarshallOfSound deleted the sam/fix-shipitlauncher-error-cache branch May 3, 2026 11:18
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.

Cancelling the privileged-install auth prompt (or a transient SMJobSubmit failure) breaks auto-update until app restart

1 participant