Skip to content

Wire HostMetadata discovery into DatabricksConfig#680

Open
hectorcast-db wants to merge 4 commits intomainfrom
hectorcast-db/stack/config-auto-complete-3
Open

Wire HostMetadata discovery into DatabricksConfig#680
hectorcast-db wants to merge 4 commits intomainfrom
hectorcast-db/stack/config-auto-complete-3

Conversation

@hectorcast-db
Copy link
Contributor

@hectorcast-db hectorcast-db commented Feb 25, 2026

🥞 Stacked PR

Use this link to review incremental changes.


Summary

Wires host metadata discovery into DatabricksConfig via a new package-private resolveHostMetadata() helper, mirroring Config._resolve_host_metadata() in the Python SDK.

Why

Users configuring the SDK today have no way to let it auto-discover accountId, workspaceId, or the OIDC endpoint from the host — they must supply each field manually. The discoveryUrl config property already allows providing a direct OIDC discovery URL; resolveHostMetadata() completes the picture by deriving all three fields automatically from the host's /.well-known/databricks-config endpoint.

What changed

Interface changes

  • DatabricksConfig.resolveHostMetadata() (package-private) — Calls getHostMetadata() on the configured host and back-fills accountId, workspaceId, and discoveryUrl (with any {account_id} placeholder substituted) if those fields are not already set. Throws DatabricksException if accountId cannot be resolved or if no oidc_endpoint is present in the metadata.

Behavioral changes

  • resolveHostMetadata() is not called automatically — it is opt-in.
  • Existing fields are never overwritten.

Internal changes

Tests in DatabricksConfigTest:

  • testResolveHostMetadataWorkspacePopulatesAllFields — workspace populates all three fields.
  • testResolveHostMetadataAccountSubstitutesAccountId — account host substitutes {account_id} in the OIDC endpoint.
  • testResolveHostMetadataDoesNotOverwriteExistingFields — existing fields are not overwritten.
  • testResolveHostMetadataRaisesWhenAccountIdUnresolvable — raises when accountId cannot be resolved.
  • testResolveHostMetadataRaisesWhenOidcEndpointMissing — raises when oidc_endpoint is absent.
  • testResolveHostMetadataRaisesOnHttpError — raises when the well-known endpoint returns an error.

How is this tested?

Unit tests in DatabricksConfigTest using FixtureServer.

NO_CHANGELOG=true

Adds `HostMetadata` and a package-private `getHostMetadata()` on
`DatabricksConfig` for parsing the `/.well-known/databricks-config`
discovery endpoint.

The method returns raw metadata with no substitution (e.g.
`{account_id}` placeholders are left as-is), keeping it a pure
discovery primitive. Callers decide how to interpret the result.
Adds tests covering:
- DATABRICKS_DISCOVERY_URL env var is loaded into Config
- getDatabricksOidcEndpoints() short-circuits to discoveryUrl when set

The underlying implementation (discoveryUrl config field and
getDatabricksOidcEndpoints() short-circuit) was already present in the
Java SDK. Mirrors the Python SDK's get_endpoints_from_url() addition.
Adds package-private `resolveHostMetadata()` to `DatabricksConfig`.
When called, it fetches `/.well-known/databricks-config` and back-fills
`accountId`, `workspaceId`, and `discoveryUrl` (with any `{account_id}`
placeholder substituted) if those fields are not already set.

Raises DatabricksException if `accountId` cannot be resolved or if no
`oidc_endpoint` is present in the metadata. Mirrors
`Config._resolve_host_metadata()` in the Python SDK.
@github-actions
Copy link

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: 680
  • Commit SHA: 18b73249bb564d01fe237f2464145a2ca025e9b4

Checks will be approved automatically on success.

@hectorcast-db hectorcast-db marked this pull request as ready for review February 25, 2026 12:21
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