Skip to content

Commit 7748059

Browse files
authored
auth: decouple CLI from SDK's Experimental_IsUnifiedHost field (#5047)
## Why Prep for SDK bump [databricks/databricks-sdk-go#1641](databricks/databricks-sdk-go#1641), which removes `Experimental_IsUnifiedHost`, its env var, and the `UnifiedHost` case in `HostType()`. 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-config` discovery is the canonical way to detect unified hosts. ## Changes Before: CLI wrote `Experimental_IsUnifiedHost` into every config, exposed `--experimental-is-unified-host`, read `experimental_is_unified_host` from `.databrickscfg` profiles, and honored the `DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST` env 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 on `Workspace` so existing `databricks.yml` files validate. Removed: - `--experimental-is-unified-host` flag (`cmd/auth/auth.go`) - `AuthArguments.IsUnifiedHost` and the `unifiedHostFallback` parameter threaded through `HasUnifiedHostSignal` / `IsSPOG` / `ResolveConfigType` - `legacyUnifiedHostFromProfile()` (`libs/auth/credentials.go`) and its caller in `error.go` - `profile.Profile.IsUnifiedHost` and the INI key read in `FileProfilerImpl.LoadProfiles` - `profileMetadata.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 in `TestToOAuthArgument_SPOGHostRoutesToUnified`, `TestRunHostDiscovery_SPOGHost`, `TestProfileLoadSPOGConfigType`, `TestLogoutSPOGProfile`, all using mock `.well-known` servers) Kept: - `Workspace.ExperimentalIsUnifiedHost` in `bundle/config/workspace.go` as a deprecated no-op field so existing `databricks.yml` still validates. Annotation updated. - Clearing `experimental_is_unified_host` from profiles on OAuth login and `configure` save, so legacy keys get cleaned up on re-login. Shared helpers extracted while touching the code: - `databrickscfg.ExperimentalIsUnifiedHostKey` constant for the cleanup-only INI key (was 4 string literals) - `auth.IsClassicAccountHost` helper replacing 3 copies of the `accounts.` / `accounts-dod.` prefix check Back-compat: | Scenario | Behavior | | --- | --- | | Profile with `experimental_is_unified_host = true`, reachable `.well-known/databricks-config` | Still works via discovery. INI key silently ignored, cleared on next login. | | Profile with `experimental_is_unified_host = true`, unreachable `.well-known` | No longer routes as unified. User needs to re-login. | | `--experimental-is-unified-host` flag | Removed; passing it is an unknown-flag error. | | `DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST` env var | Not read (was already being removed by the SDK). | | New `auth login` against a unified host | Unchanged; routing from discovery. | | `databricks.yml` with `experimental_is_unified_host: true` | Silently ignored, field kept for schema compat. | ## Test plan - [x] `make checks` clean - [x] `make lint` 0 issues - [x] `go test ./libs/auth/... ./cmd/auth/... ./bundle/config/... ./libs/databrickscfg/... ./cmd/configure/...` - [x] `go test ./acceptance -run 'TestAccept/(cmd/auth|auth|cmd/configure)'` - [x] `make schema` and `make docs` regenerated; bundle tests green
1 parent 22a957e commit 7748059

32 files changed

Lines changed: 628 additions & 418 deletions

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### CLI
66

77
* Moved file-based OAuth token cache management from the SDK to the CLI. No user-visible change; part of a three-PR sequence that makes the CLI the sole owner of its token cache.
8+
* Remove the `--experimental-is-unified-host` flag and stop reading `experimental_is_unified_host` from `.databrickscfg` profiles and the `DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST` env var. Unified hosts are now detected exclusively from `/.well-known/databricks-config` discovery. The `experimental_is_unified_host` field is retained as a no-op in `databricks.yml` for schema compatibility.
89
* Added interactive pagination for list commands that have a row template (jobs, clusters, apps, pipelines, etc.). When stdin, stdout, and stderr are all TTYs, `databricks <resource> list` now streams 50 rows at a time and prompts `[space] more [enter] all [q|esc] quit`. ENTER can be interrupted by `q`/`esc`/`Ctrl+C` between pages. Colors and alignment match the existing non-paged output; column widths stay stable across pages. Piped output and `--output json` are unchanged.
910
* Added experimental OS-native secure token storage opt-in via `DATABRICKS_AUTH_STORAGE=secure`. Legacy file-backed token storage remains the default.
1011

acceptance/auth/credentials/unified-host/out.requests.txt

Lines changed: 0 additions & 39 deletions
This file was deleted.

acceptance/auth/credentials/unified-host/out.test.toml

Lines changed: 0 additions & 5 deletions
This file was deleted.

acceptance/auth/credentials/unified-host/output.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

acceptance/auth/credentials/unified-host/script

Lines changed: 0 additions & 12 deletions
This file was deleted.

acceptance/auth/credentials/unified-host/test.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

bundle/config/workspace.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ type Workspace struct {
4646
AzureLoginAppID string `json:"azure_login_app_id,omitempty"`
4747

4848
// Unified host specific attributes.
49+
//
50+
// ExperimentalIsUnifiedHost is a deprecated no-op. Unified hosts are now
51+
// detected automatically from /.well-known/databricks-config. The field is
52+
// retained so existing databricks.yml files using it still validate against
53+
// the bundle schema.
4954
ExperimentalIsUnifiedHost bool `json:"experimental_is_unified_host,omitempty"`
5055
AccountID string `json:"account_id,omitempty"`
5156
WorkspaceID string `json:"workspace_id,omitempty"`
@@ -135,9 +140,8 @@ func (w *Workspace) Config(ctx context.Context) *config.Config {
135140
AzureLoginAppID: w.AzureLoginAppID,
136141

137142
// Unified host
138-
Experimental_IsUnifiedHost: w.ExperimentalIsUnifiedHost,
139-
AccountID: w.AccountID,
140-
WorkspaceID: w.WorkspaceID,
143+
AccountID: w.AccountID,
144+
WorkspaceID: w.WorkspaceID,
141145
}
142146

143147
for k := range config.ConfigAttributes {

0 commit comments

Comments
 (0)