Files
connector-macos/smoketest
davidandClaude Opus 5.5 08e6b2ee4f Set up a Mac for a Federated Core, like CoreDesktop's configure
A macOS counterpart of CoreDesktop's configure, with the same drop-in
items in configure.d/:

- core: Mail, Calendar and Contacts through a configuration profile,
  Superpanel as an app, Nextcloud files through the Nextcloud app, and
  Element; with test-and-fix, password change and removal
- tailscale: join the Core's network through headscale
- backup: restic to Nextcloud through rclone, run by launchd through an
  app that can be given Full Disk Access
- storage: SMB shares mounted the way Finder does, again at login and
  on network changes
- agents, claude, opencode, hermes, sandbox: install the agents and run
  them in Anthropic's sandbox runtime (Seatbelt on macOS)
- ai-servers: LLM servers on this Mac or the network, for the agents

Apps and tools macOS lacks are offered for download, checked against
their makers' Team IDs and notarization, or published SHA-256 sums.
Everything runs on macOS' bash 3.2 with only built-in tools.

smoketest/ runs scenarios in fresh macOS VMs with Tart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:34:42 -07:00
..

Smoketest

These tests run configure's pieces on real macOS, in throwaway virtual machines made with Tart on an Apple silicon Mac. They check what can't be checked on Linux:

  • macOS' bash 3.2
  • JavaScript for Automation, the keychain and profiles
  • dns-sd
  • Seatbelt, which srt's sandbox uses
  • launchd
  • Gatekeeper and code signatures
  • real downloads

Running it

On an Apple silicon Mac:

brew install cirruslabs/cli/tart
smoketest/run --list                  # scenarios and their tier
smoketest/run                         # the quick scenarios
smoketest/run --tier all              # everything, including the big downloads
smoketest/run 60-backup               # one scenario (or: smoketest/run 60)
smoketest/run --keep 50               # leave the VM running afterwards, to look around
smoketest/run --image ghcr.io/cirruslabs/macos-sequoia-vanilla:latest   # another macOS

It tests the working copy as it is, including uncommitted changes. The first run downloads the image, about 25 GB. After that, each scenario takes a minute or two plus its own work. The backup scenario takes a few minutes, and 70-apps downloads about 400 MB.

Each run writes its logs to smoketest/results/<time>/, one per scenario, and prints which scenarios passed.

How it works

Each scenario runs on a fresh clone of Cirrus Labs' vanilla macOS image (default: Tahoe):

  • What's in it: macOS as it comes, with auto-login and a user admin (password admin) who has passwordless sudo.
  • Why vanilla: the "base" images come with Homebrew, Node.js and jq. Those would hide the paths a new Mac takes, where configure has to download its tools.
  • Gatekeeper: the vanilla image switches Gatekeeper off, so 70-apps switches it back on before testing downloads.

run drives each scenario from your Mac:

  1. Clones the image with tart clone and starts it with tart run --no-graphics.
  2. Puts a throwaway SSH key in the VM. The password admin is entered once, through SSH_ASKPASS.
  3. Copies the working copy to ~/connector in the VM.
  4. Runs lib/runner.sh with the scenario in the VM's desktop session, through launchctl asuser. That is where configure's GUI pieces run on a real Mac: open, launchd's gui domain, the unlocked login keychain. An SSH session isn't.
  5. Stops and deletes the VM, unless --keep is given.

Scenarios

Scenario Checks
00-environment Every script parses with /bin/bash 3.2. None uses a tool macOS lacks: no python3, which would start installing the Command Line Tools, and no jq, timeout or mapfile. The macOS tools used are all there.
10-configure configure --help, --list (nothing on stderr; agent sign-ins hidden until installed), the menu, and an item's questions
20-json-keychain json_get and json_edit through real osascript; saving, replacing and deleting keychain secrets
30-core-local The profile: valid, passwords and names survive escaping, stable payload UUIDs, and the format of profiles show -output stdout-xml. Superpanel's app: built, re-signed after the icon changes, and it opens. Element's config, and nextcloud.cfg matching
40-mdns dns-sd output comes through a pipe and is stopped on time; the VM finds its own _ssh._tcp and resolves its .local name
50-sandbox Node.js and srt download and install. A stand-in agent in the sandbox can't read ~/.ssh or the keychains, and can't write outside its project. It can use /tmp, mktemp and a pty. It reaches allowed sites only. It reaches a local LLM server only once ai-servers allows it. A new zsh finds the sandboxed command first.
60-backup restic and rclone download. A local WebDAV server stands in for Nextcloud. The Federated Backup app is built and answers whether it has Full Disk Access. launchd runs a backup, a snapshot appears, a file restores from it, and a second run the same day does nothing. Turning backups off removes the app and the job.
70-apps (all) With Gatekeeper on: an un-notarized app is turned down, and a package signed by the wrong Team ID is refused. Element, Nextcloud and Tailscale download and install, and their Team IDs match apps.sh. Nextcloud opens with the Core's address.
80-storage The launchd job is added with the first share and removed with the last; a share whose server can't be reached is skipped quickly without asking

What still needs a person

macOS deliberately allows these only with a click, so test them by hand on a VM (--keep) or a Mac. Each scenario notes which apply to it as a skip line.

  • Installing the profile: in System Settings > Profiles, choose "Federated Core (...)", then Install. Then check Mail, Calendar and Contacts against a real Core. configure core notices the profile was installed.
  • Full Disk Access for Federated Backup: after granting it, configure backup says it can read all your files, and the backup log no longer has permission errors for Documents and Desktop.
  • Mounting a real SMB share: the sign-in window, "Remember this password in my keychain", and whether mount volume "smb://host" without a share offers a list of shares.
  • Tailscale's VPN approval, and Nextcloud's sign-in in the browser.

Writing a scenario

A scenario is a bash file in scenarios/ that sets DESCRIPTION and TIER, either quick or all, and defines scenario. It runs in the VM with what configure gives items: CONNECTOR, CONF_DIR, and confirm and confirm_yes, which always answer yes. So it can source an item and call its functions. Checks, from lib/runner.sh:

Check
check "what" cmd... ok if the command succeeds; otherwise FAIL, with its output
check_not "what" cmd... ok if the command fails
check_eq "what" expected actual ok if they're the same
skip "why" Note something not checked
step "what" A heading

check runs its command in a subshell, so variables it sets don't last. Set those before the check.