Accept ?w= URL query parameter alongside ?o=#5373
Merged
andrewnester merged 3 commits intoJun 1, 2026
Merged
Conversation
Collaborator
|
Commit: 815f916 |
andrewnester
approved these changes
May 29, 2026
hectorcast-db
approved these changes
May 29, 2026
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. Extend 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. This affects: - databricks api <verb> <path?w=...> — workspace ID extracted from the path and sent as the routing header on the call. - databricks auth login --host "https://...?w=..." — workspace ID extracted from the host URL and persisted to the profile. - workspace.host in databricks.yml — same parser is reused. When more than one spelling is present on a single URL, ?o= takes precedence over ?w=, which takes precedence over ?workspace_id=. The "o" precedence preserves the meaning of any URL already pasted from older UI builds, shell history, or committed databricks.yml files. The cmd/api helper extractOrgIDFromQuery is renamed to extractWorkspaceIDFromQuery to reflect that it now returns the value under multiple recognized parameter names.
The new X-Databricks-Workspace-Id routing header accepts non-numeric workspace identifiers (e.g. connection-style strings) in addition to classic numeric workspace IDs; the server disambiguates. The URL parser was rejecting any non-numeric value via strconv.ParseInt and silently dropping it, which would block pasted URLs that carry one of the new identifier shapes. Remove the numeric validation from all three branches (?o=, ?w=, ?workspace_id=) in ExtractHostQueryParams and pass the raw value through. Affects every caller of the helper: - databricks auth login --host - workspace.host in databricks.yml (via bundle/config/workspace.go) Flip the existing "non-numeric is skipped" tests in hostparams_test.go and host_env_test.go to "non-numeric is passed through". Add a positive test case for a UUID-shaped connection-style identifier.
4d05fbd to
144792d
Compare
Legacy URL spellings ?o= and ?workspace_id= predate the broader workspace identifier shapes the new routing header accepts. URLs in databricks.yml, browser bookmarks, and shell history that use those forms are always numeric, so keep the strconv.ParseInt validation on those branches to silently drop garbage values (matching pre-PR behavior). ?w= is the new spelling and must pass non-numeric connection-style identifiers through unchanged. Adjust the test cases: "non-numeric ?o= is skipped" and "non-numeric ?workspace_id= is skipped" go back to expecting the value to be dropped. The ?w= non-numeric and UUID-shaped positive cases stay.
3 tasks
simonfaltum
approved these changes
May 30, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.hostindatabricks.yml— uses the same shared parser (libs/auth.ExtractHostQueryParams).Precedence
When more than one spelling appears on a single URL,
?o=>?w=>?workspace_id=. Theo-first rule preserves the resolution of any URL already pasted from older UI builds, shell history, or committeddatabricks.ymlfiles.Rename
extractOrgIDFromQuery(incmd/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 theq.Get("w")branch inExtractHostQueryParams; comment refreshed to document the three accepted forms and precedence.cmd/api/api.go— addsworkspaceIDQueryParam = "w"const; renames extractor and updates its body to checkothenw.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 inTestExtractWorkspaceIDFromQuery(renamed) andTestResolveOrgIDcovering?w=and theo-wins-over-wprecedence.acceptance/cmd/api/workspace-id-from-w-query/— new acceptance test mirroringworkspace-id-from-query/but exercising the?w=path. The original?o=test stays unchanged as a regression check.Test plan