Skip to content

Commit 2c7d6cf

Browse files
committed
Address PR review feedback
- Revert tagging.yml and tagging.py to main (no version downgrades or mode changes from codegen) - Remove user_agent_agent_test.go per reviewer feedback (we don't test other SDK-injected UA bits, no need to test this one) - Fix govet nilness lint in workspaceClientOrPrompt: simplify needsPrompt logic to avoid tautological/impossible nil checks after the early return on successful auth Co-authored-by: Isaac
1 parent 217f7a0 commit 2c7d6cf

File tree

5 files changed

+18
-133
lines changed

5 files changed

+18
-133
lines changed

.github/workflows/tagging.yml

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ jobs:
3434
steps:
3535
- name: Generate GitHub App Token
3636
id: generate-token
37-
uses: actions/create-github-app-token@v2
37+
uses: actions/create-github-app-token@v3
3838
with:
3939
app-id: ${{ secrets.DECO_SDK_TAGGING_APP_ID }}
4040
private-key: ${{ secrets.DECO_SDK_TAGGING_PRIVATE_KEY }}
4141

4242
- name: Checkout repository
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@v6
4444
with:
4545
fetch-depth: 0
4646
token: ${{ steps.generate-token.outputs.token }}

cmd/root/auth.go

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -189,32 +189,21 @@ func workspaceClientOrPrompt(ctx context.Context, cfg *config.Config, allowPromp
189189
return w, nil
190190
}
191191

192-
// Determine if we should prompt for a profile based on host type.
193-
// The SDK no longer returns ErrNotWorkspaceClient from NewWorkspaceClient
194-
// (as of v0.125.0, host-type validation was removed in favor of host
195-
// metadata resolution). Use HostType() to detect the wrong host type.
196-
var needsPrompt bool
197-
switch cfg.HostType() {
198-
case config.WorkspaceHost, config.UnifiedHost:
199-
// Both workspace and unified hosts can serve workspace APIs.
200-
needsPrompt = false
201-
default:
202-
// AccountHost or unknown: wrong type for workspace client.
203-
needsPrompt = true
204-
}
205-
if !needsPrompt && err != nil && errors.Is(err, config.ErrCannotConfigureDefault) {
206-
needsPrompt = true
207-
}
192+
// Determine if we should prompt for a profile. The SDK no longer returns
193+
// ErrNotWorkspaceClient from NewWorkspaceClient (as of v0.125.0, host-type
194+
// validation was removed in favor of host metadata resolution). Use
195+
// HostType() to detect wrong host type, and check for ErrCannotConfigureDefault.
196+
needsPrompt := cfg.HostType() == config.AccountHost ||
197+
errors.Is(err, config.ErrCannotConfigureDefault)
208198

209199
if !needsPrompt {
210200
return w, err
211201
}
212202

213203
if !allowPrompt || !cmdio.IsPromptSupported(ctx) {
214-
if err == nil {
215-
err = databricks.ErrNotWorkspaceClient
216-
}
217-
return w, err
204+
// Synthesize ErrNotWorkspaceClient so callers (like MustAnyClient)
205+
// can detect the wrong config type and fall through to account client.
206+
return w, databricks.ErrNotWorkspaceClient
218207
}
219208

220209
// Try picking a profile dynamically if the current configuration is not valid.

cmd/root/auth_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ import (
1717
"github.com/stretchr/testify/require"
1818
)
1919

20+
type roundTripperFunc func(*http.Request) (*http.Response, error)
21+
22+
func (f roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) {
23+
return f(r)
24+
}
25+
2026
// noNetworkTransport prevents real HTTP calls in auth tests.
21-
// Returns 404 for all requests, preventing real HTTP calls during auth tests.
27+
// Returns 404 for all requests so host metadata resolution falls back gracefully.
2228
var noNetworkTransport = roundTripperFunc(func(r *http.Request) (*http.Response, error) {
2329
return &http.Response{StatusCode: http.StatusNotFound, Body: http.NoBody}, nil
2430
})

cmd/root/user_agent_agent_test.go

Lines changed: 0 additions & 110 deletions
This file was deleted.

internal/genkit/tagging.py

100755100644
File mode changed.

0 commit comments

Comments
 (0)