Skip to content

Commit af06c9a

Browse files
Matovidloclaude
andcommitted
fix: clarify comments and rename shadowing variable in workspace commands
- Rename `sandbox` variable to `ws` in delete/cmd.go to avoid shadowing the `sandbox` package import - Document that WithPublicKey is Snowflake-only (loginType is hardcoded to "snowflake-person-keypair"; BigQuery uses a different auth flow) - Fix misleading comment in dbt generate env dialog: matching is done by ConfigurationID, not by SandboxWorkspace.ID - Use workspace name (not UUID) in "no active editor session" error - Note that StorageWorkspaceCreateCredentialsRequest rotates credentials on every call, not just fetches them Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e43e706 commit af06c9a

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

internal/pkg/keboola/sandbox/sandbox.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ func WithSize(v string) CreateSandboxWorkspaceOption {
109109
}
110110

111111
// WithPublicKey configures keypair authentication with the given public key PEM.
112+
// Note: loginType is set to "snowflake-person-keypair"; BigQuery workspaces use a
113+
// different auth mechanism and should not use this option.
112114
func WithPublicKey(v string) CreateSandboxWorkspaceOption {
113115
return func(p *createParams) {
114116
p.PublicKey = v

internal/pkg/service/cli/cmd/dbt/generate/env/dialog.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func AskGenerateEnv(
5757
}
5858

5959
// SQL workspace (Snowflake/BigQuery) — fetch StorageWorkspace credentials via the editor session.
60-
// workspace.SandboxWorkspace.ID holds the EditorSessionID; find the matching session for WorkspaceID.
60+
// Find the editor session for this workspace by matching ConfigurationID.
6161
var matchedSession *keboola.EditorSession
6262
for _, s := range sessions {
6363
if s.ConfigurationID == workspace.Config.ID.String() {
@@ -66,14 +66,16 @@ func AskGenerateEnv(
6666
}
6767
}
6868
if matchedSession == nil {
69-
return genenv.Options{}, errors.Errorf(`no active editor session found for workspace "%s"`, workspace.Config.ID)
69+
return genenv.Options{}, errors.Errorf(`no active editor session found for workspace %q`, workspace.Config.Name)
7070
}
7171

7272
workspaceIDUint, err := strconv.ParseUint(matchedSession.WorkspaceID, 10, 64)
7373
if err != nil {
7474
return genenv.Options{}, errors.Errorf("cannot parse workspace ID %q: %w", matchedSession.WorkspaceID, err)
7575
}
7676

77+
// StorageWorkspaceCreateCredentialsRequest creates new credentials on each call,
78+
// which rotates any previously issued credentials for this workspace.
7779
storageWS, err := api.StorageWorkspaceCreateCredentialsRequest(branchID, workspaceIDUint).Send(ctx)
7880
if err != nil {
7981
return genenv.Options{}, errors.Errorf("cannot fetch workspace credentials: %w", err)

internal/pkg/service/cli/cmd/remote/workspace/delete/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ func Command(p dependencies.Provider) *cobra.Command {
9595
})
9696
}
9797

98-
sandbox, err := d.Dialogs().AskWorkspace(allWorkspaces, f.WorkspaceID)
98+
ws, err := d.Dialogs().AskWorkspace(allWorkspaces, f.WorkspaceID)
9999
if err != nil {
100100
return err
101101
}
102102

103103
// Send cmd successful/failed event
104104
defer d.EventSender().SendCmdEvent(cmd.Context(), d.Clock().Now(), &cmdErr, "remote-workspace-delete")
105105

106-
return deleteOp.Run(cmd.Context(), d, branch.ID, sandbox)
106+
return deleteOp.Run(cmd.Context(), d, branch.ID, ws)
107107
},
108108
}
109109

0 commit comments

Comments
 (0)