Skip to content

Commit 410853a

Browse files
authored
Bump Go SDK to v0.126.0, remove redundant agent tracking (#4799)
## Why The Go SDK now includes built-in AI agent detection (PR databricks/databricks-sdk-go#1537). It appends `agent/<name>` to the User-Agent header when running inside a known agent environment. The CLI had its own agent-to-UA wiring that did the same thing, which would now produce duplicate `agent/` segments. ## Changes **Before:** The CLI detected agents via `libs/agent` and injected `agent/<name>` into the UA string in `PersistentPreRunE`. The SDK had no agent detection. **Now:** The SDK handles agent detection natively. The CLI's redundant wiring is removed. Specific changes: - Bump Go SDK from v0.120.0 to v0.126.0 - Delete `cmd/root/user_agent_agent.go` (the `withAgentInUserAgent` function) - Delete `libs/agent/` package (dead code after removal) - Remove `agent.Detect(ctx)` from `Execute()` in root.go - Add HTTP-level tests verifying the SDK produces exactly one `agent/` segment - Update auth prompt logic: use `cfg.HostType()` instead of `ErrNotAccountClient`/`ErrNotWorkspaceClient` (the SDK removed host-type validation from client constructors in favor of host metadata resolution). Synthesize sentinel errors when prompting is unavailable to preserve `MustAnyClient` fallthrough behavior. - Add `.well-known/databricks-config` handler to the default test server, so acceptance tests with custom profiles don't produce non-deterministic host metadata warnings - Update `auth/switch/nominal` test to point profiles at the mock server instead of fake DNS hostnames - Add `.well-known/databricks-config` handlers to labs test mock servers - Regenerated code from `make generate` with updated OpenAPI SHA ## Test plan - [x] `TestSDKAgentDetection`: exactly one `agent/claude-code` in UA header - [x] `TestSDKNoAgentDetected`: no `agent/` when no agent env vars set - [x] `TestSDKMultipleAgentsSuppressed`: no `agent/` when multiple agents detected - [x] `TestAccountClientOrPrompt` and `TestWorkspaceClientOrPrompt` pass - [x] `TestAccountClientOrPromptReturnsErrorForWrongHostType`: wrong host type with prompting disabled returns `ErrNotAccountClient` - [x] `TestWorkspaceClientOrPromptReturnsErrorForWrongHostType`: wrong host type with prompting disabled returns `ErrNotWorkspaceClient` - [x] `TestAccountClientOrPromptReturnsErrorForMissingAccountID`: missing account ID with prompting disabled returns `ErrNotAccountClient` - [x] `cmd/labs/project` tests pass - [x] `experimental/aitools` tests pass - [x] `make checks` passes - [x] Acceptance tests (refschema, account-help, auth/switch/nominal) pass - [x] `make generate` on final commit produces no diff This pull request was AI-assisted by Isaac.
1 parent 6b6d637 commit 410853a

File tree

114 files changed

+2448
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2448
-390
lines changed

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a7c320a6b531263c8fa45619c1565b63849750e5
1+
d09dbd77f5a9560cbb816746773da43a8bdbde08

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go
9090
cmd/workspace/enable-results-downloading/enable-results-downloading.go linguist-generated=true
9191
cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go linguist-generated=true
9292
cmd/workspace/entity-tag-assignments/entity-tag-assignments.go linguist-generated=true
93+
cmd/workspace/environments/environments.go linguist-generated=true
9394
cmd/workspace/experiments/experiments.go linguist-generated=true
9495
cmd/workspace/external-lineage/external-lineage.go linguist-generated=true
9596
cmd/workspace/external-locations/external-locations.go linguist-generated=true

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ updates:
1515
- "/.github/actions/setup-build-environment"
1616
schedule:
1717
interval: "monthly"
18+
# tagging.yml is generated and maintained externally. Ignore
19+
# actions/create-github-app-token since it is only used in tagging.yml.
20+
ignore:
21+
- dependency-name: "actions/create-github-app-token"

acceptance/apps/deploy/bundle-with-appname/out.requests.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
{
2+
"method": "GET",
3+
"path": "/.well-known/databricks-config"
4+
}
15
{
26
"method": "POST",
37
"path": "/api/2.0/apps/test-app/deployments",

acceptance/apps/deploy/no-bundle-with-appname/out.requests.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
{
2+
"method": "GET",
3+
"path": "/.well-known/databricks-config"
4+
}
15
{
26
"method": "POST",
37
"path": "/api/2.0/apps/test-app/deployments",

acceptance/auth/bundle_and_profile/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
=== Inside the bundle, profile flag not matching bundle host. Should use profile from the flag and not the bundle.
1515
>>> errcode [CLI] current-user me -p profile_name
16+
Warn: Failed to resolve host metadata: (redacted). Falling back to user config.
1617
Error: Get "https://non.existing.subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted)
1718

1819
Exit code: 1
@@ -72,6 +73,7 @@ Validation OK!
7273

7374
=== Bundle commands load bundle configuration with -t and -p flag, validation not OK (profile host don't match bundle host)
7475
>>> errcode [CLI] bundle validate -t prod -p DEFAULT
76+
Warn: Failed to resolve host metadata: (redacted). Falling back to user config.
7577
Error: cannot resolve bundle auth configuration: the host in the profile ([DATABRICKS_TARGET]) doesn’t match the host configured in the bundle (https://bar.com)
7678

7779
Name: test-auth

acceptance/auth/bundle_and_profile/test.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ New='DATABRICKS_TARGET'
99
Old='DATABRICKS_URL'
1010
New='DATABRICKS_TARGET'
1111

12+
[[Repls]]
13+
Old='Warn: Failed to resolve host metadata: .*\. Falling back to user config\.'
14+
New='Warn: Failed to resolve host metadata: (redacted). Falling back to user config.'
15+
1216
[[Repls]]
1317
Old='Get "https://non.existing.subdomain.databricks.com/api/2.0/preview/scim/v2/Me": .*'
1418
New='Get "https://non.existing.subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted)'

acceptance/auth/credentials/basic/out.requests.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
{
2+
"headers": {
3+
"User-Agent": [
4+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]"
5+
]
6+
},
7+
"method": "GET",
8+
"path": "/.well-known/databricks-config"
9+
}
110
{
211
"headers": {
312
"Authorization": [

acceptance/auth/credentials/oauth/out.requests.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
{
2+
"headers": {
3+
"User-Agent": [
4+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]"
5+
]
6+
},
7+
"method": "GET",
8+
"path": "/.well-known/databricks-config"
9+
}
110
{
211
"headers": {
312
"User-Agent": [

acceptance/auth/credentials/pat/out.requests.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
{
2+
"headers": {
3+
"User-Agent": [
4+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS]"
5+
]
6+
},
7+
"method": "GET",
8+
"path": "/.well-known/databricks-config"
9+
}
110
{
211
"headers": {
312
"Authorization": [

0 commit comments

Comments
 (0)