From 1c506ed1d854124fdf40cd55610193ed38f5cd4b Mon Sep 17 00:00:00 2001 From: max-rozen-oss-db <291811446+max-rozen-oss-db@users.noreply.github.com> Date: Fri, 7 Aug 2026 12:28:44 -0400 Subject: [PATCH 1/3] Make --skip-preflight skip the Databricks CLI version check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `--skip-preflight` trusts a prior `ucode configure` and skips the per-launch auth + AI Gateway re-validation. It did not, however, skip the Databricks CLI minimum-version gate: launch still ran `ensure_bootstrap_dependencies` -> `install_databricks_cli` -> `ensure_databricks_cli_version`, whose `databricks aitools` floor of v1.0.0 rejects a perfectly usable public-preview build (e.g. v0.299.2) as "too old" — a false positive on a launch that was explicitly told to trust the existing setup. Thread a `skip_version_check` flag from `--skip-preflight` through `ensure_bootstrap_dependencies` into `install_databricks_cli`, so the version check is bypassed while a genuinely missing CLI is still installed. Update the flag's help/comments and add coverage for the new bypass. Co-authored-by: Isaac --- src/ucode/agents/__init__.py | 3 ++- src/ucode/cli.py | 20 ++++++++++------ src/ucode/databricks.py | 15 +++++++++--- tests/test_cli.py | 35 +++++++++++++++++++++++++--- tests/test_databricks.py | 44 ++++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 14 deletions(-) diff --git a/src/ucode/agents/__init__.py b/src/ucode/agents/__init__.py index 3afd4fea..06e85073 100644 --- a/src/ucode/agents/__init__.py +++ b/src/ucode/agents/__init__.py @@ -253,8 +253,9 @@ def ensure_bootstrap_dependencies( *, update_existing: bool = False, prompt_optional_updates: bool = True, + skip_cli_version_check: bool = False, ) -> None: - install_databricks_cli() + install_databricks_cli(skip_version_check=skip_cli_version_check) install_tool_binary( tool, strict=True, diff --git a/src/ucode/cli.py b/src/ucode/cli.py index a4653389..6363f91d 100644 --- a/src/ucode/cli.py +++ b/src/ucode/cli.py @@ -1384,7 +1384,11 @@ def _launch_tool( needs_auto_configure = not existing.get("workspace") or tool not in ( existing.get("available_tools") or [] ) - ensure_bootstrap_dependencies(tool, update_existing=needs_auto_configure) + ensure_bootstrap_dependencies( + tool, + update_existing=needs_auto_configure, + skip_cli_version_check=skip_preflight, + ) if needs_auto_configure: _auto_configure_tool(tool) state = ensure_provider_state(tool) @@ -1574,15 +1578,17 @@ def _launch_tool( # Launch-only escape hatch for managed/headless launchers (e.g. omnigent) that # have already run `ucode configure`: skip the ~5-10s per-launch auth + AI -# Gateway re-validation. Distinct from the configure-only `--skip-validate`, -# which skips the model smoke test. +# Gateway re-validation, plus the Databricks CLI minimum-version check (whose +# `databricks aitools` floor otherwise false-positives on a usable public-preview +# build). Distinct from the configure-only `--skip-validate`, which skips the +# model smoke test. SkipPreflightOption = Annotated[ bool, typer.Option( "--skip-preflight", - help="Skip the per-launch Databricks auth + AI Gateway re-validation, trusting a " - "prior `ucode configure`. Launches with your own local settings, ignoring any " - "workspace managed config.", + help="Skip the per-launch Databricks auth + AI Gateway re-validation (and the " + "Databricks CLI minimum-version check), trusting a prior `ucode configure`. " + "Launches with your own local settings, ignoring any workspace managed config.", ), ] @@ -1656,7 +1662,7 @@ def _launch_managed_default( return if workspace: set_current_workspace(normalize_workspace_url(workspace)) - install_databricks_cli() + install_databricks_cli(skip_version_check=skip_preflight) state = load_state() current = state.get("workspace") if not current: diff --git a/src/ucode/databricks.py b/src/ucode/databricks.py index e8738318..7e92104e 100644 --- a/src/ucode/databricks.py +++ b/src/ucode/databricks.py @@ -649,9 +649,17 @@ def ensure_databricks_cli_version() -> None: ensure_databricks_cli_version() -def install_databricks_cli() -> None: +def install_databricks_cli(*, skip_version_check: bool = False) -> None: + """Ensure the Databricks CLI is installed and (unless skipped) new enough. + + ``skip_version_check`` is set on ``--skip-preflight`` launches: they trust a + prior ``ucode configure`` and must not re-run the minimum-version gate, whose + ``databricks aitools`` floor (v1.0.0) rejects a perfectly usable public-preview + build (e.g. v0.299.2) as a false positive. A missing CLI is still installed — + only the version *check* is bypassed.""" if shutil.which("databricks"): - ensure_databricks_cli_version() + if not skip_version_check: + ensure_databricks_cli_version() return print_section("Bootstrap") @@ -662,7 +670,8 @@ def install_databricks_cli() -> None: raise RuntimeError( "Databricks CLI install completed, but `databricks` is still not on PATH." ) - ensure_databricks_cli_version() + if not skip_version_check: + ensure_databricks_cli_version() def install_ai_tools(agent_tokens: list[str], profile: str | None = None) -> None: diff --git a/tests/test_cli.py b/tests/test_cli.py index c6d36080..d0759c35 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -739,7 +739,9 @@ def test_triggers_when_no_workspace(self): ): result = runner.invoke(app, ["claude"]) assert result.exit_code == 0, result.output - mock_bootstrap.assert_called_once_with("claude", update_existing=True) + mock_bootstrap.assert_called_once_with( + "claude", update_existing=True, skip_cli_version_check=False + ) mock_auto.assert_called_once_with("claude") def test_triggers_when_tool_not_in_available_tools(self): @@ -764,7 +766,9 @@ def test_triggers_when_tool_not_in_available_tools(self): ): result = runner.invoke(app, ["claude"]) assert result.exit_code == 0, result.output - mock_bootstrap.assert_called_once_with("claude", update_existing=True) + mock_bootstrap.assert_called_once_with( + "claude", update_existing=True, skip_cli_version_check=False + ) mock_auto.assert_called_once_with("claude") def test_skipped_when_already_configured(self): @@ -787,9 +791,34 @@ def test_skipped_when_already_configured(self): patch("ucode.cli.launch_agent"), ): runner.invoke(app, ["claude"]) - mock_bootstrap.assert_called_once_with("claude", update_existing=False) + mock_bootstrap.assert_called_once_with( + "claude", update_existing=False, skip_cli_version_check=False + ) mock_auto.assert_not_called() + def test_skip_preflight_bypasses_cli_version_check(self): + """`--skip-preflight` tells bootstrap to skip the CLI minimum-version gate, + so a public-preview `databricks` (e.g. v0.299.2) isn't a false positive.""" + with ( + patch("ucode.cli.ensure_bootstrap_dependencies") as mock_bootstrap, + patch("ucode.cli.load_state", return_value=MINIMAL_STATE), + patch("ucode.cli._auto_configure_tool"), + patch("ucode.cli.configure_shared_state", return_value=MINIMAL_STATE), + patch("ucode.cli.ensure_provider_state", return_value=MINIMAL_STATE), + patch( + "ucode.cli.resolve_launch_model", + return_value=(MINIMAL_STATE, "databricks-claude-sonnet-4"), + ), + patch("ucode.cli.configure_tool", return_value=MINIMAL_STATE), + patch("ucode.cli._fetch_managed_config", return_value=None), + patch("ucode.cli.launch_agent"), + ): + result = runner.invoke(app, ["claude", "--skip-preflight"]) + assert result.exit_code == 0, result.output + mock_bootstrap.assert_called_once_with( + "claude", update_existing=False, skip_cli_version_check=True + ) + class TestPassthroughArgs: @pytest.mark.parametrize( diff --git a/tests/test_databricks.py b/tests/test_databricks.py index bfdf3e36..e5c43c64 100644 --- a/tests/test_databricks.py +++ b/tests/test_databricks.py @@ -28,6 +28,7 @@ ensure_pat_bearer, get_databricks_token, install_ai_tools, + install_databricks_cli, list_databricks_apps, list_databricks_connections, list_genie_spaces, @@ -1851,6 +1852,49 @@ def test_raises_when_version_unparseable(self, tmp_path, monkeypatch): ensure_databricks_cli_version() +class TestInstallDatabricksCli: + def test_checks_version_when_present(self, monkeypatch): + monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/usr/bin/databricks") + checked = [] + monkeypatch.setattr( + db_mod, "ensure_databricks_cli_version", lambda: checked.append(True) + ) + install_databricks_cli() + assert checked == [True] + + def test_skip_version_check_bypasses_version_gate(self, monkeypatch): + """`--skip-preflight` sets skip_version_check: an already-installed CLI is + trusted without the minimum-version gate, so a public-preview build is no + longer a false positive.""" + monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/usr/bin/databricks") + checked = [] + monkeypatch.setattr( + db_mod, "ensure_databricks_cli_version", lambda: checked.append(True) + ) + install_databricks_cli(skip_version_check=True) + assert checked == [] + + def test_skip_version_check_still_installs_when_missing(self, monkeypatch): + """A missing CLI is installed even under skip_version_check — only the + version *check* is bypassed, not the install.""" + present = {"databricks": None} + monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: present.get(cmd)) + installed = [] + + def fake_installer(brew_subcommand="install"): + present["databricks"] = "/usr/bin/databricks" + installed.append(brew_subcommand) + + monkeypatch.setattr(db_mod, "_run_databricks_cli_installer", fake_installer) + checked = [] + monkeypatch.setattr( + db_mod, "ensure_databricks_cli_version", lambda: checked.append(True) + ) + install_databricks_cli(skip_version_check=True) + assert installed == ["install"] + assert checked == [] + + class TestRunDatabricksCliInstaller: @pytest.mark.parametrize("brew_subcommand", ["install", "upgrade"]) def test_macos_uses_fully_qualified_tap_formula(self, monkeypatch, brew_subcommand): From f2f10fa9f3b8bafc534effdd3406fc73fc345774 Mon Sep 17 00:00:00 2001 From: max-rozen-oss-db <291811446+max-rozen-oss-db@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:21:04 -0400 Subject: [PATCH 2/3] Reject mistyped ucode launch flags instead of forwarding them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The launch commands set `ignore_unknown_options=True` so an agent's own flags pass straight through. That also meant a *mistyped* ucode flag — e.g. `--skip-preflight-checks` instead of `--skip-preflight` — was silently handed to the agent, where it does nothing, so `--skip-preflight` appeared not to work. Add a guard that runs before launch and rejects any passthrough arg whose bare name is a near-miss of a known ucode launch flag (a superstring like `--skip-preflight-checks`, or a near-complete truncation), with an error naming the intended flag. Unrelated agent flags (`--model`, `-r`, `--dangerously-skip-permissions`, …) are left untouched and still pass through. Co-authored-by: Isaac --- src/ucode/cli.py | 46 ++++++++++++++++++++++++++++++++++ tests/test_cli.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/src/ucode/cli.py b/src/ucode/cli.py index 6363f91d..42312ada 100644 --- a/src/ucode/cli.py +++ b/src/ucode/cli.py @@ -1359,6 +1359,51 @@ def _print_budget_panel(recommendation: dict, tool: str, managed: dict | None = console.print(panel) +# ucode's own launch flags. The launch commands set `ignore_unknown_options` +# so the agent's own flags pass straight through, which also means a *mistyped* +# ucode flag (e.g. `--skip-preflight-checks`) is silently forwarded to the agent +# instead of taking effect. We catch near-misses of these up front so a typo +# fails loudly rather than quietly running with the flag ignored. +_UCODE_LAUNCH_FLAGS = frozenset( + { + "--skip-preflight", + "--workspace", + "--provider", + "--enable-smart-routing", + "--disable-smart-routing", + } +) + + +def _reject_mistyped_ucode_flag(ctx: typer.Context) -> None: + """Error on a passthrough arg that looks like a misspelled ucode launch flag. + + Only flags whose bare name (before any `=`) is a near-miss of a known ucode + flag are rejected — an unrelated agent flag like `--model` is left alone. This + keeps `--skip-preflight-checks` from being silently handed to the agent (where + it does nothing) instead of enabling the ucode behavior the user intended. + """ + for raw in ctx.args: + if not raw.startswith("--"): + continue + name = raw.split("=", 1)[0] + if name in _UCODE_LAUNCH_FLAGS: + continue + for known in _UCODE_LAUNCH_FLAGS: + # A superstring is the reported bug: `--skip-preflight-checks` starts + # with `--skip-preflight`. A near-complete truncation (`--skip-prefligh`, + # one char short) is caught too — but a short generic prefix like + # `--enable` is left alone so a real agent flag isn't hijacked. + superstring = name.startswith(known) + truncation = known.startswith(name) and len(known) - len(name) <= 3 + if superstring or truncation: + raise RuntimeError( + f"Unknown ucode option '{name}'. Did you mean '{known}'? " + "(ucode flags must be spelled exactly; anything else is passed " + "through to the agent.)" + ) + + def _launch_tool( tool_name: str, ctx: typer.Context, @@ -1370,6 +1415,7 @@ def _launch_tool( recommendation: dict | None = None, ) -> None: try: + _reject_mistyped_ucode_flag(ctx) tool = normalize_tool(tool_name) # An explicit --workspace targets that workspace for this launch (and # auto-configures it if unseen), so `ucode claude --provider ... --workspace ...` diff --git a/tests/test_cli.py b/tests/test_cli.py index d0759c35..d6e5136c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -820,6 +820,70 @@ def test_skip_preflight_bypasses_cli_version_check(self): ) +class TestMistypedUcodeFlag: + """A launch command sets `ignore_unknown_options`, so a mistyped ucode flag + would otherwise be forwarded to the agent and silently do nothing. The guard + turns near-misses of ucode's own flags into a loud error.""" + + def test_superstring_typo_is_rejected(self): + # The reported bug: `--skip-preflight-checks` never enabled the behavior. + with patch("ucode.cli.ensure_bootstrap_dependencies") as mock_bootstrap: + result = runner.invoke(app, ["claude", "--skip-preflight-checks"]) + assert result.exit_code == 1 + out = _strip_ansi(result.output) + assert "--skip-preflight-checks" in out + assert "--skip-preflight" in out + # Fails before any bootstrap/install work runs. + mock_bootstrap.assert_not_called() + + def test_plural_workspace_typo_is_rejected(self): + result = runner.invoke(app, ["codex", "--workspaces", "https://ws"]) + assert result.exit_code == 1 + assert "--workspace" in _strip_ansi(result.output) + + def test_correct_flag_is_not_rejected(self): + with ( + patch("ucode.cli.ensure_bootstrap_dependencies"), + patch("ucode.cli.load_state", return_value=MINIMAL_STATE), + patch("ucode.cli._auto_configure_tool"), + patch("ucode.cli.configure_shared_state", return_value=MINIMAL_STATE), + patch("ucode.cli.ensure_provider_state", return_value=MINIMAL_STATE), + patch( + "ucode.cli.resolve_launch_model", + return_value=(MINIMAL_STATE, "databricks-claude-sonnet-4"), + ), + patch("ucode.cli.configure_tool", return_value=MINIMAL_STATE), + patch("ucode.cli._fetch_managed_config", return_value=None), + patch("ucode.cli.launch_agent"), + ): + result = runner.invoke(app, ["claude", "--skip-preflight"]) + assert result.exit_code == 0, result.output + + def test_unrelated_agent_flag_passes_through(self): + # A real agent flag that isn't a near-miss of any ucode flag reaches the agent. + captured = {} + with ( + patch("ucode.cli.ensure_bootstrap_dependencies"), + patch("ucode.cli.load_state", return_value=MINIMAL_STATE), + patch("ucode.cli._auto_configure_tool"), + patch("ucode.cli.configure_shared_state", return_value=MINIMAL_STATE), + patch("ucode.cli.ensure_provider_state", return_value=MINIMAL_STATE), + patch( + "ucode.cli.resolve_launch_model", + return_value=(MINIMAL_STATE, "databricks-claude-sonnet-4"), + ), + patch("ucode.cli.configure_tool", return_value=MINIMAL_STATE), + patch("ucode.cli._fetch_managed_config", return_value=None), + patch( + "ucode.cli.launch_agent", + side_effect=lambda tool, state, args: captured.setdefault("args", args), + ), + ): + result = runner.invoke(app, ["claude", "--model", "opus"]) + assert result.exit_code == 0, result.output + assert "--model" in captured.get("args", []) + + class TestPassthroughArgs: @pytest.mark.parametrize( "tool,extra_args", From 71cbf34c7d52ad8bde6291ea54ffc939242cfb83 Mon Sep 17 00:00:00 2001 From: max-rozen-oss-db <291811446+max-rozen-oss-db@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:27:46 -0400 Subject: [PATCH 3/3] Drop the mistyped-flag guard; keep PR scoped to the version-check fix Removes the `_reject_mistyped_ucode_flag` guard and its tests so this PR does one thing: skip the Databricks CLI version check under `--skip-preflight`. The mistyped-flag handling can land separately. Also apply `ruff format` to tests/test_databricks.py (line-wrap the new monkeypatch calls) so `ruff format --check` passes in CI. Co-authored-by: Isaac --- src/ucode/cli.py | 46 ----------------------------- tests/test_cli.py | 64 ---------------------------------------- tests/test_databricks.py | 12 ++------ 3 files changed, 3 insertions(+), 119 deletions(-) diff --git a/src/ucode/cli.py b/src/ucode/cli.py index 42312ada..6363f91d 100644 --- a/src/ucode/cli.py +++ b/src/ucode/cli.py @@ -1359,51 +1359,6 @@ def _print_budget_panel(recommendation: dict, tool: str, managed: dict | None = console.print(panel) -# ucode's own launch flags. The launch commands set `ignore_unknown_options` -# so the agent's own flags pass straight through, which also means a *mistyped* -# ucode flag (e.g. `--skip-preflight-checks`) is silently forwarded to the agent -# instead of taking effect. We catch near-misses of these up front so a typo -# fails loudly rather than quietly running with the flag ignored. -_UCODE_LAUNCH_FLAGS = frozenset( - { - "--skip-preflight", - "--workspace", - "--provider", - "--enable-smart-routing", - "--disable-smart-routing", - } -) - - -def _reject_mistyped_ucode_flag(ctx: typer.Context) -> None: - """Error on a passthrough arg that looks like a misspelled ucode launch flag. - - Only flags whose bare name (before any `=`) is a near-miss of a known ucode - flag are rejected — an unrelated agent flag like `--model` is left alone. This - keeps `--skip-preflight-checks` from being silently handed to the agent (where - it does nothing) instead of enabling the ucode behavior the user intended. - """ - for raw in ctx.args: - if not raw.startswith("--"): - continue - name = raw.split("=", 1)[0] - if name in _UCODE_LAUNCH_FLAGS: - continue - for known in _UCODE_LAUNCH_FLAGS: - # A superstring is the reported bug: `--skip-preflight-checks` starts - # with `--skip-preflight`. A near-complete truncation (`--skip-prefligh`, - # one char short) is caught too — but a short generic prefix like - # `--enable` is left alone so a real agent flag isn't hijacked. - superstring = name.startswith(known) - truncation = known.startswith(name) and len(known) - len(name) <= 3 - if superstring or truncation: - raise RuntimeError( - f"Unknown ucode option '{name}'. Did you mean '{known}'? " - "(ucode flags must be spelled exactly; anything else is passed " - "through to the agent.)" - ) - - def _launch_tool( tool_name: str, ctx: typer.Context, @@ -1415,7 +1370,6 @@ def _launch_tool( recommendation: dict | None = None, ) -> None: try: - _reject_mistyped_ucode_flag(ctx) tool = normalize_tool(tool_name) # An explicit --workspace targets that workspace for this launch (and # auto-configures it if unseen), so `ucode claude --provider ... --workspace ...` diff --git a/tests/test_cli.py b/tests/test_cli.py index d6e5136c..d0759c35 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -820,70 +820,6 @@ def test_skip_preflight_bypasses_cli_version_check(self): ) -class TestMistypedUcodeFlag: - """A launch command sets `ignore_unknown_options`, so a mistyped ucode flag - would otherwise be forwarded to the agent and silently do nothing. The guard - turns near-misses of ucode's own flags into a loud error.""" - - def test_superstring_typo_is_rejected(self): - # The reported bug: `--skip-preflight-checks` never enabled the behavior. - with patch("ucode.cli.ensure_bootstrap_dependencies") as mock_bootstrap: - result = runner.invoke(app, ["claude", "--skip-preflight-checks"]) - assert result.exit_code == 1 - out = _strip_ansi(result.output) - assert "--skip-preflight-checks" in out - assert "--skip-preflight" in out - # Fails before any bootstrap/install work runs. - mock_bootstrap.assert_not_called() - - def test_plural_workspace_typo_is_rejected(self): - result = runner.invoke(app, ["codex", "--workspaces", "https://ws"]) - assert result.exit_code == 1 - assert "--workspace" in _strip_ansi(result.output) - - def test_correct_flag_is_not_rejected(self): - with ( - patch("ucode.cli.ensure_bootstrap_dependencies"), - patch("ucode.cli.load_state", return_value=MINIMAL_STATE), - patch("ucode.cli._auto_configure_tool"), - patch("ucode.cli.configure_shared_state", return_value=MINIMAL_STATE), - patch("ucode.cli.ensure_provider_state", return_value=MINIMAL_STATE), - patch( - "ucode.cli.resolve_launch_model", - return_value=(MINIMAL_STATE, "databricks-claude-sonnet-4"), - ), - patch("ucode.cli.configure_tool", return_value=MINIMAL_STATE), - patch("ucode.cli._fetch_managed_config", return_value=None), - patch("ucode.cli.launch_agent"), - ): - result = runner.invoke(app, ["claude", "--skip-preflight"]) - assert result.exit_code == 0, result.output - - def test_unrelated_agent_flag_passes_through(self): - # A real agent flag that isn't a near-miss of any ucode flag reaches the agent. - captured = {} - with ( - patch("ucode.cli.ensure_bootstrap_dependencies"), - patch("ucode.cli.load_state", return_value=MINIMAL_STATE), - patch("ucode.cli._auto_configure_tool"), - patch("ucode.cli.configure_shared_state", return_value=MINIMAL_STATE), - patch("ucode.cli.ensure_provider_state", return_value=MINIMAL_STATE), - patch( - "ucode.cli.resolve_launch_model", - return_value=(MINIMAL_STATE, "databricks-claude-sonnet-4"), - ), - patch("ucode.cli.configure_tool", return_value=MINIMAL_STATE), - patch("ucode.cli._fetch_managed_config", return_value=None), - patch( - "ucode.cli.launch_agent", - side_effect=lambda tool, state, args: captured.setdefault("args", args), - ), - ): - result = runner.invoke(app, ["claude", "--model", "opus"]) - assert result.exit_code == 0, result.output - assert "--model" in captured.get("args", []) - - class TestPassthroughArgs: @pytest.mark.parametrize( "tool,extra_args", diff --git a/tests/test_databricks.py b/tests/test_databricks.py index e5c43c64..2f468e53 100644 --- a/tests/test_databricks.py +++ b/tests/test_databricks.py @@ -1856,9 +1856,7 @@ class TestInstallDatabricksCli: def test_checks_version_when_present(self, monkeypatch): monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/usr/bin/databricks") checked = [] - monkeypatch.setattr( - db_mod, "ensure_databricks_cli_version", lambda: checked.append(True) - ) + monkeypatch.setattr(db_mod, "ensure_databricks_cli_version", lambda: checked.append(True)) install_databricks_cli() assert checked == [True] @@ -1868,9 +1866,7 @@ def test_skip_version_check_bypasses_version_gate(self, monkeypatch): longer a false positive.""" monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/usr/bin/databricks") checked = [] - monkeypatch.setattr( - db_mod, "ensure_databricks_cli_version", lambda: checked.append(True) - ) + monkeypatch.setattr(db_mod, "ensure_databricks_cli_version", lambda: checked.append(True)) install_databricks_cli(skip_version_check=True) assert checked == [] @@ -1887,9 +1883,7 @@ def fake_installer(brew_subcommand="install"): monkeypatch.setattr(db_mod, "_run_databricks_cli_installer", fake_installer) checked = [] - monkeypatch.setattr( - db_mod, "ensure_databricks_cli_version", lambda: checked.append(True) - ) + monkeypatch.setattr(db_mod, "ensure_databricks_cli_version", lambda: checked.append(True)) install_databricks_cli(skip_version_check=True) assert installed == ["install"] assert checked == []