From 1a3f6ce3e4c05a52e451bf13f243e6422b76f317 Mon Sep 17 00:00:00 2001 From: max-rozen-oss-db <291811446+max-rozen-oss-db@users.noreply.github.com> Date: Mon, 8 Jun 2026 14:40:52 +0000 Subject: [PATCH] Fix macOS Databricks CLI auto-install to use the databricks/tap formula MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS the auto-installer ran `brew install databricks`, but the Databricks CLI is not in homebrew-core under that name — `databricks` resolves to an unrelated formula (the DataGrip cask), so users got the wrong tool installed. Install the fully-qualified `databricks/tap/databricks` formula instead, which resolves to the Databricks CLI and fails if the formula is missing, rather than silently falling back to the cask. Applies to both the install and upgrade paths. Co-authored-by: Isaac --- src/ucode/databricks.py | 2 +- tests/test_databricks.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ucode/databricks.py b/src/ucode/databricks.py index 90c1808..08733ba 100644 --- a/src/ucode/databricks.py +++ b/src/ucode/databricks.py @@ -483,7 +483,7 @@ def _run_databricks_cli_installer(brew_subcommand: str = "install") -> None: timeout=240, ) elif system == "Darwin" and shutil.which("brew"): - run(["brew", brew_subcommand, "databricks"], timeout=240) + run(["brew", brew_subcommand, "databricks/tap/databricks"], timeout=240) elif shutil.which("curl"): run(["sh", "-c", f"curl -fsSL {UNIX_DATABRICKS_INSTALL_URL} | sudo sh"], timeout=240) elif shutil.which("wget"): diff --git a/tests/test_databricks.py b/tests/test_databricks.py index fffdba5..45c4350 100644 --- a/tests/test_databricks.py +++ b/tests/test_databricks.py @@ -13,6 +13,7 @@ AI_GATEWAY_V2_DOCS_URL, _format_subprocess_result, _parse_databricks_cli_version, + _run_databricks_cli_installer, _scrub_databrickscfg, _scrub_json, build_auth_shell_command, @@ -804,6 +805,22 @@ def test_raises_when_version_unparseable(self, tmp_path, monkeypatch): ensure_databricks_cli_version() +class TestRunDatabricksCliInstaller: + @pytest.mark.parametrize("brew_subcommand", ["install", "upgrade"]) + def test_macos_uses_fully_qualified_tap_formula(self, monkeypatch, brew_subcommand): + calls = [] + monkeypatch.setattr(db_mod.platform, "system", lambda: "Darwin") + monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/opt/homebrew/bin/brew") + monkeypatch.setattr(db_mod, "run", lambda cmd, **kw: calls.append(cmd)) + + _run_databricks_cli_installer(brew_subcommand=brew_subcommand) + + # The fully-qualified formula forces Homebrew to the Databricks CLI in + # databricks/tap and fails if absent, rather than falling back to the + # unrelated `databricks` cask. + assert calls == [["brew", brew_subcommand, "databricks/tap/databricks"]] + + class TestIsUsageTableAccessError: """Pin which `ServerOperationError` strings trigger the friendly `system.ai_gateway.usage` permissions hint vs. fall through to the