Skip to content

auth: suggest ACCOUNT-<id> as default profile name for --skip-workspace#5339

Merged
simonfaltum merged 2 commits into
mainfrom
simonfaltum/auth-skip-ws-profile-name
May 27, 2026
Merged

auth: suggest ACCOUNT-<id> as default profile name for --skip-workspace#5339
simonfaltum merged 2 commits into
mainfrom
simonfaltum/auth-skip-ws-profile-name

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

@simonfaltum simonfaltum commented May 27, 2026

Why

When you run `databricks auth login --host X --skip-workspace`, the profile-name prompt suggests the host's first DNS label (e.g. `db-deco-test`) even though the resulting profile is account-only.

Changes

`getProfileName` already returns `ACCOUNT-` when `AccountID` is populated, but `setHostAndAccountId` (which fills `AccountID` from `.well-known/databricks-config`) only runs after the profile-name prompt. So at prompt time, `AccountID` was always empty for the no-`--profile` flow.

  • Before: `auth login --host https://db-deco-test... --skip-workspace` → prompt suggests `db-deco-test`.
  • Now: same command → URL-param extraction + host discovery run eagerly before the prompt, so the suggestion is `ACCOUNT-`.

Other login paths are unchanged. The discovery call is redundant with the one in `setHostAndAccountId` later in the flow; `runHostDiscovery` is idempotent for the auth-arguments fields it touches, so the cost is at most one extra `.well-known` round-trip (≤5s timeout) and only on the `--skip-workspace` path.

Test plan

  • New unit tests: `TestGetProfileName`, `TestSkipWorkspaceProfileNameUsesDiscoveredAccountID` (uses a mock `.well-known` server)
  • `go test ./cmd/auth/...` (full package)
  • `./task checks`
  • `./task lint-q`

When `databricks auth login --host X --skip-workspace` runs, the profile-
name prompt suggested the host's first DNS label (e.g. `db-deco-test`)
even though the resulting profile is account-only. The naming logic in
`getProfileName` already returns `ACCOUNT-<account-id>` when `AccountID`
is populated, but `setHostAndAccountId` (which discovers `account_id` via
`.well-known/databricks-config`) only runs *after* the profile-name
prompt, so `AccountID` was still empty at suggestion time.

For the `--skip-workspace` path with a known host, run URL-param
extraction and host discovery eagerly before the prompt fires. Other
login paths are unchanged.

Co-authored-by: Isaac
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented May 27, 2026

Commit: 22e4516

Run: 26518350590

@simonfaltum simonfaltum added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit b999e77 May 27, 2026
25 checks passed
@simonfaltum simonfaltum deleted the simonfaltum/auth-skip-ws-profile-name branch May 27, 2026 15:43
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: b999e77

Run: 26521895781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants