Repository navigation
Pass --force-refresh to CLI auth token command - #1628
Merged
Merged
Conversation
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 13:41 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 13:41 — with
GitHub Actions
Inactive
mihaimitrea-db
changed the base branch from
mihaimitrea-db/stack/generalize-cli-commands
to
main
April 14, 2026 13:44
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 13:59 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 13:59 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
from
April 14, 2026 14:08
acce330 to
9bf2816
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:08 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:09 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
from
April 14, 2026 14:15
9bf2816 to
96e0e97
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:15 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:15 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
from
April 14, 2026 14:22
96e0e97 to
69674ff
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:22 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:24 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
from
April 14, 2026 14:30
69674ff to
7972862
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:30 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:30 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
from
April 14, 2026 14:33
7972862 to
4b7bfb7
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:33 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 14, 2026 14:34 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
2 times, most recently
from
April 20, 2026 11:51
05796d2 to
c5f06e6
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 20, 2026 11:51 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 20, 2026 11:53 — with
GitHub Actions
Inactive
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
2 times, most recently
from
April 21, 2026 13:20
0c959e1 to
219d2dd
Compare
mihaimitrea-db
changed the base branch from
main
to
mihaimitrea-db/stack/generalize-cli-commands
April 22, 2026 09:26
renaudhartert-db
approved these changes
Apr 22, 2026
renaudhartert-db
left a comment
Contributor
There was a problem hiding this comment.
LGTM assuming resolution of the comments on the underlying PR.
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/generalize-cli-commands
branch
from
April 22, 2026 11:32
a76e875 to
1a52600
Compare
Base automatically changed from
mihaimitrea-db/stack/generalize-cli-commands
to
main
April 23, 2026 07:53
Append --force-refresh when the CLI version supports it (>= v0.296.0), bypassing the CLI's internal token cache. The SDK manages its own caching via CachedTokenSource, so a fresh token on every CLI call eliminates stale-token issues. Split buildCliCommand into a thin wrapper (which appends capability-gated flags) and buildCoreCliCommand (which picks between --profile and --host). This separation keeps the core decision logic readable and gives future capability flags — e.g. --scopes — a clean place to attach without disturbing the terminal-branch structure of the core builder. Signed-off-by: Mihai Mitrea <[email protected]>
mihaimitrea-db
force-pushed
the
mihaimitrea-db/stack/cli-force-refresh-v2
branch
from
April 23, 2026 09:15
219d2dd to
818b812
Compare
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 23, 2026 09:15 — with
GitHub Actions
Inactive
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 23, 2026 09:17 — with
GitHub Actions
Inactive
mihaimitrea-db
temporarily deployed
to
test-trigger-is
April 23, 2026 09:17 — with
GitHub Actions
Inactive
deco-sdk-tagging Bot
added a commit
that referenced
this pull request
Apr 23, 2026
## Release v0.130.0 ### Breaking Changes * Remove the `Experimental_IsUnifiedHost` field (and the `DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST` environment variable) from `Config`. Unified host detection is now automatic via the `/.well-known/databricks-config` endpoint. * Remove the unused `ErrWorkspaceIDInAccountClient` exported variable. It was never returned from any production path, and its message contradicted the unified host workflow where a single profile with both `AccountID` and `WorkspaceID` produces both clients. * Remove the file-based OAuth token cache from `credentials/u2m/cache`. The removed symbols are `cache.NewFileTokenCache`, `cache.FileTokenCacheOption`, `cache.WithFileLocation`, and the private `tokenCacheFile` struct. The `TokenCache` interface, `ErrNotFound` sentinel, `HostCacheKeyProvider`, and `DiscoveryOAuthArgument` remain exported. `NewPersistentAuth` now defaults to a new in-memory cache (`cache.NewInMemoryTokenCache`) when no `WithTokenCache` option is passed; consumers that relied on the previous file-backed default must supply their own persistent cache. See databricks/cli#5056 for the companion CLI change that moves the file cache into the CLI. ### New Features and Improvements * Add `u2m.WithDiscoveryHost` option to override the default `https://login.databricks.com` host used by the discovery login flow. Intended for testing and development against non-production environments. * Add support for unified hosts. A single configuration profile can now be used for both account-level and workspace-level operations when the host supports it and both `AccountID` and `WorkspaceID` are available. ### Bug Fixes * Fix CLI token source `--profile` fallback: `--profile` is a global Cobra flag that old CLIs accept silently instead of reporting "unknown flag", making the previous error-based detection dead code. Now uses `databricks version` to detect CLI capabilities at init time ([#1605](#1605)). ### Internal Changes * Pass `--force-refresh` to Databricks CLI `auth token` command to bypass the CLI's internal token cache ([#1628](#1628)). ### API Changes * Add [w.TemporaryVolumeCredentials](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/catalog#TemporaryVolumeCredentialsAPI) workspace-level service. * Add `GetPermissionLevels`, `GetPermissions`, `SetPermissions` and `UpdatePermissions` methods for [w.KnowledgeAssistants](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/knowledgeassistants#KnowledgeAssistantsAPI) workspace-level service. * Add `ThumbnailUrl` field for [apps.App](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#App). * Add `JiraOptions`, `OutlookOptions` and `SmartsheetOptions` fields for [pipelines.ConnectorOptions](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#ConnectorOptions). * Add `GoogleAdsConfig` field for [pipelines.SourceConfig](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#SourceConfig). * Add `ReplaceExisting` field for [postgres.CreateBranchRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#CreateBranchRequest). * Add `ReplaceExisting` field for [postgres.CreateEndpointRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#CreateEndpointRequest).
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
Apr 30, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
Apr 30, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
Apr 30, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
pull Bot
pushed a commit
to Future-Outlier/databricks-sdk-py
that referenced
this pull request
Apr 30, 2026
## 🥞 Stacked PR Use this [link](https://github.com/databricks/databricks-sdk-py/pull/1378/files) to review incremental changes. - [stack/cli-force-refresh](databricks#1377) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1377/files)] [MERGED] - [**stack/cli-progressive-token-commands**](databricks#1378) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1378/files)] --------- ## Summary Append `--force-refresh` to the `databricks auth token` command when the installed CLI is >= v0.296.0, so the CLI bypasses its internal token cache and hands the SDK a freshly minted token every time. Mirrors [databricks/databricks-sdk-go#1628](databricks/databricks-sdk-go#1628). Requires the version-detection infrastructure from the parent PR [databricks#1377](databricks#1377). ## Why The SDK already manages its own token caching via `oauth.Refreshable`. When the SDK decides it needs a new token and shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or that has already expired from the SDK's perspective). That produces unnecessary refresh failures and retry loops on top of a value that the SDK was confident was fresh. The CLI added `--force-refresh` in [databricks/cli#4767](databricks/cli#4767) (motivated by [databricks/cli#4564](databricks/cli#4564)) specifically to let callers bypass the CLI's cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change. ## What changed ### Interface changes None. `CliTokenSource` is not part of the public API surface. ### Behavioral changes - `databricks auth token` invocations now end with `--force-refresh` whenever the detected CLI is >= v0.296.0. Callers on older CLIs see no change. - On older CLIs, a `WARNING` is logged: `"Databricks CLI <ver> does not support --force-refresh (requires >= v0.296.0). The CLI's token cache may provide stale tokens."` `AzureCliTokenSource` is unaffected — it does not pass through `DatabricksCliTokenSource` and does not opt into version-gated flag selection. ### Internal changes - New constant `DatabricksCliTokenSource._CLI_VERSION_FOR_FORCE_REFRESH = CliVersion(0, 296, 0)`. - `_build_cli_command` is split into two helpers, matching the shape the Go SDK settled on after the same PR there: - **`_build_core_cli_command(cli_path, cfg, version)`** — holds the existing profile-vs-host decision (moved out of `_build_cli_command`). - **`_build_cli_command(cli_path, cfg, version)`** — now a thin wrapper that calls `_build_core_cli_command`, appends `--force-refresh` when `version >= _CLI_VERSION_FOR_FORCE_REFRESH`, and otherwise logs the unsupported-version `WARNING`. Future version-gated flags slot into the same pattern: add a `_CLI_VERSION_FOR_<flag>` constant and an `if version >= ...` block in `_build_cli_command`. ## How is this tested? Unit tests in `tests/test_credentials_provider.py`: - Additional `test_build_cli_command` cases covering the full matrix: - `--host` + v0.296.0 → appends `--force-refresh`. - account `--host` + v0.296.0 → appends `--force-refresh`. - `--profile` + v0.296.0 → `--profile` + `--force-refresh`. - `--profile` + v0.207.1 → `--profile` only (too old for `--force-refresh`). - `--profile`-only + v0.296.0 → `--profile` + `--force-refresh` even without a host. - zero version (detection failure) → `--host` only, no `--force-refresh`. - `test_build_cli_command_force_refresh_unsupported_logs_warning` — asserts the `WARNING` log is emitted when `version < _CLI_VERSION_FOR_FORCE_REFRESH`. All parent-PR tests continue to pass unchanged.
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
May 4, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
May 4, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
May 4, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
May 4, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mihaimitrea-db
added a commit
to databricks/databricks-sdk-java
that referenced
this pull request
May 6, 2026
The SDK manages its own token caching via `CachedTokenSource`. When the SDK shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or has already expired from the SDK's perspective), producing unnecessary refresh failures and retry loops. The CLI added `--force-refresh` in v0.296.0 (databricks/cli#4767) to let callers bypass its cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change: * Introduce `CLI_VERSION_FOR_FORCE_REFRESH = v0.296.0`. * Split `buildCliCommand` into the existing profile/host decision (now `buildCoreCliCommand`) and a thin wrapper that appends `--force-refresh` when supported and otherwise logs a precise warning. Future capability-gated flags slot into the same wrapper. Mirrors: * databricks/databricks-sdk-go#1628 * databricks/databricks-sdk-py#1378 Co-authored-by: Isaac
mkazia
pushed a commit
to mkazia/databricks-sdk-java
that referenced
this pull request
May 30, 2026
## 🥞 Stacked PR Use this [link](https://github.com/databricks/databricks-sdk-java/pull/752/files) to review incremental changes. - [stack/cli-force-refresh](databricks#751) [[Files changed](https://github.com/databricks/databricks-sdk-java/pull/751/files)] - [**stack/cli-attempt-chain**](databricks#752) [[Files changed](https://github.com/databricks/databricks-sdk-java/pull/752/files)] --------- ## Summary Append `--force-refresh` to the `databricks auth token` command when the installed CLI is >= v0.296.0, so the CLI bypasses its internal token cache and hands the SDK a freshly minted token every time. Mirrors [databricks/databricks-sdk-go#1628](databricks/databricks-sdk-go#1628) and [databricks/databricks-sdk-py#1378](databricks/databricks-sdk-py#1378). Requires the version-detection infrastructure from the parent PR [databricks#751](databricks#751). ## Why The SDK already manages its own token caching via `CachedTokenSource`. When the SDK decides it needs a new token and shells out to `databricks auth token`, the CLI may return a token from *its* own cache that is about to expire (or that has already expired from the SDK's perspective). That produces unnecessary refresh failures and retry loops on top of a value that the SDK was confident was fresh. The CLI added `--force-refresh` in [databricks/cli#4767](databricks/cli#4767) (motivated by [databricks/cli#4564](databricks/cli#4564)) specifically to let callers bypass the CLI's cache. With the version-detection infrastructure from the parent PR already in place, opting in is a one-constant, one-branch change. ## What changed ### Interface changes None. `CliTokenSource` is not part of the public API surface. ### Behavioral changes - `databricks auth token` invocations now end with `--force-refresh` whenever the detected CLI is >= v0.296.0. Callers on older CLIs see no change. - On older CLIs, a `WARNING` is logged: `"Databricks CLI <ver> does not support --force-refresh (requires >= v0.296.0). The CLI's token cache may provide stale tokens."` `AzureCliCredentialsProvider` is unaffected — it does not pass through `DatabricksCliCredentialsProvider` and does not opt into version-gated flag selection. ### Internal changes - New constant `DatabricksCliCredentialsProvider.CLI_VERSION_FOR_FORCE_REFRESH = new DatabricksCliVersion(0, 296, 0)`. - `buildCliCommand` is split into two helpers, matching the shape the Go and Python SDKs settled on after the same PR there: - **`buildCoreCliCommand(cliPath, config, version)`** — holds the existing profile-vs-host decision (moved out of `buildCliCommand`). - **`buildCliCommand(cliPath, config, version)`** — now a thin wrapper that calls `buildCoreCliCommand`, appends `--force-refresh` when `version.atLeast(CLI_VERSION_FOR_FORCE_REFRESH)`, and otherwise logs the unsupported-version `WARNING`. Future version-gated flags slot into the same pattern: add a `CLI_VERSION_FOR_<flag>` constant and an `if version.atLeast(...)` block in `buildCliCommand`. ## How is this tested? Additional `testBuildCliCommand` parameterized cases in `DatabricksCliCredentialsProviderTest` cover the full matrix: - `--host` + v0.296.0 → appends `--force-refresh`. - account `--host` + v0.296.0 → appends `--force-refresh`. - `--profile` + v0.296.0 → `--profile` + `--force-refresh`. - `--profile` + v0.207.1 → `--profile` only (too old for `--force-refresh`). - `--host` + v0.295.0 → `--host` only (too old for `--force-refresh`). - unknown version (detection failure) → `--host` only, no `--force-refresh`. - dev build → `--host` only, no `--force-refresh`. All parent-PR tests continue to pass unchanged.
This branch was previously deployed
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.
Summary
Pass
--force-refreshto the Databricks CLIauth tokencommand when the CLI supports it (>= v0.296.0), bypassing the CLI's internal token cache.Why
The SDK manages its own token caching via
CachedTokenSource. When the SDK decides it needs a new token and shells out todatabricks auth token, the CLI may return a cached token that is about to expire (or has already expired from the SDK's perspective). This creates unnecessary refresh failures and retry loops.The CLI added a
--force-refreshflag (databricks/cli#4767, motivated by databricks/cli#4564) that bypasses its internal cache. By using this flag, the SDK is guaranteed a freshly minted token every time it asks for one.With the version detection infrastructure from the parent PR (#1605), adding
--force-refreshis a one-constant, one-ifchange.What changed
Interface changes
None.
CliTokenSourceis not part of the public API surface.Behavioral changes
--force-refreshwhen invokingdatabricks auth tokenif the CLI version is >= v0.296.0.--force-refresh:"Databricks CLI v%s does not support --force-refresh (requires >= v%s). The CLI's token cache may provide stale tokens."Internal changes
cliVersionForForceRefresh: new version constant{0, 296, 0}.buildCliCommand: adds a nil guard and appends--force-refreshafter the base command is resolved.How is this tested?
Additional test cases in
TestBuildCliCommand:--force-refresh--force-refresh--force-refresh--profile+--force-refresh--profileonly (no--force-refresh)--profile+--force-refresh--hostonly, no--force-refresh