Skip to content

Comments

Wire profile name through CLI ToOAuthArgument for profile-based cache keys#4562

Open
simonfaltum wants to merge 1 commit intomainfrom
simonfaltum/wire-profile-oauth
Open

Wire profile name through CLI ToOAuthArgument for profile-based cache keys#4562
simonfaltum wants to merge 1 commit intomainfrom
simonfaltum/wire-profile-oauth

Conversation

@simonfaltum
Copy link
Member

@simonfaltum simonfaltum commented Feb 20, 2026

Changes

  • Add Profile field to AuthArguments struct in libs/auth/arguments.go.
  • Switch ToOAuthArgument() from NewBasic* to NewProfile* constructors, passing the profile name so the SDK uses profile-based cache keys when a profile is specified.
  • Wire profile name from cmd/auth/token.go and cmd/auth/login.go into AuthArguments before calling ToOAuthArgument().

Why

The SDK already supports profile-based OAuth token cache keys, but the CLI never passes the profile name through to the SDK constructors. This means auth token --profile X and auth login --profile X still use host-based cache keys, making profile-based caching a no-op. This is a prerequisite for profile-based cache keys to work end-to-end.

Tests

  • Unit tests pass (libs/auth, cmd/auth)
  • Added test cases for profile-based cache keys (workspace, account, unified host types)
  • Updated token_test.go in-memory cache with profile-based entries
  • Acceptance tests pass (cmd/auth/*)
  • make checks passes

Tested manually by creating two profiles that were with the same host.
Results:

  • e2-dogfood: expiry=2026-02-20T14:37:20.935183+01:00
  • duplicatedogfood: expiry=2026-02-20T14:41:50.532528+01:00

Two profiles, same host, different tokens with different expiry times. That's the whole point of this change — before, they'd share one cache entry keyed by https://e2-dogfood.staging.cloud.databricks.com and one login would clobber the other. Now they each get their own entry keyed by profile name.

The SDK supports profile-based OAuth token cache keys via NewProfile*
constructors, but the CLI always used NewBasic* constructors which
never pass the profile name through. This meant profile-based cache
keys were never used end-to-end.

Add a Profile field to AuthArguments and switch ToOAuthArgument() from
NewBasic* to NewProfile* constructors. Wire the profile name from
cmd/auth/token.go and cmd/auth/login.go into AuthArguments before
calling ToOAuthArgument().

When Profile is empty (no profile specified), behavior is unchanged
since NewProfile* with empty string falls back to host-based keys.
@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Feb 20, 2026

Commit: b592eb6

Run: 22224214999

Env 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 1 7 268 763 6:42
🟨​ aws windows 7 1 7 270 761 6:17
💚​ aws-ucws linux 8 7 364 679 7:33
💚​ aws-ucws windows 8 7 366 677 6:45
💚​ azure linux 2 9 271 761 6:06
💚​ azure windows 2 9 273 759 5:29
💚​ azure-ucws linux 2 9 369 675 8:01
💚​ azure-ucws windows 2 9 371 673 6:21
💚​ gcp linux 2 9 267 764 6:00
🔄​ gcp windows 2 9 269 762 5:52
15 interesting tests: 7 KNOWN, 7 SKIP, 1 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestAccept/ssh/connection 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f
Top 20 slowest tests (at least 2 minutes):
duration env testname
4:15 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:50 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:38 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:38 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:15 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:13 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:10 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:09 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:59 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:57 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:52 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:51 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:50 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:46 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:22 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:17 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:15 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:14 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:12 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:07 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

@simonfaltum simonfaltum force-pushed the simonfaltum/wire-profile-oauth branch from cc2ddb3 to b592eb6 Compare February 20, 2026 12:30
@simonfaltum simonfaltum marked this pull request as ready for review February 20, 2026 12:55
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.

2 participants