Skip to content

Specialize thirdshift on Linux and drop native macOS support #1665

Closed
3 of 3 issues completed
Closed

Description

@JacobStephens2

Problem Statement

Maintaining native macOS (aarch64-apple-darwin) as a supported target alongside Linux creates two problems for the Day shift and for anyone running thirdshift on an Apple Silicon Mac:

  1. Inconsistent and degraded host capabilities on native macOS: Many of thirdshift's core production and evaluation guarantees rely on Linux kernel and userspace primitives that do not exist on macOS: bwrap user, PID, IPC, UTS and network namespaces with socat proxy isolation for Trials, Graders, and Setup's Security sandbox probe; systemd --user transient cgroup v2 memory and OOM scopes; systemd service and reverse-proxy generation in thirdshift console install; pidfd_open process-identity pinning; /proc/self/exe and /proc/self/fd inheritance so child Ticket runs keep running the parent binary across thirdshift update; and native inotify filesystem watching. Running unattended sessions directly on a personal macOS host also exposes the host home directory and macOS Keychain without bwrap isolation or cgroup memory limits, while git worktree operations spawn processes four to five times slower on macOS than on a Linux ext4 filesystem.
  2. Disproportionate CI and maintenance cost: GitHub caps personal accounts at five concurrent macOS jobs, requiring a multi-job macos-plan / gate / 4-shard CI split, a manually curated macOS gate test filter, a macos-26 release build, and #[cfg(target_os = ...)] branches and test guards across the codebase. With #1663 adding a statically linked aarch64-unknown-linux-musl release binary and ubuntu-24.04-arm CI coverage, Apple Silicon Mac users can run the full-featured ARM Linux binary inside an Ubuntu 24.04 Linux VM (such as Lima on Apple's Virtualization.framework), just as Windows users run thirdshift inside WSL2. Keeping native macOS alongside aarch64 Linux duplicates Apple Silicon support with a second, degraded target.

Solution

