Skip to content

[XTA-15079] Add SPOG support for ?o= routing in httpPath#391

Open
samikshya-db wants to merge 1 commit into
mainfrom
spog-support
Open

[XTA-15079] Add SPOG support for ?o= routing in httpPath#391
samikshya-db wants to merge 1 commit into
mainfrom
spog-support

Conversation

@samikshya-db
Copy link
Copy Markdown
Collaborator

Summary

Ports the SPOG (Single Panel of Glass) routing fix from
databricks/databricks-jdbc#1316
to the Node.js driver. SPOG replaces workspace-specific hostnames with
account-level vanity URLs. When httpPath carries ?o=<workspaceId>,
endpoints that don't include the workspace in their URL path need the
workspace conveyed via the x-databricks-org-id header instead.

Changes

  • Parse ?o=<digits> out of httpPath in DBSQLClient.connect() and
    stash the org-id as x-databricks-org-id on a new
    ClientConfig.customHeaders field. A user-supplied customHeaders
    entry (case-insensitively keyed) takes precedence.
  • Telemetry POST (DatabricksTelemetryExporter) spreads
    config.customHeaders into the outgoing headers; auth headers still
    win on collision.
  • Feature-flag GET (FeatureFlagCache) does the same.
  • ConnectionOptions.customHeaders is exposed so callers can also
    inject their own out-of-band headers if needed.

What does NOT get the header

OAuth / OIDC token requests use openid-client's private HTTP transport
and never see customHeaders. This matches the JDBC PR: account-level
OAuth endpoints reject x-databricks-org-id with HTTP 400.

What is NOT needed vs JDBC

  • httpPath property parser fix — Node.js passes options.path
    through to the driver unmodified; there is no split-on-= parser to
    break.
  • Warehouse ID regex fix — this driver uses Thrift only and never
    extracts the warehouse ID into a SEA JSON body. The existing ?o=
    parser (extractWorkspaceId) already stops at ?.
  • DBFS Volume client header injection — the driver exposes no
    Volume API surface.

Test plan

Unit tests added:

  • buildCustomHeaders parses ?o= into x-databricks-org-id
  • No header when ?o= is absent and no user-supplied customHeaders
  • User-supplied customHeaders is preserved alongside parsed org-id
  • User-supplied x-databricks-org-id (any case) wins over ?o=
  • Non-numeric o=<value> does not inject a header
  • End-to-end DBSQLClient.connect() populates
    config.customHeaders['x-databricks-org-id'] from the path
  • DatabricksTelemetryExporter attaches config.customHeaders to
    the POST headers
  • Auth headers still override customHeaders on key collision
  • No header is attached when config.customHeaders is empty
  • FeatureFlagCache.fetchFeatureFlag attaches customHeaders to
    the GET headers

This pull request and its description were written by Isaac.

…flag

SPOG (Single Panel of Glass) replaces workspace-specific hostnames with
account-level vanity URLs. When httpPath carries `?o=<workspaceId>`,
endpoints that don't include the workspace in their URL path (telemetry,
feature flags) need the workspace conveyed via the
`x-databricks-org-id` header instead.

Changes:

- Parse `?o=<digits>` out of httpPath in DBSQLClient.connect() and stash
  the org-id as `x-databricks-org-id` on a new `ClientConfig.customHeaders`
  field. A user-supplied `customHeaders` entry (case-insensitive) takes
  precedence.
- DatabricksTelemetryExporter spreads `config.customHeaders` into the
  outgoing POST headers. Auth headers still win on collision.
- FeatureFlagCache does the same for the feature-flag GET.

Not applicable to this driver (vs JDBC port in
databricks/databricks-jdbc#1316):

- httpPath property parser fix — Node.js passes `options.path` through
  unmodified.
- Warehouse ID regex fix for SEA — driver uses Thrift only.
- DBFS Volume header injection — driver exposes no Volume API.

OAuth/OIDC token requests deliberately do NOT receive customHeaders.

Co-authored-by: Isaac
@samikshya-db samikshya-db deployed to azure-prod May 23, 2026 15:07 — with GitHub Actions Active
@github-actions
Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@samikshya-db samikshya-db changed the title Add SPOG support for ?o= routing in httpPath [XTA-15079] Add SPOG support for ?o= routing in httpPath May 23, 2026
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