auth: decouple CLI from SDK's Experimental_IsUnifiedHost field#5047
auth: decouple CLI from SDK's Experimental_IsUnifiedHost field#5047simonfaltum wants to merge 11 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
Unified hosts are now detected exclusively from /.well-known/databricks-config discovery. Drop the CLI flag, profile INI key reads, and the unifiedHostFallback threading from HasUnifiedHostSignal/IsSPOG/ResolveConfigType. Keep the Workspace.ExperimentalIsUnifiedHost field in bundle config as a no-op so existing databricks.yml files still validate. Co-authored-by: Isaac
Extract ExperimentalIsUnifiedHostKey constant in libs/databrickscfg so the legacy INI key isn't repeated as a string literal across login, token, and configure save paths. Add IsClassicAccountHost helper in libs/auth so the "https://accounts." / "https://accounts-dod." prefix check is defined once and reused from ToOAuthArgument, needsAccountIDPrompt, and the test. Co-authored-by: Isaac
…-experimental-unified-host # Conflicts: # NEXT_CHANGELOG.md
Why
Prep for SDK bump databricks/databricks-sdk-go#1641, which removes
Experimental_IsUnifiedHost, its env var, and theUnifiedHostcase inHostType(). After the bump the CLI wouldn't compile.Rather than stubbing the field and leaving the plumbing behind, this PR fully drops the flag from the CLI surface now that
.well-known/databricks-configdiscovery is the canonical way to detect unified hosts.Changes
Before: CLI wrote
Experimental_IsUnifiedHostinto every config, exposed--experimental-is-unified-host, readexperimental_is_unified_hostfrom.databrickscfgprofiles, and honored theDATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOSTenv var.Now: unified-host routing comes entirely from
.well-known/databricks-config. Flag, env var, and profile key read are all gone. The only surviving mention is a deprecated no-op field onWorkspaceso existingdatabricks.ymlfiles validate.Removed:
--experimental-is-unified-hostflag (cmd/auth/auth.go)AuthArguments.IsUnifiedHostand theunifiedHostFallbackparameter threaded throughHasUnifiedHostSignal/IsSPOG/ResolveConfigTypelegacyUnifiedHostFromProfile()(libs/auth/credentials.go) and its caller inerror.goprofile.Profile.IsUnifiedHostand the INI key read inFileProfilerImpl.LoadProfilesprofileMetadata.isUnifiedHost(cmd/auth/profiles.go),applyUnifiedHostFlags(cmd/auth/token.go)acceptance/auth/credentials/unified-host/(tested the now-removed env var; discovery-based unified-host coverage remains inTestToOAuthArgument_SPOGHostRoutesToUnified,TestRunHostDiscovery_SPOGHost,TestProfileLoadSPOGConfigType,TestLogoutSPOGProfile, all using mock.well-knownservers)Kept:
Workspace.ExperimentalIsUnifiedHostinbundle/config/workspace.goas a deprecated no-op field so existingdatabricks.ymlstill validates. Annotation updated.experimental_is_unified_hostfrom profiles on OAuth login andconfiguresave, so legacy keys get cleaned up on re-login.Shared helpers extracted while touching the code:
databrickscfg.ExperimentalIsUnifiedHostKeyconstant for the cleanup-only INI key (was 4 string literals)auth.IsClassicAccountHosthelper replacing 3 copies of theaccounts./accounts-dod.prefix checkBack-compat:
experimental_is_unified_host = true, reachable.well-known/databricks-configexperimental_is_unified_host = true, unreachable.well-known--experimental-is-unified-hostflagDATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOSTenv varauth loginagainst a unified hostdatabricks.ymlwithexperimental_is_unified_host: trueTest 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)'make schemaandmake docsregenerated; bundle tests green