Add interactive profile picker to auth logout#4616
Open
mihaimitrea-db wants to merge 10 commits intomainfrom
Open
Add interactive profile picker to auth logout#4616mihaimitrea-db wants to merge 10 commits intomainfrom
mihaimitrea-db wants to merge 10 commits intomainfrom
Conversation
Collaborator
|
Commit: a87d5a2
17 interesting tests: 7 KNOWN, 7 SKIP, 2 flaky, 1 RECOVERED
Top 23 slowest tests (at least 2 minutes):
|
simonfaltum
reviewed
Feb 27, 2026
Member
simonfaltum
left a comment
There was a problem hiding this comment.
Looks good! I left some comments
cmd/auth/logout.go
Outdated
Comment on lines
+129
to
+135
| configPath := args.configFilePath | ||
| if configPath == "" { | ||
| configPath = "~/.databrickscfg" | ||
| } | ||
| err := cmdio.RenderWithTemplate(ctx, map[string]string{ | ||
| "ProfileName": args.profileName, | ||
| "ConfigPath": configPath, |
Member
There was a problem hiding this comment.
"~/.databrickscfg" appears as a fallback here and also as defaultConfigPath at line 31. Consider reusing the constant (or better, resolving the actual path from the profiler/config).
bf46cfd to
f374e5a
Compare
Implement the initial version of databricks auth logout which removes a profile from ~/.databrickscfg and clears associated OAuth tokens from the token cache. This iteration supports explicit profile selection via --profile and a --force flag to skip the confirmation prompt. Interactive profile selection will be added in a follow-up. Token cache cleanup is best-effort: the profile-keyed token is always removed, and the host-keyed token is removed only when no other profile references the same host.
Replace plain fmt.Sprintf confirmation prompt with a structured template using cmdio.RenderWithTemplate. The warning now uses color and bold formatting to clearly highlight the profile name, config path, and consequences before prompting for confirmation.
Resolve config path from the profiler instead of hardcoding fallbacks. Delete the profile before clearing the token cache so a config write failure does not leave tokens removed. Fix token cleanup for account and unified profiles by computing the correct OIDC cache key (host/oidc/accounts/<account_id>). Drop the nil profiler guard, add a success message on logout, and extract backupConfigFile in ops.go to remove duplication. Consolidate token cleanup tests into a table-driven test covering shared hosts, unique hosts, account, and unified profiles.
Merge shared-host token deletion verification into one main parametrized test by addding the hostBasedKey and isSharedKey parameters to each case. This replaces the TestLogoutTokenCacheCleanup test with an assertion: host-based keys are preserved when another profile shares the same host, and deleted otherwise.
f374e5a to
c903ed8
Compare
Rewrite the test to use inline config seeds and explicit expected state. Add cases for deleting the last non-default profile, deleting a unified host profile with multiple keys, and deleting the DEFAULT section.
c903ed8 to
889b7ca
Compare
889b7ca to
7a39778
Compare
When --profile is not specified in an interactive terminal, show a searchable prompt listing all configured profiles. Profiles are sorted alphabetically and displayed with their host or account ID. The picker supports fuzzy search by name, host, or account ID.
Document the four interaction modes (explicit profile, interactive picker, non-interactive error, and --force) in the command's long help text.
7a39778 to
67eff3f
Compare
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.
🥞 Stacked PR
Use this link to review incremental changes.
When --profile is not specified in an interactive terminal, show a searchable prompt listing all configured profiles. Profiles are sorted alphabetically and displayed with their host or account ID. The picker supports fuzzy search by name, host, or account ID.
Changes
Tests