Skip to content

feat: macOS as a developer platform in preview, Homebrew, arm64 Linux (ADR-0054) - #225

Merged
7schmiede merged 10 commits into
mainfrom
feat/macos
Oct 23, 2026
Merged

7schmiede merged 10 commits into
mainfrom
feat/macos

Conversation

@7schmiede

@7schmiede 7schmiede commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Implements ADR-0054 (accepted 2026-10-23, #224). Refs #66.

Commits, in order:

  1. refactor(proc): devstack-proc split into posix.rs, linux.rs, macos.rs (stub), windows.rs; any other OS is a compile_error!. No behaviour change.

  2. refactor(desktop): new crate devstack-desktop, one module per OS: autostart, link, notification sinks, folder picker, browsers, ADR-0046 programs, Docker start, install channel, self-uninstall bits. No behaviour change (fixes the hub's dead-code errors on macOS).

  3. feat(proc): macOS backend with libproc process groups, proc_pid_rusage start time, task info CPU/RSS, getppid polling in the shim, hw.memsize/host_statistics64/HOST_CPU_LOAD_INFO, and build-job usage without cgroups. Linux too: a build job without a cgroup now tracks its process groups (usage, and its servers end with the job), like Windows and the cgroup case.

  4. feat(desktop): macOS LaunchAgent, osascript folder picker, open/open -a, Docker/OrbStack start, brew upgrade hand-over, stable <prefix>/bin/devstack for a Homebrew copy, doctor's "macOS preview" section. Notifications and devstack:// are off with "not on macOS yet".

  5. feat: release builds for aarch64/x86_64-apple-darwin and aarch64-unknown-linux-musl, a Homebrew formula and render script, jobs homebrew (install + test from a local tap on macOS, Linux x86_64 and arm64) and homebrew-tap (on a tag, push to nuetzliches/homebrew-tap with HOMEBREW_TAP_TOKEN), macos-14 in CI check and integration, install.sh for macOS and arm64 Linux, FSEvents real paths in the watcher, a connect probe for *:port listeners on macOS, and README, landing page, AGENTS.md and CHANGELOG.

  6. fix(cli): a worktree is found under its real path too. macOS keeps temporary directories under /var, which links to /private/var, and the lane was not recognised. docs/macos.md holds the tester checklist (linked from README), and CI runs every test binary (--no-fail-fast).

  7. ci: Spotlight is turned off on the macOS runners. Its indexing took most of the three cores, so a node test found no free CPU to offer (measured with top; devstack's own CPU reading matched it).

CI on this branch: all green on Windows, Linux and macOS, integration (macos-14) included. Release dry run: all five builds and the Homebrew install and test on macOS, Linux x86_64 and Linux arm64 are green.

The release workflow's dry run on these changes was green (run 39853182468): all five builds, plus brew style/install/test on macOS, Linux x86_64 and Linux arm64.

Needs from the owner before the first release with it: the repository nuetzliches/homebrew-tap and the secret HOMEBREW_TAP_TOKEN.

🤖 Generated with Claude Code

7schmiede and others added 8 commits October 23, 2026 10:53
…a module per OS

unix.rs was Linux in practice: it read /proc and cgroups, and on any other
Unix its process lists came back empty (ADR-0054 point 6). It is now:

- posix.rs: signals, process groups, the shim and its keeper thread,
  restart cleanup, rlimit, statvfs; the backend that owns process trees
  on Unix, with the same functions as windows.rs.
- linux.rs: /proc (start time, group scan, per-process CPU and RSS),
  PR_SET_PDEATHSIG, cgroup v2 (a Cgroup type), MemTotal/MemAvailable and
  /proc/stat.
- macos.rs: the same functions, answering "cannot tell" as before; its
  Cgroup is an uninhabited type (macOS has no cgroups).

lib.rs routes through `backend` (windows or posix) and `sys` (windows,
linux or macos) instead of cfg(not(any(windows, linux))) fallbacks; the
Windows code that lived in lib.rs moved to windows.rs. builds.rs keeps the
public types and has one `imp` module per backend. Another OS fails to
build (compile_error!).

No behaviour changes on Windows or Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g system

The desktop integration was spread over ten files in three crates, each with
a Windows branch and a `cfg(not(windows))` branch that meant Linux. It now
lives in `crates/devstack-desktop` (ADR-0054 point 6): `windows.rs`,
`linux.rs` and `macos.rs` implement the same functions, `lib.rs` names them
once, and an operating system without a module fails to build.

What moved:
- the hub at logon and the `devstack://` link (`devstack/integration.rs`)
- the notification sinks (`devstack-hub/notify/{windows,linux}.rs`): the
  hub keeps what notifies and when, the desktop only shows (`Note`), and
  tells the hub through hooks what failed
- the folder dialog (`devstack-hub/dialog.rs`), the foreground
  (`devstack-hub/foreground.rs`), `no_window`
- opening a browser (`devstack/hubcmd.rs`), the dashboard on a click
  (`devstack-hub/lib.rs`), the user's programs' finding and starting
  (`devstack-hub/open.rs`; the fixed list stays in the hub)
- starting Docker (`devstack-compose/engine.rs`)
- how devstack was installed (`update.rs`, `selfcmd.rs`, `integration.rs`)
  and the platform parts of `devstack self uninstall`

Behaviour does not change: `macos.rs` does what the `not(windows)` and
fallback branches did on a Mac until now. It also ends the dead-code errors
the macOS build had in the hub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS got empty process lists from the Linux code: stop never escalated
to SIGKILL, the shim did not notice the daemon dying, the restart cleanup
found nothing and every usage was zero (ADR-0054 point 2). macos.rs now
implements the OS functions the POSIX backend uses:

- process groups through libproc: proc_listpids(PROC_PGRP_ONLY) with
  proc_pidinfo(PROC_PIDTBSDINFO) to drop zombies and processes that left;
- start times from proc_pid_rusage (ri_proc_start_abstime): Mach absolute
  time since boot, which like Linux's ticks since boot only grows within a
  boot and restarts at a reboot, so the cleanup compares the same way;
- CPU time and resident set from PROC_PIDTASKINFO, the times scaled from
  Mach units with mach_timebase_info;
- the shim's parent death: a thread polls getppid() every 500 ms and
  raises the same SIGUSR2 that PR_SET_PDEATHSIG delivers on Linux;
- hw.memsize, host_statistics64(HOST_VM_INFO64) (total less app, wired
  and compressed memory, as Activity Monitor counts it: the closest to
  MemAvailable) and host_statistics(HOST_CPU_LOAD_INFO).

The build job without a cgroup (macOS, and Linux where the daemon's
cgroup is not delegated or for `devstack build`) now knows the process
group of each build it started, with its leader's start time: usage and
pids walk those groups, and dropping the job kills them, so build servers
end with the job as they do with a cgroup or a job object. Before, Linux
without a cgroup reported nothing and left the servers to their idle
timeouts.

The process tests get a macOS path (ps for liveness; the build job's
servers end with it everywhere), the cleanup unit test runs on every
Unix, and macos.rs has unit tests for the metrics, the group listing and
the scaling of CPU time. New dependency on macOS: mach2 (MIT/Apache/BSD),
for mach_host_self and mach_timebase_info, which libc deprecates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`macos.rs` replaces what the Linux branches did on a Mac:

- the hub at logon: a LaunchAgent of devstack's own
  (`~/Library/LaunchAgents/it.nuetzliche.devstack.hub.plist`, `hub start`
  once at load like the Windows and Linux entries, `AbandonProcessGroup`,
  the installing shell's PATH plus Homebrew's), loaded with `launchctl
  bootstrap gui/<uid>` and removed with `launchctl bootout`
- the folder dialog: `osascript` `choose folder`; cancel is cancel
- the dashboard and browsers: `open`, `open -a "Google Chrome"` and the
  other known names
- the user's programs (ADR-0046): Finder, Terminal, editors and agents by
  the schemes LaunchServices knows, GitHub Desktop, Orca
- Docker: `open -g -a Docker`, or OrbStack without Docker Desktop
- notifications and the `devstack://` link say "not on macOS yet"; the hub's
  session tells the dashboard, which offers `devstack hub start` instead of
  its "Start hub" link while the hub is down

A copy Homebrew installed (macOS, and Linux) is updated by `brew upgrade
nuetzliches/tap/devstack` (a pinned `--version` is refused), uninstalled by
`brew uninstall`, and started again (LaunchAgent, autostart, the hub after
an update, the hub's own `up`/`update`) by `<prefix>/bin/devstack`, never by
the versioned path under `Cellar/`. `devstack doctor` names the LaunchAgent
and what the macOS preview leaves out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R-0054)

- release.yml: aarch64/x86_64-apple-darwin (macos-14, deployment target
  11.0) and aarch64-unknown-linux-musl (ubuntu-24.04-arm); artifacts named
  bin-<target>. Job `homebrew` installs and tests the formula from the
  archives just built (local tap, file:// URLs) on macOS and Linux x86_64
  and arm64; on a tag, `homebrew-tap` pushes it to nuetzliches/homebrew-tap
  (secret HOMEBREW_TAP_TOKEN, a dry run without).
- packaging/homebrew: the formula (no `service` block) and render.sh.
- ci.yml: macos-14 in check and integration (no Docker there).
- install.sh: macOS (Rosetta takes the native build) and arm64 Linux,
  shasum fallback, a version compare without `sort -V`, refuses to overwrite
  a Homebrew copy.
- update.rs: the release archive per target triple.
- watch.rs: FSEvents' real paths are taken back under the repository.
- port_in_use: on macOS a listener on *:port is found by a connect.
- README, landing page, AGENTS.md, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/private/var); docs/macos.md, the tester checklist; CI runs every test binary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7schmiede and others added 2 commits October 23, 2026 10:59
…report is dropped (FSEvents)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ough

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 0e518d5 into main Oct 23, 2026
26 checks passed
@7schmiede
7schmiede deleted the feat/macos branch October 23, 2026 09:14
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