Skip to content

Keep the macOS installation updated from main - #13

Merged
sallaumen merged 4 commits into
mainfrom
claude/auto-update-3257ac
Nov 6, 2026
Merged

sallaumen merged 4 commits into
mainfrom
claude/auto-update-3257ac

Conversation

@sallaumen

Copy link
Copy Markdown
Owner

Summary

The installed macOS copy now knows its commit, checks GitHub main about once an hour, and updates itself only after the new version builds and serves its own commit on a spare port.

  • Installer (bin/install-launch-agent): builds the checkout's commit into ~/Library/Application Support/LocalWebMonitorex-versions/<sha> with a REVISION file, and points ~/Library/Application Support/LocalWebMonitorex at it as a symlink. An older real directory there is kept as the previous version. It also installs com.localwebmonitorex.updater (StartInterval 3600, RunAtLoad) and gives the main agent the status file path. bin/uninstall-launch-agent removes both agents.
  • Updater (bin/update-from-main, run from a private copy in ~/Library/Application Support/LocalWebMonitorex-updater): fetches main into a private bare repository, compares it with the installed commit, exports the new commit into its own version directory, and runs that version's bin/build-installation. It then smoke-tests the build with MIX_ENV=prod mix phx.server on a free loopback port, using throwaway settings and an empty watched range. Only then does it switch the symlink and kickstart the main agent. If the dashboard does not serve the new commit on the saved port, it switches back and restarts the previous version. Fetch, build, smoke and restart failures leave the current version running and are written to status and to ~/Library/Logs/LocalWebMonitorex-updater.log. Builds are capped at 30 min; the version before the current one is kept for rollback. An installed commit that is not on main pauses updates.
  • Dashboard: Settings → Updates shows the installed commit, the last check, and one of: up to date / behind main by N commits / update failed: reason / not on main. The markup is one small function component (UpdateStatusPanel) so the parallel redesign can move it. The root layout adds a localwebmonitorex-revision meta tag, which the updater uses to make sure the right version answered.
  • README documents the flow.

CI follow-up: the push token lacks the workflow scope, so .github/workflows/ci.yml is unchanged. To run the shell suite in CI, add these lines after the existing bash -n step in the test job:

      - run: shellcheck bin/install-launch-agent bin/uninstall-launch-agent bin/build-installation bin/update-from-main test/shell/update_from_main_test.sh
      - run: test/shell/update_from_main_test.sh

The loopback bind is unchanged. Nothing on the machine was installed or restarted.

Activation

After merging, from an up-to-date main checkout run ./bin/install-launch-agent once. It rebuilds into the versioned layout, restarts com.localwebmonitorex, and turns on the hourly updater.

Validation

  • mix test (65 tests), mix format --check-formatted, mix compile --warnings-as-errors
  • shellcheck clean; test/shell/update_from_main_test.sh (local): up to date, two-step update with pruning, build failure, smoke failure, restart failure with rollback, diverged install, unreachable remote, and missing REVISION. It uses a local remote, a fake server and a fake launchctl.
  • Sandboxed end-to-end run with the real build and mix phx.server (fake launchctl only, temp dirs and ports)
  • WebKit check of the Updates panel at desktop and 375 px: no horizontal overflow

🤖 Generated with Claude Code

sallaumen and others added 4 commits November 6, 2026 11:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sallaumen
sallaumen merged commit aaff0b7 into main Nov 6, 2026
4 checks passed
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.

1 participant