Skip to content

Commit 848fe0c

Browse files
authored
Add context comment for host-to-profile resolution in auth token (#4593)
## Summary Comment-only change in `cmd/auth/token.go` to document why `loadToken` resolves `--host` to a profile name before looking up the token cache. The profile key is the intended primary cache key. The SDK's `dualWrite` writes tokens under both the profile key and the legacy host key for backward compatibility with older Python/Java SDKs that only know host keys. This comment explains the migration context and when dualWrite can be removed. ## Test plan - No behavioral changes — comment only Signed-off-by: simon <simon.faltum@databricks.com>
1 parent fe485cc commit 848fe0c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/auth/token.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ func loadToken(ctx context.Context, args loadTokenArgs) (*oauth2.Token, error) {
161161
return nil, err
162162
}
163163

164-
// When no profile was specified, check if multiple profiles match the
165-
// effective cache key for this host.
164+
// When no profile was specified, resolve the host to a profile in
165+
// .databrickscfg. This ensures the token cache lookup uses the profile
166+
// key (e.g. "logfood") rather than the host URL, which is important
167+
// because the SDK's dualWrite is a transitional mechanism: it writes
168+
// tokens under both keys for backward compatibility with older SDKs
169+
// that only know host keys, but the profile key is the intended
170+
// primary key. Once older SDKs have migrated to profile-based keys,
171+
// dualWrite and the host key can be removed entirely.
166172
if args.profileName == "" && args.authArguments.Host != "" {
167173
cfg := &config.Config{
168174
Host: args.authArguments.Host,

0 commit comments

Comments
 (0)