Skip to content

[Internal] Add HostType to HostMetadata#747

Draft
tanmay-db wants to merge 3 commits intomainfrom
hosttype-metadata
Draft

[Internal] Add HostType to HostMetadata#747
tanmay-db wants to merge 3 commits intomainfrom
hosttype-metadata

Conversation

@tanmay-db
Copy link
Copy Markdown
Contributor

@tanmay-db tanmay-db commented Mar 30, 2026

🥞 Stacked PR


Summary

Parses the host_type field from the /.well-known/databricks-config discovery endpoint into
HostMetadata and stores it on DatabricksConfig, so the SDK knows whether a host is a
workspace, account, or unified host without parsing hostnames.

Why

Today, getHostType() infers the host type by prefix-matching the hostname against
accounts. — everything else is classified as WORKSPACE. This cannot detect unified hosts,
which share the same hostname pattern as workspace hosts.

The server-side host_type field is being added to the /.well-known/databricks-config
endpoint, returning "workspace", "account", or "unified". This PR threads that value
into the SDK so it's available for use when getHostType() is updated to prefer
endpoint-resolved values over URL-based inference (PR #749).

What changed

Interface changes

  • HostType.fromApiValue(String) — new static method that normalizes API values
    (workspace, account, unified) to enum constants (WORKSPACE, ACCOUNTS, UNIFIED).
    Case-insensitive. Returns null for unknown values.
  • HostMetadata.getHostType() — new getter for the host_type field parsed from the
    discovery endpoint response.

Behavioral changes

Internal changes

  • DatabricksConfig.resolvedHostType (package-private) stores the host type resolved during
    resolveHostMetadata().
  • DatabricksConfig.getResolvedHostType() / setResolvedHostType() — package-private
    accessor for testing.

How is this tested?

  • HostTypeTest — 7 tests for fromApiValue() normalization (all cases, case-insensitive,
    null, empty, unknown values)
  • DatabricksConfigTest — 5 tests for host type resolution from metadata (populates
    workspace/account/unified, does not overwrite existing, unknown ignored)

NO_CHANGELOG=true


Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 30, 2026 15:09 — with GitHub Actions Inactive
@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 30, 2026 15:09 — with GitHub Actions Inactive
@tanmay-db tanmay-db changed the title Add HostType to HostMetadata [Internal] Add HostType to HostMetadata Mar 30, 2026
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 30, 2026 17:00 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

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-java

Inputs:

  • PR number: 747
  • Commit SHA: dff706f0a48511e44fefdc8a46d6631c008b5dfb

Checks will be approved automatically on success.

@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 30, 2026 17:02 — with GitHub Actions Inactive
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