You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
The Databricks UI is migrating from `?o=<workspace-id>` to
`?w=<workspace-id>` as the SPOG URL query parameter, matching the new
workspace addressing header. This PR extends the CLI's URL parsers to
recognize `?w=` in addition to the existing `?o=` and `?workspace_id=`
spellings. Pure addition; no existing URL changes meaning.
Stacked on top of #5368 (which renames the request header to
`X-Databricks-Workspace-Id`); the two together complete the input + wire
side of the URL/header migration for the core CLI.
## Affected entry points
- `databricks api <verb> <path?w=...>` — workspace ID is extracted from
the path and sent as the routing header on the call.
- `databricks auth login --host "https://...?w=..."` — workspace ID is
extracted from the host URL and persisted to the profile.
- `workspace.host` in `databricks.yml` — uses the same shared parser
(`libs/auth.ExtractHostQueryParams`).
## Precedence
When more than one spelling appears on a single URL, **`?o=` > `?w=` >
`?workspace_id=`**. The `o`-first rule preserves the resolution of any
URL already pasted from older UI builds, shell history, or committed
`databricks.yml` files.
## Rename
`extractOrgIDFromQuery` (in `cmd/api/api.go`) →
`extractWorkspaceIDFromQuery`. The helper now returns the value under
any of the recognized parameter names, so the old name became
misleading. Unexported, single call site; updated atomically.
## Files
- `libs/auth/hostparams.go` — adds the `q.Get("w")` branch in
`ExtractHostQueryParams`; comment refreshed to document the three
accepted forms and precedence.
- `cmd/api/api.go` — adds `workspaceIDQueryParam = "w"` const; renames
extractor and updates its body to check `o` then `w`.
- `cmd/auth/login.go` — help text updated to recommend `?w=` and note
that `?o=` / `?workspace_id=` are still accepted.
- `libs/auth/hostparams_test.go` — new cases for `?w=`, precedence, and
non-numeric rejection.
- `cmd/api/api_test.go` — new cases in `TestExtractWorkspaceIDFromQuery`
(renamed) and `TestResolveOrgID` covering `?w=` and the
`o`-wins-over-`w` precedence.
- `acceptance/cmd/api/workspace-id-from-w-query/` — new acceptance test
mirroring `workspace-id-from-query/` but exercising the `?w=` path. The
original `?o=` test stays unchanged as a regression check.
## Test plan
- [x] \`go test ./libs/auth/... ./cmd/api/... ./cmd/auth/... -count=1\`
— green
- [x] \`go test ./acceptance -run
'TestAccept/cmd/api|TestAccept/cmd/auth|TestAccept/auth'\` — green
- [x] \`./task lint-q\` — 0 issues
- [x] \`./task fmt\` — no changes
0 commit comments