Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
## Unreleased — CI and contributor workflow

- Set up Homebrew in the macOS integration and benchmark workflows with `scripts/setup-macos-homebrew.sh` instead of the `Homebrew/actions/setup-homebrew` action. The organization Actions policy does not allow that action, so both workflows stopped at startup. The script uses an installed `brew` or installs Homebrew from a pinned, checksum-verified installer.
- Fix the Homebrew setup script failing at exit after a successful install (`installer: unbound variable`), and test the install path through to script exit.
- Run provider unit, SDK and prompt-parity checks on independent workers with compatible build caches, retaining MiMo fixture preparation and isolated native gates.
- Separate prerequisite-dependent MiMo qualification from ordinary provider tests, retaining required prepared-fixture checks and explicit qualification gaps. Normalize the rollback test's filesystem identity and synchronize the zombie-stream timing test with the initial cancellation.
- Pin the production prompt fixture's EOF format during regeneration; parity still compares the complete corpus bytes and unchanged token/contract expectations.
Expand Down
14 changes: 9 additions & 5 deletions docs/developer/test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test

> Last updated: 2026-09-30
> Last updated: 2026-10-01

The `d-inference` macOS CI lanes pin `blacksmith-12vcpu-macos-27` and select
Xcode 27 / native SwiftPM before compilation. Unit, SDK, prompt-parity,
Expand Down Expand Up @@ -1979,7 +1979,7 @@ make benchmark-wrapper-test # python3 -m unittest discover -s gemma_contb
python3 scripts/test-provider-release-resolution.py # signed-validation and publication routing before credentials
./scripts/sync-install-embed.sh check # coordinator/api/install.sh byte-identical to scripts/install.sh
./scripts/test-prod-env-refresh.sh # deploy/gcp/prod/refresh-env.sh contract
./scripts/test-setup-macos-homebrew.sh # scripts/setup-macos-homebrew.sh with brew already installed
./scripts/test-setup-macos-homebrew.sh # scripts/setup-macos-homebrew.sh, brew present and brew installed
./scripts/test-publish-model.sh # scripts/publish-model.sh dry-run contract
```

Expand Down Expand Up @@ -2805,9 +2805,13 @@ before they install `postgresql@16` and get its binary path with
checksum-verified installer. If Homebrew is still missing, the step fails
before E2E tests run. See `.github/workflows/integration.yml` and
`.github/workflows/benchmarks.yml`.
`./scripts/test-setup-macos-homebrew.sh` tests the path where `brew` is
already installed. It uses a fake `brew` in a temporary directory, makes no
download, and runs in the "Release Integrity" CI job.
`./scripts/test-setup-macos-homebrew.sh` tests two paths. In the first, `brew`
is already installed: the script uses a fake `brew` and downloads nothing. In
the second, `brew` is missing: the script runs a local fake installer through
to script exit, so the exit trap that deletes the installer also runs. A wrong
checksum must stop the installer. The test sets `SETUP_MACOS_HOMEBREW_TEST=1`
to point the script at the fake installer; CI workflows never set it. The test
runs in the "Release Integrity" CI job.

### Retained unsigned release recovery checks

Expand Down
16 changes: 13 additions & 3 deletions scripts/setup-macos-homebrew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ set -euo pipefail
# Homebrew/install commit and the SHA-256 of its install.sh. Change both together.
installer_commit=f6632bc2e9afc0ba20cdee1f2d28bcd7672b3245
installer_sha256=fa4ed743b4ca38316c8f32fd6623baa5bbb928fd4a47ad9f49c2be78ea833449
installer_url="https://raw.githubusercontent.com/Homebrew/install/$installer_commit/install.sh"
brew_locations=(/opt/homebrew/bin/brew /usr/local/bin/brew)

# Test-only overrides for scripts/test-setup-macos-homebrew.sh. CI never sets
# SETUP_MACOS_HOMEBREW_TEST, so the pinned values above always apply there.
if [ "${SETUP_MACOS_HOMEBREW_TEST:-}" = 1 ]; then
installer_url="${SETUP_MACOS_HOMEBREW_INSTALLER_URL:-$installer_url}"
installer_sha256="${SETUP_MACOS_HOMEBREW_INSTALLER_SHA256:-$installer_sha256}"
read -r -a brew_locations <<< "${SETUP_MACOS_HOMEBREW_LOCATIONS:-${brew_locations[*]}}"
fi

find_brew() {
local candidate
if candidate="$(command -v brew)"; then
printf '%s\n' "$candidate"
return 0
fi
for candidate in /opt/homebrew/bin/brew /usr/local/bin/brew; do
for candidate in "${brew_locations[@]}"; do
if [ -x "$candidate" ]; then
printf '%s\n' "$candidate"
return 0
Expand All @@ -32,11 +42,11 @@ install_brew() {
exit 2
fi
: "${RUNNER_TEMP:?RUNNER_TEMP is required}"
local installer
# Global, not local: the EXIT trap runs after this function returns.
installer="$(mktemp "$RUNNER_TEMP/homebrew-install.XXXXXX")"
trap 'rm -f "$installer"' EXIT
curl --fail --silent --show-error --location --retry 3 --max-time 180 \
"https://raw.githubusercontent.com/Homebrew/install/$installer_commit/install.sh" \
"$installer_url" \
--output "$installer"
# Verify before executing.
printf '%s %s\n' "$installer_sha256" "$installer" | shasum -a 256 --check
Expand Down
56 changes: 54 additions & 2 deletions scripts/test-setup-macos-homebrew.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
# Offline test: when brew is already on PATH, setup-macos-homebrew.sh exports
# its environment and downloads nothing.
# Offline tests for setup-macos-homebrew.sh:
# 1. brew is already on PATH: export its environment and download nothing.
# 2. brew is missing: run a local fake installer through to script exit, so the
# EXIT trap runs after install_brew has returned.
set -euo pipefail

ROOT=$(cd "$(dirname "$0")/.." && pwd)
Expand Down Expand Up @@ -47,4 +49,54 @@ if env -u GITHUB_ENV PATH="$prefix/bin:$TEST_ROOT/tools:$PATH" GITHUB_PATH="$git
exit 1
fi

# Install path. PATH holds only system tools and stubs, so no real brew is found.
install_prefix="$TEST_ROOT/installed"
runner_temp="$TEST_ROOT/runner-temp"
mkdir -p "$TEST_ROOT/stubs" "$runner_temp"
# The install path runs only on macOS; let it run on the Linux CI runner too.
printf '#!/bin/sh\necho Darwin\n' > "$TEST_ROOT/stubs/uname"
chmod +x "$TEST_ROOT/stubs/uname"

fake_installer="$TEST_ROOT/install.sh"
cat > "$fake_installer" <<FAKE
#!/usr/bin/env bash
set -euo pipefail
printf 'NONINTERACTIVE=%s HOMEBREW_NO_ANALYTICS=%s\n' "\$NONINTERACTIVE" "\$HOMEBREW_NO_ANALYTICS" > "$TEST_ROOT/installer-ran"
mkdir -p "$install_prefix/bin"
sed "s|$prefix|$install_prefix|g" "$prefix/bin/brew" > "$install_prefix/bin/brew"
chmod +x "$install_prefix/bin/brew"
FAKE
fake_sha256=$(shasum -a 256 "$fake_installer" | cut -d' ' -f1)

run_install() {
env PATH="$TEST_ROOT/stubs:/usr/bin:/bin" \
GITHUB_PATH="$github_path" GITHUB_ENV="$github_env" RUNNER_TEMP="$runner_temp" \
SETUP_MACOS_HOMEBREW_TEST=1 \
SETUP_MACOS_HOMEBREW_INSTALLER_URL="file://$fake_installer" \
SETUP_MACOS_HOMEBREW_INSTALLER_SHA256="$1" \
SETUP_MACOS_HOMEBREW_LOCATIONS="$install_prefix/bin/brew" \
"$ROOT/scripts/setup-macos-homebrew.sh"
}

# A wrong checksum must stop the step before the installer runs.
if run_install "$(printf '%064d' 0)" >/dev/null 2>&1; then
echo 'setup accepted an installer with the wrong SHA-256' >&2
exit 1
fi
[ ! -e "$TEST_ROOT/installer-ran" ]
# The EXIT trap removed the downloaded installer on the failure path.
[ -z "$(ls -A "$runner_temp")" ]

: > "$github_path"
: > "$github_env"
if ! install_out=$(run_install "$fake_sha256" 2>&1); then
printf 'install path failed:\n%s\n' "$install_out" >&2
exit 1
fi
grep -Fxq 'NONINTERACTIVE=1 HOMEBREW_NO_ANALYTICS=1' "$TEST_ROOT/installer-ran"
grep -Fxq "HOMEBREW_PREFIX=$install_prefix" "$github_env"
grep -Fxq "$install_prefix/bin" "$github_path"
# The EXIT trap removed the downloaded installer on the success path.
[ -z "$(ls -A "$runner_temp")" ]

echo 'setup-macos-homebrew: ok'
Loading