Skip to content

config: extract ?o=/?a= from Host URL#1699

Open
simonfaltum wants to merge 2 commits into
mainfrom
simonfaltum/host-extract-query-params
Open

config: extract ?o=/?a= from Host URL#1699
simonfaltum wants to merge 2 commits into
mainfrom
simonfaltum/host-extract-query-params

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

@simonfaltum simonfaltum commented May 27, 2026

Changes

Pasting a SPOG URL from the Databricks UI (e.g. https://acme.databricks.net/?o=12345) into Config.Host previously dropped the workspace identifier on the way through fixHostIfNeeded: the function stripped path and query without promoting them to dedicated fields. The request then went out without an X-Databricks-Org-Id header, the server couldn't route it, and the response came back as the login HTML page, surfacing as ErrHTMLContent ("received HTML response instead of JSON").

This change recognizes ?o=/?workspace_id= and ?a=/?account_id= as part of host sanitization and promotes them into Config.WorkspaceID/Config.AccountID when those fields are empty. Existing values are never overwritten.

The same fix is going in at the CLI level in databricks/cli#5337 as a stopgap that pre-processes DATABRICKS_HOST. Once this SDK fix lands and the CLI bumps the SDK version, the CLI-side workaround can be removed.

Tests

  • New table-driven test TestConfig_fixHostIfNeeded_extractsWorkspaceIDFromQuery in config/config_test.go covers: ?o= promotion, ?workspace_id= promotion, ?a= promotion, both together, existing WorkspaceID/AccountID preserved, non-numeric ?o= dropped, host without query unchanged.
  • make fmt test lint clean.

NO_CHANGELOG=true

Pasting a SPOG URL from the Databricks UI (e.g.
https://acme.databricks.net/?o=12345) into Config.Host previously dropped
the workspace identifier on the way through fixHostIfNeeded: the
function stripped path and query without promoting them to dedicated
fields. The request then went out without an X-Databricks-Org-Id header,
the server couldn't route it, and the response came back as the login
HTML page, surfacing as ErrHTMLContent ("received HTML response instead
of JSON").

Recognize ?o=/?workspace_id= and ?a=/?account_id= as part of host
sanitization and promote them into Config.WorkspaceID/Config.AccountID
when those fields are empty. Existing values are never overwritten.

Co-authored-by: Isaac
Signed-off-by: simon <simon.faltum@databricks.com>
Co-authored-by: Isaac
Signed-off-by: simon <simon.faltum@databricks.com>
@simonfaltum simonfaltum temporarily deployed to test-trigger-is May 27, 2026 11:27 — with GitHub Actions Inactive
@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-go

Inputs:

  • PR number: 1699
  • Commit SHA: e29185ac637ad1a39a276129b8c7c991b9b85eac

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