Skip to content

auth: decouple CLI from SDK's Experimental_IsUnifiedHost field#5047

Open
simonfaltum wants to merge 6 commits intomainfrom
simonfaltum/deprecate-experimental-unified-host
Open

auth: decouple CLI from SDK's Experimental_IsUnifiedHost field#5047
simonfaltum wants to merge 6 commits intomainfrom
simonfaltum/deprecate-experimental-unified-host

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

Why

SDK PR databricks/databricks-sdk-go#1641 removes:

  • config.Config.Experimental_IsUnifiedHost
  • DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST env var
  • The UnifiedHost case in Config.HostType()

The CLI touches all three across ~15 files and would fail to compile after the SDK bump. This PR preps the ground so the SDK bump can land cleanly.

Changes

Before: the CLI wrote Experimental_IsUnifiedHost into every config.Config / databricks.Config it built, read it back via cfg.Experimental_IsUnifiedHost, and branched on unified hosts through cfg.HostType(). All of those break after the SDK bump.

Now: the unified-host signal is routed through CLI-owned types.

  • libs/auth/config_type.go: new HasUnifiedHostSignal(discoveryURL, fallback) helper; IsSPOG composes on top and gains an explicit unifiedHostFallback bool parameter. ResolveConfigType does the same.
  • libs/auth/arguments.go, credentials.go, error.go: drop every SDK-field read; callers pass a.IsUnifiedHost explicitly.
  • cmd/auth/login.go: replaces the cfg.HostType() switch with a new needsAccountIDPrompt(host, isUnifiedHost, discoveryURL) helper. Account and unified hosts share the same prompt branch.
  • cmd/auth/token.go: drops the SDK field assignment in inline login and the DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST env var read.
  • cmd/auth/auth.go: --experimental-is-unified-host description marks it as deprecated.
  • cmd/auth/profiles.go: profileMetadata now carries isUnifiedHost from the INI experimental_is_unified_host key and threads it through ResolveConfigType.
  • bundle/config/workspace.go: drops the SDK field assignment in Config(). Workspace.ExperimentalIsUnifiedHost stays in the struct as a deprecated no-op so existing databricks.yml files still validate.
  • Deleted acceptance/auth/credentials/unified-host/: the test exercises the DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST env var, which stops working after the SDK bump.

Back-compat:

Scenario Behavior
Existing profile with experimental_is_unified_host = true Still works; the CLI reads the key from .databrickscfg and threads it as the fallback.
--experimental-is-unified-host flag Still works for the current session; no longer persists to the profile; deprecated.
DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST env var No longer honored by the CLI (was removed in this PR); will also be removed by the SDK.
New auth login against a unified host Routing comes from .well-known/databricks-config; the key is no longer written to the profile.
databricks.yml with experimental_is_unified_host: true Silently ignored (field kept for schema compat).

Tests: added TestHasUnifiedHostSignal and TestNeedsAccountIDPrompt (table-driven, pure-function). TestResolveConfigType expanded for the new fallback parameter. Deleted TestProfileLoadUnifiedHostFallback (coverage moved into the above table tests, dropping the httptest.Server + tempdir scaffolding).

Test plan

  • make checks clean
  • make lint 0 issues
  • go test ./libs/auth/... ./cmd/auth/... ./bundle/config/... ./libs/databrickscfg/... ./cmd/configure/...
  • go test ./acceptance -run 'TestAccept/(cmd/auth|auth|cmd/configure)'
  • Cross-compile against SDK PR #1641: build + unit tests pass. One unrelated acceptance diff (agent/multiple user-agent from SDK PR Added test for negation pattern in sync include exclude section #1637) is for the SDK bump PR to resolve.

This pull request and its description were written by Isaac.

Prepare for SDK PR databricks/databricks-sdk-go#1641 which removes the
field, its env var, and the UnifiedHost case in HostType(). Thread the
unified-host signal through CLI-owned types via a new HasUnifiedHostSignal
helper and an explicit fallback parameter on IsSPOG.

New profiles no longer persist experimental_is_unified_host; existing
profiles still read the key for back-compat. The --experimental-is-unified-host
flag and DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST env var are deprecated
no-ops for this release.

Co-authored-by: Isaac
@simonfaltum simonfaltum marked this pull request as ready for review April 21, 2026 10:38
@github-actions
Copy link
Copy Markdown

Approval status: pending

/acceptance/auth/ - needs approval

5 files changed
Suggested: @tanmay-db
Also eligible: @mihaimitrea-db, @tejaskochar-db, @renaudhartert-db, @hectorcast-db, @parthban-db, @Divyansh-db, @chrisst, @rauchy

/bundle/ - needs approval

Files: bundle/config/workspace.go
Suggested: @denik
Also eligible: @pietern, @andrewnester, @anton-107, @lennartkats-db, @shreyas-goenka, @janniklasrose

/cmd/auth/ - needs approval

6 files changed
Suggested: @tanmay-db
Also eligible: @mihaimitrea-db, @tejaskochar-db, @renaudhartert-db, @hectorcast-db, @parthban-db, @Divyansh-db, @chrisst, @rauchy

/libs/auth/ - needs approval

7 files changed
Suggested: @tanmay-db
Also eligible: @mihaimitrea-db, @tejaskochar-db, @renaudhartert-db, @hectorcast-db, @parthban-db, @Divyansh-db, @chrisst, @rauchy

General files (require maintainer)

Files: NEXT_CHANGELOG.md
Based on git history:

  • @denik -- recent work in ./, bundle/config/, cmd/auth/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

simonfaltum and others added 5 commits April 21, 2026 12:44
Addresses codex review findings on PR #5047. After dropping cfg.Experimental_IsUnifiedHost
reads, CLICredentials.Configure and writeReauthSteps stopped honoring the INI
fallback for profiles where .well-known is unreachable. This reads
experimental_is_unified_host from the resolved profile's .databrickscfg section
and threads it through AuthArguments.IsUnifiedHost so token cache keys and
reauth suggestions continue to match.

Also rewords the changelog and flag description from "no-op" to "deprecated
but still honored as a routing fallback", which is what the code actually does.

Co-authored-by: Isaac
…-experimental-unified-host

# Conflicts:
#	acceptance/auth/credentials/unified-host/out.requests.txt
…-experimental-unified-host

# Conflicts:
#	NEXT_CHANGELOG.md
#	libs/auth/credentials.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant