Skip to content

Detect mixed-architecture Base runtime chains before Homebrew setup #1555

Description

@codeforester

Problem

Base can reuse an existing ~/.base.d/base/.venv whose Python interpreter was created from Intel Homebrew under /usr/local, even when the active Homebrew prefix is ARM /opt/homebrew.

In that state, basectl setup base --profile dev reports the existing Base virtualenv as usable, then runs the Python developer-prerequisite layer through an x86_64 Python process. When that process invokes brew install bats-core, Homebrew sees Rosetta execution against /opt/homebrew and fails with:

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!

The manual recovery was:

arch -arm64 /opt/homebrew/bin/bash -lc '/Users/rameshhp/work/base/bin/basectl setup base --profile dev --recreate-venv'

That backed up the old Intel-backed Base venv, recreated it with ARM Python, and completed the dev prerequisite install.

Desired behavior

  • basectl setup, basectl check, and basectl doctor should surface a compact runtime-chain summary when platform/toolchain checks are relevant.
  • Fatal setup failures should include enough runtime-chain context to explain architecture mismatches without requiring manual file, arch, or pyvenv.cfg inspection.
  • Base virtualenv health checks should detect a mismatch between ARM Homebrew (/opt/homebrew) and an Intel-backed Base venv (/usr/local or x86_64 Python).
  • When that mismatch is found, Base should stop before invoking Homebrew and tell the user to run basectl setup --recreate-venv.

Useful fields

The diagnostic should include at least:

  • BASE_OS, BASE_PLATFORM, and BASE_HOST
  • shell path, Bash version, machine architecture, and Rosetta translation state when available
  • Base venv Python path, architecture, and pyvenv.cfg executable/home values
  • Homebrew path and prefix
  • gh path, version, and architecture when gh is involved

Acceptance criteria

  • A stale x86_64 Base venv under an ARM Homebrew prefix is reported as unhealthy before the developer artifact installer runs brew install.
  • setup --profile dev gives a precise recovery message instead of surfacing Homebrew's Rosetta error as the first actionable clue.
  • check/doctor output includes or can display the runtime-chain summary without polluting JSON/automation output.
  • Focused tests cover the mismatch detection and the runtime-summary output path.

Metadata

Metadata

Assignees

Labels

bugSomething is not workingtype:fix

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
In Review

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions