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
Fix incorrect ?w= workspace parameter in resource URLs
Why
PR #5369 changed to call auth.ResolveWorkspaceID() instead of CurrentWorkspaceID().
ResolveWorkspaceID has a fast-path that returns Config.WorkspaceID without hitting the API. That field is populated from multiple sources: the user's .databrickscfg profile workspace_id, a ?o=/?w= embedded in the host URL, the bundle's workspace.workspace_id, etc. Any of which can contain a value that doesn't match the workspace to which the bundle is actually deployed.
CurrentWorkspaceID() is always authoritative: it calls /api/2.0/preview/scim/v2/Me and reads X-Databricks-Org-Id from the response header of the actual connected workspace.
When the two diverge (e.g. a profile configured for workspace A is used with a bundle that targets workspace B), the old fast-path embedded the wrong workspace ID in ?w=, causing the Databricks UI to navigate to an unexpected workspace. This was compounded by a frontend bug in which a numeric ?w= value bypasses pub-conf reconciliation and immediately boots on the passed-in workspace, with no server-side correction.
Files: .nextchanges/bundles/fix-jobs-link-w-param-workspace-switch.md
Based on git history:
@denik -- recent work in .nextchanges/bundles/, bundle/config/mutator/, acceptance/bundle/user_agent/
Any maintainer (@anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db, @rugpanov, @rclarey) can approve all areas.
See OWNERS for ownership rules.
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
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.
Changes
Fix incorrect ?w= workspace parameter in resource URLs
Why
PR #5369 changed to call auth.ResolveWorkspaceID() instead of CurrentWorkspaceID().
ResolveWorkspaceID has a fast-path that returns Config.WorkspaceID without hitting the API. That field is populated from multiple sources: the user's .databrickscfg profile workspace_id, a ?o=/?w= embedded in the host URL, the bundle's workspace.workspace_id, etc. Any of which can contain a value that doesn't match the workspace to which the bundle is actually deployed.
CurrentWorkspaceID() is always authoritative: it calls /api/2.0/preview/scim/v2/Me and reads X-Databricks-Org-Id from the response header of the actual connected workspace.
When the two diverge (e.g. a profile configured for workspace A is used with a bundle that targets workspace B), the old fast-path embedded the wrong workspace ID in ?w=, causing the Databricks UI to navigate to an unexpected workspace. This was compounded by a frontend bug in which a numeric ?w= value bypasses pub-conf reconciliation and immediately boots on the passed-in workspace, with no server-side correction.
Tests
Added a unit test