Skip to content

Fix HostType() misclassifying account hosts without scheme#1510

Merged
renaudhartert-db merged 4 commits intomainfrom
simonfaltum/fix-hosttype-missing-scheme
Mar 2, 2026
Merged

Fix HostType() misclassifying account hosts without scheme#1510
renaudhartert-db merged 4 commits intomainfrom
simonfaltum/fix-hosttype-missing-scheme

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

Changes

When a .databrickscfg profile contains a host without the https:// scheme (e.g. host = accounts.cloud.databricks.com), HostType() failed to match the https://accounts. prefix and returned WorkspaceHost instead of AccountHost. This caused NewAccountClient to reject valid account configurations with "invalid Databricks Account configuration - host incorrect or account_id missing".

This can happen when auth login saves the host from user input that omits the scheme, or when users manually edit their config file.

The fix normalizes the host by prepending https:// when no scheme is present before checking prefixes. The normalization is local to the check and does not mutate c.Host.

Tests

Added TestHostType_AwsAccountWithoutScheme and TestHostType_AwsDodAccountWithoutScheme covering the schemeless case.

When a profile in .databrickscfg contains a host without the https://
scheme (e.g. "accounts.cloud.databricks.com"), HostType() failed to
match the "https://accounts." prefix and returned WorkspaceHost instead
of AccountHost. This caused NewAccountClient to reject valid account
configurations with "invalid Databricks Account configuration".

The fix normalizes the host by prepending "https://" when no scheme is
present before checking prefixes. The normalization is local to the
check and does not mutate c.Host.

Signed-off-by: simon <[email protected]>
Avoids per-call slice allocation while keeping the same behavior.

Signed-off-by: simon <[email protected]>
The slice groups the prefixes as data, making it easy to add new ones.
The allocation cost of a 2-element slice is negligible.

Signed-off-by: simon <[email protected]>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1510
  • Commit SHA: 00cd6b691481a9e4565467e3b8f21ff559d5c642

Checks will be approved automatically on success.

@renaudhartert-db renaudhartert-db added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit f7f7954 Mar 2, 2026
15 checks passed
@renaudhartert-db renaudhartert-db deleted the simonfaltum/fix-hosttype-missing-scheme branch March 2, 2026 19:14
deco-sdk-tagging bot added a commit that referenced this pull request Mar 3, 2026
## Release v0.116.0

### Bug Fixes

* Fix `HostType()` misclassifying account hosts when the scheme is missing ([#1510](#1510)).
renaudhartert-db added a commit that referenced this pull request Mar 6, 2026
The merge from main dropped the "AWS account without scheme" and
"AWS DoD account without scheme" test cases from the TestConfig_HostType
table. These were originally added in #1510 and cover schemeless host
values in .databrickscfg profiles.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Ubuntu <[email protected]>
github-merge-queue bot pushed a commit to databricks/cli that referenced this pull request Mar 9, 2026
## Changes

- Bump `github.com/databricks/databricks-sdk-go` from v0.112.0 to
v0.117.0
- Update OpenAPI SHA
- Regenerate CLI code via `make generate`

<details><summary>SDK v0.112 -> v0.117.0 changelog</summary>
<p>

## Release v0.117.0 (2026-03-04)

### Internal Changes
* Move cloud-based credential filtering from individual strategies into
`DefaultCredentials`. Azure strategies are skipped on GCP/AWS hosts in
auto-detect mode; GCP strategies are skipped on Azure/AWS hosts. When
`auth_type` is explicitly set (e.g. `azure-cli`), cloud filtering is
bypassed so the named strategy is always attempted regardless of host
cloud.

## Release v0.116.0 (2026-03-03)

### Bug Fixes

* Fix `HostType()` misclassifying account hosts when the scheme is
missing
([#1510](databricks/databricks-sdk-go#1510)).


## Release v0.115.0 (2026-03-02)

### Internal Changes
* Implement dynamic auth token stale period based on initial token
lifetime. Increased up to 20 mins for standard OAuth with proportionally
shorter periods for short-lived tokens.

### API Changes
* Add `CreateDatabase`, `DeleteDatabase`, `GetDatabase`, `ListDatabases`
and `UpdateDatabase` methods for
[w.Postgres](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#PostgresAPI)
workspace-level service.
* Add `Postgres` field for
[apps.AppResource](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#AppResource).
* Add `DataframeSchema`, `FilterCondition` and `TransformationSql`
fields for
[ml.DeltaTableSource](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#DeltaTableSource).
* Add `EnvironmentVersion` field for
[pipelines.PipelinesEnvironment](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#PipelinesEnvironment).
* Add `ResetCheckpointSelection` field for
[pipelines.StartUpdate](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#StartUpdate).
* [Breaking] Remove `Oauth2AppClientId` and `Oauth2AppIntegrationId`
fields for
[apps.Space](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#Space).
* Add `EnablePgNativeLogin` field for
[postgres.ProjectSpec](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#ProjectSpec).
* Add `EnablePgNativeLogin` field for
[postgres.ProjectStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#ProjectStatus).
* [Breaking] Remove `NodeTypeFlexibility` field for
[compute.EditInstancePool](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#EditInstancePool).


## Release v0.114.0 (2026-02-26)

### API Changes
* Add `EffectivePublishingMode` field for
[pipelines.GetPipelineResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#GetPipelineResponse).
* Add `DbrAutoscale` enum value for
[compute.EventDetailsCause](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#EventDetailsCause).
* Change `OutputCatalog` field for
[cleanrooms.CreateCleanRoomOutputCatalogResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CreateCleanRoomOutputCatalogResponse)
to be required.
* [Breaking] Remove `InternalAttributes` field for
[sharing.Table](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#Table).
* [Breaking] Remove `InternalAttributes` field for
[sharing.Volume](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#Volume).


## Release v0.113.0 (2026-02-25)

### New Features and Improvements
* Add `DisableAsyncTokenRefresh` field to `Config` to allow disabling
asynchronous token refresh for short-lived processes like the Databricks
CLI.


</p>
</details>

## Tests

- [x] `make lintfull`
- [x] `make test`
- [x] `make checks`

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
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.

2 participants