Specialize thirdshift strictly on Linux and remove native macOS (aarch64-apple-darwin) support:

  • Releases (dist and ADR 0003): Publish only statically linked Linux binaries (x86_64-unknown-linux-musl and aarch64-unknown-linux-musl from #1663) through GitHub Releases and the shell installer. Remove the aarch64-apple-darwin build target and its macos-26 runner mapping, and regenerate the release workflow.
  • CI workflows and test configuration: Remove the macOS CI plan, gate, shards, aggregate check, and test:macos label handling, along with the macOS gate nextest profile. Keep ubuntu-24.04 (x86_64) on every pull request and ubuntu-24.04-arm (aarch64) on main pushes, nightly schedules, manual dispatches, and opt-in pull requests.
  • Linux-only codebase and test suite: Remove all macOS and non-Linux conditional compilation branches from the binary and integration tests so process identity (pidfd_open and /proc), Console process exit watching (pidfd_open), Console service installation, Setup's Security sandbox probe, embedded Factory skills directory handles, Trial/Grader systemd scopes, and child Ticket run executable inheritance are unconditional Linux implementations. Add a top-level compile-time check rejecting non-Linux targets with a clear message directing macOS users to a Linux VM (such as Lima) and Windows users to WSL2.
  • Documentation and site: Update ADR 0003, the README, the user manual (and regenerated site manual), the hand-written site pages, and the CI/testing documentation so supported platforms are Linux-only:
    • Full test suite in CI: Ubuntu 24.04.3 and later (x86_64 and aarch64), noting that on Apple Silicon macOS, users run Ubuntu 24.04 aarch64 in a Linux VM such as Lima (vz, with repositories kept on the Linux filesystem rather than under /Users, parallel to WSL2 avoiding /mnt/c).
    • Release smoke check only: Rocky Linux 9.8 and later (x86_64) and WSL2 with Ubuntu 24.04 or later (x86_64).
      Remove the macOS LaunchAgent scheduling section from the user manual (since standard Linux cron and systemd user timers work directly inside a Linux VM on macOS) and update the homepage structured data operatingSystem field to "Linux".

User Stories

  1. As a Day shift maintainer on an Apple Silicon MacBook, I want to run thirdshift inside an Ubuntu 24.04 aarch64 Linux VM (such as Lima) using the official shell installer and thirdshift update, so that I get full bwrap sandboxing, systemd cgroup memory scopes, fast ext4 git worktree operations, and host filesystem isolation without compiling from source.
  2. As a Day shift maintainer, I want thirdshift setup to always run the live bwrap Security sandbox probe rather than maintaining a non-Linux "unavailable on this OS" fallback, so that every supported installation validates real network and home-directory isolation.
  3. As a Day shift maintainer, I want thirdshift stop and Command record liveness checks to rely unconditionally on Linux /proc boot-id + start-time ticks and pidfd_open / pidfd_send_signal, so that PID-reuse protection has one implementation across all supported hosts.
  4. As a Day shift maintainer viewing the Console, I want live process-exit notifications to use Linux pidfd_open unconditionally without a parallel kqueue implementation, so that Console process watching has a single code path to maintain and test.
  5. As a Day shift maintainer running thirdshift console install, I want the command to generate the systemd and reverse-proxy installation script directly without a runtime platform refusal branch, because every supported thirdshift binary already runs on Linux.
  6. As a Day shift maintainer running thirdshift update while a Spec run or Ticket run is active, I want child Ticket runs and Base fixes to always start from /proc/self/exe rather than falling back to the install path on non-Linux systems, so that in-flight runs never mix binary versions across an update on any supported platform.
  7. As a Day shift maintainer, I want embedded Factory skills directory handles to always use Linux O_PATH | O_DIRECTORY | O_NOFOLLOW descriptors without a non-Linux fallback, so that skill linking has uniform symlink-race protection everywhere thirdshift runs.
  8. As a Day shift maintainer running Experiments, Trials, and Graders, I want systemd --user transient cgroup scopes to be a guaranteed platform capability rather than guarded by runtime cfg!(target_os = "linux") checks, so that memory limits and OOM detection behave identically on every supported host.
  9. As a contributor or user who accidentally runs cargo build or cargo install thirdshift on a native macOS or Windows host toolchain, I want compilation to fail immediately with a clear compile_error! message pointing me to a Linux VM (such as Lima on macOS) or WSL2 (on Windows), so that I know right away how to run thirdshift on my machine.
  10. As a Day shift maintainer waiting on pull request and main CI runs, I want CI to run without macos-26 jobs (macos-plan, test-macos-gate, test-macos-shard, test-macos), so that pull requests and merges are never queued behind GitHub's 5-runner macOS concurrency cap or slowed down by macOS fork/exec overhead.
  11. As a contributor adding or modifying tests, I want .config/nextest.toml to have no macos-gate filterset to keep in sync and integration tests to have no #[cfg(target_os = "linux")] / #[cfg(not(target_os = "linux"))] guards, so that every test in the repository is unconditionally compiled and run as part of the standard Linux test suite.
  12. As a Day shift maintainer cutting a release, I want the generated release workflow to build and smoke-test only the static Linux binaries (x86_64-unknown-linux-musl and aarch64-unknown-linux-musl), so that releases do not depend on macos-26 runner availability or publish an unsupported aarch64-apple-darwin archive.
  13. As a new user reading the README, user manual, or website on an Apple Silicon Mac, I want the Supported Platforms documentation to explain that thirdshift runs on Ubuntu 24.04 aarch64 inside a Linux VM such as Lima (keeping repositories on the Linux filesystem rather than under /Users, just as WSL2 keeps repositories off /mnt/c), so that I can set up a supported environment with full sandboxing and fast git I/O.
  14. As a Day shift maintainer scheduling unattended Architect runs, Pickup runs, or Security runs on a Mac via a Linux VM, I want the user manual's scheduling instructions to cover standard Linux cron and systemd user timers without a separate macOS LaunchAgent plist section, because runs execute inside the Linux VM where macOS Keychain session restrictions do not apply.
  15. As a reader of the project's architecture decision records and CI documentation, I want ADR 0003, the CI performance guide, and the testing guide to reflect the Linux-only architecture and the x86_64 / aarch64 Linux runner split accurately, so that operational and design docs never contradict the workflows or code.

Implementation Decisions

  • Sequencing with #1663: This Spec builds on top of #1663, which adds the aarch64-unknown-linux-musl release target, the ubuntu-24.04-arm release smoke check, and the ubuntu-24.04-arm CI test suite. Native macOS removal must be executed after #1663 lands so that aarch64-unknown-linux-musl and ubuntu-24.04-arm remain in place while aarch64-apple-darwin and macos-26 are removed.
  • Compile-time Linux target enforcement: The binary crate will enforce #[cfg(not(target_os = "linux"))] compile_error!(...) at the crate root with a message stating that thirdshift supports Linux only and directing macOS users to run it inside an Ubuntu 24.04 Linux VM (such as Lima) and Windows users to use WSL2.
  • Unconditional Linux implementations in production modules:
    • Process identity and termination: Remove the macOS proc_pidinfo and proc_signal_with_audittoken implementations; retain only the Linux /proc/<pid>/stat + /proc/sys/kernel/random/boot_id start identity and pidfd_open + pidfd_send_signal termination.
    • Console process watching and filesystem change paths: Remove the macOS kqueue (EVFILT_PROC) exit descriptor implementation, leaving only the Linux pidfd_open implementation. Remove macOS-specific /private/var path-alias commentary where no longer relevant while keeping canonical path handling intact.
    • Setup Security sandbox probe: Remove the non-Linux unavailable_report fallback branch and its unit tests (macos_report_explains_unchecked_controls_and_needs_validation, other_platforms_get_unchecked_isolation_guidance_without_seatbelt, and the non-Linux integration test security_sandbox_unavailable_report_preserves_saved_settings). Setup always runs the real bwrap probe on Linux.
    • Skills directory handle: Remove the non-Linux directory-handle fallback, keeping the Linux O_PATH | O_DIRECTORY | O_NOFOLLOW descriptor implementation unconditionally.
    • Child Ticket run and Base fix spawning: Remove the cfg!(target_os = "linux") conditionals around /proc/self/exe resolution and prctl(PR_SET_NAME) so child runs unconditionally execute from /proc/self/exe and set their Linux process name.
    • Trial and Grader systemd scopes: Remove the cfg!(target_os = "linux") guard so systemd --user scope creation is unconditional.
    • Console service installer: Remove the ensure!(cfg!(target_os = "linux"), ...) runtime check from console install, since the binary only compiles on Linux.
  • Test suite cleanup: Remove all #[cfg(target_os = "linux")], #[cfg(not(target_os = "linux"))], #[cfg(target_os = "macos")], and #![cfg_attr(not(target_os = "linux"), ...)] attributes and cfg!(target_os = "macos") branches across unit and integration tests (setup, setup_lifetime, base_fix, spec_run, console, console_install, metrics, release, site_deploy, and support), deleting dead non-Linux test stubs and keeping the Linux test implementations unconditional.
  • Release configuration and generator: Remove aarch64-apple-darwin from the dist target list and custom runner map, leaving x86_64-unknown-linux-musl (ubuntu-24.04) and aarch64-unknown-linux-musl (ubuntu-24.04-arm). Regenerate the release workflow through the repository's release generator script so that no macos-26 build job is emitted and the shell installer's platform table contains only the Linux targets.
  • CI workflow and nextest configuration: Remove macos-plan, test-macos-gate, test-macos-shard, and test-macos from the CI workflow, along with test:macos label handling if not shared with ARM Linux, and remove [profile.macos-gate] from the nextest configuration. Preserve #1663's ubuntu-24.04-arm CI policy (main pushes, nightly schedule, workflow_dispatch, and opt-in pull request label) alongside the per-PR ubuntu-24.04 (x86_64) jobs.
  • Documentation, ADR 0003, and site updates:
    • Amend ADR 0003 to record that thirdshift ships two static Linux musl binaries (x86_64-unknown-linux-musl and aarch64-unknown-linux-musl) and specializes on Linux so every supported host provides bwrap namespaces, systemd --user cgroup scopes, pidfd_open, /proc/self/exe inheritance, and inotify; native macOS, Intel macOS, and native Windows have no binary, and Apple Silicon macOS users run the aarch64 Linux binary inside a Linux VM (such as Lima) just as Windows users run the x86_64 Linux binary inside WSL2.
    • Update the README, the user manual's Supported platforms and thirdshift update sections, and the hand-written site homepage (Requirements and platforms and JSON-LD operatingSystem: "Linux") to state each supported platform and how it is checked:
      • Test suite in CI: Ubuntu 24.04.3 and later (x86_64 and aarch64), noting under aarch64 that on Apple Silicon macOS you run Ubuntu 24.04 aarch64 in a Linux VM such as Lima (vz, keeping repositories on the Linux filesystem with --mount-none, not under /Users).
      • Release smoke check only: Rocky Linux 9.8 and later (x86_64) and WSL2 with Ubuntu 24.04 or later (x86_64, keeping repositories on the Linux filesystem, not /mnt/c).
    • Remove the On macOS, a LaunchAgent subsection and all cross-references to it from the user manual, and regenerate the HTML user manual (site/docs/index.html).
    • Update the CI performance and testing documentation (docs/ci-performance.md and docs/testing.md) to remove active macos-gate / macos-26 workflow tables and macOS test-fallback notes while keeping dated files under docs/research/ as historical research records.

Testing Decisions

  • What makes a good test: Tests should verify external, user-observable behavior at the highest existing seam (CLI invocations, generated workflow files, HTTP responses, and rendered documentation pages) rather than internal implementation details.
  • Release generator and workflow seam: Run the release generator freshness check and unit tests (python3 scripts/generate-release.py --check and python3 -m unittest discover -s scripts -p 'test_*.py') to verify that the generated release workflow includes only x86_64-unknown-linux-musl and aarch64-unknown-linux-musl and passes all release policy assertions.
  • Linux CLI and integration test seam: Run the existing integration and unit test suites covering Setup's bwrap sandbox probe, Stop process-identity signaling, Console live process watching and service installation, Spec run / child Ticket run execution, and PTY child lifetime supervision (setup, setup_lifetime, stop, console, console_install, spec_run, release, site_deploy, and binary unit tests) to verify that all unconditional Linux paths compile cleanly with zero warnings under cargo clippy --all-targets -- -D warnings and pass.
  • Site and generated manual seam: Regenerate the user manual (npm run docs --prefix site) and run the full site Playwright test suite (npm test --prefix site) and Console Playwright test suite (npm test --prefix console) to verify that all internal section links, anchor targets (after removing #on-macos-a-launchagent), structured data, and responsive layouts pass.
  • Final validation: Run scripts/affected-tests main to execute all affected suites end to end.

Out of Scope

  • Native macOS (aarch64-apple-darwin or x86_64-apple-darwin) and native Windows builds or runtime support.
  • Target repositories whose local build or test loop requires Apple's macOS-only Xcode SDKs (xcodebuild, SwiftUI/UIKit/AppKit, or the iOS Simulator).
  • Running a nested Lima VM inside GitHub Actions CI (the guest OS, Ubuntu 24.04 aarch64, is tested directly on ubuntu-24.04-arm in CI).
  • Modifying historical research notes in docs/research/macos-ci-speed.md.

Further Notes

  • Full primary-source research and step-by-step Lima (vz) Ubuntu 24.04 setup notes for Apple Silicon MacBooks are recorded in docs/research/linux-on-macbook.md.
  • Must be sequenced after #1663 merges so that aarch64-unknown-linux-musl and ubuntu-24.04-arm CI are already present on main.

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions