[Internal] Use resolved host type from host metadata in getHostType()#749
Draft
[Internal] Use resolved host type from host metadata in getHostType()#749
Conversation
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
This was referenced Mar 30, 2026
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
de63be7 to
ae9813b
Compare
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
ae9813b to
6b1ed72
Compare
# Conflicts: # databricks-sdk-java/src/main/java/com/databricks/sdk/core/DatabricksConfig.java # databricks-sdk-java/src/main/java/com/databricks/sdk/core/HostType.java # databricks-sdk-java/src/test/java/com/databricks/sdk/core/UnifiedHostTest.java
…orts DatabricksConfigTest.java: - Add second fixture for tests calling both resolve() and resolveHostMetadata(), since resolve() internally calls tryResolveHostMetadata() consuming the first fixture. - Replace setExperimentalIsUnifiedHost(true) with host_type in metadata response, since PR #720 removed the experimental flag check from getHostType(). UnifiedHostTest.java: - Add missing java.io.IOException import. - Remove 3 broken header injection tests that asserted X-Databricks-Org-Id in authenticate() headers — that header is injected at the service impl level, not during authentication. - Remove stale setExperimentalIsUnifiedHost(true) from remaining tests (no-op after PR #720). - Update javadoc to reflect re-introduced UNIFIED host type.
- Remove redundant explicit resolveHostMetadata() calls since resolve() already triggers it internally via tryResolveHostMetadata(). Revert to single fixtures where the second call was removed. - Keep double fixture only for testResolveHostMetadataDoesNotOverwriteExistingHostType which genuinely needs a second resolveHostMetadata() call. - Use host_type in metadata response instead of experimentalIsUnifiedHost flag (removed by PR #720) to make getClientType() return ACCOUNT.
- testWorkspaceIdFromEnvironmentVariables: use FixtureServer URL instead of https://mycompany.databricks.com to avoid hitting real /.well-known/databricks-config during resolve(). - testNewWithWorkspaceHost: use FixtureServer URL as workspace host instead of https://workspace.cloud.databricks.com. - Remove unnecessary second fixture from testEndToEndResolveToGetHostType.
…with FixtureServer Replace real unified.databricks.com hostname with FixtureServer to prevent host metadata resolution from hitting live servers during tests. Co-authored-by: Isaac
tanmay-db
added a commit
that referenced
this pull request
Apr 11, 2026
…tType() testResolveHostMetadataFallsBackToAccountIdWhenNoDefaultOidcAudience relies on resolvedHostType influencing getHostType(), which is only implemented in PR #749 (hosttype-resolved branch). Moved to that branch.
…nifiedHostTest Co-authored-by: Isaac
Contributor
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 Stacked PR
Use this link to review incremental changes.
Summary
getHostType()now returns the host type resolved from host metadata when available, fallingback to URL pattern matching only when metadata has not been resolved.
Why
PRs #747 and #748 added
host_typeparsing toHostMetadataand store it inDatabricksConfig.resolvedHostType. However,getHostType()still relied solely on URLpattern matching. This meant the authoritative signal from the server was ignored.
URL pattern matching is fragile — it can't distinguish unified hosts, and custom or
non-standard URLs may not follow expected patterns. The metadata endpoint is the authoritative
source, so
getHostType()should prefer it.What changed
Interface changes
None.
getHostType()still returnsHostTypewith the same possible values.Behavioral changes
getHostType()now returnsresolvedHostTypewhen it is notnull, taking priorityover all existing fallback logic (including the experimental unified host flag and URL pattern
matching).
resolvedHostType == null), behavior is identical to before.Internal changes
resolvedHostTypecheck at top ofgetHostType()inDatabricksConfig.java.How is this tested?
6 new tests in
UnifiedHostTest:NO_CHANGELOG=true