auth: decouple CLI from SDK's Experimental_IsUnifiedHost field#5047
auth: decouple CLI from SDK's Experimental_IsUnifiedHost field#5047simonfaltum wants to merge 6 commits intomainfrom
Conversation
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
Approval status: pending
|
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
…-experimental-unified-host
Why
SDK PR databricks/databricks-sdk-go#1641 removes:
config.Config.Experimental_IsUnifiedHostDATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOSTenv varUnifiedHostcase inConfig.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_IsUnifiedHostinto everyconfig.Config/databricks.Configit built, read it back viacfg.Experimental_IsUnifiedHost, and branched on unified hosts throughcfg.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: newHasUnifiedHostSignal(discoveryURL, fallback)helper;IsSPOGcomposes on top and gains an explicitunifiedHostFallback boolparameter.ResolveConfigTypedoes the same.libs/auth/arguments.go,credentials.go,error.go: drop every SDK-field read; callers passa.IsUnifiedHostexplicitly.cmd/auth/login.go: replaces thecfg.HostType()switch with a newneedsAccountIDPrompt(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 theDATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOSTenv var read.cmd/auth/auth.go:--experimental-is-unified-hostdescription marks it as deprecated.cmd/auth/profiles.go:profileMetadatanow carriesisUnifiedHostfrom the INIexperimental_is_unified_hostkey and threads it throughResolveConfigType.bundle/config/workspace.go: drops the SDK field assignment inConfig().Workspace.ExperimentalIsUnifiedHoststays in the struct as a deprecated no-op so existingdatabricks.ymlfiles still validate.acceptance/auth/credentials/unified-host/: the test exercises theDATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOSTenv var, which stops working after the SDK bump.Back-compat:
experimental_is_unified_host = true.databrickscfgand threads it as the fallback.--experimental-is-unified-hostflagDATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOSTenv varauth loginagainst a unified host.well-known/databricks-config; the key is no longer written to the profile.databricks.ymlwithexperimental_is_unified_host: trueTests: added
TestHasUnifiedHostSignalandTestNeedsAccountIDPrompt(table-driven, pure-function).TestResolveConfigTypeexpanded for the new fallback parameter. DeletedTestProfileLoadUnifiedHostFallback(coverage moved into the above table tests, dropping thehttptest.Server+ tempdir scaffolding).Test plan
make checkscleanmake lint0 issuesgo test ./libs/auth/... ./cmd/auth/... ./bundle/config/... ./libs/databrickscfg/... ./cmd/configure/...go test ./acceptance -run 'TestAccept/(cmd/auth|auth|cmd/configure)'agent/multipleuser-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.