Skip to content

[Internal] Use resolved host type from host metadata in getHostType()#749

Draft
tanmay-db wants to merge 5 commits intomainfrom
hosttype-resolved
Draft

[Internal] Use resolved host type from host metadata in getHostType()#749
tanmay-db wants to merge 5 commits intomainfrom
hosttype-resolved

Conversation

@tanmay-db
Copy link
Copy Markdown
Contributor

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

🥞 Stacked PR

Use this link to review incremental changes.


Summary

getHostType() now returns the host type resolved from host metadata when available, falling
back to URL pattern matching only when metadata has not been resolved.

Why

PRs #747 and #748 added host_type parsing to HostMetadata and store it in
DatabricksConfig.resolvedHostType. However, getHostType() still relied solely on URL
pattern 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 returns HostType with the same possible values.

Behavioral changes

  • getHostType() now returns resolvedHostType when it is not null, taking priority
    over all existing fallback logic (including the experimental unified host flag and URL pattern
    matching).
  • When metadata is unavailable (resolvedHostType == null), behavior is identical to before.

Internal changes

  • Added resolvedHostType check at top of getHostType() in DatabricksConfig.java.
  • Updated javadoc.

How is this tested?

6 new tests in UnifiedHostTest:

  • Metadata workspace overrides account-like URL
  • Metadata account overrides workspace-like URL
  • Metadata unified is returned directly
  • Falls back to URL matching when resolvedHostType is null
  • Metadata overrides experimental unified host flag
  • End-to-end: resolveHostMetadata → getHostType() returns metadata value

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:10 — with GitHub Actions Inactive
@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 30, 2026 15:10 — with GitHub Actions Inactive
@tanmay-db tanmay-db changed the title Hosttype resolved [Internal] Use resolved host type from host metadata in getHostType() Mar 30, 2026
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>
Signed-off-by: Tanmay Rustagi <tanmay.rustagi@databricks.com>
@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: 749
  • Commit SHA: 6b1ed72b84fe5a6468972e7f05a34068ba66fa98

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