Skip to content

Send X-Databricks-Workspace-Id on workspace-routed API calls#5368

Open
Divyansh-db wants to merge 1 commit into
mainfrom
new-workspace-parameter
Open

Send X-Databricks-Workspace-Id on workspace-routed API calls#5368
Divyansh-db wants to merge 1 commit into
mainfrom
new-workspace-parameter

Conversation

@Divyansh-db
Copy link
Copy Markdown

Summary

On unified Databricks hosts that serve multiple workspaces, the CLI sends a routing header so the gateway can dispatch each request to the correct workspace. The platform is consolidating workspace addressing onto a single header name. This PR switches the header sent on workspace-scoped API calls from X-Databricks-Org-Id to X-Databricks-Workspace-Id. The previous header continues to be accepted by the platform, so older CLI versions keep working.

The value continues to come from the workspace_id config field or DATABRICKS_WORKSPACE_ID environment variable.

Scope

Hand-written CLI paths that issue workspace-routed API calls without going through generated SDK service methods:

  • databricks api {verb} (cmd/api/api.go)
  • Files API filer (libs/filer/files_client.go)
  • Workspace files filer (libs/filer/workspace_files_client.go)
  • Telemetry uploads (libs/telemetry/logger.go)

The matching change inside the SDK landed in databricks/databricks-sdk-go#1688 and will reach generated service methods on the next SDK bump.

Asymmetric migration

Only the request-side header flips. The SDK's CurrentWorkspaceID() still reads X-Databricks-Org-Id from the response on /api/2.0/preview/scim/v2/Me, because the server continues to echo the legacy response header. The two CLI test fakes that support that flow stay on the legacy name intentionally:

  • libs/testserver/handlers.go/Me mock response header
  • libs/testproxy/server.goincludeResponseHeaders for the proxy

Test plan

  • go test ./cmd/api/... ./libs/filer/... ./libs/telemetry/... — green
  • go test ./acceptance -run 'TestAccept/cmd/api|TestAccept/telemetry/(failure|timeout|partial)' — green (acceptance fixtures regenerated via -update)
  • ./task lint-q — 0 issues; ./task fmt — no changes
  • git grep -in 'X-Databricks-Org' -- ':!*.md' ':!*.sum' ':!bundle/' — only the two intentional response-side fakes plus a context comment in cmd/api/api.go

On unified Databricks hosts that serve multiple workspaces, the CLI sends a
routing header so the gateway can dispatch each request to the correct
workspace. The platform is consolidating workspace addressing onto a single
header name. Switch the header sent on workspace-scoped API calls from
X-Databricks-Org-Id to X-Databricks-Workspace-Id. The previous header
continues to be accepted by the platform, so older CLI versions keep working.

This change covers the hand-written paths in the CLI that issue workspace-
routed API calls without going through generated SDK service methods:

- databricks api {verb} (cmd/api/api.go)
- Files API filer (libs/filer/files_client.go)
- Workspace files filer (libs/filer/workspace_files_client.go)
- Telemetry uploads (libs/telemetry/logger.go)

The value continues to come from the workspace_id config field or
DATABRICKS_WORKSPACE_ID.

The CurrentWorkspaceID() helper in the SDK still reads X-Databricks-Org-Id
from the response on /api/2.0/preview/scim/v2/Me, so the response-side
references in libs/testserver/handlers.go and libs/testproxy/server.go
intentionally remain on the legacy header name.
@github-actions
Copy link
Copy Markdown
Contributor

Approval status: pending

/cmd/api/ - needs approval

Files: cmd/api/api.go
Suggested: @simonfaltum
Also eligible: @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

/libs/filer/ - needs approval

Files: libs/filer/files_client.go, libs/filer/workspace_files_client.go, libs/filer/workspace_files_client_test.go
Suggested: @simonfaltum
Also eligible: @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

/libs/telemetry/ - needs approval

Files: libs/telemetry/logger.go
Suggested: @simonfaltum
Also eligible: @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

General files (require maintainer)

19 files changed
Based on git history:

  • @pietern -- recent work in libs/filer/, libs/telemetry/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: f1cbbd1

Run: 26579120677

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.

2 participants