From 22f687f4de9cf1f344981df2cab5fe2e5bf45f0e Mon Sep 17 00:00:00 2001 From: Sean Plaice Date: Sun, 16 Aug 2026 21:56:33 -0700 Subject: [PATCH] fix: enforce the documented macOS 26 minimum Gate bootstrap and ensure_supported_platform on the product-version major so older Apple Silicon Macs abort before Homebrew or defaults mutations. The error reports required and detected versions. Closes #6. --- boot.sh | 4 ++++ lib/common.sh | 13 +++++++++++++ site/install | 4 ++++ tests/run.sh | 22 ++++++++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/boot.sh b/boot.sh index 156d2d0..8d8bf06 100755 --- a/boot.sh +++ b/boot.sh @@ -18,6 +18,10 @@ info() { printf '\033[34m➜ %s\033[0m\n' "$*"; } [ "$(uname -s)" = "Darwin" ] || abort "omacase only runs on macOS." [ "$(uname -m)" = "arm64" ] || abort "omacase supports Apple Silicon Macs only." +MACOS_MIN=26 +v="$(sw_vers -productVersion 2>/dev/null)"; major="${v%%.*}" +case "$major" in ''|*[!0-9]*) major=0 ;; esac +[ "$major" -ge "$MACOS_MIN" ] || abort "omacase requires macOS $MACOS_MIN or later (detected: ${v:-unknown})." # 1. Xcode Command Line Tools (provides git + compilers Homebrew needs). if ! xcode-select -p >/dev/null 2>&1; then diff --git a/lib/common.sh b/lib/common.sh index f6061f5..3cf5438 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -23,9 +23,22 @@ confirm() { # confirm "Question?" -> 0 if yes } # --- environment ------------------------------------------------------------- +OMACASE_MACOS_MIN=26 + +# Pure comparison so tests can feed arbitrary strings. Accepts "26", "26.0", +# "26.6.1"; compares the MAJOR only (Omacase supports a major, not a minor). +_macos_version_supported() { + local major="${1%%.*}" + case "$major" in ''|*[!0-9]*) return 1 ;; esac + [ "$major" -ge "$OMACASE_MACOS_MIN" ] +} + ensure_supported_platform() { [ "$(uname -s)" = "Darwin" ] || abort "omacase only runs on macOS." [ "$(uname -m)" = "arm64" ] || abort "omacase supports Apple Silicon Macs only." + local v; v="$(sw_vers -productVersion 2>/dev/null)" + _macos_version_supported "$v" || \ + abort "omacase requires macOS $OMACASE_MACOS_MIN or later (detected: ${v:-unknown})." } ensure_brew_env() { diff --git a/site/install b/site/install index 156d2d0..8d8bf06 100755 --- a/site/install +++ b/site/install @@ -18,6 +18,10 @@ info() { printf '\033[34m➜ %s\033[0m\n' "$*"; } [ "$(uname -s)" = "Darwin" ] || abort "omacase only runs on macOS." [ "$(uname -m)" = "arm64" ] || abort "omacase supports Apple Silicon Macs only." +MACOS_MIN=26 +v="$(sw_vers -productVersion 2>/dev/null)"; major="${v%%.*}" +case "$major" in ''|*[!0-9]*) major=0 ;; esac +[ "$major" -ge "$MACOS_MIN" ] || abort "omacase requires macOS $MACOS_MIN or later (detected: ${v:-unknown})." # 1. Xcode Command Line Tools (provides git + compilers Homebrew needs). if ! xcode-select -p >/dev/null 2>&1; then diff --git a/tests/run.sh b/tests/run.sh index b0c5f0c..b3254ad 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -430,6 +430,26 @@ test_bootstrap_copies_are_identical() { cmp -s "$ROOT/boot.sh" "$ROOT/site/install" } +test_macos_version_gate_boundaries() { + # shellcheck source=/dev/null + source "$ROOT/lib/common.sh" + _macos_version_supported "26" && + _macos_version_supported "26.0" && + _macos_version_supported "26.6.1" && + _macos_version_supported "27.1" && + ! _macos_version_supported "25.6" && + ! _macos_version_supported "15.5" && + ! _macos_version_supported "" && + ! _macos_version_supported "beta" +} + +test_boot_and_runtime_share_macos_minimum() { + # One number, three files — drift here would let bootstrap and runtime disagree. + grep -q 'OMACASE_MACOS_MIN=26' "$ROOT/lib/common.sh" && + grep -q 'MACOS_MIN=26' "$ROOT/boot.sh" && + grep -q 'MACOS_MIN=26' "$ROOT/site/install" +} + test_backup_domains_cover_defaults_sh() { OMACASE_ROOT="$ROOT" # shellcheck source=/dev/null @@ -956,6 +976,8 @@ run_test "herdr is declared in the Brewfile" test_herdr_is_declared_in_brewfile run_test "herdr agent hooks cover shipped agent CLIs" test_herdr_hooks_cover_shipped_agents run_test "herdr skill is left to herdr, not managed by omacase" test_herdr_skill_is_not_managed_by_omacase run_test "site/install matches boot.sh" test_bootstrap_copies_are_identical +run_test "macos version gate accepts 26+ and rejects below" test_macos_version_gate_boundaries +run_test "boot and runtime share the macos 26 minimum" test_boot_and_runtime_share_macos_minimum run_test "theme manifest lists all themes" test_theme_manifest_lists_all_themes run_test "OmniWM seed is valid with nine workspaces" test_omniwm_seed_is_valid_and_has_nine_workspaces run_test "Ghostty windows remain manageable by OmniWM" test_ghostty_windows_remain_manageable