Skip to content

fix(dataplane): use provided service key without control-plane lookup#32

Merged
subnetmarco merged 1 commit into
mainfrom
fix/data-plane-service-key-short-circuit
Jul 5, 2026
Merged

fix(dataplane): use provided service key without control-plane lookup#32
subnetmarco merged 1 commit into
mainfrom
fix/data-plane-service-key-short-circuit

Conversation

@subnetmarco

Copy link
Copy Markdown
Member

When VOLCANO_TOKEN already holds a scoped data-plane service key (sk-), ServiceKeyForProject returns it directly instead of listing/creating the reserved CLI key. A service key cannot call the control-plane service-keys routes, so the previous list attempt failed with HTTP 401 and broke storage object commands (surfaced by the Cloud CLI E2E storage test: "failed to load storage object token: failed to list service keys: HTTP 401: invalid token").

Tracking

Summary

  • add volcano login --browser support for interactive local auth
  • persist the returned session so subsequent CLI commands reuse the same login

Verification

  • make lint
  • go test ./...
  • smoke-tested volcano login --browser against a local dev environment

When VOLCANO_TOKEN already holds a scoped data-plane service key (sk-),
ServiceKeyForProject returns it directly instead of listing/creating the
reserved CLI key. A service key cannot call the control-plane service-keys
routes, so the previous list attempt failed with HTTP 401 and broke
`storage object` commands (surfaced by the Cloud CLI E2E storage test:
"failed to load storage object token: failed to list service keys: HTTP
401: invalid token").

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 5, 2026 15:00
@subnetmarco subnetmarco requested a review from a team as a code owner July 5, 2026 15:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes cloud data-plane credential resolution so that when VOLCANO_TOKEN already contains a scoped data-plane service key (sk-...), the CLI uses it directly instead of attempting a control-plane service-key list/create (which fails with 401 for service-key tokens).

Changes:

  • Short-circuit ServiceKeyForProject to return the configured token when it is already a data-plane service key (sk- prefix).
  • Add a regression test ensuring no control-plane API calls occur when VOLCANO_TOKEN is a service key.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/dataplane/service_key.go Adds service-key prefix detection and bypasses reserved key lookup when a service key is already configured.
internal/dataplane/service_key_test.go Adds test coverage asserting the service key is returned directly with zero control-plane requests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +69 to +75
// When the session is already authenticated with a service key (e.g.
// VOLCANO_TOKEN is a scoped data-plane key), use it directly. It is already a
// data-plane credential, and resolving the reserved CLI key would require a
// control-plane list/create that a service key is not permitted to make (401).
if token := sessionServiceKey(project); token != "" {
return token, nil
}
@subnetmarco subnetmarco enabled auto-merge July 5, 2026 15:03
@subnetmarco subnetmarco disabled auto-merge July 5, 2026 15:03
@subnetmarco subnetmarco enabled auto-merge (squash) July 5, 2026 15:03
@subnetmarco subnetmarco disabled auto-merge July 5, 2026 15:03
@subnetmarco subnetmarco merged commit 3314bb7 into main Jul 5, 2026
9 checks passed
@subnetmarco subnetmarco deleted the fix/data-plane-service-key-short-circuit branch July 5, 2026 15:08
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