Skip to content

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

refactor: event-driven approval finding for HA compatibility (#18710)

Danny Xu0a4295837b90
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index f8d98777cc..8c7e84abbc 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -10737,10 +10737,6 @@ components:
approvalStatus:
title: approval_status
$ref: '#/components/schemas/bytebase.v1.Issue.ApprovalStatus'
- approvalStatusError:
- type: string
- title: approval_status_error
- description: Only populated when approval_status == ERROR
title: Issue
additionalProperties: false
bytebase.v1.Issue.ApprovalStatus:
@@ -10753,7 +10749,6 @@ components:
- APPROVED
- REJECTED
- SKIPPED
- - ERROR
description: The overall approval status for the issue.
bytebase.v1.Issue.Approver:
type: object
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index b4ba272eac..5bb7be059c 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -365,22 +365,56 @@ func (s *IssueService) CreateIssue(ctx context.Context, req *connect.Request[v1p
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("require issue labels"))
}
+ user, ok := GetUserFromContext(ctx)
+ if !ok {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
+ }
+
+ var issue *store.IssueMessage
switch req.Msg.Issue.Type {
case v1pb.Issue_GRANT_REQUEST:
if req.Msg.Issue.Title == "" {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("issue title is required"))
}
- return s.createIssueGrantRequest(ctx, project, req.Msg)
+ issue, err = s.createIssueGrantRequest(ctx, project, req.Msg)
case v1pb.Issue_DATABASE_CHANGE:
- return s.createIssueDatabaseChange(ctx, project, req.Msg)
+ issue, err = s.createIssueDatabaseChange(ctx, project, req.Msg)
case v1pb.Issue_DATABASE_EXPORT:
- return s.createIssueDatabaseDataExport(ctx, project, req.Msg)
+ issue, err = s.createIssueDatabaseDataExport(ctx, project, req.Msg)
default:
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unknown issue type %q", req.Msg.Issue.Type))
}
+ if err != nil {
+ return nil, err
+ }
+
+ // Trigger ISSUE_CREATED webhook
+ s.webhookManager.CreateEvent(ctx, &webhook.Event{
+ Type: storepb.Activity_ISSUE_CREATED,
+ Project: webhook.NewProject(project),
+ IssueCreated: &webhook.EventIssueCreated{
+ Creator: &webhook.User{
+ Name: user.Name,
+ Email: user.Email,
+ },
+ Issue: webhook.NewIssue(issue),
+ },
+ })
+
+ // Trigger approval finding for all issues
+ // For DATABASE_CHANGE: Will return early if plan check not ready, then retry when plan check completes
+ // For other types: Processes immediately
+ s.stateCfg.ApprovalCheckChan <- int64(issue.UID)
+
+ converted, err := s.convertToIssue(issue)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert to issue"))
+ }
+
+ return connect.NewResponse(converted), nil
}
-func (s *IssueService) createIssueDatabaseChange(ctx context.Context, project *store.ProjectMessage, request *v1pb.CreateIssueRequest) (*connect.Response[v1pb.Issue], error) {
+func (s *IssueService) createIssueDatabaseChange(ctx context.Context, project *store.ProjectMessage, request *v1pb.CreateIssueRequest) (*store.IssueMessage, error) {
user, ok := GetUserFromContext(ctx)
if !ok {
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
@@ -426,30 +460,11 @@ func (s *IssueService) createIssueDatabaseChange(ctx context.Context, project *s
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create issue"))
}
- s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
- // Trigger ISSUE_CREATED webhook
- s.webhookManager.CreateEvent(ctx, &webhook.Event{
- Type: storepb.Activity_ISSUE_CREATED,
- Project: webhook.NewProject(project),
- IssueCreated: &webhook.EventIssueCreated{
- Creator: &webhook.User{
- Name: user.Name,
- Email: user.Email,
- },
- Issue: webhook.NewIssue(issue),
- },
- })
-
- converted, err := s.convertToIssue(issue)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert to issue"))
- }
-
- return connect.NewResponse(converted), nil
+ return issue, nil
}
-func (s *IssueService) createIssueGrantRequest(ctx context.Context, project *store.ProjectMessage, request *v1pb.CreateIssueRequest) (*connect.Response[v1pb.Issue], error) {
+func (s *IssueService) createIssueGrantRequest(ctx context.Context, project *store.ProjectMessage, request *v1pb.CreateIssueRequest) (*store.IssueMessage, error) {
// Check if grant request feature is enabled.
// Grant requests are only available in Enterprise plan.
if err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_REQUEST_ROLE_WORKFLOW); err != nil {
@@ -506,30 +521,11 @@ func (s *IssueService) createIssueGrantRequest(ctx context.Context, project *sto
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create issue"))
}
- s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
-
- // Trigger ISSUE_CREATED webhook
- s.webhookManager.CreateEvent(ctx, &webhook.Event{
- Type: storepb.Activity_ISSUE_CREATED,
- Project: webhook.NewProject(project),
- IssueCreated: &webhook.EventIssueCreated{
- Creator: &webhook.User{
- Name: user.Name,
- Email: user.Email,
- },
- Issue: webhook.NewIssue(issue),
- },
- })
-
- converted, err := s.convertToIssue(issue)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert to issue"))
- }
- return connect.NewResponse(converted), nil
+ return issue, nil
}
-func (s *IssueService) createIssueDatabaseDataExport(ctx context.Context, project *store.ProjectMessage, request *v1pb.CreateIssueRequest) (*connect.Response[v1pb.Issue], error) {
+func (s *IssueService) createIssueDatabaseDataExport(ctx context.Context, project *store.ProjectMessage, request *v1pb.CreateIssueRequest) (*store.IssueMessage, error) {
user, ok := GetUserFromContext(ctx)
if !ok {
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
@@ -575,27 +571,8 @@ func (s *IssueService) createIssueDatabaseDataExport(ctx context.Context, projec
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create issue"))
}
- s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
- // Trigger ISSUE_CREATED webhook
- s.webhookManager.CreateEvent(ctx, &webhook.Event{
- Type: storepb.Activity_ISSUE_CREATED,
- Project: webhook.NewProject(project),
- IssueCreated: &webhook.EventIssueCreated{
- Creator: &webhook.User{
- Name: user.Name,
- Email: user.Email,
- },
- Issue: webhook.NewIssue(issue),
- },
- })
-
- converted, err := s.convertToIssue(issue)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert to issue"))
- }
-
- return connect.NewResponse(converted), nil
+ return issue, nil
}
// ApproveIssue approves the approval flow of the issue.
@@ -618,9 +595,6 @@ func (s *IssueService) ApproveIssue(ctx context.Context, req *connect.Request[v1
if !payload.Approval.ApprovalFindingDone {
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding is not done"))
}
- if payload.Approval.ApprovalFindingError != "" {
- return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
- }
if payload.Approval.ApprovalTemplate == nil {
return nil, connect.NewError(connect.CodeInternal, errors.New("approval template is required"))
}
@@ -794,9 +768,6 @@ func (s *IssueService) RejectIssue(ctx context.Context, req *connect.Request[v1p
if !payload.Approval.ApprovalFindingDone {
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding is not done"))
}
- if payload.Approval.ApprovalFindingError != "" {
- return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
- }
if payload.Approval.ApprovalTemplate == nil {
return nil, connect.NewError(connect.CodeInternal, errors.New("approval template is required"))
}
@@ -900,9 +871,6 @@ func (s *IssueService) RequestIssue(ctx context.Context, req *connect.Request[v1
if !payload.Approval.ApprovalFindingDone {
return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding is not done"))
}
- if payload.Approval.ApprovalFindingError != "" {
- return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
- }
if payload.Approval.ApprovalTemplate == nil {
return nil, connect.NewError(connect.CodeInternal, errors.New("approval template is required"))
}
@@ -1049,24 +1017,6 @@ func (s *IssueService) UpdateIssue(ctx context.Context, req *connect.Request[v1p
for _, path := range req.Msg.UpdateMask.Paths {
updateMasks[path] = true
switch path {
- case "approval_status":
- if req.Msg.Issue.ApprovalStatus != v1pb.Issue_CHECKING {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("can only set approval_status to CHECKING to trigger re-finding approval templates"))
- }
- payload := issue.Payload
- if payload.Approval == nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("issue payload approval is nil"))
- }
- if !payload.Approval.ApprovalFindingDone {
- return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding is not done"))
- }
-
- if patch.PayloadUpsert == nil {
- patch.PayloadUpsert = &storepb.Issue{}
- }
- patch.PayloadUpsert.Approval = &storepb.IssuePayloadApproval{
- ApprovalFindingDone: false,
- }
case "title":
// Prevent updating title if plan exists.
if issue.PlanUID != nil {
@@ -1140,10 +1090,6 @@ func (s *IssueService) UpdateIssue(ctx context.Context, req *connect.Request[v1p
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to update issue"))
}
- if updateMasks["approval_finding_done"] {
- s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
- }
-
if _, err := s.store.CreateIssueComments(ctx, user.Email, issueCommentCreates...); err != nil {
slog.Warn("failed to create issue comments", "issue id", issue.UID, log.BBError(err))
}
diff --git a/backend/api/v1/issue_service_converter.go b/backend/api/v1/issue_service_converter.go
index 0a110090c7..a9f94d37b6 100644
--- a/backend/api/v1/issue_service_converter.go
+++ b/backend/api/v1/issue_service_converter.go
@@ -114,7 +114,6 @@ func (*IssueService) convertToIssue(issue *store.IssueMessage) (*v1pb.Issue, err
issueV1.Approvers = append(issueV1.Approvers, convertedApprover)
}
issueV1.ApprovalStatus = computeApprovalStatus(approval)
- issueV1.ApprovalStatusError = approval.GetApprovalFindingError()
return issueV1, nil
}
@@ -126,11 +125,6 @@ func computeApprovalStatus(approval *storepb.IssuePayloadApproval) v1pb.Issue_Ap
return v1pb.Issue_CHECKING
}
- // If there's an error finding approval, status is error
- if approval.GetApprovalFindingError() != "" {
- return v1pb.Issue_ERROR
- }
-
// If no approval template, approval is skipped (not required)
if approval.GetApprovalTemplate() == nil {
return v1pb.Issue_SKIPPED
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.go
index deac5cd68f..35d4de9a5b 100644
--- a/backend/api/v1/plan_service.go
+++ b/backend/api/v1/plan_service.go
@@ -312,6 +312,7 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get issue: %v", err))
}
if issue != nil {
+ // Reset approval finding status
if _, err := s.store.UpdateIssue(ctx, issue.UID, &store.UpdateIssueMessage{
PayloadUpsert: &storepb.Issue{
Approval: &storepb.IssuePayloadApproval{
@@ -319,10 +320,10 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
},
},
}); err != nil {
- slog.Error("failed to update issue to refind approval", log.BBError(err))
- } else {
- s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+ slog.Error("failed to reset approval finding status after plan update", log.BBError(err))
}
+ // Note: Don't trigger ApprovalCheckChan here - plan update creates new plan check run,
+ // which will trigger approval finding on completion
}
default:
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid update_mask path %q", path))
diff --git a/backend/component/state/state.go b/backend/component/state/state.go
index a01174b5aa..95f20ccbdd 100644
--- a/backend/component/state/state.go
+++ b/backend/component/state/state.go
@@ -7,8 +7,9 @@ import (
// State is the state for all in-memory states within the server.
type State struct {
- // ApprovalFinding is the set of issues for finding the approval template.
- ApprovalFinding sync.Map // map[issue.ID]*store.IssueMessage
+ // ApprovalCheckChan signals when an issue needs approval template finding.
+ // Triggered by plan check completion, issue creation (if checks already done).
+ ApprovalCheckChan chan int64 // issue UID
TaskRunSchedulerInfo sync.Map // map[taskRunID]*storepb.SchedulerInfo
@@ -34,6 +35,7 @@ type State struct {
func New() (*State, error) {
return &State{
+ ApprovalCheckChan: make(chan int64, 1000),
PlanCheckTickleChan: make(chan int, 1000),
TaskRunTickleChan: make(chan int, 1000),
RolloutCreationChan: make(chan int64, 100),
diff --git a/backend/generated-go/store/approval.pb.go b/backend/generated-go/store/approval.pb.go
index d324debbb1..6874b6a22d 100644
--- a/backend/generated-go/store/approval.pb.go
+++ b/backend/generated-go/store/approval.pb.go
@@ -87,10 +87,8 @@ type IssuePayloadApproval struct {
// Whether the system has finished finding a matching approval template.
// False means the backend is still searching for matching templates.
ApprovalFindingDone bool `protobuf:"varint,3,opt,name=approval_finding_done,json=approvalFindingDone,proto3" json:"approval_finding_done,omitempty"`
- // Error message if approval template finding failed.
- ApprovalFindingError string `protobuf:"bytes,4,opt,name=approval_finding_error,json=approvalFindingError,proto3" json:"approval_finding_error,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *IssuePayloadApproval) Reset() {
@@ -144,13 +142,6 @@ func (x *IssuePayloadApproval) GetApprovalFindingDone() bool {
return false
}
-func (x *IssuePayloadApproval) GetApprovalFindingError() string {
- if x != nil {
- return x.ApprovalFindingError
- }
- return ""
-}
-
// ApprovalTemplate defines the approval workflow and requirements for an issue.
type ApprovalTemplate struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -321,12 +312,11 @@ var File_store_approval_proto protoreflect.FileDescriptor
const file_store_approval_proto_rawDesc = "" +
"\n" +
- "\x14store/approval.proto\x12\x0ebytebase.store\"\xe0\x03\n" +
+ "\x14store/approval.proto\x12\x0ebytebase.store\"\xaa\x03\n" +
"\x14IssuePayloadApproval\x12M\n" +
"\x11approval_template\x18\x01 \x01(\v2 .bytebase.store.ApprovalTemplateR\x10approvalTemplate\x12K\n" +
"\tapprovers\x18\x02 \x03(\v2-.bytebase.store.IssuePayloadApproval.ApproverR\tapprovers\x122\n" +
- "\x15approval_finding_done\x18\x03 \x01(\bR\x13approvalFindingDone\x124\n" +
- "\x16approval_finding_error\x18\x04 \x01(\tR\x14approvalFindingError\x1a\xc1\x01\n" +
+ "\x15approval_finding_done\x18\x03 \x01(\bR\x13approvalFindingDone\x1a\xc1\x01\n" +
"\bApprover\x12L\n" +
"\x06status\x18\x01 \x01(\x0e24.bytebase.store.IssuePayloadApproval.Approver.StatusR\x06status\x12\x1c\n" +
"\tprincipal\x18\x02 \x01(\tR\tprincipal\"I\n" +
diff --git a/backend/generated-go/store/approval_equal.pb.go b/backend/generated-go/store/approval_equal.pb.go
index aa68c4d7f8..1950aec3cb 100644
--- a/backend/generated-go/store/approval_equal.pb.go
+++ b/backend/generated-go/store/approval_equal.pb.go
@@ -40,9 +40,6 @@ func (x *IssuePayloadApproval) Equal(y *IssuePayloadApproval) bool {
if x.ApprovalFindingDone != y.ApprovalFindingDone {
return false
}
- if x.ApprovalFindingError != y.ApprovalFindingError {
- return false
- }
return true
}
diff --git a/backend/generated-go/v1/issue_service.pb.go b/backend/generated-go/v1/issue_service.pb.go
index 2fa11e1b54..5607f53e93 100644
--- a/backend/generated-go/v1/issue_service.pb.go
+++ b/backend/generated-go/v1/issue_service.pb.go
@@ -157,8 +157,6 @@ const (
Issue_REJECTED Issue_ApprovalStatus = 4
// Approval was skipped.
Issue_SKIPPED Issue_ApprovalStatus = 5
- // Error occurred during approval evaluation.
- Issue_ERROR Issue_ApprovalStatus = 6
)
// Enum value maps for Issue_ApprovalStatus.
@@ -170,7 +168,6 @@ var (
3: "APPROVED",
4: "REJECTED",
5: "SKIPPED",
- 6: "ERROR",
}
Issue_ApprovalStatus_value = map[string]int32{
"APPROVAL_STATUS_UNSPECIFIED": 0,
@@ -179,7 +176,6 @@ var (
"APPROVED": 3,
"REJECTED": 4,
"SKIPPED": 5,
- "ERROR": 6,
}
)
@@ -1114,10 +1110,8 @@ type Issue struct {
// Labels attached to the issue for categorization and filtering.
Labels []string `protobuf:"bytes,17,rep,name=labels,proto3" json:"labels,omitempty"`
ApprovalStatus Issue_ApprovalStatus `protobuf:"varint,18,opt,name=approval_status,json=approvalStatus,proto3,enum=bytebase.v1.Issue_ApprovalStatus" json:"approval_status,omitempty"`
- // Only populated when approval_status == ERROR
- ApprovalStatusError string `protobuf:"bytes,19,opt,name=approval_status_error,json=approvalStatusError,proto3" json:"approval_status_error,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *Issue) Reset() {
@@ -1255,13 +1249,6 @@ func (x *Issue) GetApprovalStatus() Issue_ApprovalStatus {
return Issue_APPROVAL_STATUS_UNSPECIFIED
}
-func (x *Issue) GetApprovalStatusError() string {
- if x != nil {
- return x.ApprovalStatusError
- }
- return ""
-}
-
type GrantRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The requested role.
@@ -2181,7 +2168,7 @@ const file_v1_issue_service_proto_rawDesc = "" +
"\x13RequestIssueRequest\x12.\n" +
"\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" +
"\x12bytebase.com/IssueR\x04name\x12\x18\n" +
- "\acomment\x18\x02 \x01(\tR\acomment\"\xe9\t\n" +
+ "\acomment\x18\x02 \x01(\tR\acomment\"\xa4\t\n" +
"\x05Issue\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1e\n" +
"\x05title\x18\x02 \x01(\tB\b\xbaH\x05r\x03\x18\xc8\x01R\x05title\x12*\n" +
@@ -2201,8 +2188,7 @@ const file_v1_issue_service_proto_rawDesc = "" +
"\n" +
"risk_level\x18\x0f \x01(\x0e2\x16.bytebase.v1.RiskLevelR\triskLevel\x12\x16\n" +
"\x06labels\x18\x11 \x03(\tR\x06labels\x12O\n" +
- "\x0fapproval_status\x18\x12 \x01(\x0e2!.bytebase.v1.Issue.ApprovalStatusB\x03\xe0A\x03R\x0eapprovalStatus\x127\n" +
- "\x15approval_status_error\x18\x13 \x01(\tB\x03\xe0A\x03R\x13approvalStatusError\x1a\xaf\x01\n" +
+ "\x0fapproval_status\x18\x12 \x01(\x0e2!.bytebase.v1.Issue.ApprovalStatusB\x03\xe0A\x03R\x0eapprovalStatus\x1a\xaf\x01\n" +
"\bApprover\x12:\n" +
"\x06status\x18\x01 \x01(\x0e2\".bytebase.v1.Issue.Approver.StatusR\x06status\x12\x1c\n" +
"\tprincipal\x18\x02 \x01(\tR\tprincipal\"I\n" +
@@ -2215,15 +2201,14 @@ const file_v1_issue_service_proto_rawDesc = "" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\x13\n" +
"\x0fDATABASE_CHANGE\x10\x01\x12\x11\n" +
"\rGRANT_REQUEST\x10\x02\x12\x13\n" +
- "\x0fDATABASE_EXPORT\x10\x03\"\x80\x01\n" +
+ "\x0fDATABASE_EXPORT\x10\x03\"u\n" +
"\x0eApprovalStatus\x12\x1f\n" +
"\x1bAPPROVAL_STATUS_UNSPECIFIED\x10\x00\x12\f\n" +
"\bCHECKING\x10\x01\x12\v\n" +
"\aPENDING\x10\x02\x12\f\n" +
"\bAPPROVED\x10\x03\x12\f\n" +
"\bREJECTED\x10\x04\x12\v\n" +
- "\aSKIPPED\x10\x05\x12\t\n" +
- "\x05ERROR\x10\x06::\xeaA7\n" +
+ "\aSKIPPED\x10\x05::\xeaA7\n" +
"\x12bytebase.com/Issue\x12!projects/{project}/issues/{issue}\"\xa2\x01\n" +
"\fGrantRequest\x12\x12\n" +
"\x04role\x18\x01 \x01(\tR\x04role\x12\x12\n" +
diff --git a/backend/generated-go/v1/issue_service_equal.pb.go b/backend/generated-go/v1/issue_service_equal.pb.go
index 1c3161f55a..6ba0689056 100644
--- a/backend/generated-go/v1/issue_service_equal.pb.go
+++ b/backend/generated-go/v1/issue_service_equal.pb.go
@@ -319,9 +319,6 @@ func (x *Issue) Equal(y *Issue) bool {
if x.ApprovalStatus != y.ApprovalStatus {
return false
}
- if x.ApprovalStatusError != y.ApprovalStatusError {
- return false
- }
return true
}
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index b6542772d6..b7b93fee88 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -3,16 +3,13 @@ package approval
import (
"context"
- "fmt"
"log/slog"
"maps"
"math"
"sync"
- "time"
"github.com/google/cel-go/cel"
"github.com/pkg/errors"
- "go.uber.org/multierr"
celtypes "github.com/google/cel-go/common/types"
@@ -46,73 +43,48 @@ func NewRunner(store *store.Store, stateCfg *state.State, webhookManager *webhoo
}
}
-const approvalRunnerInterval = 1 * time.Second
-
// Run runs the runner.
func (r *Runner) Run(ctx context.Context, wg *sync.WaitGroup) {
- ticker := time.NewTicker(approvalRunnerInterval)
- defer ticker.Stop()
defer wg.Done()
- slog.Debug(fmt.Sprintf("Approval runner started and will run every %v", approvalRunnerInterval))
- r.retryFindApprovalTemplate(ctx)
+ slog.Debug("Approval runner started (event-driven)")
for {
select {
- case <-ticker.C:
- func() {
- defer func() {
- if r := recover(); r != nil {
- err, ok := r.(error)
- if !ok {
- err = errors.Errorf("%v", r)
- }
- slog.Error("Approval runner PANIC RECOVER", log.BBError(err), log.BBStack("panic-stack"))
- }
- }()
- r.runOnce(ctx)
- }()
+ case issueUID := <-r.stateCfg.ApprovalCheckChan:
+ r.processIssue(ctx, issueUID)
case <-ctx.Done():
return
}
}
}
-func (r *Runner) runOnce(ctx context.Context) {
+func (r *Runner) processIssue(ctx context.Context, issueUID int64) {
+ // Get fresh issue from database
+ uid := int(issueUID)
+ issue, err := r.store.GetIssue(ctx, &store.FindIssueMessage{UID: &uid})
+ if err != nil {
+ slog.Error("failed to get issue for approval check",
+ slog.Int64("issue_uid", issueUID), log.BBError(err))
+ return
+ }
+ if issue == nil {
+ return // Issue deleted, nothing to do
+ }
+
approvalSetting, err := r.store.GetWorkspaceApprovalSetting(ctx)
if err != nil {
slog.Error("failed to get workspace approval setting", log.BBError(err))
return
}
- r.stateCfg.ApprovalFinding.Range(func(key, value any) bool {
- issue, ok := value.(*store.IssueMessage)
- if !ok {
- return true
- }
- done, err := r.findApprovalTemplateForIssue(ctx, issue, approvalSetting)
- if err != nil {
- slog.Error("failed to find approval template for issue", slog.Int("issue", issue.UID), log.BBError(err))
- }
- if err != nil || done {
- r.stateCfg.ApprovalFinding.Delete(key)
- }
- return true
- })
-}
-
-func (r *Runner) retryFindApprovalTemplate(ctx context.Context) {
- issues, err := r.store.ListIssues(ctx, &store.FindIssueMessage{
- StatusList: []storepb.Issue_Status{storepb.Issue_OPEN},
- })
+ // Find approval template - errors are logged, not persisted
+ _, err = r.findApprovalTemplateForIssue(ctx, issue, approvalSetting)
if err != nil {
- err := errors.Wrap(err, "failed to list issues")
- slog.Error("failed to retry finding approval template", log.BBError(err))
- }
- for _, issue := range issues {
- payload := issue.Payload
- if payload.Approval == nil || !payload.Approval.ApprovalFindingDone {
- r.stateCfg.ApprovalFinding.Store(issue.UID, issue)
- }
+ slog.Error("failed to find approval template",
+ slog.Int64("issue_uid", issueUID),
+ slog.String("issue_title", issue.Title),
+ log.BBError(err))
+ // Don't persist error - user can rerun plan check to retry
}
}
@@ -174,12 +146,8 @@ func (r *Runner) findApprovalTemplateForIssue(ctx context.Context, issue *store.
return approvalTemplate, celVarsList, true, nil
}()
if err != nil {
- if updateErr := updateIssueApprovalPayload(ctx, r.store, issue, &storepb.IssuePayloadApproval{
- ApprovalFindingDone: true,
- ApprovalFindingError: err.Error(),
- }, storepb.RiskLevel_RISK_LEVEL_UNSPECIFIED); updateErr != nil {
- return false, multierr.Append(errors.Wrap(updateErr, "failed to update issue payload"), err)
- }
+ // Don't persist error - it will be logged by caller
+ // User can rerun plan check to retry
return false, err
}
if !done {
diff --git a/backend/runner/plancheck/scheduler.go b/backend/runner/plancheck/scheduler.go
index 815dbb7a59..dff094dd36 100644
--- a/backend/runner/plancheck/scheduler.go
+++ b/backend/runner/plancheck/scheduler.go
@@ -135,12 +135,15 @@ func (s *Scheduler) markPlanCheckRunDone(ctx context.Context, planCheckRun *stor
// Auto-create rollout if plan checks pass
issue, err := s.store.GetIssue(ctx, &store.FindIssueMessage{PlanUID: &planCheckRun.PlanUID})
if err != nil {
- slog.Error("failed to get issue for rollout creation after plan check",
+ slog.Error("failed to get issue for approval check after plan check",
slog.Int("plan_id", int(planCheckRun.PlanUID)),
log.BBError(err))
return
}
if issue != nil && issue.PlanUID != nil {
+ // Trigger approval finding
+ s.stateCfg.ApprovalCheckChan <- int64(issue.UID)
+ // Trigger rollout creation (existing behavior)
s.stateCfg.RolloutCreationChan <- planCheckRun.PlanUID
}
}
diff --git a/backend/tests/approval_test.go b/backend/tests/approval_test.go
index ea41e3a804..7af3c1ab97 100644
--- a/backend/tests/approval_test.go
+++ b/backend/tests/approval_test.go
@@ -142,7 +142,6 @@ func TestDirectApprovalRuleMatching(t *testing.T) {
// Verify approval finding completed successfully
a.NotNil(issue)
a.NotEqual(v1pb.Issue_CHECKING, issue.ApprovalStatus, "Approval finding should complete")
- a.NotEqual(v1pb.Issue_ERROR, issue.ApprovalStatus, "Approval finding should not have errors")
// Verify that the approval template was correctly assigned
// Note: The status may be SKIPPED/APPROVED if the user is a workspace owner
@@ -292,7 +291,6 @@ func TestApprovalRuleFirstMatchWins(t *testing.T) {
// Verify approval finding completed
a.NotNil(issue)
a.NotEqual(v1pb.Issue_CHECKING, issue.ApprovalStatus)
- a.NotEqual(v1pb.Issue_ERROR, issue.ApprovalStatus)
// Verify the first rule was applied (not the catch-all)
a.Equal("Prod Change Database - First Rule", issue.GetApprovalTemplate().GetTitle(), "First matching rule should be applied")
@@ -423,7 +421,6 @@ func TestApprovalRuleNoMatch(t *testing.T) {
// Verify approval finding completed
a.NotNil(issue)
a.NotEqual(v1pb.Issue_CHECKING, issue.ApprovalStatus)
- a.NotEqual(v1pb.Issue_ERROR, issue.ApprovalStatus)
// Since no rule matches test environment, no approval template should be assigned
// and the issue should be auto-approved (or skipped)
@@ -637,7 +634,6 @@ func TestFallbackRuleMatchesWhenSourceSpecificDoesNot(t *testing.T) {
// Verify fallback rule was applied
a.NotNil(issue)
a.NotEqual(v1pb.Issue_CHECKING, issue.ApprovalStatus)
- a.NotEqual(v1pb.Issue_ERROR, issue.ApprovalStatus)
a.NotNil(issue.ApprovalTemplate, "Fallback approval template should be assigned")
a.Equal("Fallback Rule", issue.GetApprovalTemplate().GetTitle(), "Fallback rule should be applied")
}
@@ -776,7 +772,6 @@ func TestSourceSpecificRuleTakesPriorityOverFallback(t *testing.T) {
// Verify source-specific rule was applied, NOT the fallback
a.NotNil(issue)
a.NotEqual(v1pb.Issue_CHECKING, issue.ApprovalStatus)
- a.NotEqual(v1pb.Issue_ERROR, issue.ApprovalStatus)
a.NotNil(issue.ApprovalTemplate)
a.Equal("Source Specific Rule (should be used)", issue.GetApprovalTemplate().GetTitle(),
"Source-specific rule should take priority over fallback even when fallback is first in list")
diff --git a/backend/tests/rollout.go b/backend/tests/rollout.go
index 1065fe285c..b353a9b823 100644
--- a/backend/tests/rollout.go
+++ b/backend/tests/rollout.go
@@ -84,8 +84,8 @@ waitApproval:
return errors.Wrapf(err, "timeout after %v waiting for approval (failed to fetch issue state)", time.Since(startTime))
}
issue := issueResp.Msg
- return errors.Errorf("timeout after %v waiting for approval to complete, current approval status: %s, approval status error: %v",
- time.Since(startTime), issue.ApprovalStatus.String(), issue.ApprovalStatusError)
+ return errors.Errorf("timeout after %v waiting for approval to complete, current approval status: %s",
+ time.Since(startTime), issue.ApprovalStatus.String())
case <-ticker.C:
issueResp, err := ctl.issueServiceClient.GetIssue(ctx, connect.NewRequest(&v1pb.GetIssueRequest{Name: issueName}))
@@ -93,9 +93,6 @@ waitApproval:
return err
}
issue := issueResp.Msg
- if issue.ApprovalStatus == v1pb.Issue_ERROR {
- return errors.Errorf("approval finding error: %v", issue.ApprovalStatusError)
- }
if issue.ApprovalStatus == v1pb.Issue_APPROVED || issue.ApprovalStatus == v1pb.Issue_SKIPPED {
break waitApproval
}
diff --git a/backend/utils/utils.go b/backend/utils/utils.go
index 9d37945cdb..387d0905c8 100644
--- a/backend/utils/utils.go
+++ b/backend/utils/utils.go
@@ -60,9 +60,6 @@ func CheckApprovalApproved(approval *storepb.IssuePayloadApproval) (bool, error)
if approval == nil || !approval.ApprovalFindingDone {
return false, nil
}
- if approval.ApprovalFindingError != "" {
- return false, nil
- }
if approval.ApprovalTemplate == nil {
return true, nil
}
diff --git a/docs/plans/2025-12-31-event-driven-approval-finding-design.md b/docs/plans/2025-12-31-event-driven-approval-finding-design.md
new file mode 100644
index 0000000000..30031a55d5
--- /dev/null
+++ b/docs/plans/2025-12-31-event-driven-approval-finding-design.md
@@ -0,0 +1,608 @@
+# Event-Driven Approval Finding Design
+
+**Date:** 2025-12-31
+**Status:** Design
+**Author:** Danny
+
+## Overview
+
+This design replaces the polling-based approval finding system with an event-driven architecture that is HA-compatible. Approval templates will be determined automatically and instantly when plan checks complete, eliminating the in-memory sync.Map and 1-second polling loop.
+
+## Problem
+
+The current approval finding system uses an in-memory `sync.Map` which breaks in High Availability (HA) deployments:
+
+```go
+// backend/component/state/state.go
+type State struct {
+ ApprovalFinding sync.Map // map[issue.ID]*store.IssueMessage
+}
+
+// backend/runner/approval/runner.go
+func (r *Runner) runOnce(ctx context.Context) {
+ r.stateCfg.ApprovalFinding.Range(func(key, value any) bool {
+ // Process issues in the map
+ })
+}
+```
+
+**HA Incompatibilities:**
+
+1. **Not shared** - Each replica has its own sync.Map
+2. **Duplicate processing** - Multiple replicas might process the same issue simultaneously
+3. **Lost work** - If a replica crashes, queued issues are lost from its map
+4. **Inconsistent state** - Database has `ApprovalFindingDone` flag but no cross-instance coordination
+5. **Polling overhead** - Runs every 1 second checking all issues in map
+
+**Additional Problems:**
+
+6. **Complex error handling** - `ApprovalFindingError` persisted in database requires manual retry UI
+7. **Dead code** - "approval_status" update path has incorrect mask check, never triggers
+8. **Dependency on plan check** - Approval finding waits for plan check summary report data
+
+## Requirements
+
+1. **HA-compatible** - Multiple replicas can run without conflicts
+2. **Event-driven** - No polling, instant processing when plan checks complete
+3. **Simple error handling** - Transient errors logged, not persisted; users rerun plan check to retry
+4. **No startup recovery** - Avoid duplicate processing across replicas at startup
+5. **Clean architecture** - Remove sync.Map, dead code, and error persistence
+
+## Solution: Event-Driven Approval Finding
+
+Use a channel-based architecture similar to the existing `RolloutCreationChan` pattern. Approval finding is triggered by events, primarily plan check completion.
+
+### Key Insight
+
+Approval finding depends on plan check summary report data, so the natural trigger point is plan check completion. If users need to trigger approval finding manually, they can click "Rerun plan checks" in the UI.
+
+### Architecture
+
+```
+┌─────────────────────┐
+│ Plan Check Complete │
+│ (status = DONE) │
+└──────────┬──────────┘
+ │
+ ▼
+ ┌──────────────────┐
+ │ Signal channel: │
+ │ ApprovalCheckChan│
+ └──────────┬───────┘
+ │
+ ▼
+┌──────────────────────────┐
+│ Approval Runner (event │
+│ listener) receives signal│
+└──────────┬───────────────┘
+ │
+ ▼
+┌──────────────────────────┐
+│ Get fresh issue from DB │
+│ Find approval template │
+│ Update issue payload │
+└──────────────────────────┘
+```
+
+**Benefits:**
+- ✅ HA-compatible: channel is per-instance but that's fine (any instance can process)
+- ✅ No polling: only runs when triggered
+- ✅ Immediate: processes as soon as plan check completes
+- ✅ Simple: no sync.Map, no error persistence, just signal → process
+- ✅ Efficient: CEL evaluation only runs once per event
+
+**HA Consideration:**
+
+The channel is in-memory per-instance, which is acceptable because:
+- Plan check completion happens on one instance → signals its channel → processes
+- If that instance crashes before processing, issue is left with `approval_finding_done=false`
+- User can rerun plan check to trigger again (no automatic recovery to avoid duplicate processing)
+
+## Component Changes
+
+### 1. State Structure
+
+**File:** `backend/component/state/state.go`
+
+```go
+type State struct {
+ // ADD new channel:
+ // ApprovalCheckChan signals when an issue needs approval template finding.
+ // Triggered by plan check completion.
+ ApprovalCheckChan chan int64 // issue UID
+
+ // REMOVE old sync.Map:
+ // ApprovalFinding sync.Map // map[issue.ID]*store.IssueMessage
+
+ TaskRunSchedulerInfo sync.Map
+ RunningTaskRunsCancelFunc sync.Map
+ RunningPlanChecks sync.Map
+ RunningPlanCheckRunsCancelFunc sync.Map
+ PlanCheckTickleChan chan int
+ TaskRunTickleChan chan int
+ RolloutCreationChan chan int64
+ PlanCompletionCheckChan chan int64
+}
+
+func New() (*State, error) {
+ return &State{
+ ApprovalCheckChan: make(chan int64, 1000), // buffered for bursts
+ PlanCheckTickleChan: make(chan int, 1000),
+ TaskRunTickleChan: make(chan int, 1000),
+ RolloutCreationChan: make(chan int64, 100),
+ PlanCompletionCheckChan: make(chan int64, 1000),
+ }, nil
+}
+```
+
+### 2. Approval Runner
+
+**File:** `backend/runner/approval/runner.go`
+
+**New Run() method (event listener):**
+
+```go
+func (r *Runner) Run(ctx context.Context, wg *sync.WaitGroup) {
+ defer wg.Done()
+ slog.Debug("Approval runner started (event-driven)")
+
+ for {
+ select {
+ case issueUID := <-r.stateCfg.ApprovalCheckChan:
+ r.processIssue(ctx, issueUID)
+ case <-ctx.Done():
+ return
+ }
+ }
+}
+
+func (r *Runner) processIssue(ctx context.Context, issueUID int64) {
+ // Get fresh issue from database
+ issue, err := r.store.GetIssue(ctx, &store.FindIssueMessage{UID: &issueUID})
+ if err != nil {
+ slog.Error("failed to get issue for approval check",
+ slog.Int64("issue_uid", issueUID), log.BBError(err))
+ return
+ }
+ if issue == nil {
+ return // Issue deleted, nothing to do
+ }
+
+ approvalSetting, err := r.store.GetWorkspaceApprovalSetting(ctx)
+ if err != nil {
+ slog.Error("failed to get workspace approval setting", log.BBError(err))
+ return
+ }
+
+ // Find approval template - errors are logged, not persisted
+ _, err = r.findApprovalTemplateForIssue(ctx, issue, approvalSetting)
+ if err != nil {
+ slog.Error("failed to find approval template",
+ slog.Int64("issue_uid", issueUID),
+ slog.String("issue_title", issue.Title),
+ log.BBError(err))
+ // Don't persist error - user can rerun plan check to retry
+ }
+}
+```
+
+**Remove deprecated methods:**
+
+- `runOnce()` - polling method no longer needed
+- `retryFindApprovalTemplate()` - startup recovery removed for HA safety
+
+**Update error handling in findApprovalTemplateForIssue():**
+
+```go
+// OLD: Persisted error to database
+if err != nil {
+ if updateErr := updateIssueApprovalPayload(ctx, r.store, issue, &storepb.IssuePayloadApproval{
+ ApprovalFindingDone: true,
+ ApprovalFindingError: err.Error(),
+ }, storepb.RiskLevel_RISK_LEVEL_UNSPECIFIED); updateErr != nil {
+ return false, multierr.Append(errors.Wrap(updateErr, "failed to update issue payload"), err)
+ }
+ return false, err
+}
+
+// NEW: Just return error (logged by caller)
+if err != nil {
+ // Don't persist error - it will be logged by caller
+ // User can rerun plan check to retry
+ return false, err
+}
+```
+
+## Trigger Points
+
+### Trigger 1: Plan Check Completion (Primary)
+
+**Location:** `backend/runner/plancheck/scheduler.go`
+
+**In markPlanCheckRunDone():**
+
+```go
+func (s *Scheduler) markPlanCheckRunDone(ctx context.Context, planCheckRun *store.PlanCheckRunMessage, results []*storepb.PlanCheckRunResult_Result) {
+ result := &storepb.PlanCheckRunResult{
+ Results: results,
+ }
+ if err := s.store.UpdatePlanCheckRun(ctx,
+ store.PlanCheckRunStatusDone,
+ result,
+ planCheckRun.UID,
+ ); err != nil {
+ slog.Error("failed to mark plan check run done", log.BBError(err))
+ return
+ }
+
+ // Get issue for this plan
+ issue, err := s.store.GetIssue(ctx, &store.FindIssueMessage{PlanUID: &planCheckRun.PlanUID})
+ if err != nil {
+ slog.Error("failed to get issue for approval check after plan check",
+ slog.Int("plan_id", int(planCheckRun.PlanUID)),
+ log.BBError(err))
+ return
+ }
+
+ if issue != nil {
+ // Trigger approval finding
+ s.stateCfg.ApprovalCheckChan <- issue.UID
+
+ // Also trigger rollout creation (existing behavior)
+ s.stateCfg.RolloutCreationChan <- planCheckRun.PlanUID
+ }
+}
+```
+
+### Trigger 2: Plan Update
+
+**Location:** `backend/api/v1/plan_service.go`
+
+When user updates plan (e.g., changes SQL), reset approval status but don't trigger immediately. The plan update will trigger a new plan check run, which will trigger approval finding when it completes.
+
+```go
+// Reset approval finding status
+if _, err := s.store.UpdateIssue(ctx, issue.UID, &store.UpdateIssueMessage{
+ PayloadUpsert: &storepb.Issue{
+ Approval: &storepb.IssuePayloadApproval{
+ ApprovalFindingDone: false,
+ },
+ },
+}); err != nil {
+ slog.Error("failed to reset approval finding status after plan update", log.BBError(err))
+}
+// Note: Don't trigger ApprovalCheckChan here - plan update creates new plan check run,
+// which will trigger approval finding on completion
+```
+
+### Trigger 4: Manual Retry (Via Plan Check Rerun)
+
+User clicks "Rerun plan check" button → plan check runs → triggers approval finding on completion.
+
+**No code changes needed** - existing plan check rerun functionality handles this.
+
+### No Startup Recovery
+
+**Rationale:** Startup recovery is NOT HA-compatible:
+- Multiple instances start simultaneously
+- Each would try to process all pending issues
+- No coordination mechanism → duplicate processing
+
+**What happens to crashed work?**
+- Issue stuck with `approval_finding_done=false`
+- User notices approval stuck at CHECKING status
+- User clicks "Rerun plan check"
+- Plan check completes → triggers approval finding
+
+Since crashes are rare and users have a clear fix (rerun plan check), we accept this trade-off for HA safety.
+
+## Error Handling
+
+### Transient Error Philosophy
+
+Approval finding errors are treated as **transient** and not persisted to the database:
+
+**Error Sources:**
+
+1. **Database errors** - network issues, timeouts (transient)
+2. **Missing data** - plan/instance/database not found (should not happen in normal flow)
+3. **CEL compilation errors** - invalid approval rule expression (configuration error)
+4. **CEL evaluation errors** - type mismatches, missing variables (configuration error)
+
+**Error Handling:**
+
+1. **Log error** - Include issue UID, title, and full error details
+2. **Don't persist** - No `ApprovalFindingError` field in database
+3. **User retry** - User clicks "Rerun plan check" to retry
+4. **Issue visible** - Issue stays at `CHECKING` approval status
+
+**User Experience:**
+
+- Approval status shows "Checking..." (spinner in UI)
+- If stuck, user checks server logs or clicks "Rerun plan check"
+- Much simpler than error message + retry button
+
+### Removed Error Persistence
+
+**Delete from proto:** `proto/store/approval.proto`
+
+```proto
+message IssuePayloadApproval {
+ ApprovalTemplate approval_template = 1;
+ repeated Approver approvers = 2;
+ bool approval_finding_done = 3;
+
+ // REMOVE field 4:
+ // string approval_finding_error = 4;
+
+ // Reserve to prevent field number reuse:
+ reserved 4;
+ reserved "approval_finding_error";
+}
+```
+
+**Regenerate:** `cd proto && buf generate`
+
+## Cleanup: Remove Deprecated Code
+
+### 1. Backend Cleanup
+
+**File:** `backend/api/v1/issue_service.go`
+
+**Remove "approval_status" update path:**
+
+```go
+// DELETE entire case block (lines 1052-1069):
+case "approval_status":
+ if req.Msg.Issue.ApprovalStatus != v1pb.Issue_CHECKING {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("can only set approval_status to CHECKING to trigger re-finding approval templates"))
+ }
+ payload := issue.Payload
+ if payload.Approval == nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("issue payload approval is nil"))
+ }
+ if !payload.Approval.ApprovalFindingDone {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding is not done"))
+ }
+
+ if patch.PayloadUpsert == nil {
+ patch.PayloadUpsert = &storepb.Issue{}
+ }
+ patch.PayloadUpsert.Approval = &storepb.IssuePayloadApproval{
+ ApprovalFindingDone: false,
+ }
+```
+
+**Remove dead code:**
+
+```go
+// DELETE lines 1143-1145:
+if updateMasks["approval_finding_done"] {
+ s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+}
+```
+
+**Remove error checks (3 places):**
+
+In `ApprovalApprove()`, `RejectIssue()`, and `UpdateIssue()`:
+
+```go
+// DELETE:
+if payload.Approval.ApprovalFindingError != "" {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
+}
+```
+
+**File:** `backend/api/v1/issue_service_converter.go`
+
+```go
+// DELETE line 117:
+issueV1.ApprovalStatusError = approval.GetApprovalFindingError()
+
+// DELETE lines 130-132 in computeApprovalStatus():
+if approval.GetApprovalFindingError() != "" {
+ return v1pb.Issue_ERROR
+}
+```
+
+**File:** `backend/utils/utils.go`
+
+In `CheckApprovalApproved()`:
+
+```go
+// DELETE:
+if approval.ApprovalFindingError != "" {
+ return false, nil
+}
+```
+
+### 2. Frontend Cleanup
+
+**File:** `frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue`
+
+**Remove ERROR state and retry button:**
+
+```vue
+<!-- DELETE lines 18-30: -->
+<div
+ v-else-if="issue.approvalStatus === Issue_ApprovalStatus.ERROR"
+ class="flex items-center gap-x-2"
+>
+ <span class="text-error text-sm">{{ issue.approvalStatusError }}</span>
+ <NButton
+ size="tiny"
+ :loading="retrying"
+ @click="retryFindingApprovalFlow"
+ >
+ {{ $t("common.retry") }}
+ </NButton>
+</div>
+```
+
+**Remove retry function:**
+
+```typescript
+// DELETE:
+const retrying = ref(false);
+
+const retryFindingApprovalFlow = async () => {
+ retrying.value = true;
+ try {
+ await useIssueV1Store().regenerateReviewV1(props.issue.name);
+ emit("issue-updated");
+ } finally {
+ retrying.value = false;
+ }
+};
+```
+
+**File:** `frontend/src/store/modules/v1/issue.ts`
+
+**Remove regenerateReviewV1:**
+
+```typescript
+// DELETE function (lines 80-89):
+const regenerateReviewV1 = async (name: string) => {
+ const request = create(UpdateIssueRequestSchema, {
+ issue: create(IssueSchema, {
+ name,
+ approvalStatus: Issue_ApprovalStatus.CHECKING,
+ }),
+ updateMask: { paths: ["approval_status"] },
+ });
+ await issueServiceClientConnect.updateIssue(request);
+};
+
+// DELETE from return statement:
+return {
+ listIssues,
+ fetchIssueByName,
+ // regenerateReviewV1, // DELETE this
+};
+```
+
+## Migration Considerations
+
+### Database Migration
+
+**No database migration needed** because:
+- `ApprovalFindingError` is stored in JSONB `issue.payload` column
+- Removing the field from proto doesn't affect existing data
+- Old data with `approval_finding_error` will be ignored (field not in proto)
+- New data won't have the field
+
+### Backward Compatibility
+
+**Proto field reservation:**
+```proto
+reserved 4;
+reserved "approval_finding_error";
+```
+
+This prevents:
+- Future proto changes from reusing field number 4
+- Confusion from old clients that might still reference the field
+
+### Rollout Strategy
+
+1. Deploy backend with event-driven approval finding
+2. Deploy frontend with removed retry button
+3. No downtime required
+4. Old in-flight issues with `approval_finding_done=false` will be processed on next plan check rerun
+
+## Testing Considerations
+
+### Unit Tests
+
+1. **Approval runner event processing**
+ - Test `processIssue()` with valid issue
+ - Test with missing issue (deleted)
+ - Test with database errors
+ - Test with CEL evaluation errors
+
+2. **Trigger points**
+ - Test plan check completion triggers channel
+ - Test plan update resets approval status
+
+### Integration Tests
+
+1. **End-to-end flow**
+ - Create issue → plan check runs → approval found
+ - Update plan → new plan check → new approval
+
+2. **Error scenarios**
+ - Invalid CEL expression in approval rule
+ - Missing plan check data
+ - Database temporarily unavailable
+
+### HA Testing
+
+1. **Multiple replicas**
+ - Two instances running
+ - Plan check completes on instance A
+ - Verify approval processed (by either instance)
+ - Verify no duplicate processing
+
+2. **Crash recovery**
+ - Instance crashes after plan check, before approval finding
+ - Verify issue stuck at CHECKING status
+ - User reruns plan check
+ - Verify approval found
+
+## Success Metrics
+
+1. **HA Compatibility**
+ - No duplicate approval finding across replicas
+ - No lost work from crashes (user can retry)
+
+2. **Performance**
+ - Approval finding happens immediately after plan check (no 1s delay)
+ - No polling overhead
+
+3. **Simplicity**
+ - Removed sync.Map (~100 lines)
+ - Removed error persistence (~50 lines)
+ - Removed dead code (~30 lines)
+ - Removed retry UI (~50 lines frontend)
+ - Total: ~230 lines removed
+
+4. **User Experience**
+ - Immediate approval status (no waiting)
+ - Simple retry (rerun plan check button already exists)
+ - No confusing error messages
+
+## Future Enhancements
+
+If orphaned issues (stuck at CHECKING due to crashes) become a problem:
+
+**Option: Add lightweight polling safety net**
+- Keep event-driven as primary mechanism
+- Add slow background poll (e.g., every 60 seconds)
+- Use `FOR UPDATE SKIP LOCKED` for HA-safe claim
+- Poll only processes issues older than 5 minutes
+- Catches rare crash edge cases without overhead
+
+**Implementation:**
+```go
+func (r *Runner) Run(ctx context.Context, wg *sync.WaitGroup) {
+ defer wg.Done()
+ slog.Debug("Approval runner started (event-driven)")
+
+ ticker := time.NewTicker(60 * time.Second)
+ defer ticker.Stop()
+
+ for {
+ select {
+ case issueUID := <-r.stateCfg.ApprovalCheckChan:
+ r.processIssue(ctx, issueUID)
+ case <-ticker.C:
+ // Safety net: process old stuck issues
+ r.processStuckIssues(ctx)
+ case <-ctx.Done():
+ return
+ }
+ }
+}
+```
+
+This can be added later if needed, keeping the design simple initially.
diff --git a/docs/plans/2025-12-31-event-driven-approval-finding-impl.md b/docs/plans/2025-12-31-event-driven-approval-finding-impl.md
new file mode 100644
index 0000000000..a76edd1aa2
--- /dev/null
+++ b/docs/plans/2025-12-31-event-driven-approval-finding-impl.md
@@ -0,0 +1,1025 @@
+# Event-Driven Approval Finding Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Replace polling-based approval finding with event-driven architecture for HA compatibility.
+
+**Architecture:** Use buffered channel (`ApprovalCheckChan`) to signal approval finding needs. Primary trigger is plan check completion. Remove in-memory sync.Map and error persistence. Errors are logged but not saved to database.
+
+**Tech Stack:** Go, Protobuf, Vue.js, TypeScript
+
+---
+
+## Task 1: Remove ApprovalFindingError from Proto
+
+**Files:**
+- Modify: `proto/store/approval.proto`
+
+**Step 1: Update proto definition**
+
+Edit `proto/store/approval.proto`, find the `IssuePayloadApproval` message and remove field 4:
+
+```proto
+message IssuePayloadApproval {
+ ApprovalTemplate approval_template = 1;
+ repeated Approver approvers = 2;
+ // Whether the system has finished finding a matching approval template.
+ // False means the backend is still searching for matching templates.
+ bool approval_finding_done = 3;
+
+ // Reserve field number to prevent reuse
+ reserved 4;
+ reserved "approval_finding_error";
+
+ message Approver {
+ // The new status.
+ ApprovalStep_Status status = 1;
+ // The principal.
+ // Format: users/{email}
+ string principal = 2;
+ }
+}
+```
+
+**Step 2: Regenerate proto files**
+
+Run: `cd proto && buf generate`
+
+Expected: Proto files regenerated in `backend/generated-go/store/`
+
+**Step 3: Format proto file**
+
+Run: `buf format -w proto`
+
+Expected: Proto file formatted
+
+**Step 4: Commit**
+
+```bash
+git add proto/store/approval.proto backend/generated-go/store/
+git commit -m "refactor: remove ApprovalFindingError from proto
+
+Remove approval_finding_error field from IssuePayloadApproval.
+Errors are now transient (logged, not persisted).
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 2: Add ApprovalCheckChan to State
+
+**Files:**
+- Modify: `backend/component/state/state.go`
+
+**Step 1: Add channel field**
+
+Edit `backend/component/state/state.go`, add new field to State struct:
+
+```go
+// State is the state for all in-memory states within the server.
+type State struct {
+ // ApprovalCheckChan signals when an issue needs approval template finding.
+ // Triggered by plan check completion, issue creation (if checks already done).
+ ApprovalCheckChan chan int64 // issue UID
+
+ TaskRunSchedulerInfo sync.Map // map[taskRunID]*storepb.SchedulerInfo
+
+ // RunningTaskRunsCancelFunc is the cancelFunc of running taskruns.
+ RunningTaskRunsCancelFunc sync.Map // map[taskRunID]context.CancelFunc
+
+ // RunningPlanChecks is the set of running plan checks.
+ RunningPlanChecks sync.Map
+ // RunningPlanCheckRunsCancelFunc is the cancelFunc of running plan checks.
+ RunningPlanCheckRunsCancelFunc sync.Map // map[planCheckRunUID]context.CancelFunc
+
+ // PlanCheckTickleChan is the tickler for plan check scheduler.
+ PlanCheckTickleChan chan int
+ // TaskRunTickleChan is the tickler for task run scheduler.
+ TaskRunTickleChan chan int
+
+ // RolloutCreationChan is the channel for automatic rollout creation.
+ RolloutCreationChan chan int64
+
+ // PlanCompletionCheckChan signals when a plan might be complete (for PIPELINE_COMPLETED webhook).
+ PlanCompletionCheckChan chan int64
+}
+```
+
+**Step 2: Initialize channel in New()**
+
+Edit the `New()` function:
+
+```go
+func New() (*State, error) {
+ return &State{
+ ApprovalCheckChan: make(chan int64, 1000),
+ PlanCheckTickleChan: make(chan int, 1000),
+ TaskRunTickleChan: make(chan int, 1000),
+ RolloutCreationChan: make(chan int64, 100),
+ PlanCompletionCheckChan: make(chan int64, 1000),
+ }, nil
+}
+```
+
+**Step 3: Commit**
+
+```bash
+git add backend/component/state/state.go
+git commit -m "feat: add ApprovalCheckChan to State
+
+Add buffered channel for event-driven approval finding.
+Buffered with 1000 capacity to handle bursts.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 3: Convert Approval Runner to Event Listener
+
+**Files:**
+- Modify: `backend/runner/approval/runner.go`
+
+**Step 1: Replace Run() method**
+
+Find the `Run()` method in `backend/runner/approval/runner.go` and replace it:
+
+```go
+// Run runs the runner.
+func (r *Runner) Run(ctx context.Context, wg *sync.WaitGroup) {
+ defer wg.Done()
+ slog.Debug("Approval runner started (event-driven)")
+
+ for {
+ select {
+ case issueUID := <-r.stateCfg.ApprovalCheckChan:
+ r.processIssue(ctx, issueUID)
+ case <-ctx.Done():
+ return
+ }
+ }
+}
+```
+
+**Step 2: Add processIssue() method**
+
+Add new method after `Run()`:
+
+```go
+func (r *Runner) processIssue(ctx context.Context, issueUID int64) {
+ // Get fresh issue from database
+ issue, err := r.store.GetIssue(ctx, &store.FindIssueMessage{UID: &issueUID})
+ if err != nil {
+ slog.Error("failed to get issue for approval check",
+ slog.Int64("issue_uid", issueUID), log.BBError(err))
+ return
+ }
+ if issue == nil {
+ return // Issue deleted, nothing to do
+ }
+
+ approvalSetting, err := r.store.GetWorkspaceApprovalSetting(ctx)
+ if err != nil {
+ slog.Error("failed to get workspace approval setting", log.BBError(err))
+ return
+ }
+
+ // Find approval template - errors are logged, not persisted
+ _, err = r.findApprovalTemplateForIssue(ctx, issue, approvalSetting)
+ if err != nil {
+ slog.Error("failed to find approval template",
+ slog.Int64("issue_uid", issueUID),
+ slog.String("issue_title", issue.Title),
+ log.BBError(err))
+ // Don't persist error - user can rerun plan check to retry
+ }
+}
+```
+
+**Step 3: Commit**
+
+```bash
+git add backend/runner/approval/runner.go
+git commit -m "refactor: convert approval runner to event listener
+
+Replace polling with event-driven architecture.
+Process issues when signaled via ApprovalCheckChan.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 4: Remove Error Persistence from Approval Finding
+
+**Files:**
+- Modify: `backend/runner/approval/runner.go`
+
+**Step 1: Simplify error handling**
+
+Find the error handling block in `findApprovalTemplateForIssue()` (around line 176):
+
+```go
+// BEFORE (delete this):
+if err != nil {
+ if updateErr := updateIssueApprovalPayload(ctx, r.store, issue, &storepb.IssuePayloadApproval{
+ ApprovalFindingDone: true,
+ ApprovalFindingError: err.Error(),
+ }, storepb.RiskLevel_RISK_LEVEL_UNSPECIFIED); updateErr != nil {
+ return false, multierr.Append(errors.Wrap(updateErr, "failed to update issue payload"), err)
+ }
+ return false, err
+}
+
+// AFTER (replace with this):
+if err != nil {
+ // Don't persist error - it will be logged by caller
+ // User can rerun plan check to retry
+ return false, err
+}
+```
+
+**Step 2: Commit**
+
+```bash
+git add backend/runner/approval/runner.go
+git commit -m "refactor: remove error persistence from approval finding
+
+Errors are now transient - logged but not saved to database.
+Users rerun plan check to retry.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 5: Remove Deprecated Approval Runner Methods
+
+**Files:**
+- Modify: `backend/runner/approval/runner.go`
+
+**Step 1: Delete runOnce() method**
+
+Find and delete the entire `runOnce()` method (approximately lines 80-101):
+
+```go
+// DELETE this entire function:
+func (r *Runner) runOnce(ctx context.Context) {
+ approvalSetting, err := r.store.GetWorkspaceApprovalSetting(ctx)
+ if err != nil {
+ slog.Error("failed to get workspace approval setting", log.BBError(err))
+ return
+ }
+
+ r.stateCfg.ApprovalFinding.Range(func(key, value any) bool {
+ issue, ok := value.(*store.IssueMessage)
+ if !ok {
+ return true
+ }
+ done, err := r.findApprovalTemplateForIssue(ctx, issue, approvalSetting)
+ if err != nil {
+ slog.Error("failed to find approval template for issue", slog.Int("issue", issue.UID), log.BBError(err))
+ }
+ if err != nil || done {
+ r.stateCfg.ApprovalFinding.Delete(key)
+ }
+ return true
+ })
+}
+```
+
+**Step 2: Delete retryFindApprovalTemplate() method**
+
+Find and delete the entire `retryFindApprovalTemplate()` method (approximately lines 103-117):
+
+```go
+// DELETE this entire function:
+func (r *Runner) retryFindApprovalTemplate(ctx context.Context) {
+ issues, err := r.store.ListIssues(ctx, &store.FindIssueMessage{
+ StatusList: []storepb.Issue_Status{storepb.Issue_OPEN},
+ })
+ if err != nil {
+ err := errors.Wrap(err, "failed to list issues")
+ slog.Error("failed to retry finding approval template", log.BBError(err))
+ }
+ for _, issue := range issues {
+ payload := issue.Payload
+ if payload.Approval == nil || !payload.Approval.ApprovalFindingDone {
+ r.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+ }
+ }
+}
+```
+
+**Step 3: Commit**
+
+```bash
+git add backend/runner/approval/runner.go
+git commit -m "refactor: remove deprecated approval runner methods
+
+Remove runOnce() and retryFindApprovalTemplate().
+No longer needed with event-driven architecture.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 6: Trigger Approval Check on Plan Check Completion
+
+**Files:**
+- Modify: `backend/runner/plancheck/scheduler.go`
+
+**Step 1: Add approval trigger to markPlanCheckRunDone()**
+
+Find the `markPlanCheckRunDone()` method and update it:
+
+```go
+func (s *Scheduler) markPlanCheckRunDone(ctx context.Context, planCheckRun *store.PlanCheckRunMessage, results []*storepb.PlanCheckRunResult_Result) {
+ result := &storepb.PlanCheckRunResult{
+ Results: results,
+ }
+ if err := s.store.UpdatePlanCheckRun(ctx,
+ store.PlanCheckRunStatusDone,
+ result,
+ planCheckRun.UID,
+ ); err != nil {
+ slog.Error("failed to mark plan check run done", log.BBError(err))
+ return
+ }
+
+ // Get issue for this plan
+ issue, err := s.store.GetIssue(ctx, &store.FindIssueMessage{PlanUID: &planCheckRun.PlanUID})
+ if err != nil {
+ slog.Error("failed to get issue for approval check after plan check",
+ slog.Int("plan_id", int(planCheckRun.PlanUID)),
+ log.BBError(err))
+ return
+ }
+ if issue != nil && issue.PlanUID != nil {
+ // Trigger approval finding
+ s.stateCfg.ApprovalCheckChan <- issue.UID
+ // Trigger rollout creation (existing behavior)
+ s.stateCfg.RolloutCreationChan <- planCheckRun.PlanUID
+ }
+}
+```
+
+**Step 2: Commit**
+
+```bash
+git add backend/runner/plancheck/scheduler.go
+git commit -m "feat: trigger approval check on plan check completion
+
+Signal ApprovalCheckChan when plan checks complete successfully.
+Primary trigger for event-driven approval finding.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 7: Add tryTriggerApprovalCheck Helper to IssueService
+
+**Files:**
+- Modify: `backend/api/v1/issue_service.go`
+
+**Step 1: Add helper method**
+
+Add this method to the IssueService (after the struct definition, before CreateIssue):
+
+```go
+// tryTriggerApprovalCheck checks if plan check is already done and triggers approval finding.
+// Called after issue creation to handle the case where plan checks completed before issue was created.
+func (s *IssueService) tryTriggerApprovalCheck(ctx context.Context, issue *store.IssueMessage) {
+ if issue.PlanUID == nil {
+ return
+ }
+
+ planCheckRun, err := s.store.GetPlanCheckRun(ctx, *issue.PlanUID)
+ if err != nil {
+ slog.Debug("failed to get plan check run for approval trigger check",
+ slog.Int("plan_uid", int(*issue.PlanUID)), log.BBError(err))
+ return
+ }
+
+ // If plan check is already DONE, trigger approval finding
+ if planCheckRun != nil && planCheckRun.Status == store.PlanCheckRunStatusDone {
+ s.stateCfg.ApprovalCheckChan <- issue.UID
+ }
+}
+```
+
+**Step 2: Commit**
+
+```bash
+git add backend/api/v1/issue_service.go
+git commit -m "feat: add helper to trigger approval check on issue creation
+
+Helper checks if plan check already completed and triggers approval.
+Handles case where plan check finished before issue created.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 8: Update Issue Creation to Use New Trigger
+
+**Files:**
+- Modify: `backend/api/v1/issue_service.go`
+
+**Step 1: Update first CreateIssue call (DATABASE_CHANGE)**
+
+Find the first issue creation block (around line 429) and replace:
+
+```go
+// OLD (delete):
+s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+
+// NEW (replace with):
+s.tryTriggerApprovalCheck(ctx, issue)
+```
+
+**Step 2: Update second CreateIssue call (GRANT_REQUEST)**
+
+Find the second issue creation block (around line 509) and replace:
+
+```go
+// OLD (delete):
+s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+
+// NEW (replace with):
+s.tryTriggerApprovalCheck(ctx, issue)
+```
+
+**Step 3: Update third CreateIssue call (DATABASE_EXPORT)**
+
+Find the third issue creation block (around line 578) and replace:
+
+```go
+// OLD (delete):
+s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+
+// NEW (replace with):
+s.tryTriggerApprovalCheck(ctx, issue)
+```
+
+**Step 4: Commit**
+
+```bash
+git add backend/api/v1/issue_service.go
+git commit -m "refactor: use event trigger instead of sync.Map in issue creation
+
+Replace sync.Map.Store() with tryTriggerApprovalCheck().
+Triggers approval finding if plan check already done.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 9: Update Plan Service Approval Reset
+
+**Files:**
+- Modify: `backend/api/v1/plan_service.go`
+
+**Step 1: Update approval reset after plan update**
+
+Find the approval reset code (around line 318-325) and update:
+
+```go
+// Reset approval finding status
+if _, err := s.store.UpdateIssue(ctx, issue.UID, &store.UpdateIssueMessage{
+ PayloadUpsert: &storepb.Issue{
+ Approval: &storepb.IssuePayloadApproval{
+ ApprovalFindingDone: false,
+ },
+ },
+}); err != nil {
+ slog.Error("failed to reset approval finding status after plan update", log.BBError(err))
+}
+// Note: Don't trigger ApprovalCheckChan here - plan update creates new plan check run,
+// which will trigger approval finding on completion
+```
+
+Remove the old line:
+
+```go
+// DELETE this:
+s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+```
+
+**Step 2: Commit**
+
+```bash
+git add backend/api/v1/plan_service.go
+git commit -m "refactor: simplify approval reset on plan update
+
+Remove sync.Map.Store() - plan update triggers new plan check,
+which will trigger approval finding on completion.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 10: Remove ApprovalFinding sync.Map from State
+
+**Files:**
+- Modify: `backend/component/state/state.go`
+
+**Step 1: Remove field from State struct**
+
+Edit `backend/component/state/state.go` and delete the ApprovalFinding field:
+
+```go
+// State is the state for all in-memory states within the server.
+type State struct {
+ // ApprovalCheckChan signals when an issue needs approval template finding.
+ // Triggered by plan check completion, issue creation (if checks already done).
+ ApprovalCheckChan chan int64 // issue UID
+
+ // DELETE this line:
+ // ApprovalFinding sync.Map // map[issue.ID]*store.IssueMessage
+
+ TaskRunSchedulerInfo sync.Map // map[taskRunID]*storepb.SchedulerInfo
+
+ // ... rest of fields
+}
+```
+
+**Step 2: Commit**
+
+```bash
+git add backend/component/state/state.go
+git commit -m "refactor: remove ApprovalFinding sync.Map from State
+
+No longer needed with event-driven architecture.
+Replaced by ApprovalCheckChan.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 11: Remove approval_status Update Path
+
+**Files:**
+- Modify: `backend/api/v1/issue_service.go`
+
+**Step 1: Delete approval_status case**
+
+Find and delete the entire `case "approval_status":` block in UpdateIssue() (around lines 1052-1069):
+
+```go
+// DELETE this entire case block:
+case "approval_status":
+ if req.Msg.Issue.ApprovalStatus != v1pb.Issue_CHECKING {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("can only set approval_status to CHECKING to trigger re-finding approval templates"))
+ }
+ payload := issue.Payload
+ if payload.Approval == nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("issue payload approval is nil"))
+ }
+ if !payload.Approval.ApprovalFindingDone {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding is not done"))
+ }
+
+ if patch.PayloadUpsert == nil {
+ patch.PayloadUpsert = &storepb.Issue{}
+ }
+ patch.PayloadUpsert.Approval = &storepb.IssuePayloadApproval{
+ ApprovalFindingDone: false,
+ }
+```
+
+**Step 2: Delete dead code checking approval_finding_done**
+
+Find and delete the dead code (around lines 1143-1145):
+
+```go
+// DELETE these lines:
+if updateMasks["approval_finding_done"] {
+ s.stateCfg.ApprovalFinding.Store(issue.UID, issue)
+}
+```
+
+**Step 3: Commit**
+
+```bash
+git add backend/api/v1/issue_service.go
+git commit -m "refactor: remove approval_status update path
+
+Delete manual retry mechanism - users now rerun plan check.
+Also remove dead code checking approval_finding_done mask.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 12: Remove ApprovalFindingError Checks from Backend
+
+**Files:**
+- Modify: `backend/api/v1/issue_service.go`
+- Modify: `backend/api/v1/issue_service_converter.go`
+- Modify: `backend/utils/utils.go`
+
+**Step 1: Remove error checks from issue_service.go**
+
+Find and delete the error checks in three methods (ApprovalApprove, RejectIssue, UpdateIssue):
+
+In `ApprovalApprove()` (around line 621-622):
+```go
+// DELETE:
+if payload.Approval.ApprovalFindingError != "" {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
+}
+```
+
+In `RejectIssue()` (around line 797-798):
+```go
+// DELETE:
+if payload.Approval.ApprovalFindingError != "" {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
+}
+```
+
+In UpdateIssue()'s approvers update section (around line 903-904):
+```go
+// DELETE:
+if payload.Approval.ApprovalFindingError != "" {
+ return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf("approval template finding failed: %v", payload.Approval.ApprovalFindingError))
+}
+```
+
+**Step 2: Remove error mapping from issue_service_converter.go**
+
+Delete line 117:
+```go
+// DELETE:
+issueV1.ApprovalStatusError = approval.GetApprovalFindingError()
+```
+
+Delete lines 130-132 in `computeApprovalStatus()`:
+```go
+// DELETE:
+// If there's an error finding approval, status is error
+if approval.GetApprovalFindingError() != "" {
+ return v1pb.Issue_ERROR
+}
+```
+
+**Step 3: Remove error check from utils.go**
+
+In `CheckApprovalApproved()`, delete lines 63-65:
+```go
+// DELETE:
+if approval.ApprovalFindingError != "" {
+ return false, nil
+}
+```
+
+**Step 4: Commit**
+
+```bash
+git add backend/api/v1/issue_service.go backend/api/v1/issue_service_converter.go backend/utils/utils.go
+git commit -m "refactor: remove ApprovalFindingError references
+
+Remove all checks and mappings for approval finding errors.
+Errors are now transient (logged, not persisted).
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 13: Remove Retry Button from Frontend
+
+**Files:**
+- Modify: `frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue`
+
+**Step 1: Remove ERROR state UI**
+
+Delete the ERROR state block (lines 18-30):
+
+```vue
+<!-- DELETE this block: -->
+<div
+ v-else-if="issue.approvalStatus === Issue_ApprovalStatus.ERROR"
+ class="flex items-center gap-x-2"
+>
+ <span class="text-error text-sm">{{ issue.approvalStatusError }}</span>
+ <NButton
+ size="tiny"
+ :loading="retrying"
+ @click="retryFindingApprovalFlow"
+ >
+ {{ $t("common.retry") }}
+ </NButton>
+</div>
+```
+
+**Step 2: Remove retry function and ref**
+
+Delete the retry-related code (lines 84-94):
+
+```typescript
+// DELETE:
+const retrying = ref(false);
+
+const retryFindingApprovalFlow = async () => {
+ retrying.value = true;
+ try {
+ await useIssueV1Store().regenerateReviewV1(props.issue.name);
+ emit("issue-updated");
+ } finally {
+ retrying.value = false;
+ }
+};
+```
+
+**Step 3: Commit**
+
+```bash
+git add frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
+git commit -m "refactor: remove approval retry button from UI
+
+Remove ERROR state and retry button.
+Users now rerun plan check to retry approval finding.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 14: Remove regenerateReviewV1 from Issue Store
+
+**Files:**
+- Modify: `frontend/src/store/modules/v1/issue.ts`
+
+**Step 1: Delete regenerateReviewV1 function**
+
+Delete the function (lines 80-89):
+
+```typescript
+// DELETE:
+const regenerateReviewV1 = async (name: string) => {
+ const request = create(UpdateIssueRequestSchema, {
+ issue: create(IssueSchema, {
+ name,
+ approvalStatus: Issue_ApprovalStatus.CHECKING,
+ }),
+ updateMask: { paths: ["approval_status"] },
+ });
+ await issueServiceClientConnect.updateIssue(request);
+};
+```
+
+**Step 2: Remove from return statement**
+
+Delete from the return statement (line 139):
+
+```typescript
+return {
+ listIssues,
+ fetchIssueByName,
+ // DELETE this line:
+ // regenerateReviewV1,
+};
+```
+
+**Step 3: Commit**
+
+```bash
+git add frontend/src/store/modules/v1/issue.ts
+git commit -m "refactor: remove regenerateReviewV1 from issue store
+
+Function no longer needed - users rerun plan check to retry.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 15: Run Backend Linting
+
+**Files:**
+- All modified Go files
+
+**Step 1: Run golangci-lint**
+
+Run: `golangci-lint run --allow-parallel-runners`
+
+Expected: No linting errors
+
+**Step 2: Fix any linting issues**
+
+If there are linting errors, fix them according to the output.
+
+**Step 3: Run golangci-lint again**
+
+Run: `golangci-lint run --allow-parallel-runners`
+
+Expected: No linting errors (0 issues)
+
+**Step 4: Commit if fixes were needed**
+
+```bash
+git add .
+git commit -m "chore: fix linting issues
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 16: Run Frontend Linting and Formatting
+
+**Files:**
+- All modified frontend files
+
+**Step 1: Format with Biome**
+
+Run: `pnpm --dir frontend biome:format`
+
+Expected: Files formatted
+
+**Step 2: Lint with Biome**
+
+Run: `pnpm --dir frontend biome:lint`
+
+Expected: No linting errors
+
+**Step 3: Lint with ESLint**
+
+Run: `pnpm --dir frontend lint --fix`
+
+Expected: No linting errors
+
+**Step 4: Type check**
+
+Run: `pnpm --dir frontend type-check`
+
+Expected: No type errors
+
+**Step 5: Commit if fixes were needed**
+
+```bash
+git add frontend/
+git commit -m "chore: fix frontend linting and formatting
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Task 17: Manual Testing
+
+**Test Scenario 1: Plan check triggers approval**
+
+1. Start backend: `PG_URL=postgresql://bbdev@localhost/bbdev go run ./backend/bin/server/main.go --port 8080 --data . --debug`
+2. Create a new DATABASE_CHANGE issue with SQL
+3. Observe logs: Plan check completes → approval finding triggered
+4. Check issue in UI: approval status should show appropriate template or "No approval needed"
+
+Expected: Approval found immediately after plan check completes (no 1-second delay)
+
+**Test Scenario 2: Issue creation with completed plan check**
+
+1. Create plan check first (via API)
+2. Wait for plan check to complete
+3. Create issue for that plan
+4. Observe logs: Approval finding triggered immediately
+
+Expected: Approval found right after issue creation
+
+**Test Scenario 3: Error handling**
+
+1. Temporarily break approval rule CEL expression in workspace settings
+2. Create issue and wait for plan check
+3. Check logs: Error logged but not persisted
+4. Fix CEL expression
+5. Rerun plan check
+6. Check issue: Approval found successfully
+
+Expected: Error logged, not shown in UI. Retry works via plan check rerun.
+
+**Test Scenario 4: Plan update**
+
+1. Create issue with SQL
+2. Wait for approval to be found
+3. Update SQL in plan
+4. Observe: Approval status resets to CHECKING
+5. Wait for new plan check
+6. Check issue: New approval found
+
+Expected: Approval resets and re-finds after plan update
+
+---
+
+## Task 18: Update Documentation (Optional)
+
+**Files:**
+- Create: `docs/architecture/approval-finding.md` (optional)
+
+**Step 1: Document architecture (optional)**
+
+If desired, create architecture documentation explaining:
+- Event-driven flow
+- Trigger points
+- Error handling philosophy
+- HA compatibility
+
+**Step 2: Commit documentation**
+
+```bash
+git add docs/architecture/approval-finding.md
+git commit -m "docs: add approval finding architecture
+
+Document event-driven approval finding architecture.
+
+🤖 Generated with Claude Code
+
+Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"
+```
+
+---
+
+## Verification Checklist
+
+- [ ] Proto regenerated without ApprovalFindingError
+- [ ] ApprovalCheckChan added to State and initialized
+- [ ] Approval runner converted to event listener
+- [ ] Plan check completion triggers approval
+- [ ] Issue creation triggers approval (if plan check done)
+- [ ] Plan update resets approval status
+- [ ] sync.Map removed from State
+- [ ] approval_status update path removed
+- [ ] Error references removed from backend
+- [ ] Retry button removed from frontend
+- [ ] regenerateReviewV1 removed from store
+- [ ] Backend linting passes
+- [ ] Frontend linting passes
+- [ ] Manual testing scenarios pass
+- [ ] No console errors in browser
+- [ ] No HA-related issues (test with multiple instances if possible)
+
+---
+
+## Success Criteria
+
+1. **HA Compatible**: Multiple instances can run without duplicate processing
+2. **Immediate Processing**: Approval found right after plan check (no polling delay)
+3. **Clean Error Handling**: Errors logged, not persisted; retry via plan check rerun
+4. **Code Reduction**: ~230 lines removed (sync.Map, error persistence, dead code, retry UI)
+5. **No Regressions**: All existing approval workflows still work
+
+---
+
+## Rollback Plan
+
+If issues are discovered:
+
+1. Revert all commits on this branch
+2. Return to main branch
+3. In-memory sync.Map approach still works (not HA-safe but functional)
+
+Critical files to check for regressions:
+- `backend/runner/approval/runner.go`
+- `backend/api/v1/issue_service.go`
+- `backend/runner/plancheck/scheduler.go`
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
index 8f621f65c2..8ee7b780b7 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
@@ -16,19 +16,6 @@
{{ $t("custom-approval.issue-review.generating-approval-flow") }}
</span>
</div>
- <div
- v-else-if="issue.approvalStatus === Issue_ApprovalStatus.ERROR"
- class="flex items-center gap-x-2"
- >
- <span class="text-error text-sm">{{ issue.approvalStatusError }}</span>
- <NButton
- size="tiny"
- :loading="retrying"
- @click="retryFindingApprovalFlow"
- >
- {{ $t("common.retry") }}
- </NButton>
- </div>
<NTimeline
v-else-if="approvalSteps.length > 0"
size="large"
@@ -54,11 +41,10 @@
</template>
<script setup lang="ts">
-import { NButton, NTimeline } from "naive-ui";
-import { computed, ref } from "vue";
+import { NTimeline } from "naive-ui";
+import { computed } from "vue";
import { BBSpin } from "@/bbkit";
import FeatureBadge from "@/components/FeatureGuard/FeatureBadge.vue";
-import { useIssueV1Store } from "@/store";
import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import { Issue_ApprovalStatus } from "@/types/proto-es/v1/issue_service_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
@@ -69,10 +55,6 @@ const props = defineProps<{
issue: Issue;
}>();
-const emit = defineEmits<{
- (e: "issue-updated"): void;
-}>();
-
const approvalTemplate = computed(() => {
return props.issue.approvalTemplate;
});
@@ -80,16 +62,4 @@ const approvalTemplate = computed(() => {
const approvalSteps = computed(() => {
return approvalTemplate.value?.flow?.roles || [];
});
-
-const retrying = ref(false);
-
-const retryFindingApprovalFlow = async () => {
- retrying.value = true;
- try {
- await useIssueV1Store().regenerateReviewV1(props.issue.name);
- emit("issue-updated");
- } finally {
- retrying.value = false;
- }
-};
</script>
diff --git a/frontend/src/store/modules/v1/issue.ts b/frontend/src/store/modules/v1/issue.ts
index 61345e8f8d..cea2789999 100644
--- a/frontend/src/store/modules/v1/issue.ts
+++ b/frontend/src/store/modules/v1/issue.ts
@@ -13,10 +13,8 @@ import {
GetIssueRequestSchema,
Issue_ApprovalStatus,
Issue_Type,
- IssueSchema,
IssueStatus,
SearchIssuesRequestSchema,
- UpdateIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
import {
extractProjectResourceName,
@@ -77,17 +75,6 @@ export const buildIssueFilter = (find: IssueFilter): string => {
export const useIssueV1Store = defineStore("issue_v1", () => {
const projectStore = useProjectV1Store();
- const regenerateReviewV1 = async (name: string) => {
- const request = create(UpdateIssueRequestSchema, {
- issue: create(IssueSchema, {
- name,
- approvalStatus: Issue_ApprovalStatus.CHECKING,
- }),
- updateMask: { paths: ["approval_status"] },
- });
- await issueServiceClientConnect.updateIssue(request);
- };
-
const listIssues = async (
{ find, pageSize, pageToken }: ListIssueParams,
composeIssueConfig?: ComposeIssueConfig
@@ -136,7 +123,6 @@ export const useIssueV1Store = defineStore("issue_v1", () => {
return {
listIssues,
fetchIssueByName,
- regenerateReviewV1,
};
});
diff --git a/frontend/src/types/proto-es/v1/issue_service_pb.d.ts b/frontend/src/types/proto-es/v1/issue_service_pb.d.ts
index 5511923b26..41bdb538af 100644
--- a/frontend/src/types/proto-es/v1/issue_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/issue_service_pb.d.ts
@@ -513,13 +513,6 @@ export declare type Issue = Message<"bytebase.v1.Issue"> & {
* @generated from field: bytebase.v1.Issue.ApprovalStatus approval_status = 18;
*/
approvalStatus: Issue_ApprovalStatus;
-
- /**
- * Only populated when approval_status == ERROR
- *
- * @generated from field: string approval_status_error = 19;
- */
- approvalStatusError: string;
};
/**
@@ -682,13 +675,6 @@ export enum Issue_ApprovalStatus {
* @generated from enum value: SKIPPED = 5;
*/
SKIPPED = 5,
-
- /**
- * Error occurred during approval evaluation.
- *
- * @generated from enum value: ERROR = 6;
- */
- ERROR = 6,
}
/**
diff --git a/frontend/src/types/proto-es/v1/issue_service_pb.js b/frontend/src/types/proto-es/v1/issue_service_pb.js
index 057508686c..5dabf17fe8 100644
--- a/frontend/src/types/proto-es/v1/issue_service_pb.js
+++ b/frontend/src/types/proto-es/v1/issue_service_pb.js
@@ -17,7 +17,7 @@ import { file_v1_common } from "./common_pb";
* Describes the file v1/issue_service.proto.
*/
export const file_v1_issue_service = /*@__PURE__*/
- fileDesc("ChZ2MS9pc3N1ZV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJKCg9HZXRJc3N1ZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vSXNzdWUSDQoFZm9yY2UYAiABKAgiagoSQ3JlYXRlSXNzdWVSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBImCgVpc3N1ZRgCIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQgPgQQIihwEKEUxpc3RJc3N1ZXNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkiUQoSTGlzdElzc3Vlc1Jlc3BvbnNlEiIKBmlzc3VlcxgBIAMoCzISLmJ5dGViYXNlLnYxLklzc3VlEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJwChNTZWFyY2hJc3N1ZXNSZXF1ZXN0EhMKBnBhcmVudBgBIAEoCUID4EECEhEKCXBhZ2Vfc2l6ZRgCIAEoBRISCgpwYWdlX3Rva2VuGAMgASgJEg4KBmZpbHRlchgEIAEoCRINCgVxdWVyeRgFIAEoCSJTChRTZWFyY2hJc3N1ZXNSZXNwb25zZRIiCgZpc3N1ZXMYASADKAsyEi5ieXRlYmFzZS52MS5Jc3N1ZRIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkioAEKElVwZGF0ZUlzc3VlUmVxdWVzdBI9CgVpc3N1ZRgBIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQh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zdWVTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_expr, file_v1_annotation, file_v1_common]);
+ fileDesc("ChZ2MS9pc3N1ZV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJKCg9HZXRJc3N1ZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vSXNzdWUSDQoFZm9yY2UYAiABKAgiagoSQ3JlYXRlSXNzdWVSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBImCgVpc3N1ZRgCIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQgPgQQIihwEKEUxpc3RJc3N1ZXNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkiUQoSTGlzdElzc3Vlc1Jlc3BvbnNlEiIKBmlzc3VlcxgBIAMoCzISLmJ5dGViYXNlLnYxLklzc3VlEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJwChNTZWFyY2hJc3N1ZXNSZXF1ZXN0EhMKBnBhcmVudBgBIAEoCUID4EECEhEKCXBhZ2Vfc2l6ZRgCIAEoBRISCgpwYWdlX3Rva2VuGAMgASgJEg4KBmZpbHRlchgEIAEo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EuUmVxdWVzdElzc3VlUmVxdWVzdBoSLmJ5dGViYXNlLnYxLklzc3VlIjmQ6jACmOowAYLT5JMCKzoBKiImL3YxL3tuYW1lPXByb2plY3RzLyovaXNzdWVzLyp9OnJlcXVlc3RCpwEKD2NvbS5ieXRlYmFzZS52MUIRSXNzdWVTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_expr, file_v1_annotation, file_v1_common]);
/**
* Describes the message bytebase.v1.GetIssueRequest.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index b18783488c..6de7703bb3 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -10875,13 +10875,8 @@ components:
- APPROVED
- REJECTED
- SKIPPED
- - ERROR
type: string
format: enum
- approvalStatusError:
- readOnly: true
- type: string
- description: Only populated when approval_status == ERROR
IssueComment:
type: object
properties:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 0c16bc6641..a3fd262086 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -624,7 +624,6 @@ IssuePayloadApproval records the approval template used and approval history for
| approval_template | [ApprovalTemplate](#bytebase-store-ApprovalTemplate) | | The approval template being used for this issue. |
| approvers | [IssuePayloadApproval.Approver](#bytebase-store-IssuePayloadApproval-Approver) | repeated | List of approvers and their current status. |
| approval_finding_done | [bool](#bool) | | Whether the system has finished finding a matching approval template. False means the backend is still searching for matching templates. |
-| approval_finding_error | [string](#string) | | Error message if approval template finding failed. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 66cdde1604..853e92b09c 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -2188,13 +2188,6 @@ TODO: use range instead. </p></td>
False means the backend is still searching for matching templates. </p></td>
</tr>
- <tr>
- <td>approval_finding_error</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Error message if approval template finding failed. </p></td>
- </tr>
-
</tbody>
</table>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index c999f13004..3a1b091b2c 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -1072,7 +1072,6 @@ Webhook integration type.
| risk_level | [RiskLevel](#bytebase-v1-RiskLevel) | | The risk level of the issue. |
| labels | [string](#string) | repeated | Labels attached to the issue for categorization and filtering. |
| approval_status | [Issue.ApprovalStatus](#bytebase-v1-Issue-ApprovalStatus) | | |
-| approval_status_error | [string](#string) | | Only populated when approval_status == ERROR |
@@ -1369,7 +1368,6 @@ The overall approval status for the issue.
| APPROVED | 3 | Issue has been approved. |
| REJECTED | 4 | Issue has been rejected. |
| SKIPPED | 5 | Approval was skipped. |
-| ERROR | 6 | Error occurred during approval evaluation. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 5eea7bb6ac..6485bc071a 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -3718,13 +3718,6 @@ Format: projects/{project}/plans/{plan} </p></td>
<td><p> </p></td>
</tr>
- <tr>
- <td>approval_status_error</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Only populated when approval_status == ERROR </p></td>
- </tr>
-
</tbody>
</table>
@@ -4459,12 +4452,6 @@ In this situation, `update_mask` is ignored. </p></td>
<td><p>Approval was skipped.</p></td>
</tr>
- <tr>
- <td>ERROR</td>
- <td>6</td>
- <td><p>Error occurred during approval evaluation.</p></td>
- </tr>
-
</tbody>
</table>
diff --git a/proto/store/store/approval.proto b/proto/store/store/approval.proto
index 776fc7fcb1..07b0f7a537 100644
--- a/proto/store/store/approval.proto
+++ b/proto/store/store/approval.proto
@@ -34,9 +34,6 @@ message IssuePayloadApproval {
// Whether the system has finished finding a matching approval template.
// False means the backend is still searching for matching templates.
bool approval_finding_done = 3;
-
- // Error message if approval template finding failed.
- string approval_finding_error = 4;
}
// ApprovalTemplate defines the approval workflow and requirements for an issue.
diff --git a/proto/v1/v1/issue_service.proto b/proto/v1/v1/issue_service.proto
index a78da7bf3c..141f469cc9 100644
--- a/proto/v1/v1/issue_service.proto
+++ b/proto/v1/v1/issue_service.proto
@@ -433,12 +433,8 @@ message Issue {
REJECTED = 4;
// Approval was skipped.
SKIPPED = 5;
- // Error occurred during approval evaluation.
- ERROR = 6;
}
ApprovalStatus approval_status = 18 [(google.api.field_behavior) = OUTPUT_ONLY];
- // Only populated when approval_status == ERROR
- string approval_status_error = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
}
message GrantRequest {