Skip to content

[Feature] Add GetResolvedHostType() getter to Config for downstream host type access#1615

Open
tanmay-db wants to merge 2 commits intomainfrom
public-host-type
Open

[Feature] Add GetResolvedHostType() getter to Config for downstream host type access#1615
tanmay-db wants to merge 2 commits intomainfrom
public-host-type

Conversation

@tanmay-db
Copy link
Copy Markdown
Contributor

@tanmay-db tanmay-db commented Apr 9, 2026

Summary

Adds a GetResolvedHostType() public getter on Config that exposes the host type resolved from the /.well-known/databricks-config discovery endpoint, without falling back to URL pattern matching heuristics.

Why

The existing HostType() method combines two behaviors: it checks the resolved host metadata first, then falls back to URL pattern matching. Downstream consumers like the Terraform provider need access to only the metadata-resolved host type to make decisions about host-agnostic behavior — without the URL-based fallback polluting the result.

Today, resolvedHostType is a private field with no public accessor, so downstream packages cannot distinguish between "metadata says this is a workspace host" and "we guessed from the URL pattern."

This getter provides a clean, minimal API for that use case.

What changed

Interface changes

  • (*Config).GetResolvedHostType() HostType — Returns the host type resolved from host metadata discovery. Returns HostTypeUnknown if
    metadata has not been resolved or did not include a host type. Unlike HostType(), this method does not fall back to URL pattern matching.

Behavioral changes

None. This is a new accessor for an existing internal field.

Internal changes

None.

How is this tested?

4 unit tests added in config/config_test.go:

  • TestGetResolvedHostType_ReturnsUnknownByDefault — fresh Config returns HostTypeUnknown
  • TestGetResolvedHostType_ReturnsResolvedValue — returns WorkspaceHost when set
  • TestGetResolvedHostType_AccountHost — returns AccountHost when set
  • TestGetResolvedHostType_UnifiedHost — returns UnifiedHost when set

All pass locally via go test -run TestGetResolvedHostType ./config/.

@tanmay-db tanmay-db temporarily deployed to test-trigger-is April 9, 2026 14:01 — with GitHub Actions Inactive
@tanmay-db tanmay-db changed the title - [Feature] Add GetResolvedHostType() getter to Config for downstream host type access Apr 9, 2026
@tanmay-db tanmay-db marked this pull request as ready for review April 9, 2026 14:02
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

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

Inputs:

  • PR number: 1615
  • Commit SHA: 1aa1ee5c43c0781ce12af2cbf7bc4f771de2ca62

Checks will be approved automatically on success.

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