Skip to content

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

refactor: remove SystemBotUser concept (#19183)

Danny Xu30e9bd39fdbe
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 04842074d0..56ae05f937 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -12596,7 +12596,7 @@ components:
Supported filter:
- name: the user name, support "==" and ".matches()" operator.
- email: the user email, support "==" and ".matches()" operator.
- - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
- state: check State enum for values, support "==" operator.
- project: the project full name in "projects/{id}" format, support "==" operator.
@@ -12606,7 +12606,7 @@ components:
email == "[email protected]"
email.matches("ed")
user_type == "USER"
- user_type in ["SYSTEM_BOT", "USER"]
+ user_type in ["SERVICE_ACCOUNT", "USER"]
state == "DELETED"
project == "projects/sample-project"
You can combine filter conditions like:
@@ -18085,9 +18085,8 @@ components:
enum:
- USER_TYPE_UNSPECIFIED
- USER
- - SYSTEM_BOT
- - SERVICE_ACCOUNT
- WORKLOAD_IDENTITY
+ - SERVICE_ACCOUNT
bytebase.v1.VCSType:
type: string
title: VCSType
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index d53e70ec88..ae4c63a27c 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -423,7 +423,7 @@ func (s *IssueService) CreateIssue(ctx context.Context, req *connect.Request[v1p
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to check if approval is approved"))
}
if approved {
- issue, err = s.completeGrantRequestIssue(ctx, issue, issue.Payload.GrantRequest)
+ issue, err = s.completeGrantRequestIssue(ctx, user.Email, issue, issue.Payload.GrantRequest)
if err != nil {
return nil, connect.NewError(connect.CodeInternal,
errors.Wrapf(err, "failed to complete grant request"))
@@ -653,7 +653,7 @@ func (s *IssueService) ApproveIssue(ctx context.Context, req *connect.Request[v1
// If the issue is a grant request and approved, complete it
if issue.Type == storepb.Issue_GRANT_REQUEST && approved {
- issue, err = s.completeGrantRequestIssue(ctx, issue, payload.GrantRequest)
+ issue, err = s.completeGrantRequestIssue(ctx, user.Email, issue, payload.GrantRequest)
if err != nil {
slog.Debug("failed to complete grant request issue", log.BBError(err))
}
@@ -753,8 +753,8 @@ func (s *IssueService) RejectIssue(ctx context.Context, req *connect.Request[v1p
// Get issue creator for webhook event
creator, err := s.store.GetPrincipalByEmail(ctx, issue.CreatorEmail)
if err != nil {
- slog.Warn("failed to get issue creator, using system bot", log.BBError(err))
- creator = store.SystemBotUser
+ slog.Warn("failed to get issue creator", log.BBError(err))
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to get issue creator"))
}
// Trigger ISSUE_SENT_BACK webhook
@@ -1250,7 +1250,7 @@ func (s *IssueService) getIssueMessage(ctx context.Context, name string) (*store
// 2. Issue approval flow completes
//
// Returns the updated issue with DONE status.
-func (s *IssueService) completeGrantRequestIssue(ctx context.Context, issue *store.IssueMessage, grantRequest *storepb.GrantRequest) (*store.IssueMessage, error) {
+func (s *IssueService) completeGrantRequestIssue(ctx context.Context, userEmail string, issue *store.IssueMessage, grantRequest *storepb.GrantRequest) (*store.IssueMessage, error) {
// Grant the privilege
if err := utils.UpdateProjectPolicyFromGrantIssue(ctx, s.store, issue, grantRequest); err != nil {
return nil, err
@@ -1264,7 +1264,7 @@ func (s *IssueService) completeGrantRequestIssue(ctx context.Context, issue *sto
}
// Create issue comment documenting the status change
- if _, err := s.store.CreateIssueComments(ctx, common.SystemBotEmail, &store.IssueCommentMessage{
+ if _, err := s.store.CreateIssueComments(ctx, userEmail, &store.IssueCommentMessage{
IssueUID: issue.UID,
Payload: &storepb.IssueCommentPayload{
Event: &storepb.IssueCommentPayload_IssueUpdate_{
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index 25bf92d8fd..01b3954d16 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -949,6 +949,19 @@ func (s *ProjectService) TestWebhook(ctx context.Context, req *connect.Request[v
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Wrapf(err, "invalid webhook URL"))
}
+ user, ok := GetUserFromContext(ctx)
+ if !ok {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
+ }
+
+ userMessage, err := s.store.GetUserByEmail(ctx, user.Email)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))
+ }
+ if userMessage == nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found for email %q", user.Email))
+ }
+
resp := &v1pb.TestWebhookResponse{}
err = webhookplugin.Post(
webhook.Payload.GetType(),
@@ -960,9 +973,9 @@ func (s *ProjectService) TestWebhook(ctx context.Context, req *connect.Request[v
TitleZh: fmt.Sprintf("测试 webhook %q", webhook.Payload.GetTitle()),
Description: "This is a test",
Link: fmt.Sprintf("%s/projects/%s/webhooks/%s", externalURL, project.ResourceID, fmt.Sprintf("%s-%d", slug.Make(webhook.Payload.GetTitle()), webhook.ID)),
- ActorID: common.SystemBotID,
- ActorName: "Bytebase",
- ActorEmail: common.SystemBotEmail,
+ ActorID: userMessage.ID,
+ ActorName: userMessage.Name,
+ ActorEmail: userMessage.Email,
CreatedTS: time.Now().Unix(),
Issue: &webhookplugin.Issue{
ID: 1,
@@ -971,8 +984,8 @@ func (s *ProjectService) TestWebhook(ctx context.Context, req *connect.Request[v
Type: "bb.issue.database.create",
Description: "This is a test issue",
Creator: webhookplugin.Creator{
- Name: "Bytebase",
- Email: common.SystemBotEmail,
+ Name: userMessage.Name,
+ Email: userMessage.Email,
},
},
diff --git a/backend/api/v1/rollout_service.go b/backend/api/v1/rollout_service.go
index 18d071b2cf..9ee1c75936 100644
--- a/backend/api/v1/rollout_service.go
+++ b/backend/api/v1/rollout_service.go
@@ -283,7 +283,7 @@ func (s *RolloutService) CreateRollout(ctx context.Context, req *connect.Request
}
}
- if err := CreateRolloutAndPendingTasks(ctx, s.store, plan, issue, project, tasks); err != nil {
+ if err := CreateRolloutAndPendingTasks(ctx, s.store, user.Email, plan, issue, project, tasks); err != nil {
return nil, connect.NewError(connect.CodeInternal, err)
}
@@ -363,6 +363,7 @@ func (s *RolloutService) ListTaskRuns(ctx context.Context, req *connect.Request[
func CreateRolloutAndPendingTasks(
ctx context.Context,
s *store.Store,
+ userEmail string,
plan *store.PlanMessage,
issue *store.IssueMessage,
project *store.ProjectMessage,
@@ -401,7 +402,7 @@ func CreateRolloutAndPendingTasks(
return errors.Wrapf(err, "failed to update issue %q's status", issue.Title)
}
- if _, err := s.CreateIssueComments(ctx, common.SystemBotEmail, &store.IssueCommentMessage{
+ if _, err := s.CreateIssueComments(ctx, userEmail, &store.IssueCommentMessage{
IssueUID: issue.UID,
Payload: &storepb.IssueCommentPayload{
Event: &storepb.IssueCommentPayload_IssueUpdate_{
@@ -455,8 +456,8 @@ func CreateRolloutAndPendingTasks(
TaskUID: task.ID,
}
- // Use SystemBot for auto-rollout
- if err := s.CreatePendingTaskRuns(ctx, common.SystemBotEmail, create); err != nil {
+ // System-generated task run for auto-rollout
+ if err := s.CreatePendingTaskRuns(ctx, "", create); err != nil {
return errors.Wrapf(err, "failed to create pending task runs for task %d", task.ID)
}
}
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index 20d72a2bfb..248edba5ab 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -59,17 +59,6 @@ func (s *UserService) GetUser(ctx context.Context, request *connect.Request[v1pb
return nil, err
}
- // Special case for SYSTEM_BOT user which is a built-in resource.
- // SYSTEM_BOT is stored in principal table with type='SYSTEM_BOT', but GetEndUserByEmail
- // only queries END_USER type. We use the static SystemBotUser here to avoid mixing user types.
- if email == common.SystemBotEmail {
- v1User, err := convertToUser(ctx, s.iamManager, store.SystemBotUser)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user"))
- }
- return connect.NewResponse(v1User), nil
- }
-
user, err := s.store.GetEndUserByEmail(ctx, email)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))
@@ -187,15 +176,6 @@ func (s *UserService) ListUsers(ctx context.Context, request *connect.Request[v1
NextPageToken: nextPageToken,
}
for _, user := range users {
- // Because FindUserMessage.Type is an equality filter, we can't filter for OR (END_USER OR SYSTEM_BOT).
- // So we filter on the result set for SYSTEM_BOT if the request allows (though FindUserMessage forced END_USER).
- // Wait, FindUserMessage forced END_USER above. So we won't get SYSTEM_BOT.
- // If we want to support SYSTEM_BOT in ListUsers, we need to handle it.
- // Usually ListUsers is for management UI, which mainly deals with END_USER.
- // If we need SYSTEM_BOT, we might need a more flexible store filter or just rely on END_USER.
- // Let's assume ListUsers is strictly for END_USERs for now as per separation concern.
- // SystemBot is a special singleton usually fetched by ID or known email.
-
v1User, err := convertToUser(ctx, s.iamManager, user)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user"))
@@ -748,8 +728,6 @@ func convertToV1UserType(userType storepb.PrincipalType) v1pb.UserType {
switch userType {
case storepb.PrincipalType_END_USER:
return v1pb.UserType_USER
- case storepb.PrincipalType_SYSTEM_BOT:
- return v1pb.UserType_SYSTEM_BOT
case storepb.PrincipalType_SERVICE_ACCOUNT:
return v1pb.UserType_SERVICE_ACCOUNT
case storepb.PrincipalType_WORKLOAD_IDENTITY:
@@ -796,8 +774,10 @@ func convertToPrincipalType(userType v1pb.UserType) (storepb.PrincipalType, erro
switch userType {
case v1pb.UserType_USER:
t = storepb.PrincipalType_END_USER
- case v1pb.UserType_SYSTEM_BOT:
- t = storepb.PrincipalType_SYSTEM_BOT
+ case v1pb.UserType_SERVICE_ACCOUNT:
+ t = storepb.PrincipalType_SERVICE_ACCOUNT
+ case v1pb.UserType_WORKLOAD_IDENTITY:
+ t = storepb.PrincipalType_WORKLOAD_IDENTITY
default:
return t, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid user type %s", userType))
}
diff --git a/backend/common/const.go b/backend/common/const.go
index 45d1881c83..ae2f7fffa0 100644
--- a/backend/common/const.go
+++ b/backend/common/const.go
@@ -2,12 +2,6 @@
package common
const (
- // SystemBotID is the ID of the system robot.
- SystemBotID = 1
-
- // SystemBotEmail is the email of the system robot.
- SystemBotEmail = "[email protected]"
-
// AllUsers is the email of the pseudo allUsers account.
AllUsers = "allUsers"
diff --git a/backend/generated-go/store/user.pb.go b/backend/generated-go/store/user.pb.go
index 5c1d6497bf..45646a14f5 100644
--- a/backend/generated-go/store/user.pb.go
+++ b/backend/generated-go/store/user.pb.go
@@ -29,12 +29,10 @@ const (
PrincipalType_PRINCIPAL_TYPE_UNSPECIFIED PrincipalType = 0
// END_USER represents the human being using Bytebase.
PrincipalType_END_USER PrincipalType = 1
- // SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI.
- PrincipalType_SERVICE_ACCOUNT PrincipalType = 2
- // SYSTEM_BOT represents the internal system bot performing operations.
- PrincipalType_SYSTEM_BOT PrincipalType = 3
// WORKLOAD_IDENTITY represents external CI/CD workload identity.
- PrincipalType_WORKLOAD_IDENTITY PrincipalType = 4
+ PrincipalType_WORKLOAD_IDENTITY PrincipalType = 2
+ // SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI.
+ PrincipalType_SERVICE_ACCOUNT PrincipalType = 3
)
// Enum value maps for PrincipalType.
@@ -42,16 +40,14 @@ var (
PrincipalType_name = map[int32]string{
0: "PRINCIPAL_TYPE_UNSPECIFIED",
1: "END_USER",
- 2: "SERVICE_ACCOUNT",
- 3: "SYSTEM_BOT",
- 4: "WORKLOAD_IDENTITY",
+ 2: "WORKLOAD_IDENTITY",
+ 3: "SERVICE_ACCOUNT",
}
PrincipalType_value = map[string]int32{
"PRINCIPAL_TYPE_UNSPECIFIED": 0,
"END_USER": 1,
- "SERVICE_ACCOUNT": 2,
- "SYSTEM_BOT": 3,
- "WORKLOAD_IDENTITY": 4,
+ "WORKLOAD_IDENTITY": 2,
+ "SERVICE_ACCOUNT": 3,
}
)
@@ -385,14 +381,12 @@ const file_store_user_proto_rawDesc = "" +
"\n" +
"\x06GITHUB\x10\x01\x12\n" +
"\n" +
- "\x06GITLAB\x10\x02*y\n" +
+ "\x06GITLAB\x10\x02*i\n" +
"\rPrincipalType\x12\x1e\n" +
"\x1aPRINCIPAL_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
- "\bEND_USER\x10\x01\x12\x13\n" +
- "\x0fSERVICE_ACCOUNT\x10\x02\x12\x0e\n" +
- "\n" +
- "SYSTEM_BOT\x10\x03\x12\x15\n" +
- "\x11WORKLOAD_IDENTITY\x10\x04B\x8c\x01\n" +
+ "\bEND_USER\x10\x01\x12\x15\n" +
+ "\x11WORKLOAD_IDENTITY\x10\x02\x12\x13\n" +
+ "\x0fSERVICE_ACCOUNT\x10\x03B\x8c\x01\n" +
"\x12com.bytebase.storeB\tUserProtoP\x01Z\x12generated-go/store\xa2\x02\x03BSX\xaa\x02\x0eBytebase.Store\xca\x02\x0eBytebase\\Store\xe2\x02\x1aBytebase\\Store\\GPBMetadata\xea\x02\x0fBytebase::Storeb\x06proto3"
var (
diff --git a/backend/generated-go/v1/user_service.pb.go b/backend/generated-go/v1/user_service.pb.go
index dc00461bcd..6be562fd74 100644
--- a/backend/generated-go/v1/user_service.pb.go
+++ b/backend/generated-go/v1/user_service.pb.go
@@ -33,12 +33,10 @@ const (
UserType_USER_TYPE_UNSPECIFIED UserType = 0
// Regular human user account.
UserType_USER UserType = 1
- // System-managed bot account for automated operations.
- UserType_SYSTEM_BOT UserType = 2
+ // External CI/CD workload identity.
+ UserType_WORKLOAD_IDENTITY UserType = 2
// Service account for API integrations.
UserType_SERVICE_ACCOUNT UserType = 3
- // External CI/CD workload identity.
- UserType_WORKLOAD_IDENTITY UserType = 4
)
// Enum value maps for UserType.
@@ -46,16 +44,14 @@ var (
UserType_name = map[int32]string{
0: "USER_TYPE_UNSPECIFIED",
1: "USER",
- 2: "SYSTEM_BOT",
+ 2: "WORKLOAD_IDENTITY",
3: "SERVICE_ACCOUNT",
- 4: "WORKLOAD_IDENTITY",
}
UserType_value = map[string]int32{
"USER_TYPE_UNSPECIFIED": 0,
"USER": 1,
- "SYSTEM_BOT": 2,
+ "WORKLOAD_IDENTITY": 2,
"SERVICE_ACCOUNT": 3,
- "WORKLOAD_IDENTITY": 4,
}
)
@@ -294,7 +290,7 @@ type ListUsersRequest struct {
// Supported filter:
// - name: the user name, support "==" and ".matches()" operator.
// - email: the user email, support "==" and ".matches()" operator.
- // - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ // - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
// - state: check State enum for values, support "==" operator.
// - project: the project full name in "projects/{id}" format, support "==" operator.
//
@@ -304,7 +300,7 @@ type ListUsersRequest struct {
// email == "[email protected]"
// email.matches("ed")
// user_type == "USER"
- // user_type in ["SYSTEM_BOT", "USER"]
+ // user_type in ["SERVICE_ACCOUNT", "USER"]
// state == "DELETED"
// project == "projects/sample-project"
// You can combine filter conditions like:
@@ -1104,14 +1100,12 @@ const file_v1_user_service_proto_rawDesc = "" +
"\n" +
"\x06GITHUB\x10\x01\x12\n" +
"\n" +
- "\x06GITLAB\x10\x02*k\n" +
+ "\x06GITLAB\x10\x02*[\n" +
"\bUserType\x12\x19\n" +
"\x15USER_TYPE_UNSPECIFIED\x10\x00\x12\b\n" +
- "\x04USER\x10\x01\x12\x0e\n" +
- "\n" +
- "SYSTEM_BOT\x10\x02\x12\x13\n" +
- "\x0fSERVICE_ACCOUNT\x10\x03\x12\x15\n" +
- "\x11WORKLOAD_IDENTITY\x10\x042\xd3\b\n" +
+ "\x04USER\x10\x01\x12\x15\n" +
+ "\x11WORKLOAD_IDENTITY\x10\x02\x12\x13\n" +
+ "\x0fSERVICE_ACCOUNT\x10\x032\xd3\b\n" +
"\vUserService\x12p\n" +
"\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"5\xdaA\x04name\x8a\xea0\fbb.users.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12\x86\x01\n" +
"\rBatchGetUsers\x12!.bytebase.v1.BatchGetUsersRequest\x1a\".bytebase.v1.BatchGetUsersResponse\".\x8a\xea0\fbb.users.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/users:batchGet\x12Y\n" +
diff --git a/backend/migrator/migration/3.15/0006##remove_system_bot.sql b/backend/migrator/migration/3.15/0006##remove_system_bot.sql
new file mode 100644
index 0000000000..078e94e654
--- /dev/null
+++ b/backend/migrator/migration/3.15/0006##remove_system_bot.sql
@@ -0,0 +1,54 @@
+-- Make task_run.creator nullable (for system-generated task runs)
+ALTER TABLE task_run ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE task_run DROP CONSTRAINT task_run_creator_fkey;
+ALTER TABLE task_run ADD CONSTRAINT task_run_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+
+-- Convert existing SystemBot task runs to NULL
+UPDATE task_run SET creator = NULL
+ WHERE creator = '[email protected]';
+
+-- Backfill tables that have [email protected] from GitOps workflows
+-- Reassign to the first active user (or fail if none exists)
+DO $$
+DECLARE
+ fallback_user TEXT;
+BEGIN
+ -- Find the first active END_USER (by lowest ID, typically the initial setup user)
+ SELECT email INTO fallback_user
+ FROM principal
+ WHERE email != '[email protected]'
+ AND type = 'END_USER'
+ AND NOT deleted
+ ORDER BY id
+ LIMIT 1;
+
+ -- If no user found, raise error
+ IF fallback_user IS NULL THEN
+ RAISE EXCEPTION 'No active user found to reassign SystemBot-created records. Please create a user first.';
+ END IF;
+
+ -- Reassign all [email protected] creators to the fallback user
+ -- These tables must have real users, not system bot
+ UPDATE sheet SET creator = fallback_user WHERE creator = '[email protected]';
+ UPDATE plan SET creator = fallback_user WHERE creator = '[email protected]';
+ UPDATE issue SET creator = fallback_user WHERE creator = '[email protected]';
+ UPDATE issue_comment SET creator = fallback_user WHERE creator = '[email protected]';
+ UPDATE release SET creator = fallback_user WHERE creator = '[email protected]';
+END $$;
+
+-- Delete the SystemBot principal row
+DELETE FROM principal WHERE id = 1 AND email = '[email protected]';
+
+-- Remove SYSTEM_BOT from principal type constraint
+ALTER TABLE principal DROP CONSTRAINT principal_type_check;
+ALTER TABLE principal ADD CONSTRAINT principal_type_check
+ CHECK (type IN ('END_USER', 'SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY'));
+
+-- Update principal_project_type_check to remove SYSTEM_BOT
+ALTER TABLE principal DROP CONSTRAINT principal_project_type_check;
+ALTER TABLE principal ADD CONSTRAINT principal_project_type_check CHECK (
+ (type = 'END_USER' AND project IS NULL) OR
+ (type IN ('SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY'))
+);
diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sql
index e6812e9885..a28589f379 100644
--- a/backend/migrator/migration/LATEST.sql
+++ b/backend/migrator/migration/LATEST.sql
@@ -33,7 +33,7 @@ CREATE TABLE principal (
id serial PRIMARY KEY,
deleted boolean NOT NULL DEFAULT FALSE,
created_at timestamptz NOT NULL DEFAULT now(),
- type text NOT NULL CHECK (type IN ('END_USER', 'SYSTEM_BOT', 'SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY')),
+ type text NOT NULL CHECK (type IN ('END_USER', 'SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY')),
name text NOT NULL,
email text NOT NULL,
password_hash text NOT NULL,
@@ -46,7 +46,7 @@ CREATE TABLE principal (
-- NULL for END_USER/SYSTEM_BOT, and for workspace-level SERVICE_ACCOUNT/WORKLOAD_IDENTITY.
project text REFERENCES project(resource_id),
CONSTRAINT principal_project_type_check CHECK (
- (type IN ('END_USER', 'SYSTEM_BOT') AND project IS NULL) OR
+ (type = 'END_USER' AND project IS NULL) OR
(type IN ('SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY'))
)
);
@@ -263,7 +263,7 @@ ALTER SEQUENCE task_id_seq RESTART WITH 101;
-- task run table stores the task run
CREATE TABLE task_run (
id serial PRIMARY KEY,
- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,
+ creator text REFERENCES principal(email) ON UPDATE CASCADE ON DELETE SET NULL,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
task_id integer NOT NULL REFERENCES task(id),
@@ -589,9 +589,6 @@ CREATE TABLE web_refresh_token (
CREATE INDEX idx_web_refresh_token_user_email ON web_refresh_token(user_email);
CREATE INDEX idx_web_refresh_token_expires_at ON web_refresh_token(expires_at);
--- Default bytebase system account id is 1.
-INSERT INTO principal (id, type, name, email, password_hash) VALUES (1, 'SYSTEM_BOT', 'Bytebase', '[email protected]', '');
-
ALTER SEQUENCE principal_id_seq RESTART WITH 101;
-- Default project.
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 15e8f40daa..a0325e0edb 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,8 +12,8 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.15.5"), *files[len(files)-1].version)
- require.Equal(t, "migration/3.15/0005##migrate_iam_binding_member_prefix.sql", files[len(files)-1].path)
+ require.Equal(t, semver.MustParse("3.15.6"), *files[len(files)-1].version)
+ require.Equal(t, "migration/3.15/0006##remove_system_bot.sql", files[len(files)-1].path)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index 22d5a70ca1..5ea16254d5 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -897,8 +897,8 @@ func NotifyApprovalRequested(ctx context.Context, stores *store.Store, webhookMa
// Get issue creator as actor
creator, err := stores.GetPrincipalByEmail(ctx, issue.CreatorEmail)
if err != nil {
- slog.Warn("failed to get issue creator, using system bot", log.BBError(err))
- creator = store.SystemBotUser
+ slog.Warn("failed to get issue creator", log.BBError(err))
+ return
}
// Get approvers for this role
diff --git a/backend/runner/taskrun/pending_scheduler.go b/backend/runner/taskrun/pending_scheduler.go
index 9efa8a0e86..daae1a6ac9 100644
--- a/backend/runner/taskrun/pending_scheduler.go
+++ b/backend/runner/taskrun/pending_scheduler.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"google.golang.org/protobuf/types/known/timestamppb"
- "github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
"github.com/bytebase/bytebase/backend/store"
@@ -164,7 +163,7 @@ func (s *Scheduler) promoteTaskRun(ctx context.Context, taskRun *store.TaskRunMe
if _, err := s.store.UpdateTaskRunStatus(ctx, &store.TaskRunStatusPatch{
ID: taskRun.ID,
- Updater: common.SystemBotEmail,
+ Updater: "",
Status: storepb.TaskRun_AVAILABLE,
}); err != nil {
return errors.Wrapf(err, "failed to update task run status to available")
diff --git a/backend/runner/taskrun/rollout_creator.go b/backend/runner/taskrun/rollout_creator.go
index dd560970db..c919795001 100644
--- a/backend/runner/taskrun/rollout_creator.go
+++ b/backend/runner/taskrun/rollout_creator.go
@@ -162,7 +162,8 @@ func (rc *RolloutCreator) tryCreateRollout(ctx context.Context, planID int64) {
slog.Info("auto-creating rollout", slog.Int("plan_id", int(planID)))
// Create rollout and pending tasks
- if err := apiv1.CreateRolloutAndPendingTasks(ctx, rc.store, plan, issue, project, nil); err != nil {
+ // Use issue creator's email since this is auto-rollout for their issue
+ if err := apiv1.CreateRolloutAndPendingTasks(ctx, rc.store, issue.CreatorEmail, plan, issue, project, nil); err != nil {
slog.Error("failed to create rollout and pending tasks",
slog.Int("plan_id", int(planID)),
log.BBError(err))
diff --git a/backend/runner/taskrun/running_scheduler.go b/backend/runner/taskrun/running_scheduler.go
index 5aab9a9471..c0481e1fe3 100644
--- a/backend/runner/taskrun/running_scheduler.go
+++ b/backend/runner/taskrun/running_scheduler.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
- "github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/component/webhook"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
@@ -118,7 +117,7 @@ func (s *Scheduler) runTaskRunOnce(ctx context.Context, taskRunUID int, task *st
)
taskRunStatusPatch := &store.TaskRunStatusPatch{
ID: taskRunUID,
- Updater: common.SystemBotEmail,
+ Updater: "",
Status: storepb.TaskRun_CANCELED,
ResultProto: &storepb.TaskRunResult{},
}
@@ -140,7 +139,7 @@ func (s *Scheduler) runTaskRunOnce(ctx context.Context, taskRunUID int, task *st
)
taskRunStatusPatch := &store.TaskRunStatusPatch{
ID: taskRunUID,
- Updater: common.SystemBotEmail,
+ Updater: "",
Status: storepb.TaskRun_FAILED,
ResultProto: &storepb.TaskRunResult{
Detail: err.Error(),
@@ -185,7 +184,7 @@ func (s *Scheduler) runTaskRunOnce(ctx context.Context, taskRunUID int, task *st
// Success case
taskRunStatusPatch := &store.TaskRunStatusPatch{
ID: taskRunUID,
- Updater: common.SystemBotEmail,
+ Updater: "",
Status: storepb.TaskRun_DONE,
ResultProto: result,
}
diff --git a/backend/store/principal.go b/backend/store/principal.go
index e63545c11d..9d15b2c980 100644
--- a/backend/store/principal.go
+++ b/backend/store/principal.go
@@ -15,15 +15,6 @@ import (
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
)
-// SystemBotUser is the static system bot user.
-var SystemBotUser = &UserMessage{
- ID: common.SystemBotID,
- Name: "Bytebase",
- Email: "[email protected]",
- Type: storepb.PrincipalType_SYSTEM_BOT,
- Profile: &storepb.UserProfile{},
-}
-
// FindUserMessage is the message for finding users.
type FindUserMessage struct {
ID *int
@@ -572,10 +563,6 @@ func (s *Store) CreateUser(ctx context.Context, create *UserMessage) (*UserMessa
// UpdateUser updates a user.
func (s *Store) UpdateUser(ctx context.Context, currentUser *UserMessage, patch *UpdateUserMessage) (*UserMessage, error) {
- if currentUser.ID == common.SystemBotID {
- return nil, errors.Errorf("cannot update system bot")
- }
-
set := qb.Q()
if v := patch.Delete; v != nil {
set.Comma("deleted = ?", *v)
diff --git a/backend/store/principal_filter.go b/backend/store/principal_filter.go
index 184e6a360a..5211992046 100644
--- a/backend/store/principal_filter.go
+++ b/backend/store/principal_filter.go
@@ -33,7 +33,6 @@ func GetListUserFilter(filter string) (*GetListUserFilterResult, error) {
return &GetListUserFilterResult{
UserTypes: []storepb.PrincipalType{
storepb.PrincipalType_END_USER,
- storepb.PrincipalType_SYSTEM_BOT,
},
}, nil
}
@@ -55,8 +54,10 @@ func GetListUserFilter(filter string) (*GetListUserFilterResult, error) {
switch v1UserType {
case v1pb.UserType_USER:
return storepb.PrincipalType_END_USER, nil
- case v1pb.UserType_SYSTEM_BOT:
- return storepb.PrincipalType_SYSTEM_BOT, nil
+ case v1pb.UserType_SERVICE_ACCOUNT:
+ return storepb.PrincipalType_SERVICE_ACCOUNT, nil
+ case v1pb.UserType_WORKLOAD_IDENTITY:
+ return storepb.PrincipalType_WORKLOAD_IDENTITY, nil
default:
return storepb.PrincipalType_END_USER, errors.Errorf("invalid user type %s", v1UserType)
}
@@ -196,11 +197,10 @@ func GetListUserFilter(filter string) (*GetListUserFilterResult, error) {
}
if len(userTypes) == 0 {
- // Force to query end users and system bot.
+ // Force to query end users only.
userTypes = append(
userTypes,
storepb.PrincipalType_END_USER,
- storepb.PrincipalType_SYSTEM_BOT,
)
}
diff --git a/backend/store/principal_filter_test.go b/backend/store/principal_filter_test.go
index 0bcc7cb4c5..64fa6f72d2 100644
--- a/backend/store/principal_filter_test.go
+++ b/backend/store/principal_filter_test.go
@@ -27,7 +27,6 @@ func TestGetListUserFilter(t *testing.T) {
wantErr: false,
wantUserTypes: []storepb.PrincipalType{
storepb.PrincipalType_END_USER,
- storepb.PrincipalType_SYSTEM_BOT,
},
},
{
@@ -59,10 +58,14 @@ func TestGetListUserFilter(t *testing.T) {
wantErr: false,
},
{
- name: "user_type filter - SERVICE_ACCOUNT",
- filter: `user_type == "SERVICE_ACCOUNT"`,
- wantErr: true,
- errContains: "invalid user type SERVICE_ACCOUNT",
+ name: "user_type filter - SERVICE_ACCOUNT",
+ filter: `user_type == "SERVICE_ACCOUNT"`,
+ wantSQL: "(TRUE)",
+ wantArgs: []any{},
+ wantErr: false,
+ wantUserTypes: []storepb.PrincipalType{
+ storepb.PrincipalType_SERVICE_ACCOUNT,
+ },
},
{
name: "user_type filter - USER",
@@ -75,21 +78,26 @@ func TestGetListUserFilter(t *testing.T) {
},
},
{
- name: "user_type filter - USER",
- filter: `user_type in ["SYSTEM_BOT", "USER"]`,
+ name: "user_type filter - USER and WORKLOAD_IDENTITY",
+ filter: `user_type in ["WORKLOAD_IDENTITY", "USER"]`,
wantSQL: "(TRUE)",
wantArgs: []any{},
wantErr: false,
wantUserTypes: []storepb.PrincipalType{
- storepb.PrincipalType_SYSTEM_BOT,
+ storepb.PrincipalType_WORKLOAD_IDENTITY,
storepb.PrincipalType_END_USER,
},
},
{
- name: "user_type in list",
- filter: `user_type in ["SERVICE_ACCOUNT", "USER"]`,
- wantErr: true,
- errContains: "invalid user type SERVICE_ACCOUNT",
+ name: "user_type in list",
+ filter: `user_type in ["SERVICE_ACCOUNT", "USER"]`,
+ wantSQL: "(TRUE)",
+ wantArgs: []any{},
+ wantErr: false,
+ wantUserTypes: []storepb.PrincipalType{
+ storepb.PrincipalType_SERVICE_ACCOUNT,
+ storepb.PrincipalType_END_USER,
+ },
},
{
name: "user_type not in list",
diff --git a/backend/store/task_run.go b/backend/store/task_run.go
index 7e75a12d83..16d544f08d 100644
--- a/backend/store/task_run.go
+++ b/backend/store/task_run.go
@@ -118,11 +118,12 @@ func (s *Store) ListTaskRuns(ctx context.Context, find *FindTaskRunMessage) ([]*
for rows.Next() {
var taskRun TaskRunMessage
var startedAt, runAt sql.NullTime
+ var creatorEmail sql.NullString
var statusString string
var resultJSON, payloadJSON string
if err := rows.Scan(
&taskRun.ID,
- &taskRun.CreatorEmail,
+ &creatorEmail,
&taskRun.CreatedAt,
&taskRun.UpdatedAt,
&taskRun.TaskUID,
@@ -137,6 +138,9 @@ func (s *Store) ListTaskRuns(ctx context.Context, find *FindTaskRunMessage) ([]*
); err != nil {
return nil, err
}
+ if creatorEmail.Valid {
+ taskRun.CreatorEmail = creatorEmail.String
+ }
if statusValue, ok := storepb.TaskRun_Status_value[statusString]; ok {
taskRun.Status = storepb.TaskRun_Status(statusValue)
} else {
@@ -303,6 +307,14 @@ func (s *Store) CreatePendingTaskRuns(ctx context.Context, creator string, creat
runAts = append(runAts, create.RunAt)
}
+ // Convert empty string to NULL for system-created task runs
+ var creatorPtr any
+ if creator == "" {
+ creatorPtr = nil
+ } else {
+ creatorPtr = creator
+ }
+
// Single query that:
// 1. Filters out tasks with existing PENDING/RUNNING/DONE task runs (idempotent)
// 2. Calculates next attempt for each remaining task
@@ -333,7 +345,7 @@ func (s *Store) CreatePendingTaskRuns(ctx context.Context, creator string, creat
AND task_run.status IN (?, ?, ?, ?)
)
ON CONFLICT (task_id, attempt) DO NOTHING
- `, creator, storepb.TaskRun_PENDING.String(), taskUIDs, runAts,
+ `, creatorPtr, storepb.TaskRun_PENDING.String(), taskUIDs, runAts,
storepb.TaskRun_PENDING.String(), storepb.TaskRun_AVAILABLE.String(), storepb.TaskRun_RUNNING.String(), storepb.TaskRun_DONE.String())
query, args, err := q.ToSQL()
@@ -376,11 +388,12 @@ func (*Store) patchTaskRunStatusImpl(ctx context.Context, txn *sql.Tx, patch *Ta
}
var taskRun TaskRunMessage
+ var creatorEmail sql.NullString
var statusString string
var resultJSON string
if err := txn.QueryRowContext(ctx, query, args...).Scan(
&taskRun.ID,
- &taskRun.CreatorEmail,
+ &creatorEmail,
&taskRun.CreatedAt,
&taskRun.UpdatedAt,
&taskRun.TaskUID,
@@ -392,6 +405,9 @@ func (*Store) patchTaskRunStatusImpl(ctx context.Context, txn *sql.Tx, patch *Ta
}
return nil, err
}
+ if creatorEmail.Valid {
+ taskRun.CreatorEmail = creatorEmail.String
+ }
if statusValue, ok := storepb.TaskRun_Status_value[statusString]; ok {
taskRun.Status = storepb.TaskRun_Status(statusValue)
} else {
diff --git a/docs/plans/2026-01-29-remove-system-bot-user-design.md b/docs/plans/2026-01-29-remove-system-bot-user-design.md
new file mode 100644
index 0000000000..84f5c00fee
--- /dev/null
+++ b/docs/plans/2026-01-29-remove-system-bot-user-design.md
@@ -0,0 +1,283 @@
+# Remove SystemBotUser Design
+
+**Date:** 2026-01-29
+**Status:** Approved
+
+## Overview & Goals
+
+### Current State
+
+Bytebase currently uses a special "SystemBot" user (ID=1, email='[email protected]') to represent system-generated actions. This includes:
+- Task scheduler operations
+- Automated issue comments (status changes)
+- Fallback when real users can't be found
+- Internal system operations
+
+This SystemBot appears in the UI alongside real users, which confuses users. It's unclear whether "Bytebase <[email protected]>" is a real user, a support account, or something else.
+
+### Goal
+
+Remove the SystemBot concept entirely. System-generated actions will be clearly distinguished from user actions:
+- **Database:** `creator` fields will be `NULL` for system operations
+- **Code:** Empty string `""` used as sentinel for system operations
+- **UI:** Display "System" label for NULL creators
+- **No special constants** or hardcoded IDs/emails
+
+### Benefits
+
+- Clearer separation: NULL = system, email = real user
+- No confusing fake user in user lists
+- Simpler code (fewer special cases)
+- Better user experience (obvious what's system vs human)
+
+## Database Schema Changes
+
+### Affected Tables
+
+Only two tables need schema changes to support NULL creators:
+- `issue_comment` (creator) - System creates comments for status changes
+- `task_run` (creator) - System scheduler creates/updates task runs
+
+**All other tables with creator columns remain unchanged** - they only contain user-created records.
+
+### Schema Modifications
+
+```sql
+-- Make issue_comment.creator nullable
+ALTER TABLE issue_comment ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE issue_comment DROP CONSTRAINT issue_comment_creator_fkey;
+ALTER TABLE issue_comment ADD CONSTRAINT issue_comment_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+
+-- Make task_run.creator nullable
+ALTER TABLE task_run ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE task_run DROP CONSTRAINT task_run_creator_fkey;
+ALTER TABLE task_run ADD CONSTRAINT task_run_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+```
+
+**Note:** This minimal change reduces migration risk - we only modify tables that actually need it.
+
+## Data Migration Strategy
+
+### Migration Steps
+
+```sql
+-- Step 1: Make columns nullable and update FK constraints
+ALTER TABLE issue_comment ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE issue_comment DROP CONSTRAINT issue_comment_creator_fkey;
+ALTER TABLE issue_comment ADD CONSTRAINT issue_comment_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+
+ALTER TABLE task_run ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE task_run DROP CONSTRAINT task_run_creator_fkey;
+ALTER TABLE task_run ADD CONSTRAINT task_run_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+
+-- Step 2: Convert all existing SystemBot records to NULL
+UPDATE issue_comment SET creator = NULL
+ WHERE creator = '[email protected]';
+
+UPDATE task_run SET creator = NULL
+ WHERE creator = '[email protected]';
+
+-- Step 3: Delete the SystemBot principal row
+DELETE FROM principal WHERE id = 1 AND email = '[email protected]';
+```
+
+### Migration Files
+
+- Create: `backend/migrator/migration/X.XX/0001##remove_system_bot.sql`
+- Update: `backend/migrator/migration/LATEST.sql` (remove SystemBot INSERT, update table definitions)
+- Update: `backend/migrator/migrator_test.go` TestLatestVersion
+
+## Backend Code Changes
+
+### Store Layer Changes
+
+Update store methods to handle empty string as system sentinel:
+
+```go
+// CreateIssueComments - update to convert "" to NULL
+func (s *Store) CreateIssueComments(ctx context.Context, creator string, create *IssueCommentMessage) (*IssueCommentMessage, error) {
+ var creatorPtr *string
+ if creator == "" {
+ creatorPtr = nil // NULL for system
+ } else {
+ creatorPtr = &creator
+ }
+
+ // Use creatorPtr in INSERT query
+ // ...
+}
+
+// CreatePendingTaskRuns - update similarly
+// UpdateTaskRunStatus - update TaskRunStatusPatch.Updater handling
+```
+
+### API Layer Changes
+
+Replace all `common.SystemBotEmail` with `""`:
+
+```go
+// issue_service.go - Issue status change comments
+s.store.CreateIssueComments(ctx, "", &store.IssueCommentMessage{...})
+
+// rollout_service.go - Auto-rollout task runs
+s.CreatePendingTaskRuns(ctx, "", create)
+s.CreateIssueComments(ctx, "", &store.IssueCommentMessage{...})
+
+// running_scheduler.go & pending_scheduler.go - Task run updates
+s.store.UpdateTaskRunStatus(ctx, &store.TaskRunStatusPatch{
+ ID: taskRun.ID,
+ Updater: "", // System update
+ Status: storepb.TaskRun_AVAILABLE,
+})
+```
+
+### Remove Special Cases
+
+```go
+// user_service.go - Remove SystemBot special case
+// DELETE this entire block:
+if email == common.SystemBotEmail {
+ v1User, err := convertToUser(ctx, s.iamManager, store.SystemBotUser)
+ // ...
+}
+
+// issue_service.go & approval/runner.go - Remove fallback to SystemBotUser
+// When creator fetch fails, handle as deleted/unknown user, not SystemBot
+```
+
+### Delete Constants
+
+```go
+// backend/common/const.go - Remove:
+// - SystemBotID
+// - SystemBotEmail
+
+// backend/store/principal.go - Remove:
+// - SystemBotUser variable
+// - UpdateUser SystemBotID check
+```
+
+## Frontend Changes
+
+### Remove Constants
+
+```typescript
+// frontend/src/types/common.ts - DELETE:
+export const SYSTEM_BOT_ID = 1;
+export const SYSTEM_BOT_EMAIL = "[email protected]";
+```
+
+### Update User Display Logic
+
+Add helper function to display creator/user names:
+
+```typescript
+// frontend/src/utils/user.ts (or appropriate location)
+export const displayUserName = (user: User | null | undefined): string => {
+ if (!user || !user.email) {
+ return t('common.system'); // Returns "System" (internationalized)
+ }
+ return user.name || user.email;
+};
+```
+
+### Update i18n Files
+
+```json
+// frontend/src/locales/en-US.json
+{
+ "common": {
+ "system": "System"
+ }
+}
+
+// frontend/src/locales/zh-CN.json
+{
+ "common": {
+ "system": "系统"
+ }
+}
+```
+
+### Remove Special Case Handling
+
+```typescript
+// frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
+// REMOVE check for SYSTEM_BOT_USER_NAME - it won't exist anymore
+
+// Any other places checking SYSTEM_BOT_EMAIL or SYSTEM_BOT_ID:
+// - Replace with null/undefined checks
+// - Use displayUserName() helper
+```
+
+### Component Updates
+
+Anywhere displaying creators/updaters (issue lists, task run lists, comments, etc.):
+- Use `displayUserName()` helper
+- Handle null/undefined gracefully
+- Display "System" label with appropriate styling (possibly greyed out or with a system icon)
+
+## Testing Considerations
+
+### Unit Tests to Update
+
+1. **Store tests** - Update any tests that reference SystemBotUser:
+ - Tests for `CreateIssueComments` with empty string creator
+ - Tests for `UpdateTaskRunStatus` with empty string updater
+ - Verify NULL is correctly stored in database
+ - Remove tests checking SystemBotID validation
+
+2. **API tests** - Update tests that:
+ - Check for SystemBot in user lists
+ - Fetch SystemBot user by email
+ - Verify issue comment creation with system creator
+
+3. **Migration tests** - Verify:
+ - `TestLatestVersion` passes with updated version
+ - Schema correctly has nullable columns
+ - SystemBot row is absent from fresh database
+
+### Integration Tests to Add
+
+1. **Task scheduler flow**:
+ - Verify task runs created with NULL creator
+ - Verify status updates use NULL updater
+ - Check UI displays "System" correctly
+
+2. **Issue status changes**:
+ - Verify system comments have NULL creator
+ - Check UI renders system comments correctly
+ - Ensure webhook events handle NULL creator gracefully
+
+3. **Migration verification**:
+ - Run migration on test database with existing SystemBot data
+ - Verify all `[email protected]` converted to NULL
+ - Verify SystemBot row deleted successfully
+ - Verify foreign keys work correctly
+
+### Manual Testing Checklist
+
+- [ ] Create task run via scheduler → creator is NULL, displays "System"
+- [ ] Change issue status → system comment created, displays "System"
+- [ ] View existing migrated records → display "System" for old SystemBot records
+- [ ] User list API → no SystemBot user returned
+- [ ] GetUser API with old SystemBot email → returns 404 or not found
+
+## Implementation Order
+
+1. Database migration (schema + data)
+2. Backend store layer changes (handle "" → NULL)
+3. Backend API layer changes (replace SystemBotEmail with "")
+4. Backend cleanup (remove constants and special cases)
+5. Frontend changes (remove constants, add display logic)
+6. Frontend i18n updates
+7. Test updates
+8. Integration testing
diff --git a/docs/plans/2026-01-29-remove-system-bot-user.md b/docs/plans/2026-01-29-remove-system-bot-user.md
new file mode 100644
index 0000000000..7f90d3079b
--- /dev/null
+++ b/docs/plans/2026-01-29-remove-system-bot-user.md
@@ -0,0 +1,887 @@
+# Remove SystemBotUser Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Remove SystemBotUser concept entirely - use NULL for system-generated actions
+
+**Architecture:** Database migration makes creator columns nullable for issue_comment and task_run tables. Backend uses empty string "" as sentinel that gets converted to NULL in store layer. Frontend displays "System" for null creators.
+
+**Tech Stack:** PostgreSQL, Go, TypeScript/Vue, i18n
+
+---
+
+## Task 1: Create Database Migration
+
+**Files:**
+- Create: `backend/migrator/migration/3.15/0006##remove_system_bot.sql`
+
+**Step 1: Create migration file**
+
+Create the migration SQL file with schema changes and data cleanup:
+
+```sql
+-- Make issue_comment.creator nullable
+ALTER TABLE issue_comment ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE issue_comment DROP CONSTRAINT issue_comment_creator_fkey;
+ALTER TABLE issue_comment ADD CONSTRAINT issue_comment_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+
+-- Make task_run.creator nullable
+ALTER TABLE task_run ALTER COLUMN creator DROP NOT NULL;
+ALTER TABLE task_run DROP CONSTRAINT task_run_creator_fkey;
+ALTER TABLE task_run ADD CONSTRAINT task_run_creator_fkey
+ FOREIGN KEY (creator) REFERENCES principal(email)
+ ON UPDATE CASCADE ON DELETE SET NULL;
+
+-- Convert all existing SystemBot records to NULL
+UPDATE issue_comment SET creator = NULL
+ WHERE creator = '[email protected]';
+
+UPDATE task_run SET creator = NULL
+ WHERE creator = '[email protected]';
+
+-- Delete the SystemBot principal row
+DELETE FROM principal WHERE id = 1 AND email = '[email protected]';
+```
+
+**Step 2: Commit migration file**
+
+```bash
+git add backend/migrator/migration/3.15/0006##remove_system_bot.sql
+git commit -m "chore: add migration to remove SystemBot user
+
+- Make issue_comment.creator and task_run.creator nullable
+- Convert existing SystemBot records to NULL
+- Delete SystemBot principal row
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 2: Update LATEST.sql Schema
+
+**Files:**
+- Modify: `backend/migrator/migration/LATEST.sql`
+
+**Step 1: Update issue_comment table definition**
+
+Find the issue_comment table definition (around line 374) and change:
+```sql
+-- FROM:
+creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,
+
+-- TO:
+creator text REFERENCES principal(email) ON UPDATE CASCADE ON DELETE SET NULL,
+```
+
+**Step 2: Update task_run table definition**
+
+Find the task_run table definition (around line 264) and change:
+```sql
+-- FROM:
+creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,
+
+-- TO:
+creator text REFERENCES principal(email) ON UPDATE CASCADE ON DELETE SET NULL,
+```
+
+**Step 3: Remove SystemBot INSERT statement**
+
+Find and delete the line (around line 593):
+```sql
+-- DELETE THIS LINE:
+INSERT INTO principal (id, type, name, email, password_hash) VALUES (1, 'SYSTEM_BOT', 'Bytebase', '[email protected]', '');
+```
+
+**Step 4: Commit LATEST.sql changes**
+
+```bash
+git add backend/migrator/migration/LATEST.sql
+git commit -m "chore: update LATEST.sql to reflect SystemBot removal
+
+- Make creator columns nullable in issue_comment and task_run
+- Remove SystemBot INSERT statement
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 3: Update Migration Test
+
+**Files:**
+- Modify: `backend/migrator/migrator_test.go:15-16`
+
+**Step 1: Update TestLatestVersion**
+
+Change the test to expect the new version:
+```go
+// FROM:
+require.Equal(t, semver.MustParse("3.15.5"), *files[len(files)-1].version)
+require.Equal(t, "migration/3.15/0005##migrate_iam_binding_member_prefix.sql", files[len(files)-1].path)
+
+// TO:
+require.Equal(t, semver.MustParse("3.15.6"), *files[len(files)-1].version)
+require.Equal(t, "migration/3.15/0006##remove_system_bot.sql", files[len(files)-1].path)
+```
+
+**Step 2: Run migration test**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/migrator -run ^TestLatestVersion$`
+Expected: PASS
+
+**Step 3: Commit test update**
+
+```bash
+git add backend/migrator/migrator_test.go
+git commit -m "test: update TestLatestVersion for SystemBot removal
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 4: Update Store Layer - issue_comment.go
+
+**Files:**
+- Modify: `backend/store/issue_comment.go:124-145`
+
+**Step 1: Update CreateIssueComments to handle empty creator**
+
+Modify the CreateIssueComments function:
+```go
+func (s *Store) CreateIssueComments(ctx context.Context, creator string, creates ...*IssueCommentMessage) (*IssueCommentMessage, error) {
+ if len(creates) == 0 {
+ return nil, nil
+ }
+
+ // Prepare all payloads.
+ issueIDs := make([]int, 0, len(creates))
+ payloads := make([][]byte, 0, len(creates))
+ for _, create := range creates {
+ payload, err := protojson.Marshal(create.Payload)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to marshal payload")
+ }
+ issueIDs = append(issueIDs, create.IssueUID)
+ payloads = append(payloads, payload)
+ }
+
+ // Convert empty string to NULL for system-generated comments
+ var creatorPtr any
+ if creator == "" {
+ creatorPtr = nil
+ } else {
+ creatorPtr = creator
+ }
+
+ // Use UNNEST to insert all comments in one query.
+ q := qb.Q().Space(`
+ INSERT INTO issue_comment (creator, issue_id, payload)
+ SELECT ?, unnest(?::INT[]), unnest(?::JSONB[])
+ `, creatorPtr, issueIDs, payloads)
+
+ // Rest of function remains unchanged...
+```
+
+**Step 2: Update ListIssueComment to handle NULL creator**
+
+The SELECT already handles this, but ensure CreatorEmail can be NULL:
+```go
+// Around line 100 in the Scan, CreatorEmail already uses sql.NullString or similar
+// Verify the scan handles NULL properly - if it scans directly to string, change to:
+var creatorEmail sql.NullString
+if err := rows.Scan(
+ &ic.UID,
+ &creatorEmail, // Changed from &ic.CreatorEmail
+ &ic.CreatedAt,
+ &ic.UpdatedAt,
+ &ic.IssueUID,
+ &p,
+); err != nil {
+ return nil, err
+}
+if creatorEmail.Valid {
+ ic.CreatorEmail = creatorEmail.String
+}
+// Continue with rest of scan logic...
+```
+
+**Step 3: Run affected tests**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/store -run IssueComment`
+Expected: PASS
+
+**Step 4: Commit store changes**
+
+```bash
+git add backend/store/issue_comment.go
+git commit -m "feat: handle NULL creator in issue comments
+
+- Convert empty string to NULL when creating comments
+- Handle NULL when scanning creator from database
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 5: Update Store Layer - task_run.go
+
+**Files:**
+- Modify: `backend/store/task_run.go:192-250,294-350`
+
+**Step 1: Update patchTaskRunStatusImpl to handle empty updater**
+
+Find patchTaskRunStatusImpl function (check around line 220-250) and update to convert empty string to NULL:
+```go
+func (s *Store) patchTaskRunStatusImpl(ctx context.Context, tx *sql.Tx, patch *TaskRunStatusPatch) (*TaskRunMessage, error) {
+ set := qb.Q()
+ set.Comma("updated_at = ?", time.Now())
+
+ // Convert empty string to NULL for system updates
+ var updaterPtr any
+ if patch.Updater == "" {
+ updaterPtr = nil
+ } else {
+ updaterPtr = patch.Updater
+ }
+ set.Comma("updater = ?", updaterPtr)
+
+ // Rest of function...
+```
+
+**Step 2: Update CreatePendingTaskRuns to handle empty creator**
+
+Modify around line 306-320:
+```go
+func (s *Store) CreatePendingTaskRuns(ctx context.Context, creator string, creates ...*TaskRunMessage) error {
+ if len(creates) == 0 {
+ return nil
+ }
+
+ var taskUIDs []int
+ var runAts []*time.Time
+ for _, create := range creates {
+ taskUIDs = append(taskUIDs, create.TaskUID)
+ runAts = append(runAts, create.RunAt)
+ }
+
+ // Convert empty string to NULL for system-created task runs
+ var creatorPtr any
+ if creator == "" {
+ creatorPtr = nil
+ } else {
+ creatorPtr = creator
+ }
+
+ // Single query that:
+ // 1. Filters out tasks with existing PENDING/RUNNING/DONE task runs (idempotent)
+ // 2. Calculates next attempt for each remaining task
+ // 3. Inserts task runs
+ // 4. Uses ON CONFLICT DO NOTHING to handle race conditions
+ q := qb.Q().Space(`
+ INSERT INTO task_run (
+ creator,
+ task_id,
+ // ... rest of fields
+ )
+ // ... rest of query, use creatorPtr instead of creator
+ `, creatorPtr, /* other params */)
+
+ // Rest of function...
+```
+
+**Step 3: Update ListTaskRuns scan to handle NULL creator**
+
+Around line 124-125, ensure CreatorEmail handles NULL:
+```go
+var creatorEmail sql.NullString
+if err := rows.Scan(
+ &taskRun.ID,
+ &creatorEmail, // Changed from &taskRun.CreatorEmail
+ &taskRun.CreatedAt,
+ &taskRun.UpdatedAt,
+ &taskRun.TaskUID,
+ &statusString,
+ &startedAt,
+ &runAt,
+ &resultJSON,
+ &payloadJSON,
+ &taskRun.PlanUID,
+ &taskRun.Environment,
+ &taskRun.ProjectID,
+); err != nil {
+ return nil, err
+}
+if creatorEmail.Valid {
+ taskRun.CreatorEmail = creatorEmail.String
+}
+```
+
+**Step 4: Run affected tests**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/store -run TaskRun`
+Expected: PASS
+
+**Step 5: Commit store changes**
+
+```bash
+git add backend/store/task_run.go
+git commit -m "feat: handle NULL creator in task runs
+
+- Convert empty string to NULL when creating/updating task runs
+- Handle NULL when scanning creator from database
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 6: Update API Layer - Replace SystemBotEmail
+
+**Files:**
+- Modify: `backend/api/v1/issue_service.go:1267`
+- Modify: `backend/api/v1/rollout_service.go:404,459`
+- Modify: `backend/runner/taskrun/pending_scheduler.go:167`
+- Modify: `backend/runner/taskrun/running_scheduler.go:121,143,188`
+
+**Step 1: Update issue_service.go**
+
+Replace SystemBotEmail with empty string:
+```go
+// Around line 1267
+// FROM:
+if _, err := s.store.CreateIssueComments(ctx, common.SystemBotEmail, &store.IssueCommentMessage{
+
+// TO:
+if _, err := s.store.CreateIssueComments(ctx, "", &store.IssueCommentMessage{
+```
+
+**Step 2: Update rollout_service.go**
+
+Replace both occurrences:
+```go
+// Around line 404
+// FROM:
+if _, err := s.CreateIssueComments(ctx, common.SystemBotEmail, &store.IssueCommentMessage{
+
+// TO:
+if _, err := s.CreateIssueComments(ctx, "", &store.IssueCommentMessage{
+
+// Around line 459
+// FROM:
+if err := s.CreatePendingTaskRuns(ctx, common.SystemBotEmail, create); err != nil {
+
+// TO:
+if err := s.CreatePendingTaskRuns(ctx, "", create); err != nil {
+```
+
+**Step 3: Update pending_scheduler.go**
+
+```go
+// Around line 167
+// FROM:
+if _, err := s.store.UpdateTaskRunStatus(ctx, &store.TaskRunStatusPatch{
+ ID: taskRun.ID,
+ Updater: common.SystemBotEmail,
+
+// TO:
+if _, err := s.store.UpdateTaskRunStatus(ctx, &store.TaskRunStatusPatch{
+ ID: taskRun.ID,
+ Updater: "",
+```
+
+**Step 4: Update running_scheduler.go (3 occurrences)**
+
+```go
+// Around line 121
+taskRunStatusPatch := &store.TaskRunStatusPatch{
+ ID: taskRunUID,
+ Updater: "", // FROM: common.SystemBotEmail
+ Status: storepb.TaskRun_CANCELED,
+
+// Around line 143
+taskRunStatusPatch := &store.TaskRunStatusPatch{
+ ID: taskRunUID,
+ Updater: "", // FROM: common.SystemBotEmail
+ Status: storepb.TaskRun_FAILED,
+
+// Around line 188
+taskRunStatusPatch := &store.TaskRunStatusPatch{
+ ID: taskRunUID,
+ Updater: "", // FROM: common.SystemBotEmail
+ Status: storepb.TaskRun_DONE,
+```
+
+**Step 5: Run golangci-lint**
+
+Run: `golangci-lint run --allow-parallel-runners backend/api/v1/... backend/runner/...`
+Expected: No issues (may need multiple runs)
+
+**Step 6: Commit API layer changes**
+
+```bash
+git add backend/api/v1/issue_service.go backend/api/v1/rollout_service.go backend/runner/taskrun/pending_scheduler.go backend/runner/taskrun/running_scheduler.go
+git commit -m "refactor: replace SystemBotEmail with empty string
+
+Use empty string as sentinel for system-generated actions.
+Store layer converts to NULL in database.
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 7: Remove SystemBot Special Cases
+
+**Files:**
+- Modify: `backend/api/v1/user_service.go:62-71`
+- Modify: `backend/api/v1/issue_service.go:754-758`
+- Modify: `backend/runner/approval/runner.go:898-902`
+
+**Step 1: Remove GetUser SystemBot special case**
+
+In user_service.go, delete the entire special case block:
+```go
+// DELETE lines 62-71:
+// Special case for SYSTEM_BOT user which is a built-in resource.
+// SYSTEM_BOT is stored in principal table with type='SYSTEM_BOT', but GetEndUserByEmail
+// only queries END_USER type. We use the static SystemBotUser here to avoid mixing user types.
+if email == common.SystemBotEmail {
+ v1User, err := convertToUser(ctx, s.iamManager, store.SystemBotUser)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user"))
+ }
+ return connect.NewResponse(v1User), nil
+}
+```
+
+**Step 2: Remove SystemBotUser fallback in issue_service.go**
+
+```go
+// Around line 754-758, change:
+// FROM:
+creator, err := s.store.GetPrincipalByEmail(ctx, issue.CreatorEmail)
+if err != nil {
+ slog.Warn("failed to get issue creator, using system bot", log.BBError(err))
+ creator = store.SystemBotUser
+}
+
+// TO:
+creator, err := s.store.GetPrincipalByEmail(ctx, issue.CreatorEmail)
+if err != nil {
+ slog.Warn("failed to get issue creator", log.BBError(err))
+ // Skip webhook if creator not found
+ return nil
+}
+```
+
+**Step 3: Remove SystemBotUser fallback in approval/runner.go**
+
+```go
+// Around line 898-902, change:
+// FROM:
+creator, err := stores.GetPrincipalByEmail(ctx, issue.CreatorEmail)
+if err != nil {
+ slog.Warn("failed to get issue creator, using system bot", log.BBError(err))
+ creator = store.SystemBotUser
+}
+
+// TO:
+creator, err := stores.GetPrincipalByEmail(ctx, issue.CreatorEmail)
+if err != nil {
+ slog.Warn("failed to get issue creator", log.BBError(err))
+ // Use default/unknown user for approval checks
+ return errors.Wrap(err, "creator not found")
+}
+```
+
+**Step 4: Run golangci-lint**
+
+Run: `golangci-lint run --allow-parallel-runners backend/api/v1/... backend/runner/...`
+Expected: No issues
+
+**Step 5: Commit special case removal**
+
+```bash
+git add backend/api/v1/user_service.go backend/api/v1/issue_service.go backend/runner/approval/runner.go
+git commit -m "refactor: remove SystemBot special case handling
+
+- Remove GetUser special case for SystemBotEmail
+- Remove fallback to SystemBotUser when creator not found
+- Handle missing creators as errors instead
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 8: Delete SystemBot Constants
+
+**Files:**
+- Modify: `backend/common/const.go:5-9`
+- Modify: `backend/store/principal.go:18-24,575-577`
+
+**Step 1: Delete constants from common/const.go**
+
+Delete lines defining SystemBot constants:
+```go
+// DELETE lines 5-9:
+// SystemBotID is the ID of the system robot.
+SystemBotID = 1
+
+// SystemBotEmail is the email of the system robot.
+SystemBotEmail = "[email protected]"
+```
+
+**Step 2: Delete SystemBotUser variable from store/principal.go**
+
+Delete the variable definition:
+```go
+// DELETE lines 18-24:
+// SystemBotUser is the static system bot user.
+var SystemBotUser = &UserMessage{
+ ID: common.SystemBotID,
+ Name: "Bytebase",
+ Email: "[email protected]",
+ Type: storepb.PrincipalType_SYSTEM_BOT,
+ Profile: &storepb.UserProfile{},
+}
+```
+
+**Step 3: Remove UpdateUser SystemBotID check**
+
+Delete the check in UpdateUser function (around line 575-577):
+```go
+// DELETE:
+if currentUser.ID == common.SystemBotID {
+ return nil, errors.Errorf("cannot update system bot")
+}
+```
+
+**Step 4: Run golangci-lint repeatedly**
+
+Run: `golangci-lint run --allow-parallel-runners`
+Expected: No issues (run multiple times until clean)
+
+**Step 5: Commit constant deletion**
+
+```bash
+git add backend/common/const.go backend/store/principal.go
+git commit -m "refactor: delete SystemBot constants and variables
+
+- Remove SystemBotID and SystemBotEmail constants
+- Remove SystemBotUser variable
+- Remove UpdateUser SystemBot check
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 9: Update Frontend - Remove Constants
+
+**Files:**
+- Modify: `frontend/src/types/common.ts:1-4`
+
+**Step 1: Delete SYSTEM_BOT constants**
+
+Delete the constant definitions:
+```typescript
+// DELETE lines 1-4:
+// System bot ID
+export const SYSTEM_BOT_ID = 1;
+// System bot email
+export const SYSTEM_BOT_EMAIL = "[email protected]";
+```
+
+**Step 2: Search for usage**
+
+Run: `grep -r "SYSTEM_BOT_ID\|SYSTEM_BOT_EMAIL" frontend/src/`
+Expected: Find usages to replace in next tasks
+
+**Step 3: Commit constant deletion**
+
+```bash
+git add frontend/src/types/common.ts
+git commit -m "refactor: remove SYSTEM_BOT constants from frontend
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 10: Add i18n Translations
+
+**Files:**
+- Modify: `frontend/src/locales/en-US.json`
+- Modify: `frontend/src/locales/zh-CN.json`
+- Modify: `frontend/src/locales/es-ES.json` (if exists)
+- Modify: `frontend/src/locales/ja-JP.json` (if exists)
+
+**Step 1: Add "system" to en-US.json**
+
+Find the "common" section and add:
+```json
+{
+ "common": {
+ ...existing keys...,
+ "system": "System"
+ }
+}
+```
+
+**Step 2: Add "system" to zh-CN.json**
+
+```json
+{
+ "common": {
+ ...existing keys...,
+ "system": "系统"
+ }
+}
+```
+
+**Step 3: Add to other locale files if they exist**
+
+Check and update other locale files with appropriate translations.
+
+**Step 4: Run frontend linter**
+
+Run: `pnpm --dir frontend fix`
+Expected: No errors
+
+**Step 5: Commit i18n changes**
+
+```bash
+git add frontend/src/locales/
+git commit -m "feat: add 'system' translation for NULL creators
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 11: Remove Frontend Special Case Handling
+
+**Files:**
+- Modify: `frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue`
+
+**Step 1: Find and read UserOperationsCell.vue**
+
+Read the file to find the SystemBot check (around line 69-71).
+
+**Step 2: Remove SYSTEM_BOT_USER_NAME check**
+
+```typescript
+// FROM (around line 68-72):
+const user = props.binding.user ?? unknownUser();
+if (user.name === SYSTEM_BOT_USER_NAME) {
+ // Cannot edit the member binding for [email protected], but can edit allUsers
+ return false;
+}
+
+// TO:
+const user = props.binding.user ?? unknownUser();
+// System user is no longer in the database, no special check needed
+```
+
+**Step 3: Search for other SYSTEM_BOT references**
+
+Run: `grep -r "SYSTEM_BOT" frontend/src/`
+Expected: No remaining references (or handle them)
+
+**Step 4: Run frontend checks**
+
+Run: `pnpm --dir frontend fix && pnpm --dir frontend type-check`
+Expected: PASS
+
+**Step 5: Commit frontend cleanup**
+
+```bash
+git add frontend/src/components/
+git commit -m "refactor: remove SystemBot special case checks
+
+SystemBot no longer exists in database.
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 12: Update Frontend User Display Logic
+
+**Files:**
+- Search and update components displaying creators/users
+
+**Step 1: Find components displaying creator/user**
+
+Run: `grep -r "creator\|\.user" frontend/src/components/ | grep -i "\.name\|\.email"`
+Expected: List of files to review
+
+**Step 2: Update to handle null/undefined users**
+
+For each component found, ensure it handles null/undefined:
+```typescript
+// Example pattern:
+// FROM:
+{{ user.name || user.email }}
+
+// TO:
+{{ user?.name || user?.email || $t('common.system') }}
+```
+
+**Step 3: Run frontend checks**
+
+Run: `pnpm --dir frontend fix && pnpm --dir frontend type-check`
+Expected: PASS
+
+**Step 4: Commit display logic updates**
+
+```bash
+git add frontend/src/components/
+git commit -m "feat: display 'System' for null/undefined users
+
+Use i18n common.system when user is null or undefined.
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 13: Run Backend Tests
+
+**Files:**
+- Test: All backend tests
+
+**Step 1: Run store tests**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/store/...`
+Expected: PASS (fix any failures)
+
+**Step 2: Run API tests**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/api/...`
+Expected: PASS (fix any failures)
+
+**Step 3: Run migration tests**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/migrator/...`
+Expected: PASS
+
+**Step 4: Run all backend tests**
+
+Run: `go test -v -count=1 github.com/bytebase/bytebase/backend/...`
+Expected: PASS
+
+**Step 5: If tests fail, fix and commit**
+
+If tests need updates:
+```bash
+git add <test files>
+git commit -m "test: update tests for SystemBot removal
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 14: Run Frontend Tests
+
+**Files:**
+- Test: All frontend tests
+
+**Step 1: Run type check**
+
+Run: `pnpm --dir frontend type-check`
+Expected: PASS
+
+**Step 2: Run linter**
+
+Run: `pnpm --dir frontend check`
+Expected: PASS
+
+**Step 3: Run unit tests**
+
+Run: `pnpm --dir frontend test`
+Expected: PASS (or fix failures)
+
+**Step 4: If tests fail, fix and commit**
+
+```bash
+git add frontend/
+git commit -m "test: update frontend tests for SystemBot removal
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 15: Build and Manual Verification
+
+**Files:**
+- Build: Backend and frontend
+
+**Step 1: Build backend**
+
+Run: `go build -ldflags "-w -s" -p=16 -o ./bytebase-build/bytebase ./backend/bin/server/main.go`
+Expected: Success
+
+**Step 2: Run golangci-lint final check**
+
+Run: `golangci-lint run --allow-parallel-runners`
+Expected: No issues (run multiple times if needed)
+
+**Step 3: Build frontend**
+
+Run: `pnpm --dir frontend fix`
+Expected: Success
+
+**Step 4: Start application and verify**
+
+Manual testing:
+- Start application
+- Trigger task run → verify creator is NULL in DB, displays "System" in UI
+- Change issue status → verify comment creator is NULL, displays "System"
+- List users → verify no SystemBot user appears
+
+**Step 5: Final commit if any fixes needed**
+
+```bash
+git add .
+git commit -m "fix: final adjustments for SystemBot removal
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Verification Checklist
+
+After all tasks complete:
+
+- [ ] Migration file created and passes TestLatestVersion
+- [ ] LATEST.sql updated (nullable columns, no SystemBot INSERT)
+- [ ] Store layer converts "" to NULL for issue_comment and task_run
+- [ ] API layer uses "" instead of common.SystemBotEmail
+- [ ] SystemBot constants deleted from backend
+- [ ] SystemBot special cases removed
+- [ ] Frontend constants deleted
+- [ ] i18n translations added for "System"
+- [ ] Frontend displays "System" for null users
+- [ ] All backend tests pass
+- [ ] All frontend tests pass
+- [ ] Build succeeds
+- [ ] Manual verification confirms NULL creators display as "System"
+
+---
+
+## Notes
+
+- Use @superpowers:verification-before-completion before claiming tasks complete
+- Run golangci-lint multiple times due to max-issues limit
+- Commit frequently (after each task)
+- Test after each layer (store, API, frontend)
diff --git a/frontend/src/bbkit/BBAvatar.vue b/frontend/src/bbkit/BBAvatar.vue
index e88213a286..8738d84682 100644
--- a/frontend/src/bbkit/BBAvatar.vue
+++ b/frontend/src/bbkit/BBAvatar.vue
@@ -14,14 +14,10 @@
<script lang="ts" setup>
import isChinese from "is-chinese";
import { computed } from "vue";
-import { SYSTEM_BOT_EMAIL } from "@/types";
import type { VueClass } from "@/utils";
-import { callCssVariable } from "@/utils";
import { hashCode } from "./BBUtil";
import type { BBAvatarSizeType } from "./types";
-const DEFAULT_BRANDING_COLOR = "#4f46e5";
-
const BACKGROUND_COLOR_LIST: string[] = [
"#64748B",
"#EF4444",
@@ -85,10 +81,6 @@ const initials = computed(() => {
return "?";
}
- if (props.email === SYSTEM_BOT_EMAIL) {
- return "BB";
- }
-
// Priority
// 1. First Chinese character
// 2. At most the first 2 letters in email
@@ -134,9 +126,6 @@ const initials = computed(() => {
});
const backgroundColor = computed(() => {
- if (props.email === SYSTEM_BOT_EMAIL) {
- return callCssVariable("--color-accent") || DEFAULT_BRANDING_COLOR;
- }
return (
props.backgroundColor ||
BACKGROUND_COLOR_LIST[
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts b/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts
index ce626c15e5..77dc24d263 100644
--- a/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts
+++ b/frontend/src/components/IssueV1/components/IssueSearch/useIssueSearchScopeOptions.ts
@@ -8,10 +8,9 @@ import type {
ValueOption,
} from "@/components/AdvancedSearch/types";
import { useCommonSearchScopeOptions } from "@/components/AdvancedSearch/useCommonSearchScopeOptions";
-import SystemBotTag from "@/components/misc/SystemBotTag.vue";
import YouTag from "@/components/misc/YouTag.vue";
import { useCurrentUserV1, useProjectV1Store, useUserStore } from "@/store";
-import { isValidProjectName, SYSTEM_BOT_USER_NAME } from "@/types";
+import { isValidProjectName } from "@/types";
import {
Issue_ApprovalStatus,
IssueStatus,
@@ -87,7 +86,6 @@ export const useIssueSearchScopeOptions = (
return {
value: user.email,
keywords: [user.email, user.title],
- bot: user.name === SYSTEM_BOT_USER_NAME,
render: () => {
const children = [
h(BBAvatar, { size: "TINY", username: user.title }),
@@ -96,9 +94,6 @@ export const useIssueSearchScopeOptions = (
if (user.name === me.value.name) {
children.push(h(YouTag));
}
- if (user.name === SYSTEM_BOT_USER_NAME) {
- children.push(h(SystemBotTag));
- }
return h(
"div",
{ class: "flex items-center gap-x-1" },
@@ -168,7 +163,7 @@ export const useIssueSearchScopeOptions = (
search: searchPrincipalSearchValueOptions([
UserType.USER,
UserType.SERVICE_ACCOUNT,
- UserType.SYSTEM_BOT,
+ UserType.WORKLOAD_IDENTITY,
]),
},
{
diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
index 612b16c8e4..406a7438cc 100644
--- a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
+++ b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
@@ -1,10 +1,7 @@
<template>
<div v-if="allowEdit" class="flex justify-end gap-x-2">
<NPopconfirm
- v-if="
- allowRevoke &&
- (scope === 'workspace' || binding.projectRoleBindings.length > 0)
- "
+ v-if="scope === 'workspace' || binding.projectRoleBindings.length > 0"
:positive-button-props="{
type: 'error',
}"
@@ -37,7 +34,7 @@ import { PencilIcon, Trash2Icon } from "lucide-vue-next";
import { NPopconfirm } from "naive-ui";
import { computed } from "vue";
import { MiniActionButton } from "@/components/v2";
-import { SYSTEM_BOT_USER_NAME, unknownUser } from "@/types";
+import { unknownUser } from "@/types";
import { State } from "@/types/proto-es/v1/common_pb";
import type { MemberBinding } from "../../types";
@@ -52,24 +49,12 @@ defineEmits<{
(event: "revoke-binding"): void;
}>();
-const allowRevoke = computed(() => {
- if (props.binding.type === "groups") {
- return true;
- }
- const user = props.binding.user ?? unknownUser();
- return user.name !== SYSTEM_BOT_USER_NAME;
-});
-
const allowUpdate = computed(() => {
if (props.binding.type === "groups") {
return props.allowEdit && !props.binding.group?.deleted;
}
const user = props.binding.user ?? unknownUser();
- if (user.name === SYSTEM_BOT_USER_NAME) {
- // Cannot edit the member binding for [email protected], but can edit allUsers
- return false;
- }
return user.state === State.ACTIVE;
});
</script>
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionCreator.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionCreator.vue
index f19112f1d4..4de7f78b79 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionCreator.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionCreator.vue
@@ -1,32 +1,21 @@
<template>
- <div v-if="userEmail === userStore.systemBotUser?.email" class="inline-flex items-center gap-1">
- <span class="font-medium text-main whitespace-nowrap">
- {{ user?.title }}
- </span>
- <SystemBotTag />
- </div>
- <UserLink v-else-if="user" :title="user.title" :email="user.email" />
- <span v-else class="font-medium text-main whitespace-nowrap">-</span>
+ <UserLink v-if="user" :title="user.title" :email="user.email" />
+ <span v-else class="font-medium text-error">{{ $t("common.unknown") }}</span>
</template>
<script lang="ts" setup>
import { computedAsync } from "@vueuse/core";
-import { computed } from "vue";
-import SystemBotTag from "@/components/misc/SystemBotTag.vue";
import { UserLink } from "@/components/v2/Model/cells";
-import { extractUserId, useUserStore } from "@/store";
+import { useUserStore } from "@/store";
const props = defineProps<{
// Format: users/{email}
+ // Issue comments always have a real user creator
creator: string;
}>();
const userStore = useUserStore();
-const userEmail = computed(() => {
- return extractUserId(props.creator);
-});
-
const user = computedAsync(() => {
return userStore.getOrFetchUserByIdentifier(props.creator);
});
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionIcon.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionIcon.vue
index 3c9363606b..bc2a359f6c 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionIcon.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionIcon.vue
@@ -1,13 +1,6 @@
<template>
<div class="relative">
- <div v-if="iconConfig.type === 'system'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <img class="mt-1" src="@/assets/logo-icon.svg" alt="Bytebase" />
- </div>
- </div>
- <div v-else-if="iconConfig.type === 'avatar'" class="relative pl-0.5">
+ <div v-if="iconConfig.type === 'avatar'" class="relative pl-0.5">
<div
class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"
>
@@ -46,18 +39,12 @@ import type { Component } from "vue";
import { computed } from "vue";
import { SkipIcon } from "@/components/Icon";
import UserAvatar from "@/components/User/UserAvatar.vue";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useUserStore,
-} from "@/store";
+import { getIssueCommentType, IssueCommentType, useUserStore } from "@/store";
import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
import { IssueComment_Approval_Status } from "@/types/proto-es/v1/issue_service_pb";
type ActionIconType =
| "avatar"
- | "system"
| "create"
| "update"
| "run"
@@ -72,7 +59,7 @@ type ActionIconType =
| "commit";
interface IconConfig {
- type: "system" | "avatar" | "icon";
+ type: "avatar" | "icon";
wrapper?: string;
container?: string;
icon?: Component;
@@ -80,7 +67,7 @@ interface IconConfig {
}
const ICON_CONFIGS: Record<
- Exclude<ActionIconType, "system" | "avatar">,
+ Exclude<ActionIconType, "avatar">,
Omit<IconConfig, "type">
> = {
create: {
@@ -206,14 +193,13 @@ const iconType = computed((): ActionIconType => {
return "update";
}
- return extractUserId(issueComment.creator) === userStore.systemBotUser?.email
- ? "system"
- : "avatar";
+ // Issue comments always have a real user creator
+ return "avatar";
});
const iconConfig = computed((): IconConfig => {
const type = iconType.value;
- if (type === "system" || type === "avatar") {
+ if (type === "avatar") {
return { type };
}
return { type: "icon", ...ICON_CONFIGS[type] };
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionSentence.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionSentence.vue
index 9227e14bc0..0cd930748f 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionSentence.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/ActionSentence.vue
@@ -7,12 +7,7 @@ import { defineComponent } from "vue";
import { Translation, useI18n } from "vue-i18n";
import { usePlanContext } from "@/components/Plan/logic";
import { SpecLink } from "@/components/v2";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useUserStore,
-} from "@/store";
+import { getIssueCommentType, IssueCommentType } from "@/store";
import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
import {
IssueComment_Approval_Status,
@@ -30,21 +25,8 @@ const props = defineProps<{
}>();
const { t } = useI18n();
-const userStore = useUserStore();
const { plan } = usePlanContext();
-const maybeAutomaticallyVerb = (
- issueComment: IssueComment,
- verb: string
-): string => {
- if (extractUserId(issueComment.creator) !== userStore.systemBotUser?.email) {
- return verb;
- }
- return t("activity.sentence.xxx-automatically", {
- verb,
- });
-};
-
const renderActionSentence = () => {
const { issueComment } = props;
const commentType = getIssueCommentType(issueComment);
@@ -62,7 +44,7 @@ const renderActionSentence = () => {
verb = t("custom-approval.issue-review.re-requested-review");
}
if (verb) {
- return maybeAutomaticallyVerb(issueComment, verb);
+ return verb;
}
} else if (
commentType === IssueCommentType.ISSUE_UPDATE &&
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/IssueCommentAction.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/IssueCommentAction.vue
index 59e2be6985..3893f3f24e 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/IssueCommentAction.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/IssueCommentView/IssueCommentAction.vue
@@ -11,15 +11,7 @@
<div class="px-3 py-2" :class="$slots.comment ? 'bg-gray-50' : ''">
<div class="flex items-center justify-between">
<div class="flex items-center gap-x-2 text-sm min-w-0 flex-wrap">
- <ActionCreator
- v-if="
- extractUserId(issueComment.creator) !==
- userStore.systemBotUser?.email ||
- getIssueCommentType(issueComment) ===
- IssueCommentType.USER_COMMENT
- "
- :creator="issueComment.creator"
- />
+ <ActionCreator :creator="issueComment.creator" />
<ActionSentence
:issue-comment="issueComment"
@@ -61,12 +53,7 @@
<script lang="ts" setup>
import HumanizeTs from "@/components/misc/HumanizeTs.vue";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useUserStore,
-} from "@/store";
+import { getIssueCommentType, IssueCommentType } from "@/store";
import { getTimeForPbTimestampProtoEs } from "@/types";
import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
import ActionCreator from "./ActionCreator.vue";
@@ -75,6 +62,4 @@ import ActionSentence from "./ActionSentence.vue";
defineProps<{
issueComment: IssueComment;
}>();
-
-const userStore = useUserStore();
</script>
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts
index 44d150cb0c..166ba7ab2c 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts
@@ -15,8 +15,7 @@ import {
useRoleStore,
useUserStore,
} from "@/store";
-import { userNamePrefix } from "@/store/modules/v1/common";
-import { groupBindingPrefix, PresetRoleType, SYSTEM_BOT_EMAIL } from "@/types";
+import { groupBindingPrefix, PresetRoleType } from "@/types";
import { State } from "@/types/proto-es/v1/common_pb";
import type {
Issue,
@@ -175,12 +174,7 @@ export function useApprovalStep(
const memberMap = memberMapToRolesInProjectIAM(policy, role);
candidates.push(...memberMap.keys());
}
- return uniq(
- candidates.filter((user) => {
- if (user === `${userNamePrefix}${SYSTEM_BOT_EMAIL}`) return false;
- return true;
- })
- );
+ return uniq(candidates);
});
const isCurrentUserInCandidates = computed(() => {
diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue
index c31abaa31e..0ca4d7fac0 100644
--- a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue
+++ b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue
@@ -116,9 +116,6 @@ const allowUndelete = computed(() => {
});
const canEdit = computed(() => {
- if (props.user.userType === UserType.SYSTEM_BOT) {
- return false;
- }
return props.user.state === State.ACTIVE;
});
diff --git a/frontend/src/components/v2/Model/cells/UserNameCell.vue b/frontend/src/components/v2/Model/cells/UserNameCell.vue
index cd5ccf99da..3beb8d1e19 100644
--- a/frontend/src/components/v2/Model/cells/UserNameCell.vue
+++ b/frontend/src/components/v2/Model/cells/UserNameCell.vue
@@ -31,7 +31,6 @@
{{ user.profile.source }}
</NTag>
<YouTag v-if="currentUserV1.name === user.name" :size="tagSize"/>
- <SystemBotTag v-if="user.name === SYSTEM_BOT_USER_NAME" :size="tagSize"/>
<AccountTag :user="user" :size="tagSize" />
<NTag v-if="user.mfaEnabled && showMfaEnabled" :size="tagSize" type="success" round>
{{ $t("two-factor.enabled") }}
@@ -40,7 +39,7 @@
</div>
<slot name="footer">
<NEllipsis
- v-if="user.name !== SYSTEM_BOT_USER_NAME && showEmail"
+ v-if="showEmail"
class="textinfolabel"
:line-clamp="1"
:tooltip="true"
@@ -88,12 +87,10 @@ import { ReplyIcon } from "lucide-vue-next";
import { NButton, NEllipsis, NTag } from "naive-ui";
import { computed } from "vue";
import AccountTag from "@/components/misc/AccountTag.vue";
-import SystemBotTag from "@/components/misc/SystemBotTag.vue";
import YouTag from "@/components/misc/YouTag.vue";
import UserAvatar from "@/components/User/UserAvatar.vue";
import { CopyButton, HighlightLabelText } from "@/components/v2";
import { useCurrentUserV1 } from "@/store";
-import { SYSTEM_BOT_USER_NAME } from "@/types";
import { State } from "@/types/proto-es/v1/common_pb";
import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";
import { hasWorkspacePermissionV2 } from "@/utils";
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 2d490696df..f7c50df322 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -948,8 +948,7 @@
"changed-from-to": "changed {name} from \"{oldValue}\" to \"{newValue}\"",
"reopened-issue": "reopened issue",
"resolved-issue": "completed the issue",
- "canceled-issue": "closed the issue",
- "xxx-automatically": "{verb} automatically"
+ "canceled-issue": "closed the issue"
}
},
"issue": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 774347dfea..4a186e22d0 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -948,8 +948,7 @@
"changed-from-to": "cambio de {name} de \"{oldValue}\" a \"{newValue}\"",
"reopened-issue": "incidencia reabierta",
"resolved-issue": "completó la incidencia",
- "canceled-issue": "cerró la incidencia",
- "xxx-automatically": "{verb} automáticamente"
+ "canceled-issue": "cerró la incidencia"
}
},
"issue": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index adad0da465..8250908180 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -948,8 +948,7 @@
"changed-from-to": "{name} を「{oldValue}」から「{newValue}」に変更します",
"reopened-issue": "イシューを再開する",
"resolved-issue": "イシューを完了する",
- "canceled-issue": "イシューを閉じた",
- "xxx-automatically": "自動{verb}"
+ "canceled-issue": "イシューを閉じた"
}
},
"issue": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 84ad414c30..0162362806 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -948,8 +948,7 @@
"changed-from-to": "đã thay đổi {name} từ \"{oldValue}\" thành \"{newValue}\"",
"reopened-issue": "đã mở lại vấn đề",
"resolved-issue": "đã hoàn tất vấn đề",
- "canceled-issue": "đã đóng vấn đề",
- "xxx-automatically": "{verb} tự động"
+ "canceled-issue": "đã đóng vấn đề"
}
},
"issue": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4e5efd7836..dd970ce147 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -948,8 +948,7 @@
"changed-from-to": "将 {name} 从 \"{oldValue}\" 修改为 \"{newValue}\"",
"reopened-issue": "重开工单",
"resolved-issue": "完成工单",
- "canceled-issue": "关闭工单",
- "xxx-automatically": "自动{verb}"
+ "canceled-issue": "关闭工单"
}
},
"issue": {
diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.ts
index 777dea3a54..0fa23c6652 100644
--- a/frontend/src/store/modules/user.ts
+++ b/frontend/src/store/modules/user.ts
@@ -1,6 +1,5 @@
import { create } from "@bufbuild/protobuf";
import { createContextValues } from "@connectrpc/connect";
-import { computedAsync } from "@vueuse/core";
import { isEqual, isUndefined, uniq } from "lodash-es";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
@@ -10,7 +9,6 @@ import {
allUsersUser,
isValidProjectName,
isValidUserName,
- SYSTEM_BOT_USER_NAME,
unknownUser,
userBindingPrefix,
} from "@/types";
@@ -289,13 +287,8 @@ export const useUserStore = defineStore("user", () => {
return userMapByName.value.get(`${userNamePrefix}${id}`);
};
- const systemBotUser = computedAsync(() => {
- return getOrFetchUserByIdentifier(SYSTEM_BOT_USER_NAME);
- });
-
return {
allUser,
- systemBotUser,
fetchCurrentUser,
fetchUserList,
createUser,
diff --git a/frontend/src/store/modules/v1/issue.ts b/frontend/src/store/modules/v1/issue.ts
index 5960c56c7f..35cb2d71d3 100644
--- a/frontend/src/store/modules/v1/issue.ts
+++ b/frontend/src/store/modules/v1/issue.ts
@@ -7,7 +7,7 @@ import type { WatchCallback } from "vue";
import { ref, watch } from "vue";
import { issueServiceClientConnect } from "@/connect";
import { silentContextKey } from "@/connect/context-key";
-import { type IssueFilter, SYSTEM_BOT_EMAIL } from "@/types";
+import { type IssueFilter } from "@/types";
import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import {
GetIssueRequestSchema,
@@ -21,7 +21,7 @@ import {
memberMapToRolesInProjectIAM,
} from "@/utils";
import { useUserStore } from "../user";
-import { projectNamePrefix, userNamePrefix } from "./common";
+import { projectNamePrefix } from "./common";
import { useProjectV1Store } from "./project";
import { useProjectIamPolicyStore } from "./projectIamPolicy";
@@ -135,10 +135,6 @@ export const candidatesOfApprovalStepV1 = (issue: Issue, role: string) => {
return uniq(
candidates.filter((user) => {
- // Exclude system bot user.
- if (user === `${userNamePrefix}${SYSTEM_BOT_EMAIL}`) {
- return false;
- }
// If the project does not allow self-approval, exclude the creator.
if (!project.allowSelfApproval && user === issue.creator) {
return false;
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 598beae058..ea2037843e 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -1,8 +1,3 @@
-// System bot id
-export const SYSTEM_BOT_ID = 1;
-// System bot email
-export const SYSTEM_BOT_EMAIL = "[email protected]";
-
// The delay for debouncing search input.
export const DEBOUNCE_SEARCH_DELAY = 300;
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 d7165f8b6b..db515140c1 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
@@ -107,7 +107,7 @@ export declare type ListUsersRequest = Message<"bytebase.v1.ListUsersRequest"> &
* Supported filter:
* - name: the user name, support "==" and ".matches()" operator.
* - email: the user email, support "==" and ".matches()" operator.
- * - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ * - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
* - state: check State enum for values, support "==" operator.
* - project: the project full name in "projects/{id}" format, support "==" operator.
*
@@ -117,7 +117,7 @@ export declare type ListUsersRequest = Message<"bytebase.v1.ListUsersRequest"> &
* email == "[email protected]"
* email.matches("ed")
* user_type == "USER"
- * user_type in ["SYSTEM_BOT", "USER"]
+ * user_type in ["SERVICE_ACCOUNT", "USER"]
* state == "DELETED"
* project == "projects/sample-project"
* You can combine filter conditions like:
@@ -540,11 +540,11 @@ export enum UserType {
USER = 1,
/**
- * System-managed bot account for automated operations.
+ * External CI/CD workload identity.
*
- * @generated from enum value: SYSTEM_BOT = 2;
+ * @generated from enum value: WORKLOAD_IDENTITY = 2;
*/
- SYSTEM_BOT = 2,
+ WORKLOAD_IDENTITY = 2,
/**
* Service account for API integrations.
@@ -552,13 +552,6 @@ export enum UserType {
* @generated from enum value: SERVICE_ACCOUNT = 3;
*/
SERVICE_ACCOUNT = 3,
-
- /**
- * External CI/CD workload identity.
- *
- * @generated from enum value: WORKLOAD_IDENTITY = 4;
- */
- WORKLOAD_IDENTITY = 4,
}
/**
diff --git a/frontend/src/types/proto-es/v1/user_service_pb.js b/frontend/src/types/proto-es/v1/user_service_pb.js
index 1b16d09afd..93ae7ca725 100644
--- a/frontend/src/types/proto-es/v1/user_service_pb.js
+++ b/frontend/src/types/proto-es/v1/user_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_common } from "./common_pb";
* Describes the file v1/user_service.proto.
*/
export const file_v1_user_service = /*@__PURE__*/
- fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0VXNlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkiTgoRTGlzdFVzZXJzUmVzcG9uc2USIAoFdXNlcnMYASADKAsyES5ieXRlYmFzZS52MS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI5ChFDcmVhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECIuwBChFVcGRhdGVVc2V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SmQEKC1VwZGF0ZUVtYWlsEh8uYnl0ZWJhc2UudjEuVXBkYXRlRW1haWxSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciJW2kEKbmFtZSxlbWFpbIrqMBRiYi51c2Vycy51cGRhdGVFbWFpbJDqMAGY6jABgtPkkwIjOgEqIh4vdjEve25hbWU9dXNlcnMvKn06dXBkYXRlRW1haWxCpgEKD2NvbS5ieXRlYmFzZS52MUIQVXNlclNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
+ fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0VXNlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkiTgoRTGlzdFVzZXJzUmVzcG9uc2USIAoFdXNlcnMYASADKAsyES5ieXRlYmFzZS52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RlbGV0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciIukOowApjqMAGC0+STAiA6ASoiGy92MS97bmFtZT11c2Vycy8qfTp1bmRlbGV0ZRKZAQoLVXBkYXRlRW1haWwSHy5ieXRlYmFzZS52MS5VcGRhdGVFbWFpbFJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIlbaQQpuYW1lLGVtYWlsiuowFGJiLnVzZXJzLnVwZGF0ZUVtYWlskOowAZjqMAGC0+STAiM6ASoiHi92MS97bmFtZT11c2Vycy8qfTp1cGRhdGVFbWFpbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBVc2VyU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
/**
* Describes the message bytebase.v1.GetUserRequest.
diff --git a/frontend/src/types/v1/user.ts b/frontend/src/types/v1/user.ts
index 4befee53fe..e6662abdce 100644
--- a/frontend/src/types/v1/user.ts
+++ b/frontend/src/types/v1/user.ts
@@ -1,14 +1,12 @@
import { create } from "@bufbuild/protobuf";
import { t } from "@/plugins/i18n";
import { extractUserId } from "@/store/modules/v1/common";
-import { SYSTEM_BOT_EMAIL } from "../common";
import { UNKNOWN_ID } from "../const";
import { State } from "../proto-es/v1/common_pb";
import type { User } from "../proto-es/v1/user_service_pb";
import { UserSchema, UserType } from "../proto-es/v1/user_service_pb";
export const UNKNOWN_USER_NAME = `users/${UNKNOWN_ID}`;
-export const SYSTEM_BOT_USER_NAME = `users/${SYSTEM_BOT_EMAIL}`;
export const unknownUser = (name: string = ""): User => {
const user = create(UserSchema, {
@@ -34,7 +32,7 @@ export const allUsersUser = (): User => {
state: State.ACTIVE,
title: t("settings.members.all-users"),
email: ALL_USERS_USER_EMAIL,
- userType: UserType.SYSTEM_BOT,
+ userType: UserType.USER,
});
};
@@ -91,9 +89,6 @@ export const isValidUserName = (name: string) => {
};
export const getUserTypeByEmail = (email: string): UserType => {
- if (email === SYSTEM_BOT_EMAIL) {
- return UserType.SYSTEM_BOT;
- }
if (email.endsWith(serviceAccountSuffix)) {
return UserType.SERVICE_ACCOUNT;
}
diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vue
index d362a74d47..d65af1ed16 100644
--- a/frontend/src/views/ProfileDashboard.vue
+++ b/frontend/src/views/ProfileDashboard.vue
@@ -256,12 +256,7 @@ import {
useUserStore,
useWorkspaceV1Store,
} from "@/store";
-import {
- ALL_USERS_USER_EMAIL,
- getUserTypeByEmail,
- SYSTEM_BOT_USER_NAME,
- unknownUser,
-} from "@/types";
+import { ALL_USERS_USER_EMAIL, getUserTypeByEmail, unknownUser } from "@/types";
import { State } from "@/types/proto-es/v1/common_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
import type { User } from "@/types/proto-es/v1/user_service_pb";
@@ -369,7 +364,6 @@ const allowGet = computed(
// Besides, owner can also change anyone's info. This is for resetting password in case user forgets.
const allowEdit = computed(() => {
if (
- user.value.name === SYSTEM_BOT_USER_NAME ||
user.value.email === ALL_USERS_USER_EMAIL ||
user.value.userType !== UserType.USER
) {
diff --git a/frontend/src/views/SettingWorkspaceMembers.vue b/frontend/src/views/SettingWorkspaceMembers.vue
index 063828ca6b..589050ef99 100644
--- a/frontend/src/views/SettingWorkspaceMembers.vue
+++ b/frontend/src/views/SettingWorkspaceMembers.vue
@@ -12,10 +12,7 @@
:allow-edit="allowEdit"
:bindings="memberBindings"
:selected-bindings="state.selectedMembers"
- :select-disabled="
- (member: MemberBinding) =>
- member.user?.userType === UserType.SYSTEM_BOT
- "
+ :select-disabled="() => false"
:on-click-user="onClickUser"
@update-binding="selectMember"
@revoke-binding="revokeMember"
@@ -103,7 +100,6 @@ import {
} from "@/store";
import { userBindingPrefix } from "@/types";
import type { User } from "@/types/proto-es/v1/user_service_pb";
-import { UserType } from "@/types/proto-es/v1/user_service_pb";
import { hasWorkspacePermissionV2 } from "@/utils";
interface LocalState {
diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vue
index 0dd8ac9130..b4a3202512 100644
--- a/frontend/src/views/SettingWorkspaceUsers.vue
+++ b/frontend/src/views/SettingWorkspaceUsers.vue
@@ -396,7 +396,7 @@ const fetchUserList = async ({
pageSize,
filter: {
query: state.activeUserFilterText,
- types: [UserType.USER, UserType.SYSTEM_BOT],
+ types: [UserType.USER],
},
});
return { list: users, nextPageToken };
@@ -415,7 +415,7 @@ const fetchInactiveUserList = async ({
filter: {
query: state.inactiveUserFilterText,
state: State.DELETED,
- types: [UserType.USER, UserType.SYSTEM_BOT],
+ types: [UserType.USER],
},
});
return { list: users, nextPageToken };
@@ -446,7 +446,7 @@ onMounted(async () => {
const activeUserCount = computed(() => {
return actuatorStore.countUser({
state: State.ACTIVE,
- userTypes: [UserType.SYSTEM_BOT, UserType.USER],
+ userTypes: [UserType.USER],
});
});
diff --git a/frontend/src/views/project/ProjectPlanDashboard.vue b/frontend/src/views/project/ProjectPlanDashboard.vue
index fd128034d3..788587c702 100644
--- a/frontend/src/views/project/ProjectPlanDashboard.vue
+++ b/frontend/src/views/project/ProjectPlanDashboard.vue
@@ -73,7 +73,6 @@ import type {
ValueOption,
} from "@/components/AdvancedSearch/types";
import { useCommonSearchScopeOptions } from "@/components/AdvancedSearch/useCommonSearchScopeOptions";
-import SystemBotTag from "@/components/misc/SystemBotTag.vue";
import YouTag from "@/components/misc/YouTag.vue";
import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";
import { getLocalSheetByName, targetsForSpec } from "@/components/Plan";
@@ -92,7 +91,7 @@ import {
buildPlanFindBySearchParams,
usePlanStore,
} from "@/store/modules/v1/plan";
-import { isValidDatabaseGroupName, SYSTEM_BOT_USER_NAME } from "@/types";
+import { isValidDatabaseGroupName } from "@/types";
import { type Plan, type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { UserType } from "@/types/proto-es/v1/user_service_pb";
import {
@@ -192,7 +191,6 @@ const scopeOptions = computed((): ScopeOption[] => {
return {
value: user.email,
keywords: [user.email, user.title],
- bot: user.name === SYSTEM_BOT_USER_NAME,
render: () => {
const children = [
h(BBAvatar, { size: "TINY", username: user.title }),
@@ -201,9 +199,6 @@ const scopeOptions = computed((): ScopeOption[] => {
if (user.name === me.value.name) {
children.push(h(YouTag));
}
- if (user.name === SYSTEM_BOT_USER_NAME) {
- children.push(h(SystemBotTag));
- }
return h(
"div",
{ class: "flex items-center gap-x-1" },
@@ -222,7 +217,7 @@ const scopeOptions = computed((): ScopeOption[] => {
search: searchPrincipalSearchValueOptions([
UserType.USER,
UserType.SERVICE_ACCOUNT,
- UserType.SYSTEM_BOT,
+ UserType.WORKLOAD_IDENTITY,
]),
};
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 0571a5f03b..c57c5452f0 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -13515,7 +13515,7 @@ paths:
Supported filter:
- name: the user name, support "==" and ".matches()" operator.
- email: the user email, support "==" and ".matches()" operator.
- - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
- state: check State enum for values, support "==" operator.
- project: the project full name in "projects/{id}" format, support "==" operator.
@@ -13525,7 +13525,7 @@ paths:
email == "[email protected]"
email.matches("ed")
user_type == "USER"
- user_type in ["SYSTEM_BOT", "USER"]
+ user_type in ["SERVICE_ACCOUNT", "USER"]
state == "DELETED"
project == "projects/sample-project"
You can combine filter conditions like:
@@ -13541,7 +13541,7 @@ paths:
Supported filter:
- name: the user name, support "==" and ".matches()" operator.
- email: the user email, support "==" and ".matches()" operator.
- - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
- state: check State enum for values, support "==" operator.
- project: the project full name in "projects/{id}" format, support "==" operator.
@@ -13551,7 +13551,7 @@ paths:
email == "[email protected]"
email.matches("ed")
user_type == "USER"
- user_type in ["SYSTEM_BOT", "USER"]
+ user_type in ["SERVICE_ACCOUNT", "USER"]
state == "DELETED"
project == "projects/sample-project"
You can combine filter conditions like:
@@ -21802,7 +21802,7 @@ components:
Supported filter:
- name: the user name, support "==" and ".matches()" operator.
- email: the user email, support "==" and ".matches()" operator.
- - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
- state: check State enum for values, support "==" operator.
- project: the project full name in "projects/{id}" format, support "==" operator.
@@ -21812,7 +21812,7 @@ components:
email == "[email protected]"
email.matches("ed")
user_type == "USER"
- user_type in ["SYSTEM_BOT", "USER"]
+ user_type in ["SERVICE_ACCOUNT", "USER"]
state == "DELETED"
project == "projects/sample-project"
You can combine filter conditions like:
@@ -27453,9 +27453,8 @@ components:
enum:
- USER_TYPE_UNSPECIFIED
- USER
- - SYSTEM_BOT
- - SERVICE_ACCOUNT
- WORKLOAD_IDENTITY
+ - SERVICE_ACCOUNT
bytebase.v1.VCSType:
type: string
title: VCSType
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 3a5b282661..5be1fccce3 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -5142,9 +5142,8 @@ PrincipalType is the type of a principal.
| ---- | ------ | ----------- |
| PRINCIPAL_TYPE_UNSPECIFIED | 0 | |
| END_USER | 1 | END_USER represents the human being using Bytebase. |
-| SERVICE_ACCOUNT | 2 | SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI. |
-| SYSTEM_BOT | 3 | SYSTEM_BOT represents the internal system bot performing operations. |
-| WORKLOAD_IDENTITY | 4 | WORKLOAD_IDENTITY represents external CI/CD workload identity. |
+| WORKLOAD_IDENTITY | 2 | WORKLOAD_IDENTITY represents external CI/CD workload identity. |
+| SERVICE_ACCOUNT | 3 | SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 737946749d..ceedd61e44 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -13796,21 +13796,15 @@ Example: For &#34;SELECT 你好;&#34; in a UTF-8 sheet, range [0, 13) represents
</tr>
<tr>
- <td>SERVICE_ACCOUNT</td>
+ <td>WORKLOAD_IDENTITY</td>
<td>2</td>
- <td><p>SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI.</p></td>
+ <td><p>WORKLOAD_IDENTITY represents external CI/CD workload identity.</p></td>
</tr>
<tr>
- <td>SYSTEM_BOT</td>
+ <td>SERVICE_ACCOUNT</td>
<td>3</td>
- <td><p>SYSTEM_BOT represents the internal system bot performing operations.</p></td>
- </tr>
-
- <tr>
- <td>WORKLOAD_IDENTITY</td>
- <td>4</td>
- <td><p>WORKLOAD_IDENTITY represents external CI/CD workload identity.</p></td>
+ <td><p>SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI.</p></td>
</tr>
</tbody>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 7b86f490e1..973f9ecfb4 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2386,9 +2386,9 @@ When paginating, all other parameters provided to `ListUsers` must match the cal
| show_deleted | [bool](#bool) | | Show deleted users if specified. |
| filter | [string](#string) | | Filter is used to filter users returned in the list. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-Supported filter: - name: the user name, support &#34;==&#34; and &#34;.matches()&#34; operator. - email: the user email, support &#34;==&#34; and &#34;.matches()&#34; operator. - user_type: the type, check UserType enum for values, support &#34;SYSTEM_BOT&#34; or &#34;USER&#34; value, support &#34;==&#34; and &#34;in [xx]&#34; operator. - state: check State enum for values, support &#34;==&#34; operator. - project: the project full name in &#34;projects/{id}&#34; format, support &#34;==&#34; operator.
+Supported filter: - name: the user name, support &#34;==&#34; and &#34;.matches()&#34; operator. - email: the user email, support &#34;==&#34; and &#34;.matches()&#34; operator. - user_type: the type, check UserType enum for values, support &#34;USER&#34;, &#34;SERVICE_ACCOUNT&#34;, or &#34;WORKLOAD_IDENTITY&#34; value, support &#34;==&#34; and &#34;in [xx]&#34; operator. - state: check State enum for values, support &#34;==&#34; operator. - project: the project full name in &#34;projects/{id}&#34; format, support &#34;==&#34; operator.
-For example: name == &#34;ed&#34; name.matches(&#34;ed&#34;) email == &#34;[email protected]&#34; email.matches(&#34;ed&#34;) user_type == &#34;USER&#34; user_type in [&#34;SYSTEM_BOT&#34;, &#34;USER&#34;] state == &#34;DELETED&#34; project == &#34;projects/sample-project&#34; You can combine filter conditions like: name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; (name == &#34;ed&#34; || email == &#34;[email protected]&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; |
+For example: name == &#34;ed&#34; name.matches(&#34;ed&#34;) email == &#34;[email protected]&#34; email.matches(&#34;ed&#34;) user_type == &#34;USER&#34; user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;] state == &#34;DELETED&#34; project == &#34;projects/sample-project&#34; You can combine filter conditions like: name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; (name == &#34;ed&#34; || email == &#34;[email protected]&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; |
@@ -2539,9 +2539,8 @@ WorkloadIdentityConfig for API layer
| ---- | ------ | ----------- |
| USER_TYPE_UNSPECIFIED | 0 | Unspecified user type. |
| USER | 1 | Regular human user account. |
-| SYSTEM_BOT | 2 | System-managed bot account for automated operations. |
+| WORKLOAD_IDENTITY | 2 | External CI/CD workload identity. |
| SERVICE_ACCOUNT | 3 | Service account for API integrations. |
-| WORKLOAD_IDENTITY | 4 | External CI/CD workload identity. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 240421e04d..b828a4a9b9 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -7203,7 +7203,7 @@ The syntax and semantics of CEL are documented at https://github.com/google/cel-
Supported filter:
- name: the user name, support &#34;==&#34; and &#34;.matches()&#34; operator.
- email: the user email, support &#34;==&#34; and &#34;.matches()&#34; operator.
-- user_type: the type, check UserType enum for values, support &#34;SYSTEM_BOT&#34; or &#34;USER&#34; value, support &#34;==&#34; and &#34;in [xx]&#34; operator.
+- user_type: the type, check UserType enum for values, support &#34;USER&#34;, &#34;SERVICE_ACCOUNT&#34;, or &#34;WORKLOAD_IDENTITY&#34; value, support &#34;==&#34; and &#34;in [xx]&#34; operator.
- state: check State enum for values, support &#34;==&#34; operator.
- project: the project full name in &#34;projects/{id}&#34; format, support &#34;==&#34; operator.
@@ -7213,7 +7213,7 @@ name.matches(&#34;ed&#34;)
email == &#34;[email protected]&#34;
email.matches(&#34;ed&#34;)
user_type == &#34;USER&#34;
-user_type in [&#34;SYSTEM_BOT&#34;, &#34;USER&#34;]
+user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;]
state == &#34;DELETED&#34;
project == &#34;projects/sample-project&#34;
You can combine filter conditions like:
@@ -7613,9 +7613,9 @@ Format: groups/{email} </p></td>
</tr>
<tr>
- <td>SYSTEM_BOT</td>
+ <td>WORKLOAD_IDENTITY</td>
<td>2</td>
- <td><p>System-managed bot account for automated operations.</p></td>
+ <td><p>External CI/CD workload identity.</p></td>
</tr>
<tr>
@@ -7624,12 +7624,6 @@ Format: groups/{email} </p></td>
<td><p>Service account for API integrations.</p></td>
</tr>
- <tr>
- <td>WORKLOAD_IDENTITY</td>
- <td>4</td>
- <td><p>External CI/CD workload identity.</p></td>
- </tr>
-
</tbody>
</table>
diff --git a/proto/store/store/user.proto b/proto/store/store/user.proto
index 7c3202a979..e29342ebb9 100644
--- a/proto/store/store/user.proto
+++ b/proto/store/store/user.proto
@@ -11,12 +11,10 @@ enum PrincipalType {
PRINCIPAL_TYPE_UNSPECIFIED = 0;
// END_USER represents the human being using Bytebase.
END_USER = 1;
- // SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI.
- SERVICE_ACCOUNT = 2;
- // SYSTEM_BOT represents the internal system bot performing operations.
- SYSTEM_BOT = 3;
// WORKLOAD_IDENTITY represents external CI/CD workload identity.
- WORKLOAD_IDENTITY = 4;
+ WORKLOAD_IDENTITY = 2;
+ // SERVICE_ACCOUNT represents the external service calling Bytebase OpenAPI.
+ SERVICE_ACCOUNT = 3;
}
// MFAConfig is the MFA configuration for a user.
diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.proto
index 4ee182ba1b..8ae71192c2 100644
--- a/proto/v1/v1/user_service.proto
+++ b/proto/v1/v1/user_service.proto
@@ -160,7 +160,7 @@ message ListUsersRequest {
// Supported filter:
// - name: the user name, support "==" and ".matches()" operator.
// - email: the user email, support "==" and ".matches()" operator.
- // - user_type: the type, check UserType enum for values, support "SYSTEM_BOT" or "USER" value, support "==" and "in [xx]" operator.
+ // - user_type: the type, check UserType enum for values, support "USER", "SERVICE_ACCOUNT", or "WORKLOAD_IDENTITY" value, support "==" and "in [xx]" operator.
// - state: check State enum for values, support "==" operator.
// - project: the project full name in "projects/{id}" format, support "==" operator.
//
@@ -170,7 +170,7 @@ message ListUsersRequest {
// email == "[email protected]"
// email.matches("ed")
// user_type == "USER"
- // user_type in ["SYSTEM_BOT", "USER"]
+ // user_type in ["SERVICE_ACCOUNT", "USER"]
// state == "DELETED"
// project == "projects/sample-project"
// You can combine filter conditions like:
@@ -337,10 +337,8 @@ enum UserType {
USER_TYPE_UNSPECIFIED = 0;
// Regular human user account.
USER = 1;
- // System-managed bot account for automated operations.
- SYSTEM_BOT = 2;
+ // External CI/CD workload identity.
+ WORKLOAD_IDENTITY = 2;
// Service account for API integrations.
SERVICE_ACCOUNT = 3;
- // External CI/CD workload identity.
- WORKLOAD_IDENTITY = 4;
}