Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(api): make the four BatchGet RPCs all-or-nothing (T16) (#21291)

Danny Xu55880181d3de
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 2598036d87..50a3112bc4 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -1185,7 +1185,9 @@ paths:
summary: BatchGetDatabases
description: |-
Retrieves multiple databases by their names.
- Permissions required: bb.databases.get
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.databases.get (on each named database's project)
operationId: bytebase.v1.DatabaseService.BatchGetDatabases
parameters:
- name: Connect-Protocol-Version
@@ -1681,6 +1683,8 @@ paths:
description: |-
Gets multiple groups in a single request.
Group members or users with bb.groups.get permission can get the group.
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
Permissions required: bb.groups.get OR caller is the group member
operationId: bytebase.v1.GroupService.BatchGetGroups
parameters:
@@ -3748,7 +3752,9 @@ paths:
summary: BatchGetProjects
description: |-
BatchGetProjects retrieves multiple projects by their names.
- Permissions required: bb.projects.get
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.projects.get (on each named project)
operationId: bytebase.v1.ProjectService.BatchGetProjects
parameters:
- name: Connect-Protocol-Version
@@ -7086,6 +7092,8 @@ paths:
description: |-
Get the users in batch.
Any authenticated user can batch get users.
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
Permissions required: bb.users.get
operationId: bytebase.v1.UserService.BatchGetUsers
parameters:
@@ -9442,7 +9450,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.Database'
title: databases
- description: The databases from the specified request.
+ description: One database per requested name, in the same order as `names`.
title: BatchGetDatabasesResponse
additionalProperties: false
bytebase.v1.BatchGetGroupsRequest:
@@ -9467,7 +9475,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.Group'
title: groups
- description: The groups from the specified request.
+ description: One group per requested name, in the same order as `names`.
title: BatchGetGroupsResponse
additionalProperties: false
description: Response message for batch getting groups.
@@ -9492,7 +9500,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.Project'
title: projects
- description: The projects from the specified request.
+ description: One project per requested name, in the same order as `names`.
title: BatchGetProjectsResponse
additionalProperties: false
bytebase.v1.BatchGetUsersRequest:
@@ -9516,7 +9524,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.User'
title: users
- description: The users from the specified request.
+ description: One user per requested name, in the same order as `names`.
title: BatchGetUsersResponse
additionalProperties: false
bytebase.v1.BatchParseRequest:
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index 5a5fca25bd..8579e4badb 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -190,8 +190,7 @@ func (s *DatabaseService) BatchGetDatabases(ctx context.Context, req *connect.Re
return nil, connect.NewError(connect.CodeInvalidArgument, err)
}
if databaseMessage == nil {
- // Ignore deleted database.
- continue
+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("database %q not found", name))
}
if err := validateDatabaseParent(projectID, instanceID, databaseID, databaseMessage, parent); err != nil {
return nil, connect.NewError(connect.CodeInvalidArgument, err)
@@ -201,8 +200,9 @@ func (s *DatabaseService) BatchGetDatabases(ctx context.Context, req *connect.Re
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to check permission with error: %v", err.Error()))
}
if !ok {
- // Ignore no permission database.
- continue
+ // Same code and message as a missing database: a different one would
+ // tell the caller a database exists in a project they cannot see.
+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("database %q not found", name))
}
database, err := s.convertToDatabase(ctx, databaseMessage)
if err != nil {
diff --git a/backend/api/v1/group_service.go b/backend/api/v1/group_service.go
index 3ba324d244..a1219d970b 100644
--- a/backend/api/v1/group_service.go
+++ b/backend/api/v1/group_service.go
@@ -2,14 +2,12 @@ package v1
import (
"context"
- "log/slog"
"connectrpc.com/connect"
"github.com/pkg/errors"
"google.golang.org/protobuf/types/known/emptypb"
"github.com/bytebase/bytebase/backend/common"
- "github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/common/permission"
"github.com/bytebase/bytebase/backend/component/iam"
"github.com/bytebase/bytebase/backend/enterprise"
@@ -64,8 +62,12 @@ func (s *GroupService) BatchGetGroups(ctx context.Context, request *connect.Requ
for _, name := range request.Msg.Names {
group, err := s.GetGroup(ctx, connect.NewRequest(&v1pb.GetGroupRequest{Name: name}))
if err != nil {
- slog.Error("failed to find group", slog.String("name", name), log.BBError(err))
- continue
+ // Missing and forbidden answer alike: a different code would tell the
+ // caller a group exists that they may not read.
+ if code := connect.CodeOf(err); code == connect.CodeNotFound || code == connect.CodePermissionDenied {
+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("group %q not found", name))
+ }
+ return nil, err
}
response.Groups = append(response.Groups, group.Msg)
}
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index 976259ad97..87881c386d 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -74,9 +74,6 @@ func (s *ProjectService) BatchGetProjects(ctx context.Context, req *connect.Requ
if err != nil {
return nil, err
}
- if project.Deleted {
- continue
- }
projects = append(projects, convertToProject(project))
}
return connect.NewResponse(&v1pb.BatchGetProjectsResponse{Projects: projects}), nil
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index ed39f21c3d..edacc0fcf8 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -83,7 +83,7 @@ func (s *UserService) GetUser(ctx context.Context, request *connect.Request[v1pb
// BatchGetUsers get users in batch.
func (s *UserService) BatchGetUsers(ctx context.Context, request *connect.Request[v1pb.BatchGetUsersRequest]) (*connect.Response[v1pb.BatchGetUsersResponse], error) {
- // Extract and validate emails from names
+ // Extract and validate emails from names.
emails := make([]string, 0, len(request.Msg.Names))
for _, name := range request.Msg.Names {
email, err := common.GetUserEmail(name)
@@ -105,10 +105,18 @@ func (s *UserService) BatchGetUsers(ctx context.Context, request *connect.Reques
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to batch get users"))
}
+ // The store returns its own order; answer in request order.
+ userByEmail := make(map[string]*store.UserMessage, len(users))
+ for _, user := range users {
+ userByEmail[strings.ToLower(user.Email)] = user
+ }
- // Build a map for quick lookup
response := &v1pb.BatchGetUsersResponse{}
- for _, user := range users {
+ for i, name := range request.Msg.Names {
+ user, ok := userByEmail[strings.ToLower(emails[i])]
+ if !ok {
+ return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("user %q not found", name))
+ }
v1User, err := convertToUser(ctx, s.iamManager, user)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user"))
diff --git a/backend/generated-go/v1/database_service.pb.go b/backend/generated-go/v1/database_service.pb.go
index 379c6f878d..deee5e0c87 100644
--- a/backend/generated-go/v1/database_service.pb.go
+++ b/backend/generated-go/v1/database_service.pb.go
@@ -622,7 +622,7 @@ func (x *BatchGetDatabasesRequest) GetNames() []string {
type BatchGetDatabasesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The databases from the specified request.
+ // One database per requested name, in the same order as `names`.
Databases []*Database `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
diff --git a/backend/generated-go/v1/database_service_grpc.pb.go b/backend/generated-go/v1/database_service_grpc.pb.go
index ad6c3a51a8..93addae5ac 100644
--- a/backend/generated-go/v1/database_service_grpc.pb.go
+++ b/backend/generated-go/v1/database_service_grpc.pb.go
@@ -44,7 +44,9 @@ type DatabaseServiceClient interface {
// Permissions required: bb.databases.get
GetDatabase(ctx context.Context, in *GetDatabaseRequest, opts ...grpc.CallOption) (*Database, error)
// Retrieves multiple databases by their names.
- // Permissions required: bb.databases.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.databases.get (on each named database's project)
BatchGetDatabases(ctx context.Context, in *BatchGetDatabasesRequest, opts ...grpc.CallOption) (*BatchGetDatabasesResponse, error)
// Lists databases in a project, instance, or workspace.
// Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
@@ -230,7 +232,9 @@ type DatabaseServiceServer interface {
// Permissions required: bb.databases.get
GetDatabase(context.Context, *GetDatabaseRequest) (*Database, error)
// Retrieves multiple databases by their names.
- // Permissions required: bb.databases.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.databases.get (on each named database's project)
BatchGetDatabases(context.Context, *BatchGetDatabasesRequest) (*BatchGetDatabasesResponse, error)
// Lists databases in a project, instance, or workspace.
// Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
diff --git a/backend/generated-go/v1/group_service.pb.go b/backend/generated-go/v1/group_service.pb.go
index faf9b1173e..19ee32218b 100644
--- a/backend/generated-go/v1/group_service.pb.go
+++ b/backend/generated-go/v1/group_service.pb.go
@@ -175,7 +175,7 @@ func (x *BatchGetGroupsRequest) GetNames() []string {
// Response message for batch getting groups.
type BatchGetGroupsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The groups from the specified request.
+ // One group per requested name, in the same order as `names`.
Groups []*Group `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
diff --git a/backend/generated-go/v1/group_service_grpc.pb.go b/backend/generated-go/v1/group_service_grpc.pb.go
index 8bf57f8e6f..b2af51ec7f 100644
--- a/backend/generated-go/v1/group_service_grpc.pb.go
+++ b/backend/generated-go/v1/group_service_grpc.pb.go
@@ -40,6 +40,8 @@ type GroupServiceClient interface {
GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*Group, error)
// Gets multiple groups in a single request.
// Group members or users with bb.groups.get permission can get the group.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.groups.get OR caller is the group member
BatchGetGroups(ctx context.Context, in *BatchGetGroupsRequest, opts ...grpc.CallOption) (*BatchGetGroupsResponse, error)
// Lists all groups in the workspace.
@@ -137,6 +139,8 @@ type GroupServiceServer interface {
GetGroup(context.Context, *GetGroupRequest) (*Group, error)
// Gets multiple groups in a single request.
// Group members or users with bb.groups.get permission can get the group.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.groups.get OR caller is the group member
BatchGetGroups(context.Context, *BatchGetGroupsRequest) (*BatchGetGroupsResponse, error)
// Lists all groups in the workspace.
diff --git a/backend/generated-go/v1/project_service.pb.go b/backend/generated-go/v1/project_service.pb.go
index 0b73612627..3b6633a0de 100644
--- a/backend/generated-go/v1/project_service.pb.go
+++ b/backend/generated-go/v1/project_service.pb.go
@@ -189,7 +189,7 @@ func (x *BatchGetProjectsRequest) GetNames() []string {
type BatchGetProjectsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The projects from the specified request.
+ // One project per requested name, in the same order as `names`.
Projects []*Project `protobuf:"bytes,1,rep,name=projects,proto3" json:"projects,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
diff --git a/backend/generated-go/v1/project_service_grpc.pb.go b/backend/generated-go/v1/project_service_grpc.pb.go
index bf45590308..a120ad4492 100644
--- a/backend/generated-go/v1/project_service_grpc.pb.go
+++ b/backend/generated-go/v1/project_service_grpc.pb.go
@@ -48,7 +48,9 @@ type ProjectServiceClient interface {
// Permissions required: bb.projects.get
GetProject(ctx context.Context, in *GetProjectRequest, opts ...grpc.CallOption) (*Project, error)
// BatchGetProjects retrieves multiple projects by their names.
- // Permissions required: bb.projects.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.projects.get (on each named project)
BatchGetProjects(ctx context.Context, in *BatchGetProjectsRequest, opts ...grpc.CallOption) (*BatchGetProjectsResponse, error)
// Lists all projects in the workspace with optional filtering.
// Permissions required: bb.projects.list
@@ -260,7 +262,9 @@ type ProjectServiceServer interface {
// Permissions required: bb.projects.get
GetProject(context.Context, *GetProjectRequest) (*Project, error)
// BatchGetProjects retrieves multiple projects by their names.
- // Permissions required: bb.projects.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.projects.get (on each named project)
BatchGetProjects(context.Context, *BatchGetProjectsRequest) (*BatchGetProjectsResponse, error)
// Lists all projects in the workspace with optional filtering.
// Permissions required: bb.projects.list
diff --git a/backend/generated-go/v1/user_service.pb.go b/backend/generated-go/v1/user_service.pb.go
index f86efe964e..715004e135 100644
--- a/backend/generated-go/v1/user_service.pb.go
+++ b/backend/generated-go/v1/user_service.pb.go
@@ -120,7 +120,7 @@ func (x *BatchGetUsersRequest) GetNames() []string {
type BatchGetUsersResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The users from the specified request.
+ // One user per requested name, in the same order as `names`.
Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
diff --git a/backend/generated-go/v1/user_service_grpc.pb.go b/backend/generated-go/v1/user_service_grpc.pb.go
index e9c66e7063..dfd07e16ec 100644
--- a/backend/generated-go/v1/user_service_grpc.pb.go
+++ b/backend/generated-go/v1/user_service_grpc.pb.go
@@ -50,6 +50,8 @@ type UserServiceClient interface {
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error)
// Get the users in batch.
// Any authenticated user can batch get users.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.users.get
BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*BatchGetUsersResponse, error)
// Get the current authenticated user.
@@ -300,6 +302,8 @@ type UserServiceServer interface {
GetUser(context.Context, *GetUserRequest) (*User, error)
// Get the users in batch.
// Any authenticated user can batch get users.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.users.get
BatchGetUsers(context.Context, *BatchGetUsersRequest) (*BatchGetUsersResponse, error)
// Get the current authenticated user.
diff --git a/backend/generated-go/v1/v1connect/database_service.connect.go b/backend/generated-go/v1/v1connect/database_service.connect.go
index d4436d7454..b5a3bc0279 100644
--- a/backend/generated-go/v1/v1connect/database_service.connect.go
+++ b/backend/generated-go/v1/v1connect/database_service.connect.go
@@ -80,7 +80,9 @@ type DatabaseServiceClient interface {
// Permissions required: bb.databases.get
GetDatabase(context.Context, *connect.Request[v1.GetDatabaseRequest]) (*connect.Response[v1.Database], error)
// Retrieves multiple databases by their names.
- // Permissions required: bb.databases.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.databases.get (on each named database's project)
BatchGetDatabases(context.Context, *connect.Request[v1.BatchGetDatabasesRequest]) (*connect.Response[v1.BatchGetDatabasesResponse], error)
// Lists databases in a project, instance, or workspace.
// Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
@@ -298,7 +300,9 @@ type DatabaseServiceHandler interface {
// Permissions required: bb.databases.get
GetDatabase(context.Context, *connect.Request[v1.GetDatabaseRequest]) (*connect.Response[v1.Database], error)
// Retrieves multiple databases by their names.
- // Permissions required: bb.databases.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.databases.get (on each named database's project)
BatchGetDatabases(context.Context, *connect.Request[v1.BatchGetDatabasesRequest]) (*connect.Response[v1.BatchGetDatabasesResponse], error)
// Lists databases in a project, instance, or workspace.
// Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent)
diff --git a/backend/generated-go/v1/v1connect/group_service.connect.go b/backend/generated-go/v1/v1connect/group_service.connect.go
index 7fa654576c..c5bce75526 100644
--- a/backend/generated-go/v1/v1connect/group_service.connect.go
+++ b/backend/generated-go/v1/v1connect/group_service.connect.go
@@ -60,6 +60,8 @@ type GroupServiceClient interface {
GetGroup(context.Context, *connect.Request[v1.GetGroupRequest]) (*connect.Response[v1.Group], error)
// Gets multiple groups in a single request.
// Group members or users with bb.groups.get permission can get the group.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.groups.get OR caller is the group member
BatchGetGroups(context.Context, *connect.Request[v1.BatchGetGroupsRequest]) (*connect.Response[v1.BatchGetGroupsResponse], error)
// Lists all groups in the workspace.
@@ -175,6 +177,8 @@ type GroupServiceHandler interface {
GetGroup(context.Context, *connect.Request[v1.GetGroupRequest]) (*connect.Response[v1.Group], error)
// Gets multiple groups in a single request.
// Group members or users with bb.groups.get permission can get the group.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.groups.get OR caller is the group member
BatchGetGroups(context.Context, *connect.Request[v1.BatchGetGroupsRequest]) (*connect.Response[v1.BatchGetGroupsResponse], error)
// Lists all groups in the workspace.
diff --git a/backend/generated-go/v1/v1connect/project_service.connect.go b/backend/generated-go/v1/v1connect/project_service.connect.go
index 66637464bb..48066ef989 100644
--- a/backend/generated-go/v1/v1connect/project_service.connect.go
+++ b/backend/generated-go/v1/v1connect/project_service.connect.go
@@ -88,7 +88,9 @@ type ProjectServiceClient interface {
// Permissions required: bb.projects.get
GetProject(context.Context, *connect.Request[v1.GetProjectRequest]) (*connect.Response[v1.Project], error)
// BatchGetProjects retrieves multiple projects by their names.
- // Permissions required: bb.projects.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.projects.get (on each named project)
BatchGetProjects(context.Context, *connect.Request[v1.BatchGetProjectsRequest]) (*connect.Response[v1.BatchGetProjectsResponse], error)
// Lists all projects in the workspace with optional filtering.
// Permissions required: bb.projects.list
@@ -336,7 +338,9 @@ type ProjectServiceHandler interface {
// Permissions required: bb.projects.get
GetProject(context.Context, *connect.Request[v1.GetProjectRequest]) (*connect.Response[v1.Project], error)
// BatchGetProjects retrieves multiple projects by their names.
- // Permissions required: bb.projects.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.projects.get (on each named project)
BatchGetProjects(context.Context, *connect.Request[v1.BatchGetProjectsRequest]) (*connect.Response[v1.BatchGetProjectsResponse], error)
// Lists all projects in the workspace with optional filtering.
// Permissions required: bb.projects.list
diff --git a/backend/generated-go/v1/v1connect/user_service.connect.go b/backend/generated-go/v1/v1connect/user_service.connect.go
index 220369646d..fc020dee0e 100644
--- a/backend/generated-go/v1/v1connect/user_service.connect.go
+++ b/backend/generated-go/v1/v1connect/user_service.connect.go
@@ -84,6 +84,8 @@ type UserServiceClient interface {
GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error)
// Get the users in batch.
// Any authenticated user can batch get users.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.users.get
BatchGetUsers(context.Context, *connect.Request[v1.BatchGetUsersRequest]) (*connect.Response[v1.BatchGetUsersResponse], error)
// Get the current authenticated user.
@@ -372,6 +374,8 @@ type UserServiceHandler interface {
GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error)
// Get the users in batch.
// Any authenticated user can batch get users.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.users.get
BatchGetUsers(context.Context, *connect.Request[v1.BatchGetUsersRequest]) (*connect.Response[v1.BatchGetUsersResponse], error)
// Get the current authenticated user.
diff --git a/backend/tests/user_test.go b/backend/tests/user_test.go
index 607e0e55f5..51fc5d90f2 100644
--- a/backend/tests/user_test.go
+++ b/backend/tests/user_test.go
@@ -126,6 +126,42 @@ func TestDeleteUser(t *testing.T) {
// TestSeatCountExcludesDeletedPrincipal verifies a soft-deleted principal stops
// occupying a seat even though its IAM binding lingers, while a pending member
// (in IAM, no principal) still counts.
+func TestBatchGetUsers(t *testing.T) {
+ a := require.New(t)
+ ctx := context.Background()
+ ctl := &controller{}
+ ctx, err := ctl.StartServerWithExternalPg(ctx)
+ a.NoError(err)
+ defer ctl.Close(ctx)
+
+ first, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{
+ User: &v1pb.User{Title: "first", Email: "[email protected]", Password: "1024bytebase"},
+ }))
+ a.NoError(err)
+ second, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{
+ User: &v1pb.User{Title: "second", Email: "[email protected]", Password: "1024bytebase"},
+ }))
+ a.NoError(err)
+
+ // Newest first, so the store's own created_at ordering would invert this.
+ resp, err := ctl.userServiceClient.BatchGetUsers(ctx, connect.NewRequest(&v1pb.BatchGetUsersRequest{
+ Names: []string{second.Msg.Name, first.Msg.Name},
+ }))
+ a.NoError(err)
+ names := make([]string, 0, len(resp.Msg.Users))
+ for _, user := range resp.Msg.Users {
+ names = append(names, user.Name)
+ }
+ a.Equal([]string{second.Msg.Name, first.Msg.Name}, names, "users come back in request order")
+
+ // One name that does not resolve fails the whole call.
+ _, err = ctl.userServiceClient.BatchGetUsers(ctx, connect.NewRequest(&v1pb.BatchGetUsersRequest{
+ Names: []string{first.Msg.Name, "users/[email protected]"},
+ }))
+ a.Error(err)
+ a.Equal(connect.CodeNotFound, connect.CodeOf(err))
+}
+
func TestSeatCountExcludesDeletedPrincipal(t *testing.T) {
a := require.New(t)
ctx := context.Background()
diff --git a/docs/design/v1-api-audit-2026-08.md b/docs/design/v1-api-audit-2026-08.md
index cfaa45f75c..e8434a956b 100644
--- a/docs/design/v1-api-audit-2026-08.md
+++ b/docs/design/v1-api-audit-2026-08.md
@@ -11,7 +11,6 @@ noted. Fixed findings are removed and listed at the end.
| | Problem | Severity |
|---|---|---|
| T12 | Anonymous callers can enumerate emails, relay mail, and read your LDAP config | MED |
-| T16 | Four `BatchGet` RPCs behave four different ways when an item is missing | MED |
| T18c | Three smaller ones: broken filter, unpaginated list, half-finished delete | MED |
---
@@ -53,16 +52,6 @@ irreversibly purged, and the error names only the one that failed — not the on
## Lists that return the wrong rows
-### T16 · Four `BatchGet` RPCs, four behaviors — MED
-
-Ask for five databases and get three back, with no way to tell which two are missing. Ask for five
-projects with one missing and the entire call 404s. `BatchGetUsers` returns store order, not request
-order. `BatchGetGroups` swallows every error, so a database failure is indistinguishable from "that
-group doesn't exist."
-
-None of this is documented, and the responses are bare repeated lists — so any client matching
-`names[i]` to `results[i]` silently mis-attributes data. Contradicts AIP-231.
-
### T18c-ii · Two smaller list bugs — MED
- **The query-history `instance ==` filter always returns nothing.** It compares an instance name
@@ -157,6 +146,7 @@ constraints.
| T18a | [#21265](https://github.com/bytebase/bytebase/pull/21265) — `BatchCancelTaskRuns` confines its lookup to the plan and environment just authorized; the stage in a task run name is caller-supplied, so cancel rights in one environment reached a RUNNING row in another. An out-of-scope ID is rejected, not dropped — the cancel is driven by the requested IDs |
| T9 | [#21189](https://github.com/bytebase/bytebase/pull/21189) (self-hosted audit rows) + [#21234](https://github.com/bytebase/bytebase/pull/21234) — one `login_attempt` table bounds password, email-code, and MFA guessing per identity on both deployments, replacing the audit-log counter and the per-code attempt column (which bypassed the resend cooldown). Accepted with it: no per-tenant failed-login record on Cloud, and lockout-as-denial-of-service — see [`login-attempt-lockout.md`](login-attempt-lockout.md) |
| T15 | `update_mask` now decides what each of the four Update methods writes. **`UpdateDataSource`** dispatches the IAM credential on the mask path instead of the request's `authentication_type`, which was unset on any request that masked only the credential — the AIP-134 shape — so rotating a leaked key returned 200 and wrote nothing. The same branch, given a body type that disagreed with the mask, wrote the *other* credential and moved `authentication_type` with it though the mask named neither; the effective type is now resolved from the mask before the loop and a mismatched path is `InvalidArgument`. **`UpdateSetting(APP_IM)`** splices only the masked providers into the stored value rather than assigning the request wholesale, so saving Slack no longer erases the Feishu, WeCom, Lark, DingTalk and Teams secrets; the mask is now required, and a masked provider the payload omits is removed, which is how the console deletes one (it no longer merges the list client-side). **`UpdateIssue`** rejects paths it does not implement instead of returning 200 and dropping them — `status` belongs to `BatchUpdateIssuesStatus` and approvals to `ApproveIssue`/`RejectIssue`, so the supported set was right and only the silence was wrong. **`UpdateDatabaseCatalog`** keeps full-replace semantics and now says so in the proto; its `allow_missing` is removed and the number reserved, because a catalog is not independently creatable — it exists once its database is synced — so the flag had nothing to create, and the ACL's create-permission check on it denied every caller. Both merges were extracted into pure functions (`applyDataSourceUpdateMask`, `mergeAppIMSetting`), so `instance_service_test.go` and `setting_service_test.go` pin the behavior in milliseconds without a server or a metadata database. Accepted with it: the APP_IM mask paths still name no real proto field (`AppIMSetting` holds one repeated `settings`, and `value.app_im_setting_value.teams` is not a field path at all), so they are matched as a fixed vocabulary — making them true paths means restructuring the message one-field-per-provider, which needs a JSONB migration. Also left open, and the reason `UpdateDatabaseCatalog`'s hazard is documented rather than removed: a mask cannot express "this one table" while `schemas` is repeated, and read-modify-write on the catalog still loses one side of a concurrent edit, which needs an etag (AIP-154); the IAM-policy half of it is fixed, see T18b below |
+| T16 | The four `BatchGet` RPCs behaved four different ways when a name resolved to nothing, none of it documented, and the responses are bare repeated lists — so a client matching `names[i]` to `results[i]` silently mis-attributed data. They now answer one contract, stated in each proto and matching AIP-231: **one resource per requested name, in request order, and the first name that does not resolve fails the whole call.** `BatchGetX` is exactly `GetX` per name, so there is no partial response to reason about. What that fixed: `BatchGetDatabases` dropped a database that was gone or invisible and answered 200 with a short list; `BatchGetGroups` swallowed *every* error into a silent omission, so a store failure was indistinguishable from "no such group"; `BatchGetUsers` emitted the store's `created_at` order rather than request order, which is the mis-attribution hazard in its purest form; `BatchGetProjects` was already atomic but silently dropped a deleted project that `GetProject` returns. Partial success — reporting the names that did not resolve rather than failing — was tried and rejected as a second contract every client would have to handle; AIP-231 says to use a List method when you want one. Accepted with that: a caller resolving names held in stored references — IAM bindings, saved-query grants, SQL editor tab state — now loses the whole batch to one stale name, and on Cloud `BatchGetUsers` scopes to workspace IAM, so an issue created by a since-removed member fails the batch behind that page. Each of the four frontend stores therefore falls back to per-name fetches when the batch fails, which is the pattern `batchFetchProjects` already used for exactly this. One test in `backend/tests/batch_get_test.go` pins request order and the all-or-nothing failure against a real PostgreSQL; all four were also driven against a running server |
| T14 | [#21267](https://github.com/bytebase/bytebase/pull/21267) — filed as issue paging; the sweep it prompted found the same defect across the class, so it was fixed as a class. Counting endpoints, **17 of the 22** offset-paginated v1 list RPCs were affected; counting the store functions behind them, **14 of 17**. The three already sorting on a total order were `ListQueryHistories` and `ListSavedQueries` (both from one commit, [#21203](https://github.com/bytebase/bytebase/pull/21203), that was never swept across the other lists) and `ListPlans`, which is total only because a mandatory `WHERE plan.project = ?` pins its scope column. Every store list now names tiebreak columns that are unique under its own scope — written into the SQL, and appended after the caller's keys at the six affected lists that accept an `order_by`. The three that were already total are left untouched. Nothing enforces this statically: an earlier revision routed all seventeen through a `buildStableOrderBy` helper so an AST test could require it, but review judged that ceremony and both were removed, so a new paginated list added without a tiebreak will not fail CI. Enforcement is step 4 of `docs/pre-pr-checklist.md` plus review, with `TestPaginationStabilityAcrossProjects` and `TestIssueCommentBatchKeepsInsertionOrder` covering the behavior against a real PostgreSQL. The rules, and the five traps that produced the class — `id` alone in a `(project, id)` table, `created_at` (the *transaction* timestamp, identical across a batch insert), a nullable column, a partial unique index, and an `order_by` that replaces the default ordering rather than adding to it — are in [`backend/store/AGENTS.md`](../../backend/store/AGENTS.md#pagination-ordering). One adjacent bug fixed with it: `ListDatabases`, `ListInstances` and `ListProjects` each threw away the whole clause, tiebreak included, the moment a caller passed `order_by` — which is what broke their paging. Accepted with them: offset paging still drifts under concurrent inserts and deletes (that needs keyset pagination and a page-token change). `ListIssueComment` needed a second fix: its `resource_id` tiebreak is a random UUID, which would have scrambled the activity feed of a multi-field `UpdateIssue`, so `CreateIssueComments` now offsets each row of a batch by its ordinal to keep `created_at` unique and in insertion order. Deliberately out of scope, and worth its own change: `issue.id` is a per-project counter, so ordering a cross-project list by it is not recency — seeded with a three-year-old project and one created today, the newest issue in the new project ranked 4962nd on the default list. Making `create_time` the cross-project default is a product decision. Also left alone: issue search still discards an explicit `order_by` outright when the caller supplied query text |
| T10 | [#21252](https://github.com/bytebase/bytebase/pull/21252) + [#21258](https://github.com/bytebase/bytebase/pull/21258) — password change and MFA lifecycle move off `UpdateUser` onto their own methods, each requiring a `CredentialProof`: current password, live OTP, recovery code, or a Cloud-only emailed re-auth code. Every proof claims a T9 login-attempt slot, so no proof channel is an unbounded guessing oracle, and a factor-touching method refuses the password while a live factor exists. Accepted with it: **the stolen access token still answers until it expires (≤1h)** — credential generation and the fenced transaction were cut or deferred, password change revokes only the account's web refresh tokens (best-effort, OAuth grants untouched), and an MFA change revokes nothing. What this closes is the credential being *spent* on its own replacement, not the session. Design, and the shipped-vs-designed delta: [`reauthenticate-credential-changes.md`](reauthenticate-credential-changes.md) |
| T18b | The etag is now read wherever the caller presents it: `policy.etag` — the only place `GetIamPolicy` returns one, and so the only place a read-modify-write round-trips it — as well as the request field, with two that disagree rejected. Both handlers write through `store.SetIamPolicy`, which compares under `SELECT ... FOR UPDATE` inside the write transaction. Comparing against the handler's own earlier read would not have been enough: that is a check-then-act, and two requests reading the same policy both pass it before either writes. (An earlier revision justified this by replica cache skew, which does not exist: `store.New(ctx, pgURL, !profile.HA)` disables read caching in the only mode that runs more than one process.) The same lock closed two merges that present no etag at all and so could never be compared — `PatchWorkspaceIamPolicy` (signup, SSO provisioning, workspace-leave) and the role-grant issue approval in `backend/utils` — each of which read the policy, merged one member in, and wrote the whole thing back, so either could resurrect a member an admin had just revoked; both now merge inside the locked transaction through `store.PatchIamPolicy`. Fixed with it: workspace `SetIamPolicy` wrote to `request.Resource` while every read and check used the workspace from the token, so a request naming anything else matched no row and returned 200 having written nothing — the write now targets the workspace the reads did, which is what `GetIamPolicy` already does by ignoring the field. The audit delta and the invite emails are now derived from the policy the write actually replaced rather than the pre-validation snapshot, so they describe what happened even for an etag-less caller, and the workspace seat guard counts against that same locked policy through a `ValidateReplaced` hook rather than against a read the write does not hold. Accepted with it: an etag-less caller still gets last-write-wins, which is what AIP-154 optional-etag semantics mean and what existing API clients rely on; and the etag is still `updated_at` in milliseconds, so a write landing in the same millisecond as the one before it leaves the etag unmoved and a stale write racing that pair is accepted — too narrow to justify the wire change to a content hash, unlike the saved-query policy, which has no timestamp to derive one from. Also left as is: `validateIAMPolicy` grandfathers bindings found in the policy the handler read before the write, so an etag-less caller racing a concurrent removal re-adds that binding without the `allUsers`, role-existence, CEL and maximum-expiration checks — pre-existing, and closing it means splitting the function into a fetch half and a pure half that runs under the lock |
diff --git a/frontend/src/stores/app/database.ts b/frontend/src/stores/app/database.ts
index 37651e3741..053bbb3301 100644
--- a/frontend/src/stores/app/database.ts
+++ b/frontend/src/stores/app/database.ts
@@ -1,8 +1,8 @@
import { create as createProto } from "@bufbuild/protobuf";
-import { createContextValues } from "@connectrpc/connect";
+import { Code, createContextValues } from "@connectrpc/connect";
import { uniq } from "lodash-es";
import { databaseServiceClientConnect } from "@/api";
-import { silentContextKey } from "@/api/context-key";
+import { ignoredCodesContextKey, silentContextKey } from "@/api/context-key";
import {
BatchGetDatabasesRequestSchema,
BatchSyncDatabasesRequestSchema,
@@ -26,7 +26,7 @@ import { isValidDatabaseName } from "@/types/v1/database";
import { unknownInstanceResource } from "@/types/v1/instance";
import { createUnknownDatabase, setDatabaseAccess } from "./databaseAccess";
import type { AppSliceCreator, DatabaseSlice } from "./types";
-import { buildDatabaseFilter, toError } from "./utils";
+import { buildDatabaseFilter, isMissingOrForbidden, toError } from "./utils";
// Inlined to keep the app store's load graph free of the Pinia `@/stores`
// barrel that `@/utils/v1/database` pulls in.
@@ -169,24 +169,70 @@ export const createDatabaseSlice: AppSliceCreator<DatabaseSlice> = (
batchFetchDatabases: async (names, silent = false) => {
const validNames = uniq(names).filter(isValidDatabaseName);
if (!validNames.length) return [];
- const response = await databaseServiceClientConnect.batchGetDatabases(
- createProto(BatchGetDatabasesRequestSchema, {
- parent: "-",
- names: validNames,
- }),
- {
- contextValues: createContextValues().set(silentContextKey, silent),
- }
- );
- const composed = await composeDatabases(response.databases, silent);
- set((state) => {
- const next = { ...state.databasesByName };
- for (const db of composed) {
- next[db.name] = db;
- }
- return { databasesByName: next };
- });
- return composed;
+ try {
+ const response = await databaseServiceClientConnect.batchGetDatabases(
+ createProto(BatchGetDatabasesRequestSchema, {
+ parent: "-",
+ names: validNames,
+ }),
+ {
+ // A revoked name fails the whole batch; ignoring it here keeps the
+ // interceptor from navigating to /403. The fallback renders the rest.
+ contextValues: createContextValues()
+ .set(ignoredCodesContextKey, [
+ // Listing any code replaces the middleware defaults, so
+ // NotFound is repeated here. Unauthenticated is left out: an
+ // ignored code short-circuits before the token refresh.
+ Code.NotFound,
+ Code.PermissionDenied,
+ ])
+ .set(silentContextKey, silent),
+ }
+ );
+ const composed = await composeDatabases(response.databases, silent);
+ set((state) => {
+ const next = { ...state.databasesByName };
+ for (const db of composed) {
+ next[db.name] = db;
+ }
+ return { databasesByName: next };
+ });
+ return composed;
+ } catch (error) {
+ if (!isMissingOrForbidden(error)) throw error;
+ // Batch is all-or-nothing; refetch per name so one stale name isn't
+ // fatal. Raw gets, composed once: composeDatabases fans out to
+ // batchFetchProjects, so composing per database multiplies that call.
+ const settled = await Promise.allSettled(
+ validNames.map((name) =>
+ databaseServiceClientConnect.getDatabase(
+ createProto(GetDatabaseRequestSchema, { name }),
+ {
+ contextValues: createContextValues().set(
+ silentContextKey,
+ true
+ ),
+ }
+ )
+ )
+ );
+ // Record what did not come back, the way fetchByName does. A rejection
+ // here is one database missing from an already degraded view, not a
+ // reason to discard the ones that did resolve.
+ set((state) => ({
+ databaseErrorsByName: settled.reduce(
+ (errors, result, index) =>
+ result.status === "rejected"
+ ? { ...errors, [validNames[index]]: toError(result.reason) }
+ : errors,
+ state.databaseErrorsByName
+ ),
+ }));
+ const found = settled.flatMap((result) =>
+ result.status === "fulfilled" ? [result.value] : []
+ );
+ return found.length > 0 ? await upsertDatabases(found, true) : [];
+ }
},
batchGetOrFetchDatabases: async (names, silent = false) => {
diff --git a/frontend/src/stores/app/group.ts b/frontend/src/stores/app/group.ts
index 21428d33ae..7e36c61fc2 100644
--- a/frontend/src/stores/app/group.ts
+++ b/frontend/src/stores/app/group.ts
@@ -15,7 +15,7 @@ import {
} from "@/types/proto-es/v1/group_service_pb";
import { celString } from "@/utils/v1/celLiteral";
import type { AppSliceCreator, GroupFilter, GroupSlice } from "./types";
-import { toError } from "./utils";
+import { isMissingOrForbidden, toError } from "./utils";
const groupNamePrefix = "groups/";
@@ -73,19 +73,54 @@ export const createGroupSlice: AppSliceCreator<GroupSlice> = (set, get) => ({
batchFetchGroups: async (names) => {
const validNames = uniq(names).filter(Boolean).map(ensureGroupIdentifier);
if (validNames.length === 0) return [];
- const response = await groupServiceClientConnect.batchGetGroups(
- createProto(BatchGetGroupsRequestSchema, { names: validNames }),
- { contextValues: createContextValues().set(silentContextKey, true) }
- );
- set((state) => ({
- groupsByName: {
- ...state.groupsByName,
- ...Object.fromEntries(
- response.groups.map((group) => [group.name, group])
+ try {
+ const response = await groupServiceClientConnect.batchGetGroups(
+ createProto(BatchGetGroupsRequestSchema, { names: validNames }),
+ { contextValues: createContextValues().set(silentContextKey, true) }
+ );
+ set((state) => ({
+ groupsByName: {
+ ...state.groupsByName,
+ ...Object.fromEntries(
+ response.groups.map((group) => [group.name, group])
+ ),
+ },
+ }));
+ return response.groups;
+ } catch (error) {
+ if (!isMissingOrForbidden(error)) throw error;
+ // Batch is all-or-nothing; refetch per name so one stale name isn't fatal.
+ // Calls GetGroup directly rather than fetchGroup, whose workspace
+ // bb.groups.get guard would skip a group the caller reads as its member.
+ const settled = await Promise.allSettled(
+ validNames.map((name) =>
+ groupServiceClientConnect.getGroup(
+ createProto(GetGroupRequestSchema, { name }),
+ { contextValues: createContextValues().set(silentContextKey, true) }
+ )
+ )
+ );
+ const groups = settled.flatMap((result) =>
+ result.status === "fulfilled" ? [result.value] : []
+ );
+ // Record what did not come back, the way fetchGroup does. A rejection
+ // here is one group missing from an already degraded view, not a reason
+ // to discard the ones that did resolve.
+ set((state) => ({
+ groupsByName: {
+ ...state.groupsByName,
+ ...Object.fromEntries(groups.map((group) => [group.name, group])),
+ },
+ groupErrorsByName: settled.reduce(
+ (errors, result, index) =>
+ result.status === "rejected"
+ ? { ...errors, [validNames[index]]: toError(result.reason) }
+ : errors,
+ state.groupErrorsByName
),
- },
- }));
- return response.groups;
+ }));
+ return groups;
+ }
},
batchGetOrFetchGroups: async (names) => {
diff --git a/frontend/src/stores/app/index.test.ts b/frontend/src/stores/app/index.test.ts
index 85fcefa857..7c50e001ae 100644
--- a/frontend/src/stores/app/index.test.ts
+++ b/frontend/src/stores/app/index.test.ts
@@ -1939,7 +1939,10 @@ describe("useAppStore", () => {
});
test("falls back to individual project fetches when batch fetch fails", async () => {
- mocks.batchGetProjects.mockRejectedValue(new Error("batch failed"));
+ // BatchGetProjects is all-or-nothing, so one stale name fails the batch.
+ mocks.batchGetProjects.mockRejectedValue(
+ new ConnectError("project not found", Code.NotFound)
+ );
mocks.getProject.mockImplementation(({ name }: { name: string }) => {
return Promise.resolve(name === projectA.name ? projectA : projectB);
});
diff --git a/frontend/src/stores/app/project.ts b/frontend/src/stores/app/project.ts
index 49c53b8d1a..e67191aee7 100644
--- a/frontend/src/stores/app/project.ts
+++ b/frontend/src/stores/app/project.ts
@@ -1,7 +1,7 @@
import { create as createProto } from "@bufbuild/protobuf";
-import { createContextValues } from "@connectrpc/connect";
+import { Code, createContextValues } from "@connectrpc/connect";
import { projectServiceClientConnect } from "@/api";
-import { silentContextKey } from "@/api/context-key";
+import { ignoredCodesContextKey, silentContextKey } from "@/api/context-key";
import { isValidProjectName } from "@/lib/resourceName";
import { UNKNOWN_ID } from "@/types/const";
import { State } from "@/types/proto-es/v1/common_pb";
@@ -26,6 +26,7 @@ import {
buildProjectFilter,
defaultProjectName,
getLabelFilter,
+ isMissingOrForbidden,
toError,
} from "./utils";
@@ -196,7 +197,17 @@ export const createProjectSlice: AppSliceCreator<ProjectSlice> = (set, get) => {
const response = await projectServiceClientConnect.batchGetProjects(
createProto(BatchGetProjectsRequestSchema, { names: validNames }),
{
- contextValues: createContextValues().set(silentContextKey, silent),
+ // A revoked name fails the whole batch; ignoring it here keeps the
+ // interceptor from navigating to /403. The fallback renders the rest.
+ contextValues: createContextValues()
+ .set(ignoredCodesContextKey, [
+ // Listing any code replaces the middleware defaults, so
+ // NotFound is repeated here. Unauthenticated is left out: an
+ // ignored code short-circuits before the token refresh.
+ Code.NotFound,
+ Code.PermissionDenied,
+ ])
+ .set(silentContextKey, silent),
}
);
set((state) => ({
@@ -208,9 +219,11 @@ export const createProjectSlice: AppSliceCreator<ProjectSlice> = (set, get) => {
},
}));
return response.projects;
- } catch {
+ } catch (error) {
+ if (!isMissingOrForbidden(error)) throw error;
+ // Batch is all-or-nothing; refetch per name so one stale name isn't fatal.
const projects = await Promise.all(
- validNames.map((name) => get().fetchProject(name, silent))
+ validNames.map((name) => get().fetchProject(name, true))
);
return projects.filter(
(project): project is NonNullable<typeof project> => Boolean(project)
diff --git a/frontend/src/stores/app/user.ts b/frontend/src/stores/app/user.ts
index 9f7cc485f4..199c651765 100644
--- a/frontend/src/stores/app/user.ts
+++ b/frontend/src/stores/app/user.ts
@@ -26,6 +26,7 @@ import {
import { celString } from "@/utils/v1/celLiteral";
import { ensureUserFullName } from "@/utils/v1/user";
import type { AppSliceCreator, UserFilter, UserSlice } from "./types";
+import { isMissingOrForbidden } from "./utils";
const UNKNOWN_PROJECT_NAME_LEGACY = "projects/-";
@@ -136,8 +137,16 @@ export const createUserSlice: AppSliceCreator<UserSlice> = (set, get) => {
),
},
}));
- } catch {
- // Match the legacy store: return cached users plus unknown fallbacks.
+ } catch (error) {
+ // Batch is all-or-nothing; refetch per name so one stale name isn't
+ // fatal. Other errors skip the fallback: this returns unknown users
+ // rather than throwing, so retrying each name would only amplify an
+ // outage.
+ if (isMissingOrForbidden(error)) {
+ await Promise.all(
+ missing.map((name) => get().fetchUser(name, true))
+ );
+ }
}
}
diff --git a/frontend/src/stores/app/utils.ts b/frontend/src/stores/app/utils.ts
index b10ecfdffd..74923d356e 100644
--- a/frontend/src/stores/app/utils.ts
+++ b/frontend/src/stores/app/utils.ts
@@ -1,4 +1,11 @@
import { Code, ConnectError } from "@connectrpc/connect";
+
+// The per-resource failures the all-or-nothing BatchGet contract introduces.
+// Only these are worth a per-name retry; anything else is a real error.
+export const isMissingOrForbidden = (error: unknown) =>
+ error instanceof ConnectError &&
+ (error.code === Code.NotFound || error.code === Code.PermissionDenied);
+
import type { DatabaseFilter } from "@/lib/databaseFilter";
import {
getProjectName,
diff --git a/frontend/src/types/proto-es/v1/database_service_pb.d.ts b/frontend/src/types/proto-es/v1/database_service_pb.d.ts
index b6d073bfb5..915f906526 100644
--- a/frontend/src/types/proto-es/v1/database_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/database_service_pb.d.ts
@@ -66,7 +66,7 @@ export declare const BatchGetDatabasesRequestSchema: GenMessage<BatchGetDatabase
*/
export declare type BatchGetDatabasesResponse = Message<"bytebase.v1.BatchGetDatabasesResponse"> & {
/**
- * The databases from the specified request.
+ * One database per requested name, in the same order as `names`.
*
* @generated from field: repeated bytebase.v1.Database databases = 1;
*/
@@ -3224,7 +3224,9 @@ export declare const DatabaseService: GenService<{
},
/**
* Retrieves multiple databases by their names.
- * Permissions required: bb.databases.get
+ * One resource per requested name, in request order. The first name that
+ * does not resolve fails the whole call (AIP-231: no partial response).
+ * Permissions required: bb.databases.get (on each named database's project)
*
* @generated from rpc bytebase.v1.DatabaseService.BatchGetDatabases
*/
diff --git a/frontend/src/types/proto-es/v1/group_service_pb.d.ts b/frontend/src/types/proto-es/v1/group_service_pb.d.ts
index c08ec80a57..0d0a36a95b 100644
--- a/frontend/src/types/proto-es/v1/group_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/group_service_pb.d.ts
@@ -60,7 +60,7 @@ export declare const BatchGetGroupsRequestSchema: GenMessage<BatchGetGroupsReque
*/
export declare type BatchGetGroupsResponse = Message<"bytebase.v1.BatchGetGroupsResponse"> & {
/**
- * The groups from the specified request.
+ * One group per requested name, in the same order as `names`.
*
* @generated from field: repeated bytebase.v1.Group groups = 1;
*/
@@ -383,6 +383,8 @@ export declare const GroupService: GenService<{
/**
* Gets multiple groups in a single request.
* Group members or users with bb.groups.get permission can get the group.
+ * One resource per requested name, in request order. The first name that
+ * does not resolve fails the whole call (AIP-231: no partial response).
* Permissions required: bb.groups.get OR caller is the group member
*
* @generated from rpc bytebase.v1.GroupService.BatchGetGroups
diff --git a/frontend/src/types/proto-es/v1/project_service_pb.d.ts b/frontend/src/types/proto-es/v1/project_service_pb.d.ts
index 61c14daa16..afed957809 100644
--- a/frontend/src/types/proto-es/v1/project_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/project_service_pb.d.ts
@@ -57,7 +57,7 @@ export declare const BatchGetProjectsRequestSchema: GenMessage<BatchGetProjectsR
*/
export declare type BatchGetProjectsResponse = Message<"bytebase.v1.BatchGetProjectsResponse"> & {
/**
- * The projects from the specified request.
+ * One project per requested name, in the same order as `names`.
*
* @generated from field: repeated bytebase.v1.Project projects = 1;
*/
@@ -918,7 +918,9 @@ export declare const ProjectService: GenService<{
},
/**
* BatchGetProjects retrieves multiple projects by their names.
- * Permissions required: bb.projects.get
+ * One resource per requested name, in request order. The first name that
+ * does not resolve fails the whole call (AIP-231: no partial response).
+ * Permissions required: bb.projects.get (on each named project)
*
* @generated from rpc bytebase.v1.ProjectService.BatchGetProjects
*/
diff --git a/frontend/src/types/proto-es/v1/user_service_pb.d.ts b/frontend/src/types/proto-es/v1/user_service_pb.d.ts
index 2c80794e89..e1ff2339e6 100644
--- a/frontend/src/types/proto-es/v1/user_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/user_service_pb.d.ts
@@ -55,7 +55,7 @@ export declare const BatchGetUsersRequestSchema: GenMessage<BatchGetUsersRequest
*/
export declare type BatchGetUsersResponse = Message<"bytebase.v1.BatchGetUsersResponse"> & {
/**
- * The users from the specified request.
+ * One user per requested name, in the same order as `names`.
*
* @generated from field: repeated bytebase.v1.User users = 1;
*/
@@ -725,6 +725,8 @@ export declare const UserService: GenService<{
/**
* Get the users in batch.
* Any authenticated user can batch get users.
+ * One resource per requested name, in request order. The first name that
+ * does not resolve fails the whole call (AIP-231: no partial response).
* Permissions required: bb.users.get
*
* @generated from rpc bytebase.v1.UserService.BatchGetUsers
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 7cbab8b4c8..3e17d4e4ec 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -1274,6 +1274,8 @@ paths:
description: |-
Gets multiple groups in a single request.
Group members or users with bb.groups.get permission can get the group.
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
Permissions required: bb.groups.get OR caller is the group member
operationId: GroupService_BatchGetGroups
parameters:
@@ -4781,7 +4783,9 @@ paths:
summary: BatchGetDatabases
description: |-
Retrieves multiple databases by their names.
- Permissions required: bb.databases.get
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.databases.get (on each named database's project)
operationId: DatabaseService_BatchGetDatabases2
parameters:
- name: instance
@@ -6736,7 +6740,9 @@ paths:
summary: BatchGetDatabases
description: |-
Retrieves multiple databases by their names.
- Permissions required: bb.databases.get
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.databases.get (on each named database's project)
operationId: DatabaseService_BatchGetDatabases
parameters:
- name: project
@@ -9999,7 +10005,9 @@ paths:
summary: BatchGetDatabases
description: |-
Retrieves multiple databases by their names.
- Permissions required: bb.databases.get
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.databases.get (on each named database's project)
operationId: DatabaseService_BatchGetDatabases3
parameters:
- name: project
@@ -15417,7 +15425,9 @@ paths:
summary: BatchGetProjects
description: |-
BatchGetProjects retrieves multiple projects by their names.
- Permissions required: bb.projects.get
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
+ Permissions required: bb.projects.get (on each named project)
operationId: ProjectService_BatchGetProjects
parameters:
- name: names
@@ -17649,6 +17659,8 @@ paths:
description: |-
Get the users in batch.
Any authenticated user can batch get users.
+ One resource per requested name, in request order. The first name that
+ does not resolve fails the whole call (AIP-231: no partial response).
Permissions required: bb.users.get
operationId: UserService_BatchGetUsers
parameters:
@@ -20271,7 +20283,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.Database'
title: databases
- description: The databases from the specified request.
+ description: One database per requested name, in the same order as `names`.
title: BatchGetDatabasesResponse
additionalProperties: false
bytebase.v1.BatchGetGroupsRequest:
@@ -20298,7 +20310,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.Group'
title: groups
- description: The groups from the specified request.
+ description: One group per requested name, in the same order as `names`.
title: BatchGetGroupsResponse
additionalProperties: false
description: Response message for batch getting groups.
@@ -20325,7 +20337,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.Project'
title: projects
- description: The projects from the specified request.
+ description: One project per requested name, in the same order as `names`.
title: BatchGetProjectsResponse
additionalProperties: false
bytebase.v1.BatchGetUsersRequest:
@@ -20351,7 +20363,7 @@ components:
items:
$ref: '#/components/schemas/bytebase.v1.User'
title: users
- description: The users from the specified request.
+ description: One user per requested name, in the same order as `names`.
title: BatchGetUsersResponse
additionalProperties: false
bytebase.v1.BatchParseRequest:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index cba8c27e0b..ea77f2557d 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -5421,7 +5421,7 @@ SettingService manages workspace-level settings and configurations.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |
+| users | [User](#bytebase-v1-User) | repeated | One user per requested name, in the same order as `names`. |
@@ -5785,7 +5785,7 @@ UserService manages user accounts and authentication.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. Permissions required: bb.users.get |
-| BatchGetUsers | [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest) | [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse) | Get the users in batch. Any authenticated user can batch get users. Permissions required: bb.users.get |
+| BatchGetUsers | [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest) | [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse) | Get the users in batch. Any authenticated user can batch get users. One resource per requested name, in request order. The first name that does not resolve fails the whole call (AIP-231: no partial response). Permissions required: bb.users.get |
| GetCurrentUser | [.google.protobuf.Empty](#google-protobuf-Empty) | [User](#bytebase-v1-User) | Get the current authenticated user. Permissions required: None |
| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. Permissions required: bb.users.list |
| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Creates a user in the caller&#39;s workspace (admin action, self-hosted only). In SaaS mode, admins should add users via workspace IAM policy instead. Permissions required: bb.users.create |
@@ -7649,7 +7649,7 @@ InstanceService manages database instances and their connections.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| databases | [Database](#bytebase-v1-Database) | repeated | The databases from the specified request. |
+| databases | [Database](#bytebase-v1-Database) | repeated | One database per requested name, in the same order as `names`. |
@@ -8902,7 +8902,7 @@ DatabaseService manages databases and their schemas.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| GetDatabase | [GetDatabaseRequest](#bytebase-v1-GetDatabaseRequest) | [Database](#bytebase-v1-Database) | Retrieves a database by name. Permissions required: bb.databases.get |
-| BatchGetDatabases | [BatchGetDatabasesRequest](#bytebase-v1-BatchGetDatabasesRequest) | [BatchGetDatabasesResponse](#bytebase-v1-BatchGetDatabasesResponse) | Retrieves multiple databases by their names. Permissions required: bb.databases.get |
+| BatchGetDatabases | [BatchGetDatabasesRequest](#bytebase-v1-BatchGetDatabasesRequest) | [BatchGetDatabasesResponse](#bytebase-v1-BatchGetDatabasesResponse) | Retrieves multiple databases by their names. One resource per requested name, in request order. The first name that does not resolve fails the whole call (AIP-231: no partial response). Permissions required: bb.databases.get (on each named database&#39;s project) |
| ListDatabases | [ListDatabasesRequest](#bytebase-v1-ListDatabasesRequest) | [ListDatabasesResponse](#bytebase-v1-ListDatabasesResponse) | Lists databases in a project, instance, or workspace. Permissions required: bb.projects.get (for project parent), bb.databases.list (for workspace parent), or bb.instances.get (for instance parent) |
| UpdateDatabase | [UpdateDatabaseRequest](#bytebase-v1-UpdateDatabaseRequest) | [Database](#bytebase-v1-Database) | Updates database properties such as labels and project assignment. Permissions required: bb.databases.update |
| BatchUpdateDatabases | [BatchUpdateDatabasesRequest](#bytebase-v1-BatchUpdateDatabasesRequest) | [BatchUpdateDatabasesResponse](#bytebase-v1-BatchUpdateDatabasesResponse) | Updates multiple databases in a single batch operation. Permissions required: bb.databases.update |
@@ -8949,7 +8949,7 @@ Response message for batch getting groups.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| groups | [Group](#bytebase-v1-Group) | repeated | The groups from the specified request. |
+| groups | [Group](#bytebase-v1-Group) | repeated | One group per requested name, in the same order as `names`. |
@@ -9125,7 +9125,7 @@ GroupService manages user groups for organizing users and permissions.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| GetGroup | [GetGroupRequest](#bytebase-v1-GetGroupRequest) | [Group](#bytebase-v1-Group) | Gets a group by name. Group members or users with bb.groups.get permission can get the group. Permissions required: bb.groups.get OR caller is the group member |
-| BatchGetGroups | [BatchGetGroupsRequest](#bytebase-v1-BatchGetGroupsRequest) | [BatchGetGroupsResponse](#bytebase-v1-BatchGetGroupsResponse) | Gets multiple groups in a single request. Group members or users with bb.groups.get permission can get the group. Permissions required: bb.groups.get OR caller is the group member |
+| BatchGetGroups | [BatchGetGroupsRequest](#bytebase-v1-BatchGetGroupsRequest) | [BatchGetGroupsResponse](#bytebase-v1-BatchGetGroupsResponse) | Gets multiple groups in a single request. Group members or users with bb.groups.get permission can get the group. One resource per requested name, in request order. The first name that does not resolve fails the whole call (AIP-231: no partial response). Permissions required: bb.groups.get OR caller is the group member |
| ListGroups | [ListGroupsRequest](#bytebase-v1-ListGroupsRequest) | [ListGroupsResponse](#bytebase-v1-ListGroupsResponse) | Lists all groups in the workspace. Permissions required: bb.groups.list |
| CreateGroup | [CreateGroupRequest](#bytebase-v1-CreateGroupRequest) | [Group](#bytebase-v1-Group) | Creates a new group. Permissions required: bb.groups.create |
| UpdateGroup | [UpdateGroupRequest](#bytebase-v1-UpdateGroupRequest) | [Group](#bytebase-v1-Group) | Updates a group. Group owners or users with bb.groups.update permission can update. Permissions required: bb.groups.update OR caller is group owner When allow_missing=true, also requires: bb.groups.create |
@@ -9932,7 +9932,7 @@ Activity types for webhook notifications.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| projects | [Project](#bytebase-v1-Project) | repeated | The projects from the specified request. |
+| projects | [Project](#bytebase-v1-Project) | repeated | One project per requested name, in the same order as `names`. |
@@ -10304,7 +10304,7 @@ ProjectService manages projects that group databases and changes.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| GetProject | [GetProjectRequest](#bytebase-v1-GetProjectRequest) | [Project](#bytebase-v1-Project) | GetProject retrieves a project by name. Users with &#34;bb.projects.get&#34; permission on the workspace or the project owner can access this method. Permissions required: bb.projects.get |
-| BatchGetProjects | [BatchGetProjectsRequest](#bytebase-v1-BatchGetProjectsRequest) | [BatchGetProjectsResponse](#bytebase-v1-BatchGetProjectsResponse) | BatchGetProjects retrieves multiple projects by their names. Permissions required: bb.projects.get |
+| BatchGetProjects | [BatchGetProjectsRequest](#bytebase-v1-BatchGetProjectsRequest) | [BatchGetProjectsResponse](#bytebase-v1-BatchGetProjectsResponse) | BatchGetProjects retrieves multiple projects by their names. One resource per requested name, in request order. The first name that does not resolve fails the whole call (AIP-231: no partial response). Permissions required: bb.projects.get (on each named project) |
| ListProjects | [ListProjectsRequest](#bytebase-v1-ListProjectsRequest) | [ListProjectsResponse](#bytebase-v1-ListProjectsResponse) | Lists all projects in the workspace with optional filtering. Permissions required: bb.projects.list |
| SearchProjects | [SearchProjectsRequest](#bytebase-v1-SearchProjectsRequest) | [SearchProjectsResponse](#bytebase-v1-SearchProjectsResponse) | Searches for projects with advanced filtering capabilities. Permissions required: bb.projects.get (or project-level bb.projects.get for specific projects) |
| CreateProject | [CreateProjectRequest](#bytebase-v1-CreateProjectRequest) | [Project](#bytebase-v1-Project) | Creates a new project in the workspace. Permissions required: bb.projects.create |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 5324b966b3..97bbbc1f92 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -15593,7 +15593,7 @@ Format: users/{email} </p></td>
<td>users</td>
<td><a href="#bytebase.v1.User">User</a></td>
<td>repeated</td>
- <td><p>The users from the specified request. </p></td>
+ <td><p>One user per requested name, in the same order as `names`. </p></td>
</tr>
</tbody>
@@ -16401,6 +16401,8 @@ Permissions required: bb.users.get</p></td>
<td><a href="#bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</a></td>
<td><p>Get the users in batch.
Any authenticated user can batch get users.
+One resource per requested name, in request order. The first name that
+does not resolve fails the whole call (AIP-231: no partial response).
Permissions required: bb.users.get</p></td>
</tr>
@@ -21796,7 +21798,7 @@ Use &#34;-&#34; as wildcard to batch get databases across parent. </p></td>
<td>databases</td>
<td><a href="#bytebase.v1.Database">Database</a></td>
<td>repeated</td>
- <td><p>The databases from the specified request. </p></td>
+ <td><p>One database per requested name, in the same order as `names`. </p></td>
</tr>
</tbody>
@@ -25343,7 +25345,9 @@ Permissions required: bb.databases.get</p></td>
<td><a href="#bytebase.v1.BatchGetDatabasesRequest">BatchGetDatabasesRequest</a></td>
<td><a href="#bytebase.v1.BatchGetDatabasesResponse">BatchGetDatabasesResponse</a></td>
<td><p>Retrieves multiple databases by their names.
-Permissions required: bb.databases.get</p></td>
+One resource per requested name, in request order. The first name that
+does not resolve fails the whole call (AIP-231: no partial response).
+Permissions required: bb.databases.get (on each named database&#39;s project)</p></td>
</tr>
<tr>
@@ -25760,7 +25764,7 @@ Format: groups/{email} </p></td>
<td>groups</td>
<td><a href="#bytebase.v1.Group">Group</a></td>
<td>repeated</td>
- <td><p>The groups from the specified request. </p></td>
+ <td><p>One group per requested name, in the same order as `names`. </p></td>
</tr>
</tbody>
@@ -26137,6 +26141,8 @@ Permissions required: bb.groups.get OR caller is the group member</p></td>
<td><a href="#bytebase.v1.BatchGetGroupsResponse">BatchGetGroupsResponse</a></td>
<td><p>Gets multiple groups in a single request.
Group members or users with bb.groups.get permission can get the group.
+One resource per requested name, in request order. The first name that
+does not resolve fails the whole call (AIP-231: no partial response).
Permissions required: bb.groups.get OR caller is the group member</p></td>
</tr>
@@ -28287,7 +28293,7 @@ Format: projects/{project} </p></td>
<td>projects</td>
<td><a href="#bytebase.v1.Project">Project</a></td>
<td>repeated</td>
- <td><p>The projects from the specified request. </p></td>
+ <td><p>One project per requested name, in the same order as `names`. </p></td>
</tr>
</tbody>
@@ -29224,7 +29230,9 @@ Permissions required: bb.projects.get</p></td>
<td><a href="#bytebase.v1.BatchGetProjectsRequest">BatchGetProjectsRequest</a></td>
<td><a href="#bytebase.v1.BatchGetProjectsResponse">BatchGetProjectsResponse</a></td>
<td><p>BatchGetProjects retrieves multiple projects by their names.
-Permissions required: bb.projects.get</p></td>
+One resource per requested name, in request order. The first name that
+does not resolve fails the whole call (AIP-231: no partial response).
+Permissions required: bb.projects.get (on each named project)</p></td>
</tr>
<tr>
diff --git a/proto/v1/v1/database_service.proto b/proto/v1/v1/database_service.proto
index de73e0977d..1761bf623b 100644
--- a/proto/v1/v1/database_service.proto
+++ b/proto/v1/v1/database_service.proto
@@ -30,7 +30,9 @@ service DatabaseService {
}
// Retrieves multiple databases by their names.
- // Permissions required: bb.databases.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.databases.get (on each named database's project)
rpc BatchGetDatabases(BatchGetDatabasesRequest) returns (BatchGetDatabasesResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*}/databases:batchGet"
@@ -248,7 +250,7 @@ message BatchGetDatabasesRequest {
}
message BatchGetDatabasesResponse {
- // The databases from the specified request.
+ // One database per requested name, in the same order as `names`.
repeated Database databases = 1;
}
diff --git a/proto/v1/v1/group_service.proto b/proto/v1/v1/group_service.proto
index 4d769788c7..eb3c6b1ed5 100644
--- a/proto/v1/v1/group_service.proto
+++ b/proto/v1/v1/group_service.proto
@@ -29,6 +29,8 @@ service GroupService {
// Gets multiple groups in a single request.
// Group members or users with bb.groups.get permission can get the group.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.groups.get OR caller is the group member
rpc BatchGetGroups(BatchGetGroupsRequest) returns (BatchGetGroupsResponse) {
option (google.api.http) = {get: "/v1/groups:batchGet"};
@@ -115,7 +117,7 @@ message BatchGetGroupsRequest {
// Response message for batch getting groups.
message BatchGetGroupsResponse {
- // The groups from the specified request.
+ // One group per requested name, in the same order as `names`.
repeated Group groups = 1;
}
diff --git a/proto/v1/v1/project_service.proto b/proto/v1/v1/project_service.proto
index 777fd72b7e..d9374c1028 100644
--- a/proto/v1/v1/project_service.proto
+++ b/proto/v1/v1/project_service.proto
@@ -30,7 +30,9 @@ service ProjectService {
}
// BatchGetProjects retrieves multiple projects by their names.
- // Permissions required: bb.projects.get
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
+ // Permissions required: bb.projects.get (on each named project)
rpc BatchGetProjects(BatchGetProjectsRequest) returns (BatchGetProjectsResponse) {
option (google.api.http) = {get: "/v1/projects:batchGet"};
option (bytebase.v1.permission) = "bb.projects.get";
@@ -231,7 +233,7 @@ message BatchGetProjectsRequest {
}
message BatchGetProjectsResponse {
- // The projects from the specified request.
+ // One project per requested name, in the same order as `names`.
repeated Project projects = 1;
}
diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.proto
index 9e8a75875a..27d7e16ae0 100644
--- a/proto/v1/v1/user_service.proto
+++ b/proto/v1/v1/user_service.proto
@@ -31,6 +31,8 @@ service UserService {
// Get the users in batch.
// Any authenticated user can batch get users.
+ // One resource per requested name, in request order. The first name that
+ // does not resolve fails the whole call (AIP-231: no partial response).
// Permissions required: bb.users.get
rpc BatchGetUsers(BatchGetUsersRequest) returns (BatchGetUsersResponse) {
option (google.api.http) = {get: "/v1/users:batchGet"};
@@ -270,7 +272,7 @@ message BatchGetUsersRequest {
}
message BatchGetUsersResponse {
- // The users from the specified request.
+ // One user per requested name, in the same order as `names`.
repeated User users = 1;
}