Files
connector-macos/smoketest
David YoungandClaude Opus 5.5 ad97e68db1 Let sandboxed agents use mktemp, and keep backups from waiting on prompts
macOS' mktemp uses the per-user temp folder in /var/folders, not TMPDIR,
so the sandbox now allows writing there. The sandbox's settings move out
of it, to Application Support, which the agent can't read or write.

Without Full Disk Access, reading Desktop, Documents, Downloads, other
apps' containers or Photos makes macOS ask, and restic waited for an
answer no one gives at night. The backup now leaves those out until it
has Full Disk Access, as configure backup already said it did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:19:21 -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 openai/tools/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. The image also allows only App Store apps (spctl --status -v says "developer id disabled"), and since macOS 15 only System Settings or MDM can change that. So 70-apps checks that app_install says so, and skips installing Element, Nextcloud and Tailscale. To test those installs, allow "App Store & Known Developers" in a VM's Privacy & Security once, and use that VM as the image (see below).

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.
05-install install.sh piped into bash, as curl | bash runs it, with the working copy. The commands are in ~/.local/bin and a login zsh finds them, and update swaps in a fresh copy without leaving staging folders behind. Then the published version installs from Gitea, records its commit, and update says it is up to date.
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
85-sftp macFUSE and SSHFS install, with their Team IDs checked; FSKit is chosen on macOS 26. Then it tries to turn on macFUSE's extension with pluginkit. If that works, the VM mounts a folder from itself over SSH, a file reads and writes through the mount, and storage-mount mounts it again after it's unmounted.

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 next backup includes Desktop, Documents and Downloads, which it leaves out without Full Disk Access (as macOS would otherwise stop it with a prompt).
  • Turning on macFUSE's file system extension, if 85-sftp couldn't do it with pluginkit: then mount an SFTP folder with configure storage. With the extension off, 85-sftp checks that add_sftp gives up after 30 seconds rather than hanging.
  • 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.
  • Installing Element, Nextcloud and Tailscale, on an image that allows apps from identified developers: start a VM with --keep, choose "App Store & Known Developers" in System Settings > Privacy & Security, stop it, then tart clone it to a new name and run smoketest/run --image <that name> 70.

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.