Add SPOG bundle support: account_id, host URL parsing, workspace_id disambiguation#4825
Merged
simonfaltum merged 2 commits intomainfrom Mar 26, 2026
Merged
Add SPOG bundle support: account_id, host URL parsing, workspace_id disambiguation#4825simonfaltum merged 2 commits intomainfrom
simonfaltum merged 2 commits intomainfrom
Conversation
Collaborator
|
Commit: 66289fd
17 interesting tests: 10 SKIP, 7 RECOVERED
Top 20 slowest tests (at least 2 minutes):
|
Suggested reviewersBased on git history of the changed files, these people are best suited to review:
Confidence: low Eligible reviewersBased on CODEOWNERS, these people or teams could also review: Suggestions based on git history of 12 changed files (8 scored). See CODEOWNERS for path-specific ownership rules. |
| return "NormalizeHostURL" | ||
| } | ||
|
|
||
| func (m *normalizeHostURL) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics { |
Contributor
There was a problem hiding this comment.
Why do we need a separate mutator if we call NormalizeHostURL in Client() call anyway?
| @@ -0,0 +1,94 @@ | |||
| package mutator_test | |||
Contributor
There was a problem hiding this comment.
I'd move this to workspace_test to keep all of this together since mutator does not do anything else anyway
8 tasks
simonfaltum
added a commit
that referenced
this pull request
Mar 24, 2026
Resolve merge conflicts with origin/main (discovery login flow). Extract host URL query param parsing into libs/auth.ExtractHostQueryParams so it can be reused by the bundle SPOG support PR (#4825). Co-authored-by: Isaac
simonfaltum
added a commit
that referenced
this pull request
Mar 24, 2026
Refactor Workspace.NormalizeHostURL() to use auth.ExtractHostQueryParams() instead of duplicating URL query parameter parsing. Remove the NormalizeHostURL mutator since Client() already calls NormalizeHostURL() before building the SDK config, making the Initialize-phase mutator redundant. Addresses review feedback from andrewnester on #4825. Co-authored-by: Isaac
67233d2 to
7f43e4d
Compare
andrewnester
approved these changes
Mar 24, 2026
…e_id profile disambiguation Bundles need to support SPOG (Single Pane of Glass) hosts where multiple workspaces share the same host URL. This adds three capabilities: 1. account_id field in bundle workspace config, passed through to the SDK. 2. Host URL query parameter extraction (?o= for workspace_id, ?a= for account_id). Runs in Workspace.Client() before profile resolution so the extracted fields are available for disambiguation. A mutator in the initialize phase provides secondary cleanup. 3. Profile resolution by workspace_id when multiple profiles share the same host. Host matching runs first (preserving existing behavior), then workspace_id disambiguates if available. Also adds workspace_id and account_id to the auth interpolation warning since they now participate in profile resolution at auth time. Co-authored-by: Isaac
Refactor Workspace.NormalizeHostURL() to use auth.ExtractHostQueryParams() instead of duplicating URL query parameter parsing. Remove the NormalizeHostURL mutator since Client() already calls NormalizeHostURL() before building the SDK config, making the Initialize-phase mutator redundant. Addresses review feedback from andrewnester on #4825. Co-authored-by: Isaac
7f43e4d to
66289fd
Compare
Collaborator
|
Commit: 42bd421
54 interesting tests: 23 RECOVERED, 14 flaky, 10 FAIL, 5 KNOWN, 2 SKIP
Top 50 slowest tests (at least 2 minutes):
|
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.
Why
SPOG (Single Pane of Glass) hosts serve multiple workspaces from a single URL (e.g.
api.databricks.cominstead of separate per-workspace hosts). Bundles need to support this model so users can:account_idin their bundle workspace config.https://host.databricks.com/?o=12345) directly intodatabricks.yml.Without this, bundles on SPOG hosts fail with "multiple profiles matched" errors because the CLI can't distinguish between profiles that share the same host.
Changes
Before: Bundles had no
account_idfield, no query parameter parsing from host URLs, and profile resolution only matched by host (erroring on duplicates with no way to disambiguate).Now: Three capabilities added:
1.
account_idfield in workspace configAdded
AccountIDto theWorkspacestruct, passed through to the SDK config. Users can now write:2. Host URL query parameter extraction
Workspace.Client()now callsNormalizeHostURL()before building the SDK config. This extracts?o=(workspace_id),?a=(account_id), and their long-form aliases from the host URL, then strips the query params.Why in
Client()and not just in the mutator pipeline? The bundle flow callsWorkspaceClientE()(which callsClient()) inconfigureBundlebeforephases.Initialize()runs. If extraction only happened in the Initialize mutator, workspace_id would be empty when the profile loader runs, and disambiguation would fail. The mutator is kept as a secondary pass to ensure the bundle config stays clean for any code that readsb.Config.Workspace.Hostdirectly.Why explicit fields take precedence over URL params? A user who writes both
workspace_id: "111"andhost: https://x/?o=222clearly intended the explicit field. URL params are a convenience for copy-paste from browser URLs.3. Profile resolution by workspace_id
When multiple profiles match the same host, the loader now uses
workspace_idto disambiguate. The matching order is: host first, then workspace_id as a fallback.Why host first, not workspace_id first? Most existing configs don't have workspace_id set yet. Running host matching first preserves existing behavior for the long tail of configs. workspace_id only kicks in when host matching is ambiguous. This was discussed with @pietern and @andrewnester, who preferred keeping the same detection logic with an additional disambiguation fallback over two separate code paths.
Why fall back to the original error when workspace_id doesn't match? If a user has two profiles for host X with workspace_ids 111 and 222, but the bundle specifies workspace_id 999, the "multiple profiles matched" error is more helpful than "no matching profiles" since it tells them which profiles exist.
Other changes
workspace_idandaccount_idto the auth interpolation warning inNoInterpolationInAuthConfig. These fields now participate in profile resolution at auth time, soworkspace_id: ${var.my_ws_id}would be unresolved and cause silent failures.account_idfield.Test plan
NormalizeHostURLmutator (8 cases: empty, no params, ?o=, ?a=, ?account_id=, ?workspace_id=, explicit precedence)Workspace.NormalizeHostURL()methodTestWorkspaceClientNormalizesHostBeforeProfileResolutionverifies thatClient()normalizes the host URL and populates workspace_id before profile resolution runs (the critical path)make checkspassesmake lintfullpasses (0 issues)