Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(approval): enforce last plan editor policy (#21298)
p0nyd524bb3141f6
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 5565526826..4798b19d68 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -16407,6 +16407,13 @@ components:The lifecycle status of the linked issue.Unspecified when no linked issue exists.$ref: '#/components/schemas/bytebase.v1.IssueStatus'+ lastPlanEditor:+ type: string+ title: last_plan_editor+ description: |-+ The user who last created or updated the Plan specs.+ Format: users/[email protected]. For legacy Plans without stored attribution,+ this falls back to the Plan creator.title: PlanadditionalProperties: falsebytebase.v1.Plan.ChangeDatabaseConfig:@@ -17092,6 +17099,10 @@ components:type: booleantitle: allow_just_in_time_accessdescription: Once enabled, users can request and use the just-in-time access in the SQL Editor.+ allowLastPlanEditorApproval:+ type: boolean+ title: allow_last_plan_editor_approval+ description: Whether to allow the last Plan editor to approve a database change issue.title: ProjectadditionalProperties: falsebytebase.v1.Project.ExecutionRetryPolicy:diff --git a/backend/api/v1/audit_redact_inventory_test.go b/backend/api/v1/audit_redact_inventory_test.goindex 9513aec643..ebbab9c3b5 100644--- a/backend/api/v1/audit_redact_inventory_test.go+++ b/backend/api/v1/audit_redact_inventory_test.go@@ -740,6 +740,7 @@ var auditRecordedFields = []string{"bytebase.v1.Plan.creator","bytebase.v1.Plan.description","bytebase.v1.Plan.issue",+ "bytebase.v1.Plan.last_plan_editor","bytebase.v1.Plan.name","bytebase.v1.Plan.title","bytebase.v1.PlanCheckRun.Result.content",diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.goindex 7c64b68c02..2f1760487e 100644--- a/backend/api/v1/plan_service.go+++ b/backend/api/v1/plan_service.go@@ -300,6 +300,7 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[vvar description *stringvar deleted *boolvar specs []*storepb.PlanConfig_Spec+ var lastPlanEditor *stringvar planCheckRunsTrigger boolvar databaseGroup *v1pb.DatabaseGroup@@ -334,6 +335,8 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v// Trigger plan check runs.planCheckRunsTrigger = true+ editor := strings.ToLower(user.Email)+ lastPlanEditor = &editordefault:return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid update_mask path %q", path))}@@ -344,13 +347,14 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[vspecsUpdate = &specs}updateResult, err := s.reviewWorkflow.UpdatePlan(ctx, review.UpdatePlanInput{- Workspace: common.GetWorkspaceIDFromContext(ctx),- PlanUID: oldPlan.UID,- ProjectID: oldPlan.ProjectID,- Title: title,- Description: description,- Deleted: deleted,- Specs: specsUpdate,+ Workspace: common.GetWorkspaceIDFromContext(ctx),+ PlanUID: oldPlan.UID,+ ProjectID: oldPlan.ProjectID,+ Title: title,+ Description: description,+ Deleted: deleted,+ Specs: specsUpdate,+ LastPlanEditor: lastPlanEditor,})if err != nil {var workflowErr *review.Error@@ -942,6 +946,7 @@ func buildV1PlanFields(plan *store.PlanMessage) *v1pb.Plan {Title: plan.Name,Description: plan.Description,Creator: common.FormatUserEmail(plan.Creator),+ LastPlanEditor: common.FormatUserEmail(effectivePlanEditor(plan)),Specs: specs,CreateTime: timestamppb.New(plan.CreatedAt),UpdateTime: timestamppb.New(plan.UpdatedAt),@@ -954,6 +959,13 @@ func buildV1PlanFields(plan *store.PlanMessage) *v1pb.Plan {return p}+func effectivePlanEditor(plan *store.PlanMessage) string {+ if plan.LastPlanEditor != nil {+ return *plan.LastPlanEditor+ }+ return plan.Creator+}+func buildRolloutStageSummaries(projectID string, planUID int64, counts []*store.TaskStatusCount, environmentOrderMap map[string]int) []*v1pb.Plan_RolloutStageSummary {summariesByEnvironment := make(map[string]map[v1pb.Task_Status]int32)for _, count := range counts {diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex 87881c386d..03d5980b97 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -365,6 +365,9 @@ func (s *ProjectService) UpdateProject(ctx context.Context, req *connect.Requestcase "allow_just_in_time_access":projectSettings.AllowJustInTimeAccess = req.Msg.Project.AllowJustInTimeAccesspatch.Setting = projectSettings+ case "allow_last_plan_editor_approval":+ projectSettings.AllowLastPlanEditorApproval = req.Msg.Project.AllowLastPlanEditorApproval+ patch.Setting = projectSettingscase "labels":if err := validateLabels(req.Msg.Project.Labels); err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)diff --git a/backend/api/v1/project_service_converter.go b/backend/api/v1/project_service_converter.goindex 88dfd594bd..8e5f96bf32 100644--- a/backend/api/v1/project_service_converter.go+++ b/backend/api/v1/project_service_converter.go@@ -283,25 +283,26 @@ func convertToProject(projectMessage *store.ProjectMessage) *v1pb.Project {}return &v1pb.Project{- Name: common.FormatProject(projectMessage.ResourceID),- State: convertDeletedToState(projectMessage.Deleted),- Title: projectMessage.Title,- Webhooks: projectWebhooks,- DataClassificationConfigId: projectMessage.Setting.DataClassificationConfigId,- IssueLabels: issueLabels,- ForceIssueLabels: projectMessage.Setting.ForceIssueLabels,- EnforceIssueTitle: projectMessage.Setting.EnforceIssueTitle,- EnforceSqlReview: projectMessage.Setting.EnforceSqlReview,- PostgresDatabaseTenantMode: projectMessage.Setting.PostgresDatabaseTenantMode,- AllowSelfApproval: projectMessage.Setting.AllowSelfApproval,- ExecutionRetryPolicy: convertToV1ExecutionRetryPolicy(projectMessage.Setting.ExecutionRetryPolicy),- CiSamplingSize: projectMessage.Setting.CiSamplingSize,- ParallelTasksPerRollout: projectMessage.Setting.ParallelTasksPerRollout,- Labels: projectMessage.Setting.Labels,- RequireIssueApproval: projectMessage.Setting.RequireIssueApproval,- RequirePlanCheckNoError: projectMessage.Setting.RequirePlanCheckNoError,- AllowRequestRole: projectMessage.Setting.AllowRequestRole,- AllowJustInTimeAccess: projectMessage.Setting.AllowJustInTimeAccess,+ Name: common.FormatProject(projectMessage.ResourceID),+ State: convertDeletedToState(projectMessage.Deleted),+ Title: projectMessage.Title,+ Webhooks: projectWebhooks,+ DataClassificationConfigId: projectMessage.Setting.DataClassificationConfigId,+ IssueLabels: issueLabels,+ ForceIssueLabels: projectMessage.Setting.ForceIssueLabels,+ EnforceIssueTitle: projectMessage.Setting.EnforceIssueTitle,+ EnforceSqlReview: projectMessage.Setting.EnforceSqlReview,+ PostgresDatabaseTenantMode: projectMessage.Setting.PostgresDatabaseTenantMode,+ AllowSelfApproval: projectMessage.Setting.AllowSelfApproval,+ ExecutionRetryPolicy: convertToV1ExecutionRetryPolicy(projectMessage.Setting.ExecutionRetryPolicy),+ CiSamplingSize: projectMessage.Setting.CiSamplingSize,+ ParallelTasksPerRollout: projectMessage.Setting.ParallelTasksPerRollout,+ Labels: projectMessage.Setting.Labels,+ RequireIssueApproval: projectMessage.Setting.RequireIssueApproval,+ RequirePlanCheckNoError: projectMessage.Setting.RequirePlanCheckNoError,+ AllowRequestRole: projectMessage.Setting.AllowRequestRole,+ AllowJustInTimeAccess: projectMessage.Setting.AllowJustInTimeAccess,+ AllowLastPlanEditorApproval: projectMessage.Setting.AllowLastPlanEditorApproval,}}@@ -332,18 +333,19 @@ func convertToProjectMessage(resourceID string, project *v1pb.Project) *store.PrResourceID: resourceID,Title: project.Title,Setting: &storepb.Project{- EnforceIssueTitle: project.EnforceIssueTitle,- PostgresDatabaseTenantMode: project.PostgresDatabaseTenantMode,- AllowSelfApproval: project.AllowSelfApproval,- CiSamplingSize: project.CiSamplingSize,- ParallelTasksPerRollout: project.ParallelTasksPerRollout,- Labels: project.Labels,- EnforceSqlReview: project.EnforceSqlReview,- RequireIssueApproval: project.RequireIssueApproval,- RequirePlanCheckNoError: project.RequirePlanCheckNoError,- AllowRequestRole: project.AllowRequestRole,- AllowJustInTimeAccess: project.AllowJustInTimeAccess,- DataClassificationConfigId: project.DataClassificationConfigId,+ EnforceIssueTitle: project.EnforceIssueTitle,+ PostgresDatabaseTenantMode: project.PostgresDatabaseTenantMode,+ AllowSelfApproval: project.AllowSelfApproval,+ CiSamplingSize: project.CiSamplingSize,+ ParallelTasksPerRollout: project.ParallelTasksPerRollout,+ Labels: project.Labels,+ EnforceSqlReview: project.EnforceSqlReview,+ RequireIssueApproval: project.RequireIssueApproval,+ RequirePlanCheckNoError: project.RequirePlanCheckNoError,+ AllowRequestRole: project.AllowRequestRole,+ AllowJustInTimeAccess: project.AllowJustInTimeAccess,+ AllowLastPlanEditorApproval: project.AllowLastPlanEditorApproval,+ DataClassificationConfigId: project.DataClassificationConfigId,},}}diff --git a/backend/component/review/plan.go b/backend/component/review/plan.goindex 08b69602e4..aeb8732879 100644--- a/backend/component/review/plan.go+++ b/backend/component/review/plan.go@@ -3,6 +3,7 @@ package reviewimport ("context""database/sql"+ "strings""time""github.com/pkg/errors"@@ -18,13 +19,14 @@ import (// issue's metadata and lifecycle synchronized with the Plan and resets review// state when submitted Plan specs change.type UpdatePlanInput struct {- Workspace string- ProjectID string- PlanUID int64- Title *string- Description *string- Deleted *bool- Specs *[]*storepb.PlanConfig_Spec+ Workspace string+ ProjectID string+ PlanUID int64+ Title *string+ Description *string+ Deleted *bool+ Specs *[]*storepb.PlanConfig_Spec+ LastPlanEditor *string}// UpdatePlanResult is the committed Plan and linked review state.@@ -37,13 +39,14 @@ type UpdatePlanResult struct {// UpdatePlanSpecsInput is retained for callers performing a spec mutation.type UpdatePlanSpecsInput struct {- Workspace string- ProjectID string- PlanUID int64- Title *string- Description *string- Deleted *bool- Specs []*storepb.PlanConfig_Spec+ Workspace string+ ProjectID string+ PlanUID int64+ Title *string+ Description *string+ Deleted *bool+ Specs []*storepb.PlanConfig_Spec+ LastPlanEditor *string}// UpdatePlanSpecsResult is the result of a spec mutation.@@ -52,13 +55,14 @@ type UpdatePlanSpecsResult = UpdatePlanResult// UpdatePlanSpecs commits a Plan spec mutation through UpdatePlan.func (w *Workflow) UpdatePlanSpecs(ctx context.Context, input UpdatePlanSpecsInput) (*UpdatePlanSpecsResult, error) {return w.UpdatePlan(ctx, UpdatePlanInput{- Workspace: input.Workspace,- ProjectID: input.ProjectID,- PlanUID: input.PlanUID,- Title: input.Title,- Description: input.Description,- Deleted: input.Deleted,- Specs: &input.Specs,+ Workspace: input.Workspace,+ ProjectID: input.ProjectID,+ PlanUID: input.PlanUID,+ Title: input.Title,+ Description: input.Description,+ Deleted: input.Deleted,+ Specs: &input.Specs,+ LastPlanEditor: input.LastPlanEditor,})}@@ -103,21 +107,27 @@ func (w *Workflow) UpdatePlan(ctx context.Context, input UpdatePlanInput) (*Upda}updatedAt := time.Now()+ lastPlanEditor := ""+ if input.LastPlanEditor != nil {+ lastPlanEditor = strings.ToLower(*input.LastPlanEditor)+ }if err := tx.QueryRowContext(ctx, `UPDATE planSET updated_at = $1,name = CASE WHEN $2 THEN $3 ELSE name END,description = CASE WHEN $4 THEN $5 ELSE description END,deleted = CASE WHEN $6 THEN $7 ELSE deleted END,- config = CASE WHEN $8 THEN $9::jsonb ELSE config END- WHERE project = $10- AND id = $11+ config = CASE WHEN $8 THEN $9::jsonb ELSE config END,+ last_plan_editor = CASE WHEN $10 THEN $11 ELSE last_plan_editor END+ WHERE project = $12+ AND id = $13RETURNING updated_at`,updatedAt,input.Title != nil, stringValue(input.Title),input.Description != nil, stringValue(input.Description),input.Deleted != nil, boolValue(input.Deleted),input.Specs != nil, config,+ input.LastPlanEditor != nil, lastPlanEditor,input.ProjectID, input.PlanUID,).Scan(&plan.UpdatedAt); err != nil {return nil, workflowWrap(ErrorInternal, err, "failed to update Plan")@@ -132,6 +142,9 @@ func (w *Workflow) UpdatePlan(ctx context.Context, input UpdatePlanInput) (*Updaplan.Deleted = *input.Deleted}plan.Config = updatedConfig+ if input.LastPlanEditor != nil {+ plan.LastPlanEditor = &lastPlanEditor+ }result := &UpdatePlanResult{Plan: plan, Issue: issue}if issue != nil && issue.Payload.GetDraft() {@@ -199,8 +212,9 @@ func (w *Workflow) UpdatePlan(ctx context.Context, input UpdatePlanInput) (*Updafunc lockPlan(ctx context.Context, tx *sql.Tx, workspace, projectID string, planUID int64) (*store.PlanMessage, error) {plan := &store.PlanMessage{Config: &storepb.PlanConfig{}}var config []byte+ var lastPlanEditor sql.NullStringerr := tx.QueryRowContext(ctx, `- SELECT plan.id, plan.creator, plan.created_at, plan.updated_at, plan.project, plan.name, plan.description, plan.config, plan.deleted+ SELECT plan.id, plan.creator, plan.last_plan_editor, plan.created_at, plan.updated_at, plan.project, plan.name, plan.description, plan.config, plan.deletedFROM planJOIN project ON project.resource_id = plan.projectWHERE project.workspace = $1@@ -209,6 +223,7 @@ func lockPlan(ctx context.Context, tx *sql.Tx, workspace, projectID string, planFOR UPDATE OF plan`, workspace, projectID, planUID).Scan(&plan.UID,&plan.Creator,+ &lastPlanEditor,&plan.CreatedAt,&plan.UpdatedAt,&plan.ProjectID,@@ -226,6 +241,9 @@ func lockPlan(ctx context.Context, tx *sql.Tx, workspace, projectID string, planif err := common.ProtojsonUnmarshaler.Unmarshal(config, plan.Config); err != nil {return nil, workflowWrap(ErrorInternal, err, "failed to unmarshal Plan config")}+ if lastPlanEditor.Valid {+ plan.LastPlanEditor = &lastPlanEditor.String+ }return plan, nil}diff --git a/backend/component/review/workflow.go b/backend/component/review/workflow.goindex 71e70c7714..3112746301 100644--- a/backend/component/review/workflow.go+++ b/backend/component/review/workflow.go@@ -231,7 +231,7 @@ func (w *Workflow) ReviewIssue(ctx context.Context, input IssueInput) (*IssueRes}updatedApproval := proto.CloneOf(approval)- events, err := w.applyReviewAction(ctx, project, issue, input, updatedApproval)+ events, err := w.applyReviewAction(ctx, project, issue, observedPlan, input, updatedApproval)if err != nil {return nil, err}@@ -323,7 +323,7 @@ func updateIssuePayload(ctx context.Context, tx *sql.Tx, issue *store.IssueMessa).Scan(&issue.UpdatedAt)}-func (w *Workflow) applyReviewAction(ctx context.Context, project *store.ProjectMessage, issue *store.IssueMessage, input IssueInput, approval *storepb.IssuePayloadApproval) ([]Event, error) {+func (w *Workflow) applyReviewAction(ctx context.Context, project *store.ProjectMessage, issue *store.IssueMessage, plan *store.PlanMessage, input IssueInput, approval *storepb.IssuePayloadApproval) ([]Event, error) {switch input.Action {case ActionApprove, ActionReject:verb := "approve"@@ -345,6 +345,15 @@ func (w *Workflow) applyReviewAction(ctx context.Context, project *store.Projectif !project.Setting.GetAllowSelfApproval() && issue.CreatorEmail == input.Actor.Email {return nil, workflowError(ErrorPermissionDenied, "cannot %s because self-approval is not allowed for this project", verb)}+ if input.Action == ActionApprove && !project.Setting.GetAllowLastPlanEditorApproval() && plan != nil {+ lastPlanEditor := plan.Creator+ if plan.LastPlanEditor != nil {+ lastPlanEditor = *plan.LastPlanEditor+ }+ if lastPlanEditor == input.Actor.Email {+ return nil, workflowError(ErrorFailedPrecondition, "cannot approve because the user is the last Plan editor")+ }+ }approval.Approvers = append(approval.Approvers, &storepb.IssuePayloadApproval_Approver{Status: status,Principal: common.FormatUserEmail(input.Actor.Email),@@ -466,7 +475,7 @@ func lockIssuePlan(ctx context.Context, tx *sql.Tx, issue *store.IssueMessage) (return nil, nil}return scanIssuePlan(tx.QueryRowContext(ctx, `- SELECT id, creator, created_at, updated_at, project, name, description, config, deleted+ SELECT id, creator, last_plan_editor, created_at, updated_at, project, name, description, config, deletedFROM planWHERE project = $1AND id = $2@@ -478,7 +487,7 @@ func getIssuePlan(ctx context.Context, tx *sql.Tx, issue *store.IssueMessage) (*return nil, nil}return scanIssuePlan(tx.QueryRowContext(ctx, `- SELECT id, creator, created_at, updated_at, project, name, description, config, deleted+ SELECT id, creator, last_plan_editor, created_at, updated_at, project, name, description, config, deletedFROM planWHERE project = $1AND id = $2`, issue.ProjectID, *issue.PlanUID), "failed to get plan")@@ -487,9 +496,11 @@ func getIssuePlan(ctx context.Context, tx *sql.Tx, issue *store.IssueMessage) (*func scanIssuePlan(row *sql.Row, queryErrorMessage string) (*store.PlanMessage, error) {plan := &store.PlanMessage{Config: &storepb.PlanConfig{}}var config []byte+ var lastPlanEditor sql.NullStringerr := row.Scan(&plan.UID,&plan.Creator,+ &lastPlanEditor,&plan.CreatedAt,&plan.UpdatedAt,&plan.ProjectID,@@ -507,6 +518,9 @@ func scanIssuePlan(row *sql.Row, queryErrorMessage string) (*store.PlanMessage,if err := common.ProtojsonUnmarshaler.Unmarshal(config, plan.Config); err != nil {return nil, workflowWrap(ErrorInternal, err, "failed to unmarshal plan config")}+ if lastPlanEditor.Valid {+ plan.LastPlanEditor = &lastPlanEditor.String+ }return plan, nil}diff --git a/backend/component/review/workflow_test.go b/backend/component/review/workflow_test.goindex 163d10b9e7..5ede9bfff2 100644--- a/backend/component/review/workflow_test.go+++ b/backend/component/review/workflow_test.go@@ -124,6 +124,83 @@ func TestReviewIssueApproveCurrentPlan(t *testing.T) {}, result.Events)}+func TestLastPlanEditorApproval(t *testing.T) {+ newIssue := func(ctx context.Context, t *testing.T, stores *store.Store, clearLastPlanEditor bool) *store.IssueMessage {+ t.Helper()+ plan, err := stores.CreatePlan(ctx, &store.PlanMessage{+ ProjectID: "project-a",+ Name: "change database",+ Config: &storepb.PlanConfig{ApprovalInputVersion: 2},+ }, "[email protected]")+ require.NoError(t, err)+ if clearLastPlanEditor {+ _, err := stores.GetDB().ExecContext(ctx, "UPDATE plan SET last_plan_editor = NULL WHERE project = $1 AND id = $2", plan.ProjectID, plan.UID)+ require.NoError(t, err)+ }+ issue, err := stores.CreateIssue(ctx, &store.IssueMessage{+ ProjectID: "project-a",+ CreatorEmail: "[email protected]",+ Title: "change database",+ Type: storepb.Issue_DATABASE_CHANGE,+ PlanUID: &plan.UID,+ Payload: &storepb.Issue{Approval: &storepb.IssuePayloadApproval{+ ApprovalFindingDone: true,+ ApprovalInputVersion: 2,+ ApprovalTemplate: &storepb.ApprovalTemplate{Flow: &storepb.ApprovalFlow{Roles: []string{"roles/projectOwner"}}},+ }},+ })+ require.NoError(t, err)+ return issue+ }++ for _, test := range []struct {+ name string+ action Action+ allowLastPlanEditor bool+ clearLastPlanEditor bool+ wantError ErrorCode+ }{+ {name: "approve blocked", action: ActionApprove, wantError: ErrorFailedPrecondition},+ {name: "reject allowed", action: ActionReject},+ {name: "approve allowed by setting", action: ActionApprove, allowLastPlanEditor: true},+ {name: "legacy Plan falls back to creator", action: ActionApprove, clearLastPlanEditor: true, wantError: ErrorFailedPrecondition},+ } {+ t.Run(test.name, func(t *testing.T) {+ ctx := context.Background()+ stores := setupWorkflowStore(ctx, t)+ _, err := stores.PatchWorkspaceIamPolicy(ctx, &store.PatchIamPolicyMessage{+ Workspace: "default",+ Member: common.FormatUserEmail("[email protected]"),+ Roles: []string{"roles/projectOwner"},+ })+ require.NoError(t, err)+ if test.allowLastPlanEditor {+ projectID := "project-a"+ require.NoError(t, stores.UpdateProjects(ctx, &store.UpdateProjectMessage{+ Workspace: "default",+ ResourceID: projectID,+ Setting: &storepb.Project{AllowLastPlanEditorApproval: true},+ }))+ }+ issue := newIssue(ctx, t, stores, test.clearLastPlanEditor)+ _, err = NewWorkflow(stores).ReviewIssue(ctx, IssueInput{+ Workspace: "default",+ ProjectID: "project-a",+ IssueUID: issue.UID,+ Actor: &store.UserMessage{Email: "[email protected]"},+ Action: test.action,+ })+ if test.wantError == ErrorInternal {+ require.NoError(t, err)+ return+ }+ var workflowErr *Error+ require.ErrorAs(t, err, &workflowErr)+ require.Equal(t, test.wantError, workflowErr.Code)+ })+ }+}+func TestReviewIssueConcurrentApprovalsHaveOneWinner(t *testing.T) {ctx := context.Background()stores := setupWorkflowStore(ctx, t)diff --git a/backend/generated-go/store/project.pb.go b/backend/generated-go/store/project.pb.goindex 998dc40df2..ccef5632b4 100644--- a/backend/generated-go/store/project.pb.go+++ b/backend/generated-go/store/project.pb.go@@ -122,8 +122,10 @@ type Project struct {DataClassificationConfigId string `protobuf:"bytes,18,opt,name=data_classification_config_id,json=dataClassificationConfigId,proto3" json:"data_classification_config_id,omitempty"`// Once enabled, users can request and use the just-in-time access in the SQL Editor.AllowJustInTimeAccess bool `protobuf:"varint,19,opt,name=allow_just_in_time_access,json=allowJustInTimeAccess,proto3" json:"allow_just_in_time_access,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ // Whether to allow the last Plan editor to approve a database change issue.+ AllowLastPlanEditorApproval bool `protobuf:"varint,20,opt,name=allow_last_plan_editor_approval,json=allowLastPlanEditorApproval,proto3" json:"allow_last_plan_editor_approval,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *Project) Reset() {@@ -261,6 +263,13 @@ func (x *Project) GetAllowJustInTimeAccess() bool {return false}+func (x *Project) GetAllowLastPlanEditorApproval() bool {+ if x != nil {+ return x.AllowLastPlanEditorApproval+ }+ return false+}+// ExecutionRetryPolicy defines retry behavior for failed task executions.type Project_ExecutionRetryPolicy struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -315,7 +324,7 @@ const file_store_project_proto_rawDesc = "" +"\x05Label\x12\x14\n" +"\x05value\x18\x01 \x01(\tR\x05value\x12(\n" +"\x05color\x18\x02 \x01(\v2\x12.google.type.ColorR\x05color\x12\x14\n" +- "\x05group\x18\x03 \x01(\tR\x05group\"\xf1\a\n" ++ "\x05group\x18\x03 \x01(\tR\x05group\"\xb7\b\n" +"\aProject\x128\n" +"\fissue_labels\x18\x01 \x03(\v2\x15.bytebase.store.LabelR\vissueLabels\x12,\n" +"\x12force_issue_labels\x18\x02 \x01(\bR\x10forceIssueLabels\x12.\n" +@@ -332,7 +341,8 @@ const file_store_project_proto_rawDesc = "" +"\x1brequire_plan_check_no_error\x18\x10 \x01(\bR\x17requirePlanCheckNoError\x12,\n" +"\x12allow_request_role\x18\x11 \x01(\bR\x10allowRequestRole\x12A\n" +"\x1ddata_classification_config_id\x18\x12 \x01(\tR\x1adataClassificationConfigId\x128\n" +- "\x19allow_just_in_time_access\x18\x13 \x01(\bR\x15allowJustInTimeAccess\x1a?\n" ++ "\x19allow_just_in_time_access\x18\x13 \x01(\bR\x15allowJustInTimeAccess\x12D\n" ++ "\x1fallow_last_plan_editor_approval\x18\x14 \x01(\bR\x1ballowLastPlanEditorApproval\x1a?\n" +"\x14ExecutionRetryPolicy\x12'\n" +"\x0fmaximum_retries\x18\x01 \x01(\x05R\x0emaximumRetries\x1a9\n" +"\vLabelsEntry\x12\x10\n" +diff --git a/backend/generated-go/store/project_equal.pb.go b/backend/generated-go/store/project_equal.pb.goindex a04886d3c8..ec8b9e9f6d 100644--- a/backend/generated-go/store/project_equal.pb.go+++ b/backend/generated-go/store/project_equal.pb.go@@ -108,5 +108,8 @@ func (x *Project) Equal(y *Project) bool {if x.AllowJustInTimeAccess != y.AllowJustInTimeAccess {return false}+ if x.AllowLastPlanEditorApproval != y.AllowLastPlanEditorApproval {+ return false+ }return true}diff --git a/backend/generated-go/v1/plan_service.pb.go b/backend/generated-go/v1/plan_service.pb.goindex 474c9a799d..510fc9b560 100644--- a/backend/generated-go/v1/plan_service.pb.go+++ b/backend/generated-go/v1/plan_service.pb.go@@ -491,9 +491,13 @@ type Plan struct {RolloutStageSummaries []*Plan_RolloutStageSummary `protobuf:"bytes,14,rep,name=rollout_stage_summaries,json=rolloutStageSummaries,proto3" json:"rollout_stage_summaries,omitempty"`// The lifecycle status of the linked issue.// Unspecified when no linked issue exists.- IssueStatus IssueStatus `protobuf:"varint,15,opt,name=issue_status,json=issueStatus,proto3,enum=bytebase.v1.IssueStatus" json:"issue_status,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ IssueStatus IssueStatus `protobuf:"varint,15,opt,name=issue_status,json=issueStatus,proto3,enum=bytebase.v1.IssueStatus" json:"issue_status,omitempty"`+ // The user who last created or updated the Plan specs.+ // Format: users/[email protected]. For legacy Plans without stored attribution,+ // this falls back to the Plan creator.+ LastPlanEditor string `protobuf:"bytes,16,opt,name=last_plan_editor,json=lastPlanEditor,proto3" json:"last_plan_editor,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *Plan) Reset() {@@ -624,6 +628,13 @@ func (x *Plan) GetIssueStatus() IssueStatus {return IssueStatus_ISSUE_STATUS_UNSPECIFIED}+func (x *Plan) GetLastPlanEditor() string {+ if x != nil {+ return x.LastPlanEditor+ }+ return ""+}+type GetPlanCheckRunRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the plan check run to retrieve.@@ -1574,7 +1585,7 @@ const file_v1_plan_service_proto_rawDesc = "" +"\x04plan\x18\x01 \x01(\v2\x11.bytebase.v1.PlanB\x03\xe0A\x02R\x04plan\x12@\n" +"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +"updateMask\x12#\n" +- "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\xa7\x0e\n" ++ "\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\xd6\x0e\n" +"\x04Plan\x12\x12\n" +"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x19\n" +@@ -1593,7 +1604,8 @@ const file_v1_plan_service_proto_rawDesc = "" +"hasRollout\x12I\n" +"\x0fapproval_status\x18\r \x01(\x0e2\x1b.bytebase.v1.ApprovalStatusB\x03\xe0A\x03R\x0eapprovalStatus\x12b\n" +"\x17rollout_stage_summaries\x18\x0e \x03(\v2%.bytebase.v1.Plan.RolloutStageSummaryB\x03\xe0A\x03R\x15rolloutStageSummaries\x12@\n" +- "\fissue_status\x18\x0f \x01(\x0e2\x18.bytebase.v1.IssueStatusB\x03\xe0A\x03R\vissueStatus\x1a\xe0\x01\n" ++ "\fissue_status\x18\x0f \x01(\x0e2\x18.bytebase.v1.IssueStatusB\x03\xe0A\x03R\vissueStatus\x12-\n" ++ "\x10last_plan_editor\x18\x10 \x01(\tB\x03\xe0A\x03R\x0elastPlanEditor\x1a\xe0\x01\n" +"\x04Spec\x12\x0e\n" +"\x02id\x18\x01 \x01(\tR\x02id\x12^\n" +"\x16create_database_config\x18\x02 \x01(\v2&.bytebase.v1.Plan.CreateDatabaseConfigH\x00R\x14createDatabaseConfig\x12^\n" +diff --git a/backend/generated-go/v1/plan_service_equal.pb.go b/backend/generated-go/v1/plan_service_equal.pb.goindex 220eb3f177..749966f838 100644--- a/backend/generated-go/v1/plan_service_equal.pb.go+++ b/backend/generated-go/v1/plan_service_equal.pb.go@@ -288,6 +288,9 @@ func (x *Plan) Equal(y *Plan) bool {if x.IssueStatus != y.IssueStatus {return false}+ if x.LastPlanEditor != y.LastPlanEditor {+ return false+ }return true}diff --git a/backend/generated-go/v1/project_service.pb.go b/backend/generated-go/v1/project_service.pb.goindex 3b6633a0de..88f01c52f2 100644--- a/backend/generated-go/v1/project_service.pb.go+++ b/backend/generated-go/v1/project_service.pb.go@@ -952,8 +952,10 @@ type Project struct {AllowRequestRole bool `protobuf:"varint,22,opt,name=allow_request_role,json=allowRequestRole,proto3" json:"allow_request_role,omitempty"`// Once enabled, users can request and use the just-in-time access in the SQL Editor.AllowJustInTimeAccess bool `protobuf:"varint,23,opt,name=allow_just_in_time_access,json=allowJustInTimeAccess,proto3" json:"allow_just_in_time_access,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ // Whether to allow the last Plan editor to approve a database change issue.+ AllowLastPlanEditorApproval bool `protobuf:"varint,24,opt,name=allow_last_plan_editor_approval,json=allowLastPlanEditorApproval,proto3" json:"allow_last_plan_editor_approval,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *Project) Reset() {@@ -1119,6 +1121,13 @@ func (x *Project) GetAllowJustInTimeAccess() bool {return false}+func (x *Project) GetAllowLastPlanEditorApproval() bool {+ if x != nil {+ return x.AllowLastPlanEditorApproval+ }+ return false+}+type AddWebhookRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the project to add the webhook to.@@ -1653,7 +1662,7 @@ const file_v1_project_service_proto_rawDesc = "" +"\x05Label\x12\x14\n" +"\x05value\x18\x01 \x01(\tR\x05value\x12(\n" +"\x05color\x18\x02 \x01(\v2\x12.google.type.ColorR\x05color\x12\x14\n" +- "\x05group\x18\x03 \x01(\tR\x05group\"\xa7\t\n" ++ "\x05group\x18\x03 \x01(\tR\x05group\"\xed\t\n" +"\aProject\x12\x12\n" +"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x1e\n" +@@ -1674,7 +1683,8 @@ const file_v1_project_service_proto_rawDesc = "" +"\x16require_issue_approval\x18\x14 \x01(\bR\x14requireIssueApproval\x12<\n" +"\x1brequire_plan_check_no_error\x18\x15 \x01(\bR\x17requirePlanCheckNoError\x12,\n" +"\x12allow_request_role\x18\x16 \x01(\bR\x10allowRequestRole\x128\n" +- "\x19allow_just_in_time_access\x18\x17 \x01(\bR\x15allowJustInTimeAccess\x1a?\n" ++ "\x19allow_just_in_time_access\x18\x17 \x01(\bR\x15allowJustInTimeAccess\x12D\n" ++ "\x1fallow_last_plan_editor_approval\x18\x18 \x01(\bR\x1ballowLastPlanEditorApproval\x1a?\n" +"\x14ExecutionRetryPolicy\x12'\n" +"\x0fmaximum_retries\x18\x01 \x01(\x05R\x0emaximumRetries\x1a9\n" +"\vLabelsEntry\x12\x10\n" +diff --git a/backend/generated-go/v1/project_service_equal.pb.go b/backend/generated-go/v1/project_service_equal.pb.goindex 579b5d04f4..81ab6000e8 100644--- a/backend/generated-go/v1/project_service_equal.pb.go+++ b/backend/generated-go/v1/project_service_equal.pb.go@@ -356,6 +356,9 @@ func (x *Project) Equal(y *Project) bool {if x.AllowJustInTimeAccess != y.AllowJustInTimeAccess {return false}+ if x.AllowLastPlanEditorApproval != y.AllowLastPlanEditorApproval {+ return false+ }return true}diff --git a/backend/migrator/migration/3.23/0002##plan_last_editor_approval.sql b/backend/migrator/migration/3.23/0002##plan_last_editor_approval.sqlnew file mode 100644index 0000000000..bb87969141--- /dev/null+++ b/backend/migrator/migration/3.23/0002##plan_last_editor_approval.sql@@ -0,0 +1,6 @@+ALTER TABLE plan ADD COLUMN last_plan_editor text;++-- Preserve existing approval behavior for every existing project, including+-- soft-deleted projects. New projects retain the proto default (false).+UPDATE project+SET setting = jsonb_set(setting, '{allowLastPlanEditorApproval}', 'true'::jsonb, true);diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex e5546ea9c8..976a03f8f9 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -283,6 +283,8 @@ CREATE TABLE plan (id bigint NOT NULL,deleted boolean NOT NULL DEFAULT FALSE,creator text NOT NULL,+ -- The last actor to create or update the plan specs. Nullable for legacy plans.+ last_plan_editor text,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),project text NOT NULL REFERENCES project(resource_id),diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex ff54a9e361..b54a85705f 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -21,8 +21,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.23.1"), *files[len(files)-1].version)- require.Equal(t, "migration/3.23/0001##issue_comment_thread.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.23.2"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.23/0002##plan_last_editor_approval.sql", files[len(files)-1].path)}func TestMigration3_23_1_IssueCommentThreads(t *testing.T) {@@ -133,6 +133,43 @@ func TestVersionUnique(t *testing.T) {}}+func TestMigration3_23_2BackfillsLastPlanEditorApproval(t *testing.T) {+ ctx := context.Background()+ container := testcontainer.GetTestPgContainer(ctx, t)+ t.Cleanup(func() { container.Close(ctx) })+ db := container.GetDB()+ _, err := db.ExecContext(ctx, `+ CREATE TABLE project (+ resource_id text PRIMARY KEY,+ deleted boolean NOT NULL DEFAULT FALSE,+ setting jsonb NOT NULL DEFAULT '{}'+ );+ CREATE TABLE plan (id bigint NOT NULL, project text NOT NULL, creator text NOT NULL);+ INSERT INTO project (resource_id, deleted) VALUES ('active', false), ('deleted', true);+ `)+ require.NoError(t, err)+ statement, err := migrationFS.ReadFile("migration/3.23/0002##plan_last_editor_approval.sql")+ require.NoError(t, err)+ _, err = db.ExecContext(ctx, string(statement))+ require.NoError(t, err)++ for _, projectID := range []string{"active", "deleted"} {+ var enabled bool+ err := db.QueryRowContext(ctx, `+ SELECT (setting->>'allowLastPlanEditorApproval')::boolean+ FROM project+ WHERE resource_id = $1`, projectID).Scan(&enabled)+ require.NoError(t, err)+ require.True(t, enabled)+ }+ var nullable string+ require.NoError(t, db.QueryRowContext(ctx, `+ SELECT is_nullable+ FROM information_schema.columns+ WHERE table_name = 'plan' AND column_name = 'last_plan_editor'`).Scan(&nullable))+ require.Equal(t, "YES", nullable)+}+func TestMigration3_22_12MigratesSampleProjectInstance(t *testing.T) {ctx := context.Background()container := testcontainer.GetTestPgContainer(ctx, t)diff --git a/backend/store/plan.go b/backend/store/plan.goindex 4fea58fa59..d0507021f3 100644--- a/backend/store/plan.go+++ b/backend/store/plan.go@@ -2,6 +2,7 @@ package storeimport ("context"+ "database/sql""strings""time"@@ -28,11 +29,12 @@ type PlanMessage struct {Description stringConfig *storepb.PlanConfig// output only- UID int64- Creator string- CreatedAt time.Time- UpdatedAt time.Time- Deleted bool+ UID int64+ Creator string+ LastPlanEditor *string+ CreatedAt time.Time+ UpdatedAt time.Time+ Deleted bool}// FindPlanMessage is the message to find a plan.@@ -72,18 +74,20 @@ func (s *Store) CreatePlan(ctx context.Context, plan *PlanMessage, creator strinreturn nil, err}+ lastPlanEditor := strings.ToLower(creator)q := qb.Q().Space(`INSERT INTO plan (id,creator,+ last_plan_editor,project,name,description,config) VALUES (- ?, ?, ?, ?, ?, ?+ ?, ?, ?, ?, ?, ?, ?) RETURNING created_at, updated_at- `, nextID, creator, plan.ProjectID, plan.Name, plan.Description, config)+ `, nextID, creator, lastPlanEditor, plan.ProjectID, plan.Name, plan.Description, config)query, args, err := q.ToSQL()if err != nil {@@ -100,6 +104,7 @@ func (s *Store) CreatePlan(ctx context.Context, plan *PlanMessage, creator strinplan.UID = nextIDplan.Creator = creator+ plan.LastPlanEditor = &lastPlanEditorreturn plan, nil}@@ -124,6 +129,7 @@ func (s *Store) ListPlans(ctx context.Context, find *FindPlanMessage) ([]*PlanMeSELECTplan.id,plan.creator,+ plan.last_plan_editor,plan.created_at,plan.updated_at,plan.project,@@ -182,7 +188,7 @@ func (s *Store) ListPlans(ctx context.Context, find *FindPlanMessage) ([]*PlanMe)`)}- q.Space("ORDER BY id DESC")+ q.Space("ORDER BY plan.id DESC, plan.project DESC")if v := find.Limit; v != nil {q.Space("LIMIT ?", *v)}@@ -207,9 +213,11 @@ func (s *Store) ListPlans(ctx context.Context, find *FindPlanMessage) ([]*PlanMeConfig: &storepb.PlanConfig{},}var config []byte+ var lastPlanEditor sql.NullStringif err := rows.Scan(&plan.UID,&plan.Creator,+ &lastPlanEditor,&plan.CreatedAt,&plan.UpdatedAt,&plan.ProjectID,@@ -223,6 +231,9 @@ func (s *Store) ListPlans(ctx context.Context, find *FindPlanMessage) ([]*PlanMeif err := common.ProtojsonUnmarshaler.Unmarshal(config, plan.Config); err != nil {return nil, errors.Wrap(err, "failed to unmarshal plan config")}+ if lastPlanEditor.Valid {+ plan.LastPlanEditor = &lastPlanEditor.String+ }plans = append(plans, &plan)}if err := rows.Err(); err != nil {diff --git a/backend/store/principal.go b/backend/store/principal.goindex 7fbbbe6bdf..12b8f3ad96 100644--- a/backend/store/principal.go+++ b/backend/store/principal.go@@ -915,6 +915,9 @@ func (s *Store) UpdateUserEmail(ctx context.Context, user *UserMessage, newEmailif err := updateReference("UPDATE plan SET creator = $1 WHERE creator = $2"); err != nil {return nil, err}+ if err := updateReference("UPDATE plan SET last_plan_editor = $1 WHERE last_plan_editor = $2"); err != nil {+ return nil, err+ }if err := updateReference("UPDATE access_grant SET creator = $1 WHERE creator = $2"); err != nil {return nil, err}diff --git a/backend/tests/database.go b/backend/tests/database.goindex 6a0ac3eb5a..b8702527c5 100644--- a/backend/tests/database.go+++ b/backend/tests/database.go@@ -6,11 +6,25 @@ import ("connectrpc.com/connect""github.com/google/uuid"+ "google.golang.org/protobuf/types/known/fieldmaskpb"v1pb "github.com/bytebase/bytebase/backend/generated-go/v1")func (ctl *controller) createDatabase(ctx context.Context, project *v1pb.Project, instance *v1pb.Instance, environment *v1pb.EnvironmentSetting_Environment, databaseName string, owner string) error {+ // Database provisioning is test setup, and its plan is approved by the same+ // test actor. Opt into that legacy behavior explicitly; production projects+ // keep the restrictive default when the setting is absent.+ if _, err := ctl.projectServiceClient.UpdateProject(ctx, connect.NewRequest(&v1pb.UpdateProjectRequest{+ Project: &v1pb.Project{+ Name: project.Name,+ AllowLastPlanEditorApproval: true,+ },+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"allow_last_plan_editor_approval"}},+ })); err != nil {+ return err+ }+characterSet, collation := "utf8mb4", "utf8mb4_general_ci"if instance.Engine == v1pb.Engine_POSTGRES {characterSet = "UTF8"diff --git a/backend/tests/plan_update_test.go b/backend/tests/plan_update_test.goindex baa44a667a..b7c99dcf87 100644--- a/backend/tests/plan_update_test.go+++ b/backend/tests/plan_update_test.go@@ -37,6 +37,17 @@ func setupPlanUpdateFixture(t *testing.T, withIssue bool) *planUpdateFixture {ctx, err := ctl.StartServerWithExternalPg(ctx)a.NoError(err)t.Cleanup(func() { _ = ctl.Close(ctx) })+ // The fixture creates a database through a bootstrap Plan owned and approved+ // by the test user. Keep that setup flow independent of the feature under+ // test; individual tests can set the project policy they need afterwards.+ _, err = ctl.projectServiceClient.UpdateProject(ctx, connect.NewRequest(&v1pb.UpdateProjectRequest{+ Project: &v1pb.Project{+ Name: ctl.project.Name,+ AllowLastPlanEditorApproval: true,+ },+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"allow_last_plan_editor_approval"}},+ }))+ a.NoError(err)instanceName := "planUpdateInstance_" + generateRandomString("inst")pgContainer, err := provisionPgInstance(ctx, t)@@ -131,6 +142,145 @@ func listPlanUpdateEvents(t *testing.T, f *planUpdateFixture) []*v1pb.IssueCommereturn out}+func TestPlanLastEditorAttributionAndApproval(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ f := setupPlanUpdateFixture(t, false)+ newProjectID := generateRandomString("last-editor-default")+ newProject, err := f.ctl.projectServiceClient.CreateProject(f.ctx, connect.NewRequest(&v1pb.CreateProjectRequest{+ Project: &v1pb.Project{Title: newProjectID},+ ProjectId: newProjectID,+ }))+ a.NoError(err)+ a.False(newProject.Msg.AllowLastPlanEditorApproval)+ a.Equal("users/[email protected]", f.plan.LastPlanEditor)+ _, err = f.ctl.projectServiceClient.UpdateProject(f.ctx, connect.NewRequest(&v1pb.UpdateProjectRequest{+ Project: &v1pb.Project{+ Name: f.ctl.project.Name,+ AllowSelfApproval: false,+ AllowLastPlanEditorApproval: false,+ },+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"allow_self_approval", "allow_last_plan_editor_approval"}},+ }))+ a.NoError(err)++ installWorkspaceApprovalRule(f.ctx, t, f.ctl, f.ctl.project, []string{"roles/projectOwner"})+ editor := provisionApprover(f.ctx, t, f.ctl, f.ctl.project, "last-plan-editor", "roles/projectOwner")++ updateSpecs := func(specs []*v1pb.Plan_Spec) *v1pb.Plan {+ var updated *v1pb.Plan+ withImpersonation(f.ctx, t, f.ctl, editor, func() {+ resp, err := f.ctl.planServiceClient.UpdatePlan(f.ctx, connect.NewRequest(&v1pb.UpdatePlanRequest{+ Plan: &v1pb.Plan{Name: f.plan.Name, Specs: specs},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"specs"}},+ }))+ a.NoError(err)+ updated = resp.Msg+ })+ return updated+ }++ // An identical specs update is accepted and must still attribute the editor.+ updated := updateSpecs(f.plan.Specs)+ a.Equal("users/"+editor.Email, updated.LastPlanEditor)++ secondSpec := &v1pb.Plan_Spec{+ Id: uuid.NewString(),+ Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{+ ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{+ Targets: []string{f.database.Name},+ Sheet: f.sheet2.Name,+ },+ },+ }+ updated = updateSpecs(append(updated.Specs, secondSpec))+ // Reordering specs is accepted and must also attribute the editor.+ updated = updateSpecs([]*v1pb.Plan_Spec{updated.Specs[1], updated.Specs[0]})+ a.Equal("users/"+editor.Email, updated.LastPlanEditor)++ // Metadata and lifecycle updates must not transfer Last Plan Editor.+ metadataEditor := provisionApprover(f.ctx, t, f.ctl, f.ctl.project, "metadata-editor", "roles/projectOwner")+ withImpersonation(f.ctx, t, f.ctl, metadataEditor, func() {+ resp, err := f.ctl.planServiceClient.UpdatePlan(f.ctx, connect.NewRequest(&v1pb.UpdatePlanRequest{+ Plan: &v1pb.Plan{+ Name: updated.Name,+ Title: "metadata update",+ Description: "metadata update",+ State: v1pb.State_DELETED,+ },+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title", "description", "state"}},+ }))+ a.NoError(err)+ a.Equal("users/"+editor.Email, resp.Msg.LastPlanEditor)+ resp, err = f.ctl.planServiceClient.UpdatePlan(f.ctx, connect.NewRequest(&v1pb.UpdatePlanRequest{+ Plan: &v1pb.Plan{Name: updated.Name, State: v1pb.State_ACTIVE},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}},+ }))+ a.NoError(err)+ a.Equal("users/"+editor.Email, resp.Msg.LastPlanEditor)+ updated = resp.Msg+ })++ issue := createIssueForPlan(f.ctx, t, f.ctl, f.ctl.project, updated, "last plan editor approval")+ waitForIssuePending(f.ctx, t, f.ctl, issue)++ withImpersonation(f.ctx, t, f.ctl, editor, func() {+ _, err := f.ctl.issueServiceClient.ApproveIssue(f.ctx, connect.NewRequest(&v1pb.ApproveIssueRequest{Name: issue.Name}))+ a.Error(err)+ a.Equal(connect.CodeFailedPrecondition, connect.CodeOf(err))+ _, err = f.ctl.issueServiceClient.RejectIssue(f.ctx, connect.NewRequest(&v1pb.RejectIssueRequest{Name: issue.Name}))+ a.NoError(err)+ })++ projectResp, err := f.ctl.projectServiceClient.UpdateProject(f.ctx, connect.NewRequest(&v1pb.UpdateProjectRequest{+ Project: &v1pb.Project{+ Name: f.ctl.project.Name,+ AllowLastPlanEditorApproval: true,+ },+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"allow_last_plan_editor_approval"}},+ }))+ a.NoError(err)+ a.True(projectResp.Msg.AllowLastPlanEditorApproval)+ issueResp, err := f.ctl.issueServiceClient.GetIssue(f.ctx, connect.NewRequest(&v1pb.GetIssueRequest{Name: issue.Name}))+ a.NoError(err)+ a.Len(issueResp.Msg.Approvers, 1)+ a.Equal(v1pb.Issue_Approver_REJECTED, issueResp.Msg.Approvers[0].Status)+ requestIssueAsCreator(f.ctx, t, f.ctl, issue, "updated")++ withImpersonation(f.ctx, t, f.ctl, editor, func() {+ _, err := f.ctl.issueServiceClient.ApproveIssue(f.ctx, connect.NewRequest(&v1pb.ApproveIssueRequest{Name: issue.Name}))+ a.NoError(err)+ })++ // Enabling last-editor approval does not override the self-approval rule.+ var selfPlan *v1pb.Plan+ var selfIssue *v1pb.Issue+ withImpersonation(f.ctx, t, f.ctl, editor, func() {+ planResp, err := f.ctl.planServiceClient.CreatePlan(f.ctx, connect.NewRequest(&v1pb.CreatePlanRequest{+ Parent: f.ctl.project.Name,+ Plan: &v1pb.Plan{Specs: updated.Specs},+ }))+ a.NoError(err)+ selfPlan = planResp.Msg+ issueResp, err := f.ctl.issueServiceClient.CreateIssue(f.ctx, connect.NewRequest(&v1pb.CreateIssueRequest{+ Parent: f.ctl.project.Name,+ Issue: &v1pb.Issue{+ Type: v1pb.Issue_DATABASE_CHANGE,+ Title: "self approval remains disabled",+ Plan: selfPlan.Name,+ },+ }))+ a.NoError(err)+ selfIssue = issueResp.Msg+ })+ waitForIssuePending(f.ctx, t, f.ctl, selfIssue)+ withImpersonation(f.ctx, t, f.ctl, editor, func() {+ _, err := f.ctl.issueServiceClient.ApproveIssue(f.ctx, connect.NewRequest(&v1pb.ApproveIssueRequest{Name: selfIssue.Name}))+ a.Error(err)+ a.Equal(connect.CodePermissionDenied, connect.CodeOf(err))+ })+}+// TestPlanSpecUpdate_SheetChange_EmitsIssueComment is the original test from// PR #20032: changing a spec's sheet emits a single PlanSpecUpdate row.func TestPlanSpecUpdate_SheetChange_EmitsIssueComment(t *testing.T) {diff --git a/backend/tests/user_test.go b/backend/tests/user_test.goindex 51fc5d90f2..8cc31387dd 100644--- a/backend/tests/user_test.go+++ b/backend/tests/user_test.go@@ -6,6 +6,7 @@ import ("testing""connectrpc.com/connect"+ "github.com/google/uuid""github.com/stretchr/testify/require""google.golang.org/genproto/googleapis/type/expr""google.golang.org/protobuf/types/known/emptypb"@@ -476,6 +477,20 @@ func TestUpdateUserEmail(t *testing.T) {}))a.NoError(err)+ pgContainer, err := provisionPgInstance(ctx, t)+ a.NoError(err)+ instanceResp, err := ctl.instanceServiceClient.CreateInstance(ctx, connect.NewRequest(&v1pb.CreateInstanceRequest{+ InstanceId: generateRandomString("email-update"),+ Instance: &v1pb.Instance{+ Title: "email-update",+ Engine: v1pb.Engine_POSTGRES,+ Environment: new("environments/prod"),+ Activation: true,+ DataSources: []*v1pb.DataSource{pgContainer.adminDataSource()},+ },+ }))+ a.NoError(err)+// 2. Login as user and create resourcesloginResp, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{Email: originalEmail,@@ -513,6 +528,22 @@ func TestUpdateUserEmail(t *testing.T) {a.NoError(err)comment := commentResp.Msg+ planResp, err := ctl.planServiceClient.CreatePlan(userCtx, connect.NewRequest(&v1pb.CreatePlanRequest{+ Parent: "projects/" + projectID,+ Plan: &v1pb.Plan{Specs: []*v1pb.Plan_Spec{{+ Id: uuid.NewString(),+ Config: &v1pb.Plan_Spec_CreateDatabaseConfig{+ CreateDatabaseConfig: &v1pb.Plan_CreateDatabaseConfig{+ Target: instanceResp.Msg.Name,+ Database: "email_update_test",+ },+ },+ }}},+ }))+ a.NoError(err)+ plan := planResp.Msg+ a.Equal(common.FormatUserEmail(originalEmail), plan.LastPlanEditor)+// 3. Update Email (as Admin)// Login as adminadminLoginResp, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{@@ -556,6 +587,12 @@ func TestUpdateUserEmail(t *testing.T) {}a.True(foundComment)+ updatedPlanResp, err := ctl.planServiceClient.GetPlan(ctx, connect.NewRequest(&v1pb.GetPlanRequest{+ Name: plan.Name,+ }))+ a.NoError(err)+ a.Equal(common.FormatUserEmail(newEmail), updatedPlanResp.Msg.LastPlanEditor, "Plan last editor should be updated")+// Verify Project PolicynewPolicyResp, err := ctl.projectServiceClient.GetIamPolicy(ctx, connect.NewRequest(&v1pb.GetIamPolicyRequest{Resource: "projects/" + projectID,diff --git a/docs/design/last-plan-change-approval.md b/docs/design/last-plan-change-approval.mdnew file mode 100644index 0000000000..73838bc636--- /dev/null+++ b/docs/design/last-plan-change-approval.md@@ -0,0 +1,46 @@+# Approval by the person who last changed a plan++## Decision++Bytebase treats the authenticated user on the most recent accepted `Plan.specs` mutation as the+Last Plan Editor. Project owners independently control whether that user and the Issue creator may+approve the related database change Issue. Both permissions are cumulative: a reviewer who is both+actors may approve only when both permissions allow it.++The public API retains `last_plan_editor` and `allow_last_plan_editor_approval` as precise resource+names. User-facing text describes the action — “the person who last changed the plan” — because+“Plan Editor” otherwise reads as a role.++## Product behavior++A plan creation or any accepted update whose update mask includes `specs` transfers Last Plan+Editor attribution to the authenticated caller. Identical and reorder-only specs updates count+because accepting the mutation makes that caller responsible for the submitted plan.++The following operations do not transfer attribution:++- changing the plan title or description;+- changing lifecycle state; and+- changing the content of a referenced Sheet without updating `Plan.specs`.++When `allow_last_plan_editor_approval` is disabled, the attributed user remains visible as a review+candidate but cannot Approve. The UI explains that the user last changed the plan and that another+reviewer must approve. Reject and request-review remain available.++`allow_self_approval` is a separate permission based on Issue creator identity. Keeping two controls+lets a project prohibit either authorship relationship independently. Combining them would prevent a+project from allowing Issue creators while requiring an independent reviewer after plan changes, or+the reverse.++## Attribution and compatibility++The Plan stores Last Plan Editor as a normalized email and updates that reference when the user's+email changes. The mutation, attribution transfer, and approval reset commit atomically. Approval is+authorized by the backend; UI eligibility is explanatory and cannot grant approval.++Historical plans without stored attribution use the Plan creator as the effective Last Plan Editor.+Existing projects are migrated to allow approval so upgrades preserve their prior behavior. New+projects use the restrictive default until a project owner enables the permission.++Changing either project permission affects future approval actions only. It does not remove or+rewrite recorded approval steps.diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex b1e68d909a..509164602c 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1742,6 +1742,7 @@"no-reviewers": "No reviewers","rejected-by": "Rejected by {{user}}"},+ "candidate-last-changed-plan": "Can't approve — last changed this plan","comment-required-to-reject": "A comment is required to reject","footer": {"all-gates-passed": "All gates passed",@@ -1771,6 +1772,7 @@"rollout-not-created": "Rollout was not created automatically","waiting-on-review": "Waiting on review"},+ "last-plan-editor-cannot-approve": "You can't approve this issue because you were the last person to change its plan. A different reviewer must approve it.","rejection": {"guidance-prefix": "Update your changes to address the feedback, or","guidance-suffix": "without changes",@@ -1970,17 +1972,25 @@"description": "Allow project members to request time-boxed access grants for specific read-only statements. Grants can also cover exporting results and viewing unmasked data.","self": "Allow access grants"},+ "allow-last-plan-editor-approval": {+ "description": "Allow the person who most recently changed a plan to approve its related database change issue.",+ "self": "Allow approval by the person who last changed the plan"+ },"allow-request-role": {"description": "Allow project members to request roles.","self": "Allow request role"},"allow-self-approval": {- "description": "Allow the issue creator to approve the issue.",- "self": "Allow self approval"+ "description": "Allow the person who created an issue to approve it.",+ "self": "Allow issue creators to approve their own issues"},"approval-flow-configured": "Approval flow configured","approval-flow-fallback": "Using fallback approval flow","approval-flow-not-configured": "No approval flow configured",+ "approval-permissions": {+ "description": "These permissions are cumulative. If a reviewer both created the issue and last changed its plan, both permissions must be enabled.",+ "self": "Approval permissions"+ },"ci-sampling-size": {"description": "The maximum number of databases to sample during CI data validation. When disabled (zero), full validation will be performed.","self": "CI Data Sampling Size"diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 4a6732e789..0411dd4906 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1742,6 +1742,7 @@"no-reviewers": "Sin revisores","rejected-by": "Rechazado por {{user}}"},+ "candidate-last-changed-plan": "No puede aprobar — fue la última persona en modificar este plan","comment-required-to-reject": "Se requiere un comentario para rechazar","footer": {"all-gates-passed": "Todos los requisitos cumplidos",@@ -1771,6 +1772,7 @@"rollout-not-created": "El despliegue no se creó automáticamente","waiting-on-review": "Esperando revisión"},+ "last-plan-editor-cannot-approve": "No puedes aprobar este issue porque fuiste la última persona en modificar su plan. Otra persona debe aprobarlo.","rejection": {"guidance-prefix": "Actualiza tus cambios para atender los comentarios, o","guidance-suffix": "sin cambios",@@ -1970,17 +1972,25 @@"description": "Permite a los miembros del proyecto solicitar concesiones de acceso con límite de tiempo para sentencias específicas de solo lectura. Las concesiones también pueden incluir la exportación de resultados y la visualización de datos sin enmascarar.","self": "Permitir concesiones de acceso"},+ "allow-last-plan-editor-approval": {+ "description": "Permite que la persona que modificó un plan por última vez apruebe el issue de cambio de base de datos relacionado.",+ "self": "Permitir la aprobación de la persona que modificó el plan por última vez"+ },"allow-request-role": {"description": "Los usuarios que no son propietarios del proyecto pueden solicitar roles a nivel de proyecto por sí mismos","self": "Permitir solicitar rol"},"allow-self-approval": {- "description": "Permitir que el creador del problema apruebe el problema.",- "self": "Permitir la autoaprobación"+ "description": "Permite que la persona que creó un issue lo apruebe.",+ "self": "Permitir que los creadores aprueben sus propios issues"},"approval-flow-configured": "Flujo de aprobación configurado","approval-flow-fallback": "Usando regla de aprobación predeterminada","approval-flow-not-configured": "Flujo de aprobación no configurado",+ "approval-permissions": {+ "description": "Estos permisos son acumulativos. Si una persona creó el issue y también modificó su plan por última vez, ambos permisos deben estar habilitados.",+ "self": "Permisos de aprobación"+ },"ci-sampling-size": {"description": "El número máximo de bases de datos para probar durante la validación de datos de CI. \nCuando está deshabilitado (cero), se realizará la validación completa.","self": "Tamaño de muestreo de datos de CI"diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 38aed2a1af..a8f61f53d0 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1742,6 +1742,7 @@"no-reviewers": "レビュアーなし","rejected-by": "{{user}} が却下"},+ "candidate-last-changed-plan": "承認不可 — このプランを最後に変更","comment-required-to-reject": "却下するにはコメントが必要です","footer": {"all-gates-passed": "すべての条件を満たしました",@@ -1771,6 +1772,7 @@"rollout-not-created": "ロールアウトは自動作成されませんでした","waiting-on-review": "レビュー待ち"},+ "last-plan-editor-cannot-approve": "この Issue を承認できません。最後にプランを変更したユーザーであるためです。別のレビュー担当者による承認が必要です。","rejection": {"guidance-prefix": "フィードバックに対応して変更を更新するか、変更なしで","guidance-suffix": "こともできます",@@ -1970,17 +1972,25 @@"description": "プロジェクトメンバーが特定の読み取り専用ステートメントに対して期限付きのアクセス付与をリクエストできるようにします。付与には結果のエクスポートやマスク解除データの閲覧を含めることもできます。","self": "アクセス付与を許可"},+ "allow-last-plan-editor-approval": {+ "description": "プランを最後に変更したユーザーが、関連するデータベース変更 Issue を承認できるようにします。",+ "self": "プランを最後に変更したユーザーによる承認を許可"+ },"allow-request-role": {"description": "プロジェクト所有者以外のユーザーがプロジェクトレベルのロールを自分でリクエストできます","self": "ロールリクエストを許可"},"allow-self-approval": {- "description": "イシューの作成者がイシューを承認できるようにします。",- "self": "自己承認を許可する"+ "description": "Issue の作成者がその Issue を承認できるようにします。",+ "self": "Issue 作成者による自己承認を許可"},"approval-flow-configured": "承認フローが設定済み","approval-flow-fallback": "フォールバック承認ルールを使用中","approval-flow-not-configured": "承認フローが未設定",+ "approval-permissions": {+ "description": "これらの権限は累積して適用されます。レビュー担当者が Issue の作成者であり、かつプランを最後に変更したユーザーでもある場合、両方の権限を有効にする必要があります。",+ "self": "承認権限"+ },"ci-sampling-size": {"description": "CIデータ検証中にサンプリングするデータベースの最大数。\n無効(ゼロ)の場合、完全な検証が実行されます。","self": "CIデータサンプリングサイズ"diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 9f07ca7ce6..81a9c335d4 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -1742,6 +1742,7 @@"no-reviewers": "Không có người xét duyệt","rejected-by": "Bị từ chối bởi {{user}}"},+ "candidate-last-changed-plan": "Không thể phê duyệt — là người thay đổi kế hoạch gần đây nhất","comment-required-to-reject": "Cần có bình luận để từ chối","footer": {"all-gates-passed": "Đã đạt mọi điều kiện",@@ -1771,6 +1772,7 @@"rollout-not-created": "Bản triển khai chưa được tạo tự động","waiting-on-review": "Đang chờ xét duyệt"},+ "last-plan-editor-cannot-approve": "Bạn không thể phê duyệt issue này vì bạn là người thay đổi kế hoạch gần đây nhất. Một người xét duyệt khác phải phê duyệt issue này.","rejection": {"guidance-prefix": "Cập nhật thay đổi để xử lý phản hồi, hoặc","guidance-suffix": "mà không thay đổi",@@ -1970,17 +1972,25 @@"description": "Cho phép thành viên dự án yêu cầu cấp quyền truy cập có thời hạn cho các câu lệnh chỉ đọc cụ thể. Quyền được cấp cũng có thể bao gồm xuất kết quả và xem dữ liệu chưa che.","self": "Cho phép cấp quyền truy cập"},+ "allow-last-plan-editor-approval": {+ "description": "Cho phép người thay đổi kế hoạch gần đây nhất phê duyệt issue thay đổi cơ sở dữ liệu liên quan.",+ "self": "Cho phép người thay đổi kế hoạch gần đây nhất phê duyệt"+ },"allow-request-role": {"description": "Người dùng không phải chủ sở hữu dự án có thể tự yêu cầu vai trò cấp dự án","self": "Cho phép yêu cầu vai trò"},"allow-self-approval": {- "description": "Cho phép người tạo vấn đề phê duyệt vấn đề.",- "self": "Cho phép tự phê duyệt"+ "description": "Cho phép người tạo issue phê duyệt issue đó.",+ "self": "Cho phép người tạo issue tự phê duyệt"},"approval-flow-configured": "Quy trình phê duyệt đã được cấu hình","approval-flow-fallback": "Đang sử dụng quy tắc phê duyệt mặc định","approval-flow-not-configured": "Chưa cấu hình quy trình phê duyệt",+ "approval-permissions": {+ "description": "Các quyền này được áp dụng đồng thời. Nếu một người xét duyệt vừa tạo issue vừa là người thay đổi kế hoạch gần đây nhất, cả hai quyền phải được bật.",+ "self": "Quyền phê duyệt"+ },"ci-sampling-size": {"description": "Số lượng cơ sở dữ liệu tối đa để lấy mẫu trong quá trình xác thực dữ liệu CI. \nKhi bị vô hiệu hóa (không), xác thực đầy đủ sẽ được thực hiện.","self": "Kích thước lấy mẫu dữ liệu CI"diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 1edf1a1b8f..54a702f901 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1742,6 +1742,7 @@"no-reviewers": "无审批人","rejected-by": "由 {{user}} 拒绝"},+ "candidate-last-changed-plan": "无法审批 — 最后修改了此计划","comment-required-to-reject": "拒绝时必须填写评论","footer": {"all-gates-passed": "所有条件已满足",@@ -1771,6 +1772,7 @@"rollout-not-created": "发布未自动创建","waiting-on-review": "等待审批"},+ "last-plan-editor-cannot-approve": "由于您最后修改了该计划,因此无法审批此工单。请由其他审批人进行审批。","rejection": {"guidance-prefix": "请根据反馈修改变更,或","guidance-suffix": "(不做修改)",@@ -1970,17 +1972,25 @@"description": "允许项目成员为特定只读语句申请限时访问授权。授权还可包含导出查询结果和查看未脱敏数据。","self": "允许访问授权"},+ "allow-last-plan-editor-approval": {+ "description": "允许最后修改计划的用户审批关联的数据库变更工单。",+ "self": "允许最后修改计划的用户审批"+ },"allow-request-role": {"description": "非项目所有者可以自行申请项目级角色","self": "允许申请角色"},"allow-self-approval": {- "description": "允许创建者审批自己创建的工单。",- "self": "允许创建者审批"+ "description": "允许工单创建者审批该工单。",+ "self": "允许工单创建者审批自己的工单"},"approval-flow-configured": "审批流程已配置","approval-flow-fallback": "使用默认审批规则","approval-flow-not-configured": "未配置审批流程",+ "approval-permissions": {+ "description": "这些权限会同时生效。如果审批人既创建了工单又最后修改了计划,则必须同时启用这两项权限。",+ "self": "审批权限"+ },"ci-sampling-size": {"description": "在CI数据验证期间,要采样的数据库数量的最大数量。\n禁用(零)时,将执行完整验证。","self": "CI 数据采样大小"diff --git a/frontend/src/routes/project/ProjectSettingsPage.tsx b/frontend/src/routes/project/ProjectSettingsPage.tsxindex 62d3b00fe8..78db57cb6e 100644--- a/frontend/src/routes/project/ProjectSettingsPage.tsx+++ b/frontend/src/routes/project/ProjectSettingsPage.tsx@@ -226,6 +226,8 @@ export function ProjectSettingsPage() {const [allowSelfApproval, setAllowSelfApproval] = useState(project?.allowSelfApproval ?? false);+ const [allowLastPlanEditorApproval, setAllowLastPlanEditorApproval] =+ useState(project?.allowLastPlanEditorApproval ?? false);const [requireIssueApproval, setRequireIssueApproval] = useState(project?.requireIssueApproval ?? false);@@ -310,6 +312,8 @@ export function ProjectSettingsPage() {if (enforceIssueTitle !== project.enforceIssueTitle) return true;if (enforceSqlReview !== project.enforceSqlReview) return true;if (allowSelfApproval !== project.allowSelfApproval) return true;+ if (allowLastPlanEditorApproval !== project.allowLastPlanEditorApproval)+ return true;if (requireIssueApproval !== project.requireIssueApproval) return true;if (requirePlanCheckNoError !== project.requirePlanCheckNoError)return true;@@ -341,6 +345,7 @@ export function ProjectSettingsPage() {enforceIssueTitle,enforceSqlReview,allowSelfApproval,+ allowLastPlanEditorApproval,requireIssueApproval,requirePlanCheckNoError,postgresDatabaseTenantMode,@@ -387,6 +392,7 @@ export function ProjectSettingsPage() {setEnforceIssueTitle(project.enforceIssueTitle);setEnforceSqlReview(project.enforceSqlReview);setAllowSelfApproval(project.allowSelfApproval);+ setAllowLastPlanEditorApproval(project.allowLastPlanEditorApproval);setRequireIssueApproval(project.requireIssueApproval);setRequirePlanCheckNoError(project.requirePlanCheckNoError);setPostgresDatabaseTenantMode(project.postgresDatabaseTenantMode);@@ -490,6 +496,10 @@ export function ProjectSettingsPage() {projectPatch.allowSelfApproval = allowSelfApproval;updateMask.push("allow_self_approval");}+ if (allowLastPlanEditorApproval !== project.allowLastPlanEditorApproval) {+ projectPatch.allowLastPlanEditorApproval = allowLastPlanEditorApproval;+ updateMask.push("allow_last_plan_editor_approval");+ }if (requireIssueApproval !== project.requireIssueApproval) {projectPatch.requireIssueApproval = requireIssueApproval;updateMask.push("require_issue_approval");@@ -566,6 +576,7 @@ export function ProjectSettingsPage() {enforceIssueTitle,enforceSqlReview,allowSelfApproval,+ allowLastPlanEditorApproval,requireIssueApproval,requirePlanCheckNoError,postgresDatabaseTenantMode,@@ -975,6 +986,14 @@ export function ProjectSettingsPage() {"project.settings.issue-related.enforce-sql-review.description")}/>+ <FormField+ title={t(+ "project.settings.issue-related.approval-permissions.self"+ )}+ description={t(+ "project.settings.issue-related.approval-permissions.description"+ )}+ /><ToggleRowchecked={allowSelfApproval}onCheckedChange={setAllowSelfApproval}@@ -986,6 +1005,17 @@ export function ProjectSettingsPage() {"project.settings.issue-related.allow-self-approval.description")}/>+ <ToggleRow+ checked={allowLastPlanEditorApproval}+ onCheckedChange={setAllowLastPlanEditorApproval}+ disabled={!canUpdateProject}+ label={t(+ "project.settings.issue-related.allow-last-plan-editor-approval.self"+ )}+ description={t(+ "project.settings.issue-related.allow-last-plan-editor-approval.description"+ )}+ /><ToggleRowchecked={requireIssueApproval}onCheckedChange={setRequireIssueApproval}diff --git a/frontend/src/routes/project/approvalEligibility.test.ts b/frontend/src/routes/project/approvalEligibility.test.tsnew file mode 100644index 0000000000..8f3bd55ea1--- /dev/null+++ b/frontend/src/routes/project/approvalEligibility.test.ts@@ -0,0 +1,59 @@+import { describe, expect, test } from "vitest";+import type { Project } from "@/types/proto-es/v1/project_service_pb";+import { getApprovalEligibility } from "./approvalEligibility";++const project = (+ allowSelfApproval: boolean,+ allowLastPlanEditorApproval: boolean+) =>+ ({+ allowLastPlanEditorApproval,+ allowSelfApproval,+ }) as Pick<Project, "allowLastPlanEditorApproval" | "allowSelfApproval">;++describe("getApprovalEligibility", () => {+ test("keeps the last plan editor in the role while denying approval", () => {+ expect(+ getApprovalEligibility({+ actor: "users/[email protected]",+ issueCreator: "users/[email protected]",+ lastPlanEditor: "users/[email protected]",+ project: project(false, false),+ })+ ).toEqual({+ canApprove: false,+ canReview: true,+ ineligibilities: ["last-plan-editor"],+ });+ });++ test("combines self-approval and last-editor restrictions", () => {+ expect(+ getApprovalEligibility({+ actor: "users/[email protected]",+ issueCreator: "users/[email protected]",+ lastPlanEditor: "users/[email protected]",+ project: project(false, false),+ })+ ).toEqual({+ canApprove: false,+ canReview: false,+ ineligibilities: ["self-approval", "last-plan-editor"],+ });+ });++ test("allows the last editor when the project policy opts in", () => {+ expect(+ getApprovalEligibility({+ actor: "users/[email protected]",+ issueCreator: "users/[email protected]",+ lastPlanEditor: "users/[email protected]",+ project: project(false, true),+ })+ ).toEqual({+ canApprove: true,+ canReview: true,+ ineligibilities: [],+ });+ });+});diff --git a/frontend/src/routes/project/approvalEligibility.ts b/frontend/src/routes/project/approvalEligibility.tsnew file mode 100644index 0000000000..f6055b0d58--- /dev/null+++ b/frontend/src/routes/project/approvalEligibility.ts@@ -0,0 +1,39 @@+import type { Project } from "@/types/proto-es/v1/project_service_pb";++export type ApprovalIneligibility = "last-plan-editor" | "self-approval";++export interface ApprovalEligibility {+ canApprove: boolean;+ canReview: boolean;+ ineligibilities: ApprovalIneligibility[];+}++export function getApprovalEligibility({+ actor,+ issueCreator,+ lastPlanEditor,+ project,+}: {+ actor: string;+ issueCreator: string;+ lastPlanEditor: string;+ project: Pick<Project, "allowLastPlanEditorApproval" | "allowSelfApproval">;+}): ApprovalEligibility {+ const ineligibilities: ApprovalIneligibility[] = [];++ if (!project.allowSelfApproval && actor === issueCreator) {+ ineligibilities.push("self-approval");+ }+ if (!project.allowLastPlanEditorApproval && actor === lastPlanEditor) {+ ineligibilities.push("last-plan-editor");+ }++ return {+ // Self-approval is a review-wide restriction: the backend rejects both an+ // approval and a rejection. Last-plan-editor is deliberately narrower,+ // so that editor can still request changes.+ canApprove: ineligibilities.length === 0,+ canReview: !ineligibilities.includes("self-approval"),+ ineligibilities,+ };+}diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsxindex 8706ebacb9..6cf0d79002 100644--- a/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx@@ -396,6 +396,7 @@ export function IssueDetailActionBar() {onExecute={executeAction}><IssueDetailReviewPopover+ canApprove={context.permissions.canApproveIssue}context={context}mobile={page.sidebarMode === "MOBILE"}onOpenChange={setPendingReviewOpen}@@ -618,6 +619,7 @@ function IssueDetailConfirmDialog({type IssueReviewAction = "COMMENT" | "APPROVE" | "REJECT";function IssueDetailReviewPopover({+ canApprove,context,mobile,onOpenChange,@@ -625,6 +627,7 @@ function IssueDetailReviewPopover({onRefreshState,open,}: {+ canApprove: boolean;context: ActionContext;mobile: boolean;onOpenChange: (open: boolean) => void;@@ -641,7 +644,9 @@ function IssueDetailReviewPopover({useState<IssueReviewAction>("COMMENT");const issue = page.issue;const submitDisabled =- loading || (selectedAction === "COMMENT" && comment.trim().length === 0);+ loading ||+ (selectedAction === "APPROVE" && !canApprove) ||+ (selectedAction === "COMMENT" && comment.trim().length === 0);useEffect(() => {if (!open) {@@ -753,8 +758,14 @@ function IssueDetailReviewPopover({selected={selectedAction === "COMMENT"}value="COMMENT"/>- {context.permissions.isApprovalCandidate && (+ {context.permissions.isReviewCandidate && (<IssueDetailReviewOption+ disabled={!canApprove}+ disabledReason={+ canApprove+ ? undefined+ : t("plan.review.last-plan-editor-cannot-approve")+ }description={t("issue.review.approve-description")}icon={<Check className="size-4 text-success" />}label={t("common.approve")}@@ -762,7 +773,7 @@ function IssueDetailReviewPopover({value="APPROVE"/>)}- {context.permissions.isApprovalCandidate && (+ {context.permissions.isReviewCandidate && (<IssueDetailReviewOptiondescription={t("issue.review.reject-description")}icon={<X className="size-4 text-error" />}@@ -825,20 +836,25 @@ function IssueDetailReviewPopover({}function IssueDetailReviewOption({+ disabled = false,+ disabledReason,description,icon,label,selected,value,}: {+ disabled?: boolean;+ disabledReason?: string;description?: string;icon?: ReactNode;label: string;selected: boolean;value: IssueReviewAction;}) {- return (+ const option = (<RadioGroupItem+ disabled={disabled}value={value}radioClassName="mt-1"className={cn(@@ -856,4 +872,12 @@ function IssueDetailReviewOption({</span></RadioGroupItem>);+ if (!disabledReason) {+ return option;+ }+ return (+ <Tooltip content={disabledReason}>+ <span className="block">{option}</span>+ </Tooltip>+ );}diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailApprovalFlow.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailApprovalFlow.tsxindex 0a2d97fbfa..b002f024fd 100644--- a/frontend/src/routes/project/issue-detail/components/IssueDetailApprovalFlow.tsx+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailApprovalFlow.tsx@@ -45,10 +45,19 @@ import {isBindingPolicyExpired,memberMapToRolesInProjectIAM,} from "@/utils";+import {+ type ApprovalIneligibility,+ getApprovalEligibility,+} from "../../approvalEligibility";import { useIssueDetailContext } from "../context/IssueDetailContext";type ApprovalStepStatus = "approved" | "rejected" | "current" | "pending";+type PotentialApprover = {+ ineligibilities: ApprovalIneligibility[];+ user: UserMessage;+};+export function IssueDetailApprovalFlow() {const { t } = useTranslation();const page = useIssueDetailContext();@@ -343,7 +352,7 @@ function ApprovalUserText({ candidate }: { candidate: string }) {);}-function PotentialApprovers({ users }: { users: UserMessage[] }) {+function PotentialApprovers({ users }: { users: PotentialApprover[] }) {const { t } = useTranslation();if (users.length === 0) {@@ -354,7 +363,7 @@ function PotentialApprovers({ users }: { users: UserMessage[] }) {return (<div className="flex flex-col items-start gap-1">{users.map((user) => (- <ApprovalCandidateRow key={user.name} user={user} />+ <ApprovalCandidateRow key={user.user.name} candidate={user} />))}</div>);@@ -362,7 +371,9 @@ function PotentialApprovers({ users }: { users: UserMessage[] }) {const visibleUsers = users.slice(0, 3);const names = visibleUsers- .map((user) => user.title || user.email.split("@")[0])+ .map(+ (candidate) => candidate.user.title || candidate.user.email.split("@")[0]+ ).join(", ");const remainingCount = users.length - visibleUsers.length;const triggerText = t("custom-approval.issue-review.and-n-other-users", {@@ -375,7 +386,11 @@ function PotentialApprovers({ users }: { users: UserMessage[] }) {content={<div className="flex max-w-xs flex-col gap-y-1">{users.map((user) => (- <ApprovalCandidateRow key={user.name} showEmail user={user} />+ <ApprovalCandidateRow+ candidate={user}+ key={user.user.name}+ showEmail+ />))}</div>}@@ -389,14 +404,15 @@ function PotentialApprovers({ users }: { users: UserMessage[] }) {}function ApprovalCandidateRow({+ candidate,showEmail = false,- user,}: {+ candidate: PotentialApprover;showEmail?: boolean;- user: UserMessage;}) {const { t } = useTranslation();const currentUser = useCurrentUser();+ const { user } = candidate;const displayName = user.title || user.email.split("@")[0];const isCurrentUser = currentUser?.name === user.name;@@ -417,6 +433,11 @@ function ApprovalCandidateRow({{showEmail && (<span className="text-xs text-control-light">{user.email}</span>)}+ {candidate.ineligibilities.includes("last-plan-editor") && (+ <span className="text-xs text-warning">+ {t("plan.review.candidate-last-changed-plan")}+ </span>+ )}</div>);}@@ -516,9 +537,9 @@ function useApprovalStep(issue: Issue, step: string, stepIndex: number) {(identifier: string) => groupsByName[ensureGroupIdentifier(identifier)],[groupsByName]);- const [potentialApprovers, setPotentialApprovers] = useState<UserMessage[]>(- []- );+ const [potentialApprovers, setPotentialApprovers] = useState<+ PotentialApprover[]+ >([]);const [reRequesting, setReRequesting] = useState(false);const projectName = `${projectNamePrefix}${page.projectId}`;const currentUserEmail = currentUser?.email ?? "";@@ -608,23 +629,6 @@ function useApprovalStep(issue: Issue, step: string, stepIndex: number) {return candidateEmails.includes(`${userNamePrefix}${currentUserEmail}`);}, [candidateEmails, currentUserEmail]);- const filteredCandidateEmails = useMemo(() => {- if (- !project.allowSelfApproval &&- issue.creator === `${userNamePrefix}${currentUserEmail}`- ) {- return candidateEmails.filter(- (candidate) => candidate !== `${userNamePrefix}${currentUserEmail}`- );- }- return candidateEmails;- }, [- candidateEmails,- currentUserEmail,- issue.creator,- project.allowSelfApproval,- ]);-const showSelfApprovalTip = useMemo(() => {return (status === "current" &&@@ -644,13 +648,13 @@ function useApprovalStep(issue: Issue, step: string, stepIndex: number) {let canceled = false;const load = async () => {- if (status !== "current" || filteredCandidateEmails.length === 0) {+ if (status !== "current" || candidateEmails.length === 0) {setPotentialApprovers([]);return;}const users = await batchGetOrFetchUsers(- filteredCandidateEmails.map(ensureUserFullName)+ candidateEmails.map(ensureUserFullName));if (canceled) {return;@@ -668,7 +672,16 @@ function useApprovalStep(issue: Issue, step: string, stepIndex: number) {if (left.email === currentUserEmail) return -1;if (right.email === currentUserEmail) return 1;return left.title.localeCompare(right.title);- });+ })+ .map((user) => ({+ ineligibilities: getApprovalEligibility({+ actor: user.name,+ issueCreator: issue.creator,+ lastPlanEditor: page.plan?.lastPlanEditor ?? "",+ project,+ }).ineligibilities,+ user,+ }));setPotentialApprovers(next);};@@ -677,7 +690,15 @@ function useApprovalStep(issue: Issue, step: string, stepIndex: number) {return () => {canceled = true;};- }, [batchGetOrFetchUsers, currentUserEmail, filteredCandidateEmails, status]);+ }, [+ batchGetOrFetchUsers,+ candidateEmails,+ currentUserEmail,+ issue.creator,+ page.plan?.lastPlanEditor,+ project,+ status,+ ]);const handleReRequestReview = async () => {if (reRequesting) {diff --git a/frontend/src/routes/project/issue-detail/utils/actionRegistry.ts b/frontend/src/routes/project/issue-detail/utils/actionRegistry.tsindex bc7432e95f..5e70bbbb4d 100644--- a/frontend/src/routes/project/issue-detail/utils/actionRegistry.ts+++ b/frontend/src/routes/project/issue-detail/utils/actionRegistry.ts@@ -19,6 +19,7 @@ import {isValidIssueName,isValidPlanName,} from "@/utils";+import { getApprovalEligibility } from "../../approvalEligibility";import { isApprovalCompleted } from "./approval";import { candidatesOfApprovalStepV1 } from "./approvalCandidates";@@ -43,8 +44,9 @@ export interface ActionPermissions {createIssue: boolean;updateIssue: boolean;createRollout: boolean;+ canApproveIssue: boolean;+ isReviewCandidate: boolean;runTasks: boolean;- isApprovalCandidate: boolean;}export interface ActionValidation {@@ -97,22 +99,24 @@ export interface ContextBuilderInput {isSpecEmpty: (spec: Plan["specs"][0]) => boolean;}-const computeIsApprovalCandidate = (+const computeApprovalEligibility = (issue: Issue | undefined,currentUser: User,+ plan: Plan,project: Project-): boolean => {- if (!issue) return false;- if (isApprovalCompleted(issue)) return false;+) => {+ if (!issue || isApprovalCompleted(issue)) {+ return { canApprove: false, canReview: false };+ }const { approvers, approvalTemplate } = issue;const hasRejection = approvers.some((app) => app.status === Issue_Approver_Status.REJECTED);- if (hasRejection) return false;+ if (hasRejection) return { canApprove: false, canReview: false };const roles = approvalTemplate?.flow?.roles ?? [];- if (roles.length === 0) return false;+ if (roles.length === 0) return { canApprove: false, canReview: false };const rejectedIndex = approvers.findIndex((approver) => approver.status === Issue_Approver_Status.REJECTED@@ -120,18 +124,18 @@ const computeIsApprovalCandidate = (const currentRoleIndex =rejectedIndex >= 0 ? rejectedIndex : approvers.length;const currentRole = roles[currentRoleIndex];- if (!currentRole) return false;+ if (!currentRole) return { canApprove: false, canReview: false };const candidates = candidatesOfApprovalStepV1(issue, currentRole);- if (!isUserIncludedInList(currentUser.email, candidates)) return false;-- if (- !project.allowSelfApproval &&- currentUser.email === extractUserEmail(issue.creator)- ) {- return false;+ if (!isUserIncludedInList(currentUser.email, candidates)) {+ return { canApprove: false, canReview: false };}- return true;+ return getApprovalEligibility({+ actor: currentUser.name,+ issueCreator: issue.creator,+ lastPlanEditor: plan.lastPlanEditor,+ project,+ });};export const buildIssueDetailActionContext = (@@ -160,6 +164,12 @@ export const buildIssueDetailActionContext = (const hasDeferredRollout = plan.specs.some((spec) => spec.config?.case === "createDatabaseConfig");+ const reviewEligibility = computeApprovalEligibility(+ issue,+ currentUser,+ plan,+ project+ );const permissions: ActionPermissions = {updatePlan:currentUserEmail === extractUserEmail(plan.creator || "") ||@@ -168,11 +178,8 @@ export const buildIssueDetailActionContext = (updateIssue: hasProjectPermissionV2(project, "bb.issues.update"),createRollout: hasProjectPermissionV2(project, "bb.rollouts.create"),runTasks: hasProjectPermissionV2(project, "bb.taskRuns.create"),- isApprovalCandidate: computeIsApprovalCandidate(- issue,- currentUser,- project- ),+ canApproveIssue: reviewEligibility.canApprove,+ isReviewCandidate: reviewEligibility.canReview,};const validation: ActionValidation = {@@ -269,7 +276,7 @@ export const createIssueDetailActions = (t: TFunction): ActionDefinition[] => {ctx.issueStatus === IssueStatus.OPEN &&ctx.approvalStatus !== ApprovalStatus.APPROVED &&ctx.approvalStatus !== ApprovalStatus.SKIPPED &&- ctx.permissions.isApprovalCandidate,+ ctx.permissions.isReviewCandidate,isDisabled: () => false,disabledReason: () => undefined,executeType: "popover:review",diff --git a/frontend/src/routes/project/issue-detail/utils/approvalCandidates.ts b/frontend/src/routes/project/issue-detail/utils/approvalCandidates.tsindex 583726c2d7..5775bc6a2b 100644--- a/frontend/src/routes/project/issue-detail/utils/approvalCandidates.ts+++ b/frontend/src/routes/project/issue-detail/utils/approvalCandidates.ts@@ -25,13 +25,5 @@ export const candidatesOfApprovalStepV1 = (issue: Issue, role: string) => {};const candidates = role ? candidatesForRoles(role) : [];- return uniq(- candidates.filter((user) => {- // If the project does not allow self-approval, exclude the creator.- if (!project.allowSelfApproval && user === issue.creator) {- return false;- }- return true;- })- );+ return uniq(candidates);};diff --git a/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.test.tsx b/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.test.tsxindex d258cb7aae..1014e38833 100644--- a/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.test.tsx+++ b/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.test.tsx@@ -75,7 +75,7 @@ describe("PlanLifecycleSlot (right action area)", () => {slot({ kind: "review-generating" });expect(container.textContent).toContain("plan.review.action");- slot({ kind: "review-your-turn" });+ slot({ canApprove: true, kind: "review-your-turn" });expect(container.textContent).toContain("marker-review-your-turn");slot({ kind: "plan-status", reason: "rejected" });@@ -117,16 +117,12 @@ describe("PlanLifecycleStamp (left of title)", () => {});test("renders nothing for non-terminal states", () => {- for (const kind of [- "create",- "review-your-turn",- "running-stage",+ for (const state of [+ { kind: "create" },+ { canApprove: true, kind: "review-your-turn" },+ { kind: "running-stage", stage },] as const) {- renderEl(- <PlanLifecycleStamp- state={kind === "running-stage" ? { kind, stage } : { kind }}- />- );+ renderEl(<PlanLifecycleStamp state={state} />);expect(container.textContent).toBe("");}});diff --git a/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.tsx b/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.tsxindex d5f966ce98..d2f056dde8 100644--- a/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.tsx+++ b/frontend/src/routes/project/plan-detail/components/lifecycle/PlanLifecycleSlot.tsx@@ -39,7 +39,12 @@ export function PlanLifecycleSlot({);case "review-your-turn":// review-your-turn only resolves while an open issue exists.- return page.issue ? <ReviewYourTurnAction issue={page.issue} /> : null;+ return page.issue ? (+ <ReviewYourTurnAction+ canApprove={state.canApprove}+ issue={page.issue}+ />+ ) : null;case "plan-status":return page.issue ? (<PlanStatusAction issue={page.issue} reason={state.reason} />diff --git a/frontend/src/routes/project/plan-detail/components/lifecycle/ReviewYourTurnAction.tsx b/frontend/src/routes/project/plan-detail/components/lifecycle/ReviewYourTurnAction.tsxindex 9ebe0b660d..4b7b6dadbf 100644--- a/frontend/src/routes/project/plan-detail/components/lifecycle/ReviewYourTurnAction.tsx+++ b/frontend/src/routes/project/plan-detail/components/lifecycle/ReviewYourTurnAction.tsx@@ -14,7 +14,13 @@ import {import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import { ReviewActionPopover } from "../review/ReviewActionPopover";-export function ReviewYourTurnAction({ issue }: { issue: Issue }) {+export function ReviewYourTurnAction({+ canApprove,+ issue,+}: {+ canApprove: boolean;+ issue: Issue;+}) {const { t } = useTranslation();const [open, setOpen] = useState(false);@@ -25,7 +31,11 @@ export function ReviewYourTurnAction({ issue }: { issue: Issue }) {<ChevronDown className="size-4" /></PopoverTrigger><PopoverContent align="end" className="px-4 py-4">- <ReviewActionPopover issue={issue} onClose={() => setOpen(false)} />+ <ReviewActionPopover+ canApprove={canApprove}+ issue={issue}+ onClose={() => setOpen(false)}+ /></PopoverContent></Popover>);diff --git a/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.test.ts b/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.test.tsindex c7e8bf97fe..38847f0d2d 100644--- a/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.test.ts+++ b/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.test.ts@@ -35,7 +35,8 @@ const base: PlanLifecycleResolverInput = {issueDraft: false,approvalStatus: ApprovalStatus.PENDING,hasCurrentStep: false,- isCurrentUserCandidate: false,+ canCurrentUserApprove: false,+ isCurrentUserReviewCandidate: false,checks: checks(),hasRollout: false,rollout: undefined,@@ -124,14 +125,19 @@ describe("resolvePlanLifecycleHeaderState — review", () => {test("pending + current user's turn -> review-your-turn", () => {expect(- resolve({ hasCurrentStep: true, isCurrentUserCandidate: true }).kind+ resolve({+ canCurrentUserApprove: true,+ hasCurrentStep: true,+ isCurrentUserReviewCandidate: true,+ }).kind).toBe("review-your-turn");});test("readonly suppresses the your-turn advance -> plan-status", () => {const state = resolve({hasCurrentStep: true,- isCurrentUserCandidate: true,+ canCurrentUserApprove: true,+ isCurrentUserReviewCandidate: true,readonly: true,});expect(state.kind).toBe("plan-status");@@ -142,6 +148,16 @@ describe("resolvePlanLifecycleHeaderState — review", () => {expect(state).toMatchObject({ kind: "plan-status", reason: "in-review" });});+ test("last plan editor can review but cannot approve", () => {+ expect(+ resolve({+ canCurrentUserApprove: false,+ hasCurrentStep: true,+ isCurrentUserReviewCandidate: true,+ })+ ).toEqual({ canApprove: false, kind: "review-your-turn" });+ });+test("pending + checks failing -> still in-review (review is the active gate)", () => {const state = resolve({ checks: checks(2) });expect(state).toMatchObject({ kind: "plan-status", reason: "in-review" });diff --git a/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.ts b/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.tsindex 00da553ee7..aa41ef795c 100644--- a/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.ts+++ b/frontend/src/routes/project/plan-detail/components/lifecycle/planLifecycleHeaderState.ts@@ -40,7 +40,7 @@ export type PlanLifecycleHeaderState =| { kind: "closed" } // terminal stamp// Review.| { kind: "review-generating" } // disabled + loading- | { kind: "review-your-turn" }+ | { kind: "review-your-turn"; canApprove: boolean }| { kind: "plan-status"; reason: PlanStatusReason }// Pre-deploy → rollout creation.| { kind: "preparing-rollout" }@@ -62,7 +62,8 @@ export interface PlanLifecycleResolverInput {issueDraft: boolean;approvalStatus: ApprovalStatus;hasCurrentStep: boolean;- isCurrentUserCandidate: boolean;+ canCurrentUserApprove: boolean;+ isCurrentUserReviewCandidate: boolean;checks: PlanCheckSummary;@@ -165,8 +166,15 @@ export function resolvePlanLifecycleHeaderState(}// Pending review: the advance is the current reviewer's to take.- if (input.hasCurrentStep && input.isCurrentUserCandidate && !input.readonly) {- return { kind: "review-your-turn" };+ if (+ input.hasCurrentStep &&+ input.isCurrentUserReviewCandidate &&+ !input.readonly+ ) {+ return {+ canApprove: input.canCurrentUserApprove,+ kind: "review-your-turn",+ };}// Review is the active gate — surface it plainly regardless of check state.return { kind: "plan-status", reason: "in-review" };diff --git a/frontend/src/routes/project/plan-detail/components/lifecycle/usePlanLifecycleHeader.ts b/frontend/src/routes/project/plan-detail/components/lifecycle/usePlanLifecycleHeader.tsindex 3583e395ea..24ea7b6f61 100644--- a/frontend/src/routes/project/plan-detail/components/lifecycle/usePlanLifecycleHeader.ts+++ b/frontend/src/routes/project/plan-detail/components/lifecycle/usePlanLifecycleHeader.ts@@ -33,11 +33,13 @@ export function usePlanLifecycleHeader(: "",[issue]);- const { isCurrentUserCandidate } = useApprovalCandidates(- issue ?? EMPTY_ISSUE,- page.projectId,- currentRole- );+ const { canCurrentUserApprove, isCurrentUserReviewCandidate } =+ useApprovalCandidates(+ issue ?? EMPTY_ISSUE,+ page.projectId,+ currentRole,+ page.plan.lastPlanEditor+ );const isGitOpsPlan = useMemo(() => isReleaseBackedPlan(page.plan.specs),@@ -67,7 +69,8 @@ export function usePlanLifecycleHeader(issueDraft,approvalStatus,hasCurrentStep: currentRole !== "",- isCurrentUserCandidate,+ canCurrentUserApprove,+ isCurrentUserReviewCandidate,checks,hasRollout: !!page.rollout,rollout: page.rollout,@@ -77,7 +80,8 @@ export function usePlanLifecycleHeader(checks,currentRole,hasIssue,- isCurrentUserCandidate,+ canCurrentUserApprove,+ isCurrentUserReviewCandidate,isGitOpsPlan,issueDraft,issueStatus,diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActionPopover.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActionPopover.tsxindex b121ddf707..0b8d25d334 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActionPopover.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActionPopover.tsx@@ -21,13 +21,14 @@ import {RejectIssueRequestSchema,} from "@/types/proto-es/v1/issue_service_pb";import { usePlanDetailContext } from "../../shell/PlanDetailContext";--type ReviewAction = "COMMENT" | "APPROVE" | "REJECT";+import { isReviewSubmitDisabled, type ReviewAction } from "./reviewAction";export function ReviewActionPopover({+ canApprove,issue,onClose,}: {+ canApprove: boolean;issue: Issue;onClose: () => void;}) {@@ -43,10 +44,12 @@ export function ReviewActionPopover({}, [issue.name]);const commentMissing = comment.trim().length === 0;- const submitDisabled =- loading ||- (action === "COMMENT" && commentMissing) ||- (action === "REJECT" && commentMissing);+ const submitDisabled = isReviewSubmitDisabled({+ action,+ canApprove,+ commentMissing,+ loading,+ });const submit = async () => {if (submitDisabled) return;@@ -102,6 +105,12 @@ export function ReviewActionPopover({value="COMMENT"/><ReviewOption+ disabled={!canApprove}+ disabledReason={+ canApprove+ ? undefined+ : t("plan.review.last-plan-editor-cannot-approve")+ }description={t("issue.review.approve-description")}icon={<DecisionIcon spec={REVIEW_DECISION_ICON.approved} />}label={t("common.approve")}@@ -151,20 +160,25 @@ function DecisionIcon({ spec }: { spec: ActivityIconSpec }) {}function ReviewOption({+ disabled = false,+ disabledReason,description,icon,label,selected,value,}: {+ disabled?: boolean;+ disabledReason?: string;description?: string;icon?: ReactNode;label: string;selected: boolean;value: ReviewAction;}) {- return (+ const option = (<RadioGroupItem+ disabled={disabled}value={value}radioClassName="mt-1"className={cn(@@ -182,4 +196,12 @@ function ReviewOption({</span></RadioGroupItem>);+ if (!disabledReason) {+ return option;+ }+ return (+ <Tooltip content={disabledReason}>+ <span className="block">{option}</span>+ </Tooltip>+ );}diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.test.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.test.tsxindex 722e697395..c9637d554a 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.test.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.test.tsx@@ -33,11 +33,17 @@ vi.mock("@/stores/app", () => ({}),}));-vi.mock("./useApprovalCandidates", () => ({- useApprovalCandidates: () => ({+const mocks: { approvalCandidates: ApprovalCandidates } = {+ approvalCandidates: {+ canCurrentUserApprove: false,candidates: [],- isCurrentUserCandidate: false,- }),+ isCurrentUserReviewCandidate: false,+ isCurrentUserRoleMember: false,+ } as ApprovalCandidates,+};++vi.mock("./useApprovalCandidates", () => ({+ useApprovalCandidates: () => mocks.approvalCandidates,}));vi.mock("../../shell/PlanDetailContext", () => ({@@ -66,6 +72,7 @@ vi.mock("@/lib/role", () => ({}));import { ReviewApprovalFlow } from "./ReviewApprovalFlow";+import type { ApprovalCandidates } from "./useApprovalCandidates";const makeIssue = ({approvalStatus = ApprovalStatus.PENDING,@@ -93,6 +100,44 @@ const renderIntoContainer = (element: ReactElement) => {};describe("ReviewApprovalFlow", () => {+ test("keeps the last plan editor visible with an ineligible reason", () => {+ mocks.approvalCandidates = {+ canCurrentUserApprove: false,+ candidates: [+ {+ canApprove: false,+ canReview: true,+ ineligibilities: ["last-plan-editor"],+ user: {+ email: "[email protected]",+ name: "users/[email protected]",+ title: "Editor",+ },+ },+ ],+ isCurrentUserReviewCandidate: true,+ isCurrentUserRoleMember: true,+ } as unknown as ApprovalCandidates;+ const { container, render, unmount } = renderIntoContainer(+ <ReviewApprovalFlow issue={makeIssue()} />+ );++ render();++ expect(container.textContent).toContain("Editor");+ expect(container.textContent).toContain(+ "plan.review.candidate-last-changed-plan"+ );++ mocks.approvalCandidates = {+ canCurrentUserApprove: false,+ candidates: [],+ isCurrentUserReviewCandidate: false,+ isCurrentUserRoleMember: false,+ } as ApprovalCandidates;+ unmount();+ });+// BYT-9745: a skipped approval has no flow to render. The component must show// the "no approval required" note instead of an empty box — otherwise callers// that forget to guard the skipped case (e.g. the bypass confirm sheet) showdiff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.tsxindex 12bfeb1005..3e55217944 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewApprovalFlow.tsx@@ -22,7 +22,10 @@ import {type ApprovalStepStatus,computeApprovalFlowLayout,} from "./approvalFlowLayout";-import { useApprovalCandidates } from "./useApprovalCandidates";+import {+ type ApprovalCandidate,+ useApprovalCandidates,+} from "./useApprovalCandidates";export interface FlowStep {index: number;@@ -319,6 +322,7 @@ function NodeReviewers({role: string;}) {const { t } = useTranslation();+ const page = usePlanDetailContext();// Whether the project IAM policy is in cache yet — used to tell "still// loading" (show nothing) apart from "genuinely no eligible reviewers".const policyLoaded = useAppStore(@@ -326,7 +330,12 @@ function NodeReviewers({state.projectPoliciesByName[`${projectNamePrefix}${projectId}`] !==undefined);- const { candidates } = useApprovalCandidates(issue, projectId, role);+ const { candidates } = useApprovalCandidates(+ issue,+ projectId,+ role,+ page.plan?.lastPlanEditor ?? ""+ );if (candidates.length === 0) {// No eligible reviewers means this stage can never be approved — surface it// explicitly rather than rendering nothing (BYT-9711). Stay silent until the@@ -340,6 +349,9 @@ function NodeReviewers({}const visible = candidates.slice(0, 3);const overflow = candidates.length - visible.length;+ const lastPlanEditorCandidate = candidates.find((candidate) =>+ candidate.ineligibilities.includes("last-plan-editor")+ );// A role can resolve to thousands of candidates; render a bounded, scrollable// slice in the popover and summarize the rest rather than mounting every row.const MAX_LISTED = 50;@@ -347,58 +359,79 @@ function NodeReviewers({const remaining = candidates.length - listed.length;return (- <Popover>- <PopoverTrigger- delay={100}- nativeButton={false}- openOnHover- render={- <div className="mt-1 flex h-5 w-fit cursor-default items-center gap-x-1.5">- <div className="flex items-center">- {visible.map((user) => (- <InitialsAvatar- className="-ml-1 size-5 text-xs ring-2 ring-background first:ml-0"- key={user.name}- user={user}- />- ))}- {overflow > 0 && (- <span className="-ml-1 flex size-5 items-center justify-center rounded-full bg-control-bg font-medium text-control text-xs ring-2 ring-background first:ml-0">- +{overflow}- </span>- )}+ <div className="mt-1">+ <Popover>+ <PopoverTrigger+ delay={100}+ nativeButton={false}+ openOnHover+ render={+ <div className="flex h-5 w-fit cursor-default items-center gap-x-1.5">+ <div className="flex items-center">+ {visible.map(({ user }) => (+ <InitialsAvatar+ className="-ml-1 size-5 text-xs ring-2 ring-background first:ml-0"+ key={user.name}+ user={user}+ />+ ))}+ {overflow > 0 && (+ <span className="-ml-1 flex size-5 items-center justify-center rounded-full bg-control-bg font-medium text-control text-xs ring-2 ring-background first:ml-0">+ +{overflow}+ </span>+ )}+ </div>+ <span className="text-xs text-control-light">+ {t("plan.review.approval-flow.n-reviewers", {+ count: candidates.length,+ })}+ </span></div>- <span className="text-xs text-control-light">- {t("plan.review.approval-flow.n-reviewers", {- count: candidates.length,- })}- </span>+ }+ />+ <PopoverContent align="start" className="w-60" side="bottom">+ <div className="flex max-h-64 flex-col gap-y-2 overflow-y-auto">+ {listed.map((candidate) => (+ <CandidateRow candidate={candidate} key={candidate.user.name} />+ ))}</div>- }- />- <PopoverContent align="start" className="w-60" side="bottom">- <div className="flex max-h-64 flex-col gap-y-2 overflow-y-auto">- {listed.map((user) => (- <div className="flex items-center gap-x-2" key={user.name}>- <InitialsAvatar className="size-6 text-xs" user={user} />- <div className="min-w-0">- <div className="truncate text-sm text-main">- {user.title || user.email.split("@")[0]}- </div>- <div className="truncate text-xs text-control-light">- {user.email}- </div>- </div>+ {remaining > 0 && (+ <div className="mt-2 border-t pt-1.5 text-xs text-control-placeholder">+ {t("plan.review.approval-flow.and-n-more", { count: remaining })}</div>- ))}+ )}+ </PopoverContent>+ </Popover>+ {lastPlanEditorCandidate && (+ <div className="mt-1 truncate text-xs text-warning">+ {lastPlanEditorCandidate.user.title ||+ lastPlanEditorCandidate.user.email}+ {": "}+ {t("plan.review.candidate-last-changed-plan")}</div>- {remaining > 0 && (- <div className="mt-2 border-t pt-1.5 text-xs text-control-placeholder">- {t("plan.review.approval-flow.and-n-more", { count: remaining })}+ )}+ </div>+ );+}++function CandidateRow({ candidate }: { candidate: ApprovalCandidate }) {+ const { t } = useTranslation();+ const { user } = candidate;+ return (+ <div className="flex items-center gap-x-2">+ <InitialsAvatar className="size-6 text-xs" user={user} />+ <div className="min-w-0">+ <div className="truncate text-sm text-main">+ {user.title || user.email.split("@")[0]}+ </div>+ <div className="truncate text-xs text-control-light">{user.email}</div>+ {candidate.ineligibilities.includes("last-plan-editor") && (+ <div className="text-xs text-warning">+ {t("plan.review.candidate-last-changed-plan")}</div>)}- </PopoverContent>- </Popover>+ </div>+ </div>);}@@ -540,7 +573,8 @@ function PendingPopoverRow({ issue, step }: { issue: Issue; step: FlowStep }) {const { candidates } = useApprovalCandidates(issue,page.projectId,- step.role+ step.role,+ page.plan?.lastPlanEditor ?? "");const roleName = displayRoleTitleFromList(step.role, roleList);const visible = candidates.slice(0, 4);@@ -556,7 +590,7 @@ function PendingPopoverRow({ issue, step }: { issue: Issue; step: FlowStep }) {{candidates.length > 0 && (<div className="mt-1 flex items-center gap-x-1.5"><div className="flex items-center">- {visible.map((user) => (+ {visible.map(({ user }) => (<InitialsAvatarclassName="-ml-1 size-5 text-xs ring-2 ring-background first:ml-0"key={user.name}diff --git a/frontend/src/routes/project/plan-detail/components/review/reviewAction.test.ts b/frontend/src/routes/project/plan-detail/components/review/reviewAction.test.tsnew file mode 100644index 0000000000..e7c8fcc258--- /dev/null+++ b/frontend/src/routes/project/plan-detail/components/review/reviewAction.test.ts@@ -0,0 +1,23 @@+import { describe, expect, test } from "vitest";+import { isReviewSubmitDisabled } from "./reviewAction";++describe("isReviewSubmitDisabled", () => {+ test("disables approval for the last plan editor without blocking rejection", () => {+ expect(+ isReviewSubmitDisabled({+ action: "APPROVE",+ canApprove: false,+ commentMissing: false,+ loading: false,+ })+ ).toBe(true);+ expect(+ isReviewSubmitDisabled({+ action: "REJECT",+ canApprove: false,+ commentMissing: false,+ loading: false,+ })+ ).toBe(false);+ });+});diff --git a/frontend/src/routes/project/plan-detail/components/review/reviewAction.ts b/frontend/src/routes/project/plan-detail/components/review/reviewAction.tsnew file mode 100644index 0000000000..ab857beb9c--- /dev/null+++ b/frontend/src/routes/project/plan-detail/components/review/reviewAction.ts@@ -0,0 +1,20 @@+export type ReviewAction = "APPROVE" | "COMMENT" | "REJECT";++export function isReviewSubmitDisabled({+ action,+ canApprove,+ commentMissing,+ loading,+}: {+ action: ReviewAction;+ canApprove: boolean;+ commentMissing: boolean;+ loading: boolean;+}): boolean {+ return (+ loading ||+ (action === "APPROVE" && !canApprove) ||+ (action === "COMMENT" && commentMissing) ||+ (action === "REJECT" && commentMissing)+ );+}diff --git a/frontend/src/routes/project/plan-detail/components/review/useApprovalCandidates.ts b/frontend/src/routes/project/plan-detail/components/review/useApprovalCandidates.tsindex f2bdd21897..13d104449a 100644Binary files a/frontend/src/routes/project/plan-detail/components/review/useApprovalCandidates.ts and b/frontend/src/routes/project/plan-detail/components/review/useApprovalCandidates.ts differdiff --git a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts b/frontend/src/types/proto-es/v1/plan_service_pb.d.tsindex 7cd5d4810d..2a665be1e3 100644--- a/frontend/src/types/proto-es/v1/plan_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/plan_service_pb.d.ts@@ -294,6 +294,15 @@ export declare type Plan = Message<"bytebase.v1.Plan"> & {* @generated from field: bytebase.v1.IssueStatus issue_status = 15;*/issueStatus: IssueStatus;++ /**+ * The user who last created or updated the Plan specs.+ * Format: users/[email protected]. For legacy Plans without stored attribution,+ * this falls back to the Plan creator.+ *+ * @generated from field: string last_plan_editor = 16;+ */+ lastPlanEditor: string;};/**diff --git a/frontend/src/types/proto-es/v1/plan_service_pb.js b/frontend/src/types/proto-es/v1/plan_service_pb.jsindex 9895fa681c..cf0afb805d 100644--- a/frontend/src/types/proto-es/v1/plan_service_pb.js+++ b/frontend/src/types/proto-es/v1/plan_service_pb.js@@ -18,7 +18,7 @@ import { file_v1_sql_service } from "./sql_service_pb";* Describes the file v1/plan_service.proto.*/export const file_v1_plan_service = /*@__PURE__*/- fileDesc("ChV2MS9wbGFuX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFBsYW5SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1BsYW4id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0SuQEKDVJ1blBsYW5DaGVja3MSIS5ieXRlYmFzZS52MS5SdW5QbGFuQ2hlY2tzUmVxdWVzdBoiLmJ5dGViYXNlLnYxLlJ1blBsYW5DaGVja3NSZXNwb25zZSJh2kEEbmFtZYrqMBRiYi5wbGFuQ2hlY2tSdW5zLnJ1bpDqMAGY6jABoOowAoLT5JMCMDoBKiIrL3YxL3tuYW1lPXByb2plY3RzLyovcGxhbnMvKn06cnVuUGxhbkNoZWNrcxLOAQoSQ2FuY2VsUGxhbkNoZWNrUnVuEiYuYnl0ZWJhc2UudjEuQ2FuY2VsUGxhbkNoZWNrUnVuUmVxdWVzdBonLmJ5dGViYXNlLnYxLkNhbmNlbFBsYW5DaGVja1J1blJlc3BvbnNlImfaQQRuYW1liuowFGJiLnBsYW5DaGVja1J1bnMucnVukOowAZjqMAGg6jACgtPkkwI2OgEqIjEvdjEve25hbWU9cHJvamVjdHMvKi9wbGFucy8qL3BsYW5DaGVja1J1bn06Y2FuY2VsQqYBCg9jb20uYnl0ZWJhc2UudjFCEFBsYW5TZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_rollout_service, file_v1_sql_service]);+ fileDesc("ChV2MS9wbGFuX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFBsYW5SZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1BsYW4idwoQTGlzdFBsYW5zUmVxdWVzdBIsCgZwYXJl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ovcGxhbnMvKi9wbGFuQ2hlY2tSdW59ErkBCg1SdW5QbGFuQ2hlY2tzEiEuYnl0ZWJhc2UudjEuUnVuUGxhbkNoZWNrc1JlcXVlc3QaIi5ieXRlYmFzZS52MS5SdW5QbGFuQ2hlY2tzUmVzcG9uc2UiYdpBBG5hbWWK6jAUYmIucGxhbkNoZWNrUnVucy5ydW6Q6jABmOowAaDqMAKC0+STAjA6ASoiKy92MS97bmFtZT1wcm9qZWN0cy8qL3BsYW5zLyp9OnJ1blBsYW5DaGVja3MSzgEKEkNhbmNlbFBsYW5DaGVja1J1bhImLmJ5dGViYXNlLnYxLkNhbmNlbFBsYW5DaGVja1J1blJlcXVlc3QaJy5ieXRlYmFzZS52MS5DYW5jZWxQbGFuQ2hlY2tSdW5SZXNwb25zZSJn2kEEbmFtZYrqMBRiYi5wbGFuQ2hlY2tSdW5zLnJ1bpDqMAGY6jABoOowAoLT5JMCNjoBKiIxL3YxL3tuYW1lPXByb2plY3RzLyovcGxhbnMvKi9wbGFuQ2hlY2tSdW59OmNhbmNlbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBQbGFuU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_rollout_service, file_v1_sql_service]);/*** Describes the message bytebase.v1.GetPlanRequest.diff --git a/frontend/src/types/proto-es/v1/project_service_pb.d.ts b/frontend/src/types/proto-es/v1/project_service_pb.d.tsindex afed957809..f03593a44c 100644--- a/frontend/src/types/proto-es/v1/project_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/project_service_pb.d.ts@@ -582,6 +582,13 @@ export declare type Project = Message<"bytebase.v1.Project"> & {* @generated from field: bool allow_just_in_time_access = 23;*/allowJustInTimeAccess: boolean;++ /**+ * Whether to allow the last Plan editor to approve a database change issue.+ *+ * @generated from field: bool allow_last_plan_editor_approval = 24;+ */+ allowLastPlanEditorApproval: boolean;};/**diff --git a/frontend/src/types/proto-es/v1/project_service_pb.js b/frontend/src/types/proto-es/v1/project_service_pb.jsindex 28989bff20..0c75c2fe15 100644--- a/frontend/src/types/proto-es/v1/project_service_pb.js+++ b/frontend/src/types/proto-es/v1/project_service_pb.js@@ -18,7 +18,7 @@ import { file_v1_iam_policy } from "./iam_policy_pb";* Describes the file v1/project_service.proto.*/export const file_v1_project_service = /*@__PURE__*/- fileDesc("Chh2MS9wcm9qZWN0X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIj8KEUdldFByb2plY3RSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QiRgoXQmF0Y2hHZXRQcm9qZWN0c1JlcXVlc3QSKwoFbmFtZXMYASADKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QiQgoYQmF0Y2hHZXRQcm9qZWN0c1Jlc3BvbnNlEiYKCHByb2plY3RzGAEgAygLMhQuYnl0ZWJhc2UudjEuUHJvamVjdCJ0ChNMaXN0UHJvamVjdHNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkSEAoIb3JkZXJfYnkYBSABKAkiVwoUTGlzdFByb2plY3RzUmVzcG9uc2USJgoIcHJvamVjdHMYASADKAsyFC5ieXRlYmFzZS52MS5Qcm9qZWN0EhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJ2ChVTZWFyY2hQc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lRlc3RXZWJob29rUmVxdWVzdBogLmJ5dGViYXNlLnYxLlRlc3RXZWJob29rUmVzcG9uc2UiUYrqMBJiYi5wcm9qZWN0cy51cGRhdGWQ6jABoOowBKjqMAyC0+STAik6ASoiJC92MS97cHJvamVjdD1wcm9qZWN0cy8qfTp0ZXN0V2ViaG9va0KpAQoPY29tLmJ5dGViYXNlLnYxQhNQcm9qZWN0U2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [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_type_color, file_v1_annotation, file_v1_common, file_v1_iam_policy]);+ fileDesc("Chh2MS9wcm9qZWN0X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIj8KEUdldFByb2plY3RSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QiRgoXQmF0Y2hHZXRQcm9qZWN0c1JlcXVlc3QSKwoFbmFtZXMYASADKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QiQgoYQmF0Y2hHZXRQcm9qZWN0c1Jlc3BvbnNlEiYKCHByb2plY3RzGAEgAygLMhQuYnl0ZWJhc2UudjEuUHJvamVjdCJ0ChNMaXN0UHJvamVjdHNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkSEAoIb3JkZXJfYnkYBSABKAkiVwoUTGlzdFByb2plY3RzUmVzcG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jABmOowAaDqMASo6jAJgtPkkwI7OgEqIjYvdjEve3dlYmhvb2submFtZT1wcm9qZWN0cy8qL3dlYmhvb2tzLyp9OnJlbW92ZVdlYmhvb2sSowEKC1Rlc3RXZWJob29rEh8uYnl0ZWJhc2UudjEuVGVzdFdlYmhvb2tSZXF1ZXN0GiAuYnl0ZWJhc2UudjEuVGVzdFdlYmhvb2tSZXNwb25zZSJRiuowEmJiLnByb2plY3RzLnVwZGF0ZZDqMAGg6jAEqOowDILT5JMCKToBKiIkL3YxL3twcm9qZWN0PXByb2plY3RzLyp9OnRlc3RXZWJob29rQqkBCg9jb20uYnl0ZWJhc2UudjFCE1Byb2plY3RTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [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_type_color, file_v1_annotation, file_v1_common, file_v1_iam_policy]);/*** Describes the message bytebase.v1.GetProjectRequest.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 27557a532f..f5cdbcc763 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -27549,6 +27549,14 @@ components:Unspecified when no linked issue exists.readOnly: true$ref: '#/components/schemas/bytebase.v1.IssueStatus'+ lastPlanEditor:+ type: string+ title: last_plan_editor+ description: |-+ The user who last created or updated the Plan specs.+ Format: users/[email protected]. For legacy Plans without stored attribution,+ this falls back to the Plan creator.+ readOnly: truetitle: PlanadditionalProperties: falsebytebase.v1.Plan.ChangeDatabaseConfig:@@ -28243,6 +28251,10 @@ components:type: booleantitle: allow_just_in_time_accessdescription: Once enabled, users can request and use the just-in-time access in the SQL Editor.+ allowLastPlanEditorApproval:+ type: boolean+ title: allow_last_plan_editor_approval+ description: Whether to allow the last Plan editor to approve a database change issue.title: ProjectadditionalProperties: falsebytebase.v1.Project.ExecutionRetryPolicy:diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex b2559af0c5..0c5b80c753 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -3650,6 +3650,7 @@ Project contains settings and configuration for a Bytebase project.| allow_request_role | [bool](#bool) | | || data_classification_config_id | [string](#string) | | The data classification configuration ID for the project. || allow_just_in_time_access | [bool](#bool) | | Once enabled, users can request and use the just-in-time access in the SQL Editor. |+| allow_last_plan_editor_approval | [bool](#bool) | | Whether to allow the last Plan editor to approve a database change issue. |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 765483a974..280182c1d8 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -10459,6 +10459,13 @@ If enabled, issues cannot be created when SQL review finds errors. </p></td><td><p>Once enabled, users can request and use the just-in-time access in the SQL Editor. </p></td></tr>+ <tr>+ <td>allow_last_plan_editor_approval</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether to allow the last Plan editor to approve a database change issue. </p></td>+ </tr>+</tbody></table>diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex b5926686dc..7c13261c09 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -3608,6 +3608,7 @@ For example: creator == "users/[email protected]" && create_time &| approval_status | [ApprovalStatus](#bytebase-v1-ApprovalStatus) | | The approval status of the linked issue. Unspecified when no linked issue exists or the linked issue is a draft. || rollout_stage_summaries | [Plan.RolloutStageSummary](#bytebase-v1-Plan-RolloutStageSummary) | repeated | Per-stage rollout status summary. Ordered by environment deployment order. Empty when no rollout exists. || issue_status | [IssueStatus](#bytebase-v1-IssueStatus) | | The lifecycle status of the linked issue. Unspecified when no linked issue exists. |+| last_plan_editor | [string](#string) | | The user who last created or updated the Plan specs. Format: users/[email protected]. For legacy Plans without stored attribution, this falls back to the Plan creator. |@@ -10139,6 +10140,7 @@ When paginating, all other parameters provided to `ListProjects` must match the| require_plan_check_no_error | [bool](#bool) | | Whether to require plan check to have no error before rollout. || allow_request_role | [bool](#bool) | | || allow_just_in_time_access | [bool](#bool) | | Once enabled, users can request and use the just-in-time access in the SQL Editor. |+| allow_last_plan_editor_approval | [bool](#bool) | | Whether to allow the last Plan editor to approve a database change issue. |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex e78792be6b..5ad2780b73 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -10894,6 +10894,15 @@ Ordered by environment deployment order. Empty when no rollout exists. </p></td><td><p>The lifecycle status of the linked issue.Unspecified when no linked issue exists. </p></td></tr>++ <tr>+ <td>last_plan_editor</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The user who last created or updated the Plan specs.+Format: users/[email protected]. For legacy Plans without stored attribution,+this falls back to the Plan creator. </p></td>+ </tr></tbody></table>@@ -28882,6 +28891,13 @@ If enabled, issues cannot be created when SQL review finds errors. </p></td><td></td><td><p>Once enabled, users can request and use the just-in-time access in the SQL Editor. </p></td></tr>++ <tr>+ <td>allow_last_plan_editor_approval</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether to allow the last Plan editor to approve a database change issue. </p></td>+ </tr></tbody></table>diff --git a/proto/store/store/project.proto b/proto/store/store/project.protoindex 74e2b794ae..891f8ee8e9 100644--- a/proto/store/store/project.proto+++ b/proto/store/store/project.proto@@ -71,4 +71,7 @@ message Project {// Once enabled, users can request and use the just-in-time access in the SQL Editor.bool allow_just_in_time_access = 19;++ // Whether to allow the last Plan editor to approve a database change issue.+ bool allow_last_plan_editor_approval = 20;}diff --git a/proto/v1/v1/plan_service.proto b/proto/v1/v1/plan_service.protoindex b9fc630b86..86a09e8db9 100644--- a/proto/v1/v1/plan_service.proto+++ b/proto/v1/v1/plan_service.proto@@ -265,6 +265,11 @@ message Plan {// Unspecified when no linked issue exists.IssueStatus issue_status = 15 [(google.api.field_behavior) = OUTPUT_ONLY];+ // The user who last created or updated the Plan specs.+ // Format: users/[email protected]. For legacy Plans without stored attribution,+ // this falls back to the Plan creator.+ string last_plan_editor = 16 [(google.api.field_behavior) = OUTPUT_ONLY];+message CreateDatabaseConfig {reserved 8;// The resource name of the instance on which the database is created.diff --git a/proto/v1/v1/project_service.proto b/proto/v1/v1/project_service.protoindex d9374c1028..da0b6b3ca4 100644--- a/proto/v1/v1/project_service.proto+++ b/proto/v1/v1/project_service.proto@@ -491,6 +491,9 @@ message Project {// Once enabled, users can request and use the just-in-time access in the SQL Editor.bool allow_just_in_time_access = 23;++ // Whether to allow the last Plan editor to approve a database change issue.+ bool allow_last_plan_editor_approval = 24;}message AddWebhookRequest {