Skip to content

Hosttype resolved#1372

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

Hosttype resolved#1372
tanmay-db wants to merge 4 commits intomainfrom
hosttype-resolved

Conversation

@tanmay-db
Copy link
Copy Markdown
Contributor

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

Python SDK — PR #1372: [Internal] Use resolved host type from host metadata in host_type
property

🥞 Stacked PR

Use this [link](https://github.com/databricks/databricks-sdk-py/pull/1372/files/ca751eebb5ffcd
689c678475b0f60bcf8c4180da..6aabd40) to review incremental
changes.


Summary

The host_type property 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 #1370 and #1371 added host_type parsing to HostMetadata and store it in
Config._resolved_host_type. However, the host_type property 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 host_type should prefer it.

What changed

Interface changes

None. host_type still returns HostType with the same possible values.

Behavioral changes

  • host_type now returns _resolved_host_type when it is not None, taking priority
    over all existing fallback logic (including URL pattern matching).
  • When metadata is unavailable (_resolved_host_type is None), behavior is identical to
    before.

Internal changes

  • Added _resolved_host_type check at top of host_type property in config.py.
  • Updated docstring.

How is this tested?

7 new tests:

  • Metadata workspace overrides account-like URL
  • Metadata account overrides workspace-like URL
  • Metadata unified is returned directly
  • Falls back to URL matching when _resolved_host_type is None
  • Metadata overrides experimental unified host flag
  • End-to-end: resolve → host_type returns metadata value
  • Default (no metadata, no URL) returns WORKSPACE

NO_CHANGELOG=true

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

Inputs:

  • PR number: 1372
  • Commit SHA: 5b452430782ebd5ad6f016e741172a1da11e4cb7

Checks will be approved automatically on success.

@tanmay-db tanmay-db temporarily deployed to test-trigger-is March 30, 2026 16:47 — 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