Skip to content

Fix incorrect ?w= workspace parameter in resource URLs - #6754

Open
andrewnester wants to merge 7 commits into
mainfrom
fix/spog-regression
Open

andrewnester wants to merge 7 commits into
mainfrom
fix/spog-regression

Conversation

@andrewnester

@andrewnester andrewnester commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

Files: acceptance/bundle/user_agent/output.txt, acceptance/bundle/user_agent/simple/out.requests.summary.direct.json, acceptance/bundle/user_agent/simple/out.requests.summary.terraform.json
Suggested: @denik
Also eligible: @janniklasrose, @shreyas-goenka, @pietern, @anton-107, @lennartkats-db

/bundle/ - needs approval

Files: bundle/config/mutator/initialize_urls.go, bundle/config/mutator/initialize_urls_test.go
Suggested: @denik
Also eligible: @janniklasrose, @shreyas-goenka, @pietern, @anton-107, @lennartkats-db

General files (require maintainer)

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.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 791ce82

Run: 35594938100

Env ✅​pass 🙈​skip Time
✅​ aws linux 276 17 5:35
✅​ aws windows 278 15 3:27
✅​ azure linux 275 17 5:24
✅​ azure windows 277 15 3:34
✅​ gcp linux 276 17 5:28
✅​ gcp windows 278 15 3:45
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:57 aws linux TestAccept
3:53 gcp linux TestAccept
3:52 azure linux TestAccept
3:44 gcp windows TestAccept
3:32 azure windows TestAccept
3:26 aws windows TestAccept

Comment thread bundle/config/mutator/initialize_urls.go
// non-numeric Config.WorkspaceID (e.g. a UUID connection-style identifier) is
// passed through unchanged into the ?w= parameter. The numeric-mismatch check
// is skipped because such IDs cannot be compared against an integer org ID.
func TestInitializeURLsApplyNonNumericConfigPassedThrough(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this and the case below an acceptance test? Would be simpler?

]
},
"method": "GET",
"path": "/api/2.0/preview/scim/v2/Me",

@shreyas-goenka shreyas-goenka Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to avoid this additoinal call?

This branch has not been deployed

No deployments
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.

3 participants