Commit 2cb9ab4
authored
Send X-Databricks-Workspace-Id on workspace-routed API calls (databricks#5368)
## 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.go` — `includeResponseHeaders` for the proxy
## Test plan
- [x] `go test ./cmd/api/... ./libs/filer/... ./libs/telemetry/...` —
green
- [x] `go test ./acceptance -run
'TestAccept/cmd/api|TestAccept/telemetry/(failure|timeout|partial)'` —
green (acceptance fixtures regenerated via `-update`)
- [x] `./task lint-q` — 0 issues; `./task fmt` — no changes
- [x] `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`1 parent cf28cd2 commit 2cb9ab4
32 files changed
Lines changed: 186 additions & 84 deletions
File tree
- acceptance
- cmd/api
- account-flag
- account-path
- default-profile
- workspace-id-flag
- workspace-id-from-query
- workspace-id-from-w-query
- workspace-id-none
- workspace-path
- workspace-proxy-regression
- telemetry
- failure
- partial-success
- success
- timeout
- bundle/deploy
- cmd
- api
- auth
- libs
- auth
- filer
- telemetry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments