Skip to content

Install certificate-free local nightlies without Squirrel #20

Closed

Description

@lastobelus

Problem

The LastCode local-nightly channel intentionally produces ad-hoc-signed macOS builds. This machine cannot obtain a usable Apple Developer certificate, so obtaining a Developer ID identity is not an acceptable prerequisite or fix.

The in-app local update flow nevertheless stages and installs those builds through electron-updater/Squirrel. Successive ad-hoc builds do not have a stable signing requirement: their designated requirements are tied to different CDHashes. Squirrel's macOS update path therefore cannot be relied on to replace one local nightly with the next.

This failed concretely while updating:

0.0.34-nightly.20260815.1104
→ 0.0.34-nightly.20260816.1110.1

The build and download completed, and the downloaded ZIP's SHA-512 matched nightly-mac.yml. The loopback feed served the entire 145,539,168-byte ZIP, but no ShipIt install job was registered and the installed version did not change. On Restart & Install, DesktopUpdates.installDownloadedUpdate stopped the backend, destroyed every window, and called quitAndInstall; the old app then remained running without a renderer or visible window.

The two app bundles were valid ad-hoc-signed bundles, but had different designated CDHash requirements. Each failed verification against the other build's requirement. Installing the retained DMG with lastcode-install successfully recovered the target version.

Password prompts and needing to use Reload App after installing an ad-hoc build are known constraints of this machine's broken/free Apple developer-account setup. They are not part of this bug, and this issue must not attempt to solve them by requiring a certificate.

Desired behavior

The lastcode-local source must install its retained, validated DMG through a certificate-free managed helper instead of Squirrel. Hosted, properly signed releases should retain the existing electron-updater path.

Use the existing lastcode-install behavior as the install primitive: validate and stage the replacement, take the cross-process install lock, quit LastCode, swap /Applications/LastCode.app with rollback protection, and relaunch the target. Avoid maintaining two independent implementations of that sequence.

The desktop must transfer ownership to a helper that can survive the old app quitting. The handoff needs an explicit readiness result after preflight. Do not stop backends or remove the only window until the helper has accepted the exact artifact and is ready to own quit/swap/relaunch. Once accepted, perform the normal graceful backend shutdown and app quit; do not destroy all windows first and then wait indefinitely on Squirrel.

If helper launch or preflight fails, leave the current version and visible window usable, clear the quitting/install-in-flight flags, and surface a retryable install error. If a swap fails after quit, preserve or restore the old app using the existing rollback behavior.

Keep this a small LastCode-only tracer rather than a general updater or background-job framework. The helper should receive an exact validated artifact path/identity via argv or a small typed payload; do not invoke arbitrary shell text or expose the retained-artifact directory as ambient authority.

Relevant implementation seams

  • scripts/build-desktop-artifact.ts
    • Local desktop artifacts explicitly use identity: "-", disable hardened runtime, and disable signing discovery. Preserve this certificate-free policy.
  • apps/desktop/src/updates/DesktopUpdates.ts
    • Local builds currently start a loopback generic feed and stage the ZIP with electron-updater.
    • installDownloadedUpdate stops the backend pool, calls electronWindow.destroyAll, then delegates to quitAndInstall.
    • Route install behavior by DesktopUpdateState.source: lastcode-local uses the managed DMG helper; hosted retains Squirrel.
  • apps/desktop/src/updates/LastCodeLocalUpdates.ts
    • Owns the versioned local helper boundary and is the natural place for a narrow validated install-handoff contract.
  • scripts/lastcode-local-update.mjs
    • Produces immutable local output and can expose the exact retained DMG identity needed by the handoff.
  • scripts/lastcode-install.mjs
    • Already implements locking, DMG mounting, app validation, staging, graceful quit, swap/rollback, and relaunch. Extract or share the smallest reusable install primitive instead of duplicating it.
  • apps/desktop/src/updates/updateMachine.ts
    • Model handoff/preflight failure as a retryable install failure without lying about the current installed version.
  • docs/lastcode/local-nightly-updates.md
    • Currently says the ad-hoc ZIP reuses Electron's normal install machinery. Update the documented install path and recovery behavior.

Acceptance criteria

  • From one packaged Apple Silicon ad-hoc local nightly, two consecutive newer ad-hoc local nightlies with different CDHashes can be installed from the sidebar without an Apple Developer/Developer ID certificate.
  • The lastcode-local flow does not start a Squirrel/ShipIt install. It hands the exact retained DMG to a LastCode-managed helper that survives the old process exiting.
  • The helper validates the artifact and acquires the install lock before acknowledging readiness; LastCode keeps its backend and visible window alive until that acknowledgment.
  • After a successful handoff, all owned backends stop gracefully, the current app quits, /Applications/LastCode.app is replaced with rollback protection, and the requested version is launched.
  • A deterministic helper launch/preflight failure leaves the old version running with a visible window and presents a retryable error.
  • A deterministic swap failure restores the prior app and preserves actionable diagnostics.
  • Manual lastcode-install and the in-app path share the lock, validation, staging, swap, rollback, and relaunch implementation rather than drifting copies.
  • Hosted signed updates preserve their current electron-updater behavior.
  • Focused tests cover source routing, exact-artifact handoff, readiness failure before shutdown, graceful shutdown after acceptance, install-lock contention, rollback, and hosted-path non-regression.
  • Packaged-desktop verification records the installed version and a visible native window after each of two successive certificate-free local updates. Password prompts or a manual Reload App may still be required on this known machine and are not failures of this issue.

Scope boundaries

  • LastCode-only; do not propose this personal local-nightly workflow upstream.
  • Do not require, provision, or repair Apple signing certificates.
  • Do not weaken artifact checksum/manifest validation, app-bundle validation, install locking, graceful backend shutdown, or rollback.
  • Do not add a daemon, general job framework, polling API, or compatibility layer.
  • Do not fold in issue Show phase progress and copyable errors for local nightly builds #19's build-progress/error-panel work.
  • Do not redesign hosted releases or their signing/update path.

Activity

  1. added 14 commits that reference this issue on Aug 17, 2026
    ae50096
    13a413a
    c1ff593
    81770c7
    42f689c
    b6a2764
    3ac8ff5
    03791a6
    07a7661
    3e41d4e
    e712f93
    4716dec
    b006db1
    9d23f0e
  2. 21 remaining items

  3. added 15 commits that reference this issue on Sep 2, 2026
    3373c09
    ef5d5db
    7ee4741
    97ba3e7
    112e1d4
    b007dc8
    ba215a1
    cb2ad53
    adb9842
    98bb708
    7d9023d
    5dea4f2
    8065609
    42550f7
    09e478a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions