Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ paths:
description: Filter credentials by provider
schema:
type: string
enum: [github, gitlab, jira, google, kubeconfig]
enum: [github, gitlab, jira, google, vertex, kubeconfig]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify vertex provider is accepted in backend credential handlers

# Check for provider validation/switch statements in credentials plugin
rg -nP --type=go -C3 'provider\s*(==|:=|case|switch)' components/ambient-api-server/plugins/credentials/

# Check for hardcoded provider lists that might need updating
rg -nP --type=go 'github.*gitlab.*jira.*google' components/ambient-api-server/plugins/credentials/

Repository: ambient-code/platform

Length of output: 47


🏁 Script executed:

fd -t f -i "credential" --type f | head -20

Repository: ambient-code/platform

Length of output: 1332


🏁 Script executed:

find components -type d -name "*credential*" 2>/dev/null

Repository: ambient-code/platform

Length of output: 251


🏁 Script executed:

rg -t go "github.*gitlab.*jira" --max-count 5

Repository: ambient-code/platform

Length of output: 422


🏁 Script executed:

rg -t go "case.*github" --max-count 5

Repository: ambient-code/platform

Length of output: 171


🏁 Script executed:

# Search for provider validation in backend handlers
rg -t go "provider" components/backend/handlers/oauth.go -A 5 | head -50

Repository: ambient-code/platform

Length of output: 1852


🏁 Script executed:

# Check runtime credentials handler for provider switch/validation
rg -t go "case.*:" components/backend/handlers/runtime_credentials.go | grep -i "github\|gitlab\|jira\|google\|vertex\|kubeconfig"

Repository: ambient-code/platform

Length of output: 47


🏁 Script executed:

# Look for provider enums or constants
rg -t go "(github|gitlab|jira|google|kubeconfig)" components/backend/handlers/ -A 2

Repository: ambient-code/platform

Length of output: 50378


🏁 Script executed:

# Check if vertex is mentioned anywhere in Go code
rg -t go "vertex" components/

Repository: ambient-code/platform

Length of output: 10711


🏁 Script executed:

# Look for credential handler function that validates provider
rg -t go "func.*Credential" components/backend/handlers/ -A 10 | head -80

Repository: ambient-code/platform

Length of output: 6468


🏁 Script executed:

# Search for where credentials are actually retrieved/validated
rg -t go "GetCredential\|provider.*==" components/backend/handlers/ -B 2 -A 3

Repository: ambient-code/platform

Length of output: 47


🏁 Script executed:

# Check runtime_credentials.go for vertex handling
cat components/backend/handlers/runtime_credentials.go | head -150

Repository: ambient-code/platform

Length of output: 5935


🏁 Script executed:

# Search for any vertex credential-specific handling or routing
rg -t go "GetVertexCredentials\|case.*vertex" components/backend/

Repository: ambient-code/platform

Length of output: 47


🏁 Script executed:

# Check if there's a router/mux registration for vertex credentials endpoint
rg -t go "credentials/vertex\|/vertex" components/backend/handlers/ | grep -v test | head -20

Repository: ambient-code/platform

Length of output: 47


Add backend credential handler for vertex provider.

The vertex enum value was added to credential provider schemas in the OpenAPI spec, but the backend lacks a corresponding credential handler function. Add GetVertexCredentialsForSession() in components/backend/handlers/runtime_credentials.go and register the endpoint, similar to existing handlers for github, google, jira, gitlab, coderabbit, and gerrit.

Also applies to: 287-287, 322-322, 349-349

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/ambient-api-server/openapi/openapi.credentials.yaml` at line 46,
Add a new handler GetVertexCredentialsForSession that mirrors the pattern and
signature of the existing handlers (e.g., GetGithubCredentialsForSession /
GetGoogleCredentialsForSession) to return vertex provider credentials for a
session, implement the same request parsing, auth checks, and response shape
used by the other credential handlers, and then register this handler in the
same endpoint registration block where the other credential handlers (github,
google, jira, gitlab, coderabbit, gerrit) are registered so the OpenAPI enum
value "vertex" is backed by an operative endpoint.

post:
summary: Create a new credential in a project
security:
Expand Down Expand Up @@ -284,7 +284,7 @@ components:
type: string
provider:
type: string
enum: [github, gitlab, jira, google, kubeconfig]
enum: [github, gitlab, jira, google, vertex, kubeconfig]
token:
type: string
writeOnly: true
Expand Down Expand Up @@ -319,7 +319,7 @@ components:
type: string
provider:
type: string
enum: [github, gitlab, jira, google, kubeconfig]
enum: [github, gitlab, jira, google, vertex, kubeconfig]
token:
type: string
writeOnly: true
Expand All @@ -346,7 +346,7 @@ components:
description: ID of the credential
provider:
type: string
enum: [github, gitlab, jira, google, kubeconfig]
enum: [github, gitlab, jira, google, vertex, kubeconfig]
description: Provider type for this credential
token:
type: string
Expand Down
4 changes: 0 additions & 4 deletions components/ambient-api-server/openapi/openapi.projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ components:
properties:
name:
type: string
display_name:
type: string
description:
type: string
labels:
Expand Down Expand Up @@ -250,8 +248,6 @@ components:
properties:
name:
type: string
display_name:
type: string
description:
type: string
labels:
Expand Down
4 changes: 0 additions & 4 deletions components/ambient-api-server/openapi/openapi.sessions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,6 @@ components:
agent_id:
type: string
description: The Agent that owns this session. Immutable after creation.
triggered_by_user_id:
type: string
readOnly: true
description: User who started the agent
project_id:
type: string
description: Immutable after creation. Set at creation time only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func newParentProject() (*projects.Project, error) {
projectService := projects.Service(&environments.Environment().Services)
result, svcErr := projectService.Create(context.Background(), &projects.Project{
Name: fmt.Sprintf("test-project-%d", projectCounter),
DisplayName: stringPtr("Test Project"),
Description: stringPtr("test-description"),
Status: stringPtr("active"),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func newProject(suffix string) (*projects.Project, error) {

project := &projects.Project{
Name: fmt.Sprintf("proj-%s-%d", suffix, projectCounter),
DisplayName: stringPtr("Test Project"),
Description: stringPtr("test-description"),
Status: stringPtr("active"),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func (h *projectGRPCHandler) CreateProject(ctx context.Context, req *pb.CreatePr

project := &Project{
Name: req.GetName(),
DisplayName: req.DisplayName,
Description: req.Description,
Labels: req.Labels,
Annotations: req.Annotations,
Expand All @@ -78,9 +77,6 @@ func (h *projectGRPCHandler) UpdateProject(ctx context.Context, req *pb.UpdatePr
if req.Name != nil {
found.Name = *req.Name
}
if req.DisplayName != nil {
found.DisplayName = req.DisplayName
}
if req.Description != nil {
found.Description = req.Description
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ func TestProjectGRPCCrud(t *testing.T) {
client := pb.NewProjectServiceClient(conn)
ctx := metadata.AppendToOutgoingContext(context.Background(), "authorization", "Bearer "+token)

displayName := "Test Project Display"
created, err := client.CreateProject(ctx, &pb.CreateProjectRequest{
Name: "grpc-test-project",
DisplayName: &displayName,
Name: "grpc-test-project",
})
Expect(err).NotTo(HaveOccurred())
Expect(created.GetName()).To(Equal("grpc-test-project"))
Expect(created.GetMetadata().GetId()).NotTo(BeEmpty())
Expect(created.GetMetadata().GetKind()).To(Equal("Project"))
Expect(created.GetDisplayName()).To(Equal("Test Project Display"))

got, err := client.GetProject(ctx, &pb.GetProjectRequest{Id: created.GetMetadata().GetId()})
Expect(err).NotTo(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func projectToProto(p *Project) *pb.Project {
Href: "/api/ambient/v1/projects/" + p.ID,
},
Name: p.Name,
DisplayName: p.DisplayName,
Description: p.Description,
Labels: p.Labels,
Annotations: p.Annotations,
Expand Down
12 changes: 12 additions & 0 deletions components/ambient-api-server/plugins/projects/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@ func promptMigration() *gormigrate.Migration {
},
}
}

func dropDisplayNameMigration() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "202505090001",
Migrate: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE IF EXISTS projects DROP COLUMN IF EXISTS display_name`).Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE IF EXISTS projects ADD COLUMN IF NOT EXISTS display_name TEXT`).Error
},
}
}
2 changes: 0 additions & 2 deletions components/ambient-api-server/plugins/projects/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
type Project struct {
api.Meta
Name string `json:"name" gorm:"uniqueIndex;not null"`
DisplayName *string `json:"display_name"`
Description *string `json:"description"`
Prompt *string `json:"prompt" gorm:"type:text"`
Labels *string `json:"labels"`
Expand All @@ -34,7 +33,6 @@ func (d *Project) BeforeCreate(tx *gorm.DB) error {

type ProjectPatchRequest struct {
Name *string `json:"name,omitempty"`
DisplayName *string `json:"display_name,omitempty"`
Description *string `json:"description,omitempty"`
Prompt *string `json:"prompt,omitempty"`
Labels *string `json:"labels,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions components/ambient-api-server/plugins/projects/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,5 @@ func init() {

db.RegisterMigration(migration())
db.RegisterMigration(promptMigration())
db.RegisterMigration(dropDisplayNameMigration())
}
4 changes: 4 additions & 0 deletions components/ambient-api-server/proto/ambient/v1/projects.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import "ambient/v1/common.proto";
message Project {
ObjectReference metadata = 1;
string name = 2;
// TODO(proto-cleanup): display_name was removed from model.go (migration 202505090001).
// Remove this field and regenerate with `buf generate` when buf is available.
optional string display_name = 3;
optional string description = 4;
optional string labels = 5;
Expand All @@ -18,6 +20,7 @@ message Project {

message CreateProjectRequest {
string name = 1;
// TODO(proto-cleanup): display_name removed from model.go; remove here and regenerate.
optional string display_name = 2;
optional string description = 3;
optional string labels = 4;
Expand All @@ -31,6 +34,7 @@ message GetProjectRequest {
message UpdateProjectRequest {
string id = 1;
optional string name = 2;
// TODO(proto-cleanup): display_name removed from model.go; remove here and regenerate.
optional string display_name = 3;
optional string description = 4;
optional string labels = 5;
Expand Down
2 changes: 0 additions & 2 deletions components/ambient-cli/cmd/acpctl/ambient/tui/views/detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ func ProjectDetail(p sdktypes.Project) []DetailLine {
lines := []DetailLine{
{Key: "ID", Value: p.ID},
{Key: "Name", Value: p.Name},
{Key: "Display Name", Value: p.DisplayName},
{Key: "Description", Value: p.Description},
{Key: "Status", Value: p.Status},
{Key: "Prompt", Value: p.Prompt},
Expand Down Expand Up @@ -543,7 +542,6 @@ func SessionDetail(s sdktypes.Session) []DetailLine {
{Key: "Project ID", Value: s.ProjectID},
{Key: "Agent ID", Value: s.AgentID},
{Key: "Prompt", Value: s.Prompt},
{Key: "Triggered By", Value: s.TriggeredByUserID},
{Key: "Assigned User", Value: s.AssignedUserID},
{Key: "Created By", Value: s.CreatedByUserID},
{Key: "Bot Account", Value: s.BotAccountName},
Expand Down
4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/agent_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/credential_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/inbox_message_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/iterator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/project_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/project_settings_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/role_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/role_binding_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/scheduled_session_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/session_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/session_message_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/client/user_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/types/agent.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/types/base.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/types/credential.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/types/inbox_message.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/ambient-sdk/go-sdk/types/list_options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading