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(review): keep a standard rule finding's thread across runs (#21869)
rebelice3e9bc41ab3e1
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex d532ddc842..43fbbc78d3 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -15047,6 +15047,14 @@ components:title: plan_updatedescription: Plan update event.title: plan_update+ - type: object+ properties:+ reviewRunCompletion:+ allOf:+ - $ref: '#/components/schemas/bytebase.v1.IssueComment.ReviewRunCompletion'+ title: review_run_completion+ description: Review run completion event.+ title: review_run_completion- type: objectproperties:reviewSubmission:@@ -15065,6 +15073,8 @@ components:- issueUpdate- required:- planUpdate+ - required:+ - reviewRunCompletion- required:- reviewSubmission- not:@@ -15075,6 +15085,8 @@ components:- issueUpdate- required:- planUpdate+ - required:+ - reviewRunCompletion- required:- reviewSubmissionproperties:@@ -15132,8 +15144,10 @@ components:title: statement_anchordescription: |-(IMMUTABLE) Optional source context on a root or reply. A reply's anchor must share- the root's spec and sheet_sha256; it may narrow the range.- Cannot be set on events. Immutable after creation.+ the root's spec and sheet_sha256 when created; it may narrow the range.+ Cannot be set on events. Immutable after creation, except that a later+ review run reporting a review result again moves the result to its+ statement in the SQL that run reviewed.reviewMetadata:allOf:- $ref: '#/components/schemas/bytebase.v1.IssueComment.ReviewMetadata'@@ -15257,8 +15271,15 @@ components:type: booleantitle: supersededdescription: |-- A later run of the same reviewer has completed, so the result is not- from the latest review, whatever its thread state.+ A later run of the same reviewer has completed without reporting the+ result again, whatever its thread state.+ attempt:+ type: string+ title: attempt+ format: int64+ description: |-+ The ReviewRunCompletion.attempt of the run that posted the result. A+ result a later run reports again keeps its thread and its attempt.title: ReviewMetadataadditionalProperties: falsedescription: What a review result carries beyond its text.@@ -15273,6 +15294,41 @@ components:description: |-Priority says what resolving the thread means. It has no bearing onblocking, which thread_state alone decides.+ bytebase.v1.IssueComment.ReviewRunCompletion:+ type: object+ properties:+ runType:+ allOf:+ - $ref: '#/components/schemas/bytebase.v1.ReviewRun.Type'+ title: run_type+ description: The reviewer that ran.+ attempt:+ type: string+ title: attempt+ format: int64+ description: |-+ Identifies the run among its reviewer's runs on the issue. The results+ it posted carry the same ReviewMetadata.attempt.+ postedCount:+ type: integer+ title: posted_count+ format: int32+ description: Results the run posted as new threads.+ keptCount:+ type: integer+ title: kept_count+ format: int32+ description: Earlier results the run reported again, which kept their threads.+ supersededCount:+ type: integer+ title: superseded_count+ format: int32+ description: Earlier results the run no longer reports, now superseded.+ title: ReviewRunCompletion+ additionalProperties: false+ description: |-+ A review run completed, and what it did to the results of its reviewer.+ Posted by the reviewer, with no creator.bytebase.v1.IssueComment.ReviewSubmission:type: objecttitle: ReviewSubmissiondiff --git a/backend/api/v1/issue_service_converter.go b/backend/api/v1/issue_service_converter.goindex 10b331f3c8..8b767205ad 100644--- a/backend/api/v1/issue_service_converter.go+++ b/backend/api/v1/issue_service_converter.go@@ -192,6 +192,7 @@ func convertToIssueCommentReviewMetadata(metadata *storepb.IssueCommentPayload_RPriority: v1pb.IssueComment_ReviewMetadata_Priority(metadata.Priority),Targets: metadata.Targets,Superseded: metadata.Superseded,+ Attempt: metadata.Attempt,}}@@ -202,7 +203,7 @@ func convertToIssueComment(issueName string, ic *store.IssueCommentMessage) *v1pUpdateTime: timestamppb.New(ic.UpdatedAt),Name: common.FormatIssueComment(issueName, ic.ResourceID),}- // A review result has no creator; its review_metadata names the reviewer.+ // A review result or run completion has no creator; it names the reviewer.if ic.CreatorEmail != "" {r.Creator = common.FormatUserEmail(ic.CreatorEmail)}@@ -239,6 +240,17 @@ func convertToIssueComment(issueName string, ic *store.IssueCommentMessage) *v1pr.Event = &v1pb.IssueComment_ReviewSubmission_{ReviewSubmission: &v1pb.IssueComment_ReviewSubmission{},}+ case *storepb.IssueCommentPayload_ReviewRunCompletion_:+ completion := e.ReviewRunCompletion+ r.Event = &v1pb.IssueComment_ReviewRunCompletion_{+ ReviewRunCompletion: &v1pb.IssueComment_ReviewRunCompletion{+ RunType: convertToReviewRunType(completion.RunType.String()),+ Attempt: completion.Attempt,+ PostedCount: completion.PostedCount,+ KeptCount: completion.KeptCount,+ SupersededCount: completion.SupersededCount,+ },+ }case *storepb.IssueCommentPayload_PlanUpdate_:projectID, _, _ := common.GetProjectIDIssueUID(issueName)r.Event = convertToIssueCommentEventPlanUpdate(projectID, e)diff --git a/backend/generated-go/store/issue_comment.pb.go b/backend/generated-go/store/issue_comment.pb.goindex 911c7deb7e..5ce6fddc0e 100644--- a/backend/generated-go/store/issue_comment.pb.go+++ b/backend/generated-go/store/issue_comment.pb.go@@ -77,7 +77,7 @@ func (x IssueCommentPayload_ReviewMetadata_Priority) Number() protoreflect.EnumN// Deprecated: Use IssueCommentPayload_ReviewMetadata_Priority.Descriptor instead.func (IssueCommentPayload_ReviewMetadata_Priority) EnumDescriptor() ([]byte, []int) {- return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 4, 0}+ return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 5, 0}}type IssueCommentPayload struct {@@ -89,9 +89,12 @@ type IssueCommentPayload struct {// *IssueCommentPayload_IssueUpdate_// *IssueCommentPayload_PlanUpdate_// *IssueCommentPayload_ReviewSubmission_+ // *IssueCommentPayload_ReviewRunCompletion_Event isIssueCommentPayload_Event `protobuf_oneof:"event"`// The statement context an inline comment references. Set at creation and- // immutable afterward; never set together with an event.+ // immutable afterward, except that a later run reporting a review result+ // again moves the result to its statement in the SQL that run reviewed.+ // Never set together with an event.StatementAnchor *IssueCommentPayload_StatementAnchor `protobuf:"bytes,9,opt,name=statement_anchor,json=statementAnchor,proto3" json:"statement_anchor,omitempty"`// Present on review results only, beside the text and never together with// an event. Written by the review executor; CreateIssueComment rejects it.@@ -182,6 +185,15 @@ func (x *IssueCommentPayload) GetReviewSubmission() *IssueCommentPayload_ReviewSreturn nil}+func (x *IssueCommentPayload) GetReviewRunCompletion() *IssueCommentPayload_ReviewRunCompletion {+ if x != nil {+ if x, ok := x.Event.(*IssueCommentPayload_ReviewRunCompletion_); ok {+ return x.ReviewRunCompletion+ }+ }+ return nil+}+func (x *IssueCommentPayload) GetStatementAnchor() *IssueCommentPayload_StatementAnchor {if x != nil {return x.StatementAnchor@@ -216,6 +228,10 @@ type IssueCommentPayload_ReviewSubmission_ struct {ReviewSubmission *IssueCommentPayload_ReviewSubmission `protobuf:"bytes,8,opt,name=review_submission,json=reviewSubmission,proto3,oneof"`}+type IssueCommentPayload_ReviewRunCompletion_ struct {+ ReviewRunCompletion *IssueCommentPayload_ReviewRunCompletion `protobuf:"bytes,11,opt,name=review_run_completion,json=reviewRunCompletion,proto3,oneof"`+}+func (*IssueCommentPayload_Approval_) isIssueCommentPayload_Event() {}func (*IssueCommentPayload_IssueUpdate_) isIssueCommentPayload_Event() {}@@ -224,6 +240,8 @@ func (*IssueCommentPayload_PlanUpdate_) isIssueCommentPayload_Event() {}func (*IssueCommentPayload_ReviewSubmission_) isIssueCommentPayload_Event() {}+func (*IssueCommentPayload_ReviewRunCompletion_) isIssueCommentPayload_Event() {}+type IssueCommentPayload_Approval struct {state protoimpl.MessageState `protogen:"open.v1"`Status IssuePayloadApproval_Approver_Status `protobuf:"varint,1,opt,name=status,proto3,enum=bytebase.store.IssuePayloadApproval_Approver_Status" json:"status,omitempty"`@@ -405,6 +423,90 @@ func (*IssueCommentPayload_ReviewSubmission) Descriptor() ([]byte, []int) {return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 2}}+// ReviewRunCompletion records that a review run completed DONE, and what+// it did to the results of its reviewer. Posted with no creator, in the+// transaction that posts the run's results.+type IssueCommentPayload_ReviewRunCompletion struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ RunType ReviewRun_Type `protobuf:"varint,1,opt,name=run_type,json=runType,proto3,enum=bytebase.store.ReviewRun_Type" json:"run_type,omitempty"`+ // The run's review_run.attempt; its new results carry the same+ // ReviewMetadata.attempt.+ Attempt int64 `protobuf:"varint,2,opt,name=attempt,proto3" json:"attempt,omitempty"`+ // Results the run posted as new threads.+ PostedCount int32 `protobuf:"varint,3,opt,name=posted_count,json=postedCount,proto3" json:"posted_count,omitempty"`+ // Earlier results the run reported again, which kept their threads.+ KeptCount int32 `protobuf:"varint,4,opt,name=kept_count,json=keptCount,proto3" json:"kept_count,omitempty"`+ // Earlier results the run no longer reports, which it superseded.+ SupersededCount int32 `protobuf:"varint,5,opt,name=superseded_count,json=supersededCount,proto3" json:"superseded_count,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *IssueCommentPayload_ReviewRunCompletion) Reset() {+ *x = IssueCommentPayload_ReviewRunCompletion{}+ mi := &file_store_issue_comment_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *IssueCommentPayload_ReviewRunCompletion) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*IssueCommentPayload_ReviewRunCompletion) ProtoMessage() {}++func (x *IssueCommentPayload_ReviewRunCompletion) ProtoReflect() protoreflect.Message {+ mi := &file_store_issue_comment_proto_msgTypes[4]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use IssueCommentPayload_ReviewRunCompletion.ProtoReflect.Descriptor instead.+func (*IssueCommentPayload_ReviewRunCompletion) Descriptor() ([]byte, []int) {+ return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 3}+}++func (x *IssueCommentPayload_ReviewRunCompletion) GetRunType() ReviewRun_Type {+ if x != nil {+ return x.RunType+ }+ return ReviewRun_TYPE_UNSPECIFIED+}++func (x *IssueCommentPayload_ReviewRunCompletion) GetAttempt() int64 {+ if x != nil {+ return x.Attempt+ }+ return 0+}++func (x *IssueCommentPayload_ReviewRunCompletion) GetPostedCount() int32 {+ if x != nil {+ return x.PostedCount+ }+ return 0+}++func (x *IssueCommentPayload_ReviewRunCompletion) GetKeptCount() int32 {+ if x != nil {+ return x.KeptCount+ }+ return 0+}++func (x *IssueCommentPayload_ReviewRunCompletion) GetSupersededCount() int32 {+ if x != nil {+ return x.SupersededCount+ }+ return 0+}+// PlanUpdate carries before/after snapshots of plan.config.specs,// emitted once per PlanService.UpdatePlan call whose specs branch// produces a non-cosmetic diff. The renderer computes per-spec@@ -419,7 +521,7 @@ type IssueCommentPayload_PlanUpdate struct {func (x *IssueCommentPayload_PlanUpdate) Reset() {*x = IssueCommentPayload_PlanUpdate{}- mi := &file_store_issue_comment_proto_msgTypes[4]+ mi := &file_store_issue_comment_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -431,7 +533,7 @@ func (x *IssueCommentPayload_PlanUpdate) String() string {func (*IssueCommentPayload_PlanUpdate) ProtoMessage() {}func (x *IssueCommentPayload_PlanUpdate) ProtoReflect() protoreflect.Message {- mi := &file_store_issue_comment_proto_msgTypes[4]+ mi := &file_store_issue_comment_proto_msgTypes[5]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -444,7 +546,7 @@ func (x *IssueCommentPayload_PlanUpdate) ProtoReflect() protoreflect.Message {// Deprecated: Use IssueCommentPayload_PlanUpdate.ProtoReflect.Descriptor instead.func (*IssueCommentPayload_PlanUpdate) Descriptor() ([]byte, []int) {- return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 3}+ return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 4}}func (x *IssueCommentPayload_PlanUpdate) GetFromSpecs() []*PlanConfig_Spec {@@ -463,10 +565,11 @@ func (x *IssueCommentPayload_PlanUpdate) GetToSpecs() []*PlanConfig_Spec {// ReviewMetadata is what a review result carries beyond its text: which// reviewer posted it, what it was judged against, its priority, and the-// databases it applies to. Results from the same reviewer are superseded-// together: when a run completes, it resolves every OPEN root of its type-// and marks every earlier root of its type superseded, in the transaction-// that posts the new results.+// databases it applies to. When a run completes, an earlier result of its+// type whose fingerprint the run reports again keeps its thread, and the+// run posts no new result for it; every other earlier root of its type is+// resolved and marked superseded, in the transaction that posts the new+// results.type IssueCommentPayload_ReviewMetadata struct {state protoimpl.MessageState `protogen:"open.v1"`// The reviewer slot that posted the result; review_run.type stores the@@ -481,17 +584,25 @@ type IssueCommentPayload_ReviewMetadata struct {// renderer collapses it when it equals the spec's target set.// Format: instances/{instance}/databases/{database}Targets []string `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"`- // A later run of the same reviewer has completed, so the result is not- // from the latest review. Set by that run whatever the thread state, and- // never cleared.- Superseded bool `protobuf:"varint,5,opt,name=superseded,proto3" json:"superseded,omitempty"`+ // A later run of the same reviewer has completed without reporting the+ // result again, so the latest review does not hold it. Set by that run+ // whatever the thread state, and never cleared.+ Superseded bool `protobuf:"varint,5,opt,name=superseded,proto3" json:"superseded,omitempty"`+ // Identifies the finding across runs: equal fingerprints are the same+ // finding on the same SQL. Unique among the results of one run. Empty+ // when the reviewer cannot tell findings apart across runs, and an empty+ // fingerprint matches nothing.+ Fingerprint string `protobuf:"bytes,6,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"`+ // The review_run.attempt of the run that posted the result. A result+ // a later run reports again keeps its attempt.+ Attempt int64 `protobuf:"varint,7,opt,name=attempt,proto3" json:"attempt,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}func (x *IssueCommentPayload_ReviewMetadata) Reset() {*x = IssueCommentPayload_ReviewMetadata{}- mi := &file_store_issue_comment_proto_msgTypes[5]+ mi := &file_store_issue_comment_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -503,7 +614,7 @@ func (x *IssueCommentPayload_ReviewMetadata) String() string {func (*IssueCommentPayload_ReviewMetadata) ProtoMessage() {}func (x *IssueCommentPayload_ReviewMetadata) ProtoReflect() protoreflect.Message {- mi := &file_store_issue_comment_proto_msgTypes[5]+ mi := &file_store_issue_comment_proto_msgTypes[6]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -516,7 +627,7 @@ func (x *IssueCommentPayload_ReviewMetadata) ProtoReflect() protoreflect.Message// Deprecated: Use IssueCommentPayload_ReviewMetadata.ProtoReflect.Descriptor instead.func (*IssueCommentPayload_ReviewMetadata) Descriptor() ([]byte, []int) {- return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 4}+ return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 5}}func (x *IssueCommentPayload_ReviewMetadata) GetRunType() ReviewRun_Type {@@ -554,6 +665,20 @@ func (x *IssueCommentPayload_ReviewMetadata) GetSuperseded() bool {return false}+func (x *IssueCommentPayload_ReviewMetadata) GetFingerprint() string {+ if x != nil {+ return x.Fingerprint+ }+ return ""+}++func (x *IssueCommentPayload_ReviewMetadata) GetAttempt() int64 {+ if x != nil {+ return x.Attempt+ }+ return 0+}+// StatementAnchor records the anchored statement revision and range.// The SQL excerpt and current/changed/unavailable state are computed on// read against the anchored sheet and the current plan, not stored.@@ -578,7 +703,7 @@ type IssueCommentPayload_StatementAnchor struct {func (x *IssueCommentPayload_StatementAnchor) Reset() {*x = IssueCommentPayload_StatementAnchor{}- mi := &file_store_issue_comment_proto_msgTypes[6]+ mi := &file_store_issue_comment_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -590,7 +715,7 @@ func (x *IssueCommentPayload_StatementAnchor) String() string {func (*IssueCommentPayload_StatementAnchor) ProtoMessage() {}func (x *IssueCommentPayload_StatementAnchor) ProtoReflect() protoreflect.Message {- mi := &file_store_issue_comment_proto_msgTypes[6]+ mi := &file_store_issue_comment_proto_msgTypes[7]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -603,7 +728,7 @@ func (x *IssueCommentPayload_StatementAnchor) ProtoReflect() protoreflect.Messag// Deprecated: Use IssueCommentPayload_StatementAnchor.ProtoReflect.Descriptor instead.func (*IssueCommentPayload_StatementAnchor) Descriptor() ([]byte, []int) {- return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 5}+ return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 6}}func (x *IssueCommentPayload_StatementAnchor) GetSpecId() string {@@ -638,14 +763,15 @@ var File_store_issue_comment_proto protoreflect.FileDescriptorconst file_store_issue_comment_proto_rawDesc = "" +"\n" +- "\x19store/issue_comment.proto\x12\x0ebytebase.store\x1a\x14store/approval.proto\x1a\x12store/common.proto\x1a\x11store/issue.proto\x1a\x10store/plan.proto\x1a\x17store/review_rule.proto\x1a\x16store/review_run.proto\"\xcc\x0e\n" ++ "\x19store/issue_comment.proto\x12\x0ebytebase.store\x1a\x14store/approval.proto\x1a\x12store/common.proto\x1a\x11store/issue.proto\x1a\x10store/plan.proto\x1a\x17store/review_rule.proto\x1a\x16store/review_run.proto\"\xd1\x11\n" +"\x13IssueCommentPayload\x12\x18\n" +"\acomment\x18\x01 \x01(\tR\acomment\x12J\n" +"\bapproval\x18\x02 \x01(\v2,.bytebase.store.IssueCommentPayload.ApprovalH\x00R\bapproval\x12T\n" +"\fissue_update\x18\x03 \x01(\v2/.bytebase.store.IssueCommentPayload.IssueUpdateH\x00R\vissueUpdate\x12Q\n" +"\vplan_update\x18\a \x01(\v2..bytebase.store.IssueCommentPayload.PlanUpdateH\x00R\n" +"planUpdate\x12c\n" +- "\x11review_submission\x18\b \x01(\v24.bytebase.store.IssueCommentPayload.ReviewSubmissionH\x00R\x10reviewSubmission\x12^\n" ++ "\x11review_submission\x18\b \x01(\v24.bytebase.store.IssueCommentPayload.ReviewSubmissionH\x00R\x10reviewSubmission\x12m\n" ++ "\x15review_run_completion\x18\v \x01(\v27.bytebase.store.IssueCommentPayload.ReviewRunCompletionH\x00R\x13reviewRunCompletion\x12^\n" +"\x10statement_anchor\x18\t \x01(\v23.bytebase.store.IssueCommentPayload.StatementAnchorR\x0fstatementAnchor\x12[\n" +"\x0freview_metadata\x18\n" +" \x01(\v22.bytebase.store.IssueCommentPayload.ReviewMetadataR\x0ereviewMetadata\x1aX\n" +@@ -670,12 +796,19 @@ const file_store_issue_comment_proto_rawDesc = "" +"\f_from_statusB\f\n" +"\n" +"_to_status\x1a\x12\n" +- "\x10ReviewSubmission\x1a\x88\x01\n" ++ "\x10ReviewSubmission\x1a\xd7\x01\n" ++ "\x13ReviewRunCompletion\x129\n" ++ "\brun_type\x18\x01 \x01(\x0e2\x1e.bytebase.store.ReviewRun.TypeR\arunType\x12\x18\n" ++ "\aattempt\x18\x02 \x01(\x03R\aattempt\x12!\n" ++ "\fposted_count\x18\x03 \x01(\x05R\vpostedCount\x12\x1d\n" ++ "\n" ++ "kept_count\x18\x04 \x01(\x05R\tkeptCount\x12)\n" ++ "\x10superseded_count\x18\x05 \x01(\x05R\x0fsupersededCount\x1a\x88\x01\n" +"\n" +"PlanUpdate\x12>\n" +"\n" +"from_specs\x18\x01 \x03(\v2\x1f.bytebase.store.PlanConfig.SpecR\tfromSpecs\x12:\n" +- "\bto_specs\x18\x02 \x03(\v2\x1f.bytebase.store.PlanConfig.SpecR\atoSpecs\x1a\xd9\x02\n" ++ "\bto_specs\x18\x02 \x03(\v2\x1f.bytebase.store.PlanConfig.SpecR\atoSpecs\x1a\x95\x03\n" +"\x0eReviewMetadata\x129\n" +"\brun_type\x18\x01 \x01(\x0e2\x1e.bytebase.store.ReviewRun.TypeR\arunType\x12;\n" +"\trule_type\x18\x02 \x01(\x0e2\x1e.bytebase.store.ReviewRuleTypeR\bruleType\x12W\n" +@@ -683,7 +816,9 @@ const file_store_issue_comment_proto_rawDesc = "" +"\atargets\x18\x04 \x03(\tR\atargets\x12\x1e\n" +"\n" +"superseded\x18\x05 \x01(\bR\n" +- "superseded\"<\n" ++ "superseded\x12 \n" ++ "\vfingerprint\x18\x06 \x01(\tR\vfingerprint\x12\x18\n" ++ "\aattempt\x18\a \x01(\x03R\aattempt\"<\n" +"\bPriority\x12\x18\n" +"\x14PRIORITY_UNSPECIFIED\x10\x00\x12\x06\n" +"\x02P0\x10\x01\x12\x06\n" +@@ -710,45 +845,48 @@ func file_store_issue_comment_proto_rawDescGZIP() []byte {}var file_store_issue_comment_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_store_issue_comment_proto_msgTypes = make([]protoimpl.MessageInfo, 7)+var file_store_issue_comment_proto_msgTypes = make([]protoimpl.MessageInfo, 8)var file_store_issue_comment_proto_goTypes = []any{(IssueCommentPayload_ReviewMetadata_Priority)(0), // 0: bytebase.store.IssueCommentPayload.ReviewMetadata.Priority(*IssueCommentPayload)(nil), // 1: bytebase.store.IssueCommentPayload(*IssueCommentPayload_Approval)(nil), // 2: bytebase.store.IssueCommentPayload.Approval(*IssueCommentPayload_IssueUpdate)(nil), // 3: bytebase.store.IssueCommentPayload.IssueUpdate(*IssueCommentPayload_ReviewSubmission)(nil), // 4: bytebase.store.IssueCommentPayload.ReviewSubmission- (*IssueCommentPayload_PlanUpdate)(nil), // 5: bytebase.store.IssueCommentPayload.PlanUpdate- (*IssueCommentPayload_ReviewMetadata)(nil), // 6: bytebase.store.IssueCommentPayload.ReviewMetadata- (*IssueCommentPayload_StatementAnchor)(nil), // 7: bytebase.store.IssueCommentPayload.StatementAnchor- (IssuePayloadApproval_Approver_Status)(0), // 8: bytebase.store.IssuePayloadApproval.Approver.Status- (Issue_Status)(0), // 9: bytebase.store.Issue.Status- (*PlanConfig_Spec)(nil), // 10: bytebase.store.PlanConfig.Spec+ (*IssueCommentPayload_ReviewRunCompletion)(nil), // 5: bytebase.store.IssueCommentPayload.ReviewRunCompletion+ (*IssueCommentPayload_PlanUpdate)(nil), // 6: bytebase.store.IssueCommentPayload.PlanUpdate+ (*IssueCommentPayload_ReviewMetadata)(nil), // 7: bytebase.store.IssueCommentPayload.ReviewMetadata+ (*IssueCommentPayload_StatementAnchor)(nil), // 8: bytebase.store.IssueCommentPayload.StatementAnchor+ (IssuePayloadApproval_Approver_Status)(0), // 9: bytebase.store.IssuePayloadApproval.Approver.Status+ (Issue_Status)(0), // 10: bytebase.store.Issue.Status(ReviewRun_Type)(0), // 11: bytebase.store.ReviewRun.Type- (ReviewRuleType)(0), // 12: bytebase.store.ReviewRuleType- (*Position)(nil), // 13: bytebase.store.Position+ (*PlanConfig_Spec)(nil), // 12: bytebase.store.PlanConfig.Spec+ (ReviewRuleType)(0), // 13: bytebase.store.ReviewRuleType+ (*Position)(nil), // 14: bytebase.store.Position}var file_store_issue_comment_proto_depIdxs = []int32{2, // 0: bytebase.store.IssueCommentPayload.approval:type_name -> bytebase.store.IssueCommentPayload.Approval3, // 1: bytebase.store.IssueCommentPayload.issue_update:type_name -> bytebase.store.IssueCommentPayload.IssueUpdate- 5, // 2: bytebase.store.IssueCommentPayload.plan_update:type_name -> bytebase.store.IssueCommentPayload.PlanUpdate+ 6, // 2: bytebase.store.IssueCommentPayload.plan_update:type_name -> bytebase.store.IssueCommentPayload.PlanUpdate4, // 3: bytebase.store.IssueCommentPayload.review_submission:type_name -> bytebase.store.IssueCommentPayload.ReviewSubmission- 7, // 4: bytebase.store.IssueCommentPayload.statement_anchor:type_name -> bytebase.store.IssueCommentPayload.StatementAnchor- 6, // 5: bytebase.store.IssueCommentPayload.review_metadata:type_name -> bytebase.store.IssueCommentPayload.ReviewMetadata- 8, // 6: bytebase.store.IssueCommentPayload.Approval.status:type_name -> bytebase.store.IssuePayloadApproval.Approver.Status- 9, // 7: bytebase.store.IssueCommentPayload.IssueUpdate.from_status:type_name -> bytebase.store.Issue.Status- 9, // 8: bytebase.store.IssueCommentPayload.IssueUpdate.to_status:type_name -> bytebase.store.Issue.Status- 10, // 9: bytebase.store.IssueCommentPayload.PlanUpdate.from_specs:type_name -> bytebase.store.PlanConfig.Spec- 10, // 10: bytebase.store.IssueCommentPayload.PlanUpdate.to_specs:type_name -> bytebase.store.PlanConfig.Spec- 11, // 11: bytebase.store.IssueCommentPayload.ReviewMetadata.run_type:type_name -> bytebase.store.ReviewRun.Type- 12, // 12: bytebase.store.IssueCommentPayload.ReviewMetadata.rule_type:type_name -> bytebase.store.ReviewRuleType- 0, // 13: bytebase.store.IssueCommentPayload.ReviewMetadata.priority:type_name -> bytebase.store.IssueCommentPayload.ReviewMetadata.Priority- 13, // 14: bytebase.store.IssueCommentPayload.StatementAnchor.start_position:type_name -> bytebase.store.Position- 13, // 15: bytebase.store.IssueCommentPayload.StatementAnchor.end_position:type_name -> bytebase.store.Position- 16, // [16:16] is the sub-list for method output_type- 16, // [16:16] is the sub-list for method input_type- 16, // [16:16] is the sub-list for extension type_name- 16, // [16:16] is the sub-list for extension extendee- 0, // [0:16] is the sub-list for field type_name+ 5, // 4: bytebase.store.IssueCommentPayload.review_run_completion:type_name -> bytebase.store.IssueCommentPayload.ReviewRunCompletion+ 8, // 5: bytebase.store.IssueCommentPayload.statement_anchor:type_name -> bytebase.store.IssueCommentPayload.StatementAnchor+ 7, // 6: bytebase.store.IssueCommentPayload.review_metadata:type_name -> bytebase.store.IssueCommentPayload.ReviewMetadata+ 9, // 7: bytebase.store.IssueCommentPayload.Approval.status:type_name -> bytebase.store.IssuePayloadApproval.Approver.Status+ 10, // 8: bytebase.store.IssueCommentPayload.IssueUpdate.from_status:type_name -> bytebase.store.Issue.Status+ 10, // 9: bytebase.store.IssueCommentPayload.IssueUpdate.to_status:type_name -> bytebase.store.Issue.Status+ 11, // 10: bytebase.store.IssueCommentPayload.ReviewRunCompletion.run_type:type_name -> bytebase.store.ReviewRun.Type+ 12, // 11: bytebase.store.IssueCommentPayload.PlanUpdate.from_specs:type_name -> bytebase.store.PlanConfig.Spec+ 12, // 12: bytebase.store.IssueCommentPayload.PlanUpdate.to_specs:type_name -> bytebase.store.PlanConfig.Spec+ 11, // 13: bytebase.store.IssueCommentPayload.ReviewMetadata.run_type:type_name -> bytebase.store.ReviewRun.Type+ 13, // 14: bytebase.store.IssueCommentPayload.ReviewMetadata.rule_type:type_name -> bytebase.store.ReviewRuleType+ 0, // 15: bytebase.store.IssueCommentPayload.ReviewMetadata.priority:type_name -> bytebase.store.IssueCommentPayload.ReviewMetadata.Priority+ 14, // 16: bytebase.store.IssueCommentPayload.StatementAnchor.start_position:type_name -> bytebase.store.Position+ 14, // 17: bytebase.store.IssueCommentPayload.StatementAnchor.end_position:type_name -> bytebase.store.Position+ 18, // [18:18] is the sub-list for method output_type+ 18, // [18:18] is the sub-list for method input_type+ 18, // [18:18] is the sub-list for extension type_name+ 18, // [18:18] is the sub-list for extension extendee+ 0, // [0:18] is the sub-list for field type_name}func init() { file_store_issue_comment_proto_init() }@@ -767,6 +905,7 @@ func file_store_issue_comment_proto_init() {(*IssueCommentPayload_IssueUpdate_)(nil),(*IssueCommentPayload_PlanUpdate_)(nil),(*IssueCommentPayload_ReviewSubmission_)(nil),+ (*IssueCommentPayload_ReviewRunCompletion_)(nil),}file_store_issue_comment_proto_msgTypes[2].OneofWrappers = []any{}type x struct{}@@ -775,7 +914,7 @@ func file_store_issue_comment_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_issue_comment_proto_rawDesc), len(file_store_issue_comment_proto_rawDesc)),NumEnums: 1,- NumMessages: 7,+ NumMessages: 8,NumExtensions: 0,NumServices: 0,},diff --git a/backend/generated-go/store/issue_comment_equal.pb.go b/backend/generated-go/store/issue_comment_equal.pb.goindex 35ccb438c1..e583217e22 100644--- a/backend/generated-go/store/issue_comment_equal.pb.go+++ b/backend/generated-go/store/issue_comment_equal.pb.go@@ -70,6 +70,31 @@ func (x *IssueCommentPayload_ReviewSubmission) Equal(y *IssueCommentPayload_Revireturn true}+func (x *IssueCommentPayload_ReviewRunCompletion) Equal(y *IssueCommentPayload_ReviewRunCompletion) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.RunType != y.RunType {+ return false+ }+ if x.Attempt != y.Attempt {+ return false+ }+ if x.PostedCount != y.PostedCount {+ return false+ }+ if x.KeptCount != y.KeptCount {+ return false+ }+ if x.SupersededCount != y.SupersededCount {+ return false+ }+ return true+}+func (x *IssueCommentPayload_PlanUpdate) Equal(y *IssueCommentPayload_PlanUpdate) bool {if x == y {return true@@ -123,6 +148,12 @@ func (x *IssueCommentPayload_ReviewMetadata) Equal(y *IssueCommentPayload_Reviewif x.Superseded != y.Superseded {return false}+ if x.Fingerprint != y.Fingerprint {+ return false+ }+ if x.Attempt != y.Attempt {+ return false+ }return true}@@ -170,6 +201,9 @@ func (x *IssueCommentPayload) Equal(y *IssueCommentPayload) bool {if !x.GetReviewSubmission().Equal(y.GetReviewSubmission()) {return false}+ if !x.GetReviewRunCompletion().Equal(y.GetReviewRunCompletion()) {+ return false+ }if !x.StatementAnchor.Equal(y.StatementAnchor) {return false}diff --git a/backend/generated-go/v1/issue_service.pb.go b/backend/generated-go/v1/issue_service.pb.goindex 6186e35d2f..39966d21ea 100644--- a/backend/generated-go/v1/issue_service.pb.go+++ b/backend/generated-go/v1/issue_service.pb.go@@ -1925,8 +1925,10 @@ type IssueComment struct {// Adding a reply does not reopen a resolved thread.ThreadState *IssueComment_ThreadState `protobuf:"varint,15,opt,name=thread_state,json=threadState,proto3,enum=bytebase.v1.IssueComment_ThreadState,oneof" json:"thread_state,omitempty"`// Optional source context on a root or reply. A reply's anchor must share- // the root's spec and sheet_sha256; it may narrow the range.- // Cannot be set on events. Immutable after creation.+ // the root's spec and sheet_sha256 when created; it may narrow the range.+ // Cannot be set on events. Immutable after creation, except that a later+ // review run reporting a review result again moves the result to its+ // statement in the SQL that run reviewed.StatementAnchor *StatementAnchor `protobuf:"bytes,16,opt,name=statement_anchor,json=statementAnchor,proto3" json:"statement_anchor,omitempty"`// Present on review results, the comments the review executor posts.// Never accepted on create or update.@@ -1939,6 +1941,7 @@ type IssueComment struct {// *IssueComment_IssueUpdate_// *IssueComment_PlanUpdate_// *IssueComment_ReviewSubmission_+ // *IssueComment_ReviewRunCompletion_Event isIssueComment_Event `protobuf_oneof:"event"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -2087,6 +2090,15 @@ func (x *IssueComment) GetReviewSubmission() *IssueComment_ReviewSubmission {return nil}+func (x *IssueComment) GetReviewRunCompletion() *IssueComment_ReviewRunCompletion {+ if x != nil {+ if x, ok := x.Event.(*IssueComment_ReviewRunCompletion_); ok {+ return x.ReviewRunCompletion+ }+ }+ return nil+}+type isIssueComment_Event interface {isIssueComment_Event()}@@ -2111,6 +2123,11 @@ type IssueComment_ReviewSubmission_ struct {ReviewSubmission *IssueComment_ReviewSubmission `protobuf:"bytes,13,opt,name=review_submission,json=reviewSubmission,proto3,oneof"`}+type IssueComment_ReviewRunCompletion_ struct {+ // Review run completion event.+ ReviewRunCompletion *IssueComment_ReviewRunCompletion `protobuf:"bytes,18,opt,name=review_run_completion,json=reviewRunCompletion,proto3,oneof"`+}+func (*IssueComment_Approval_) isIssueComment_Event() {}func (*IssueComment_IssueUpdate_) isIssueComment_Event() {}@@ -2119,6 +2136,8 @@ func (*IssueComment_PlanUpdate_) isIssueComment_Event() {}func (*IssueComment_ReviewSubmission_) isIssueComment_Event() {}+func (*IssueComment_ReviewRunCompletion_) isIssueComment_Event() {}+// The saved statement revision and range referenced by a comment.// Source currency is derived by comparing the spec and hash with the current plan.// Historical SQL is available through SheetService.GetSheet with this hash.@@ -2457,9 +2476,12 @@ type IssueComment_ReviewMetadata struct {// Every database the result applies to, sorted.// Format: instances/{instance}/databases/{database}Targets []string `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"`- // A later run of the same reviewer has completed, so the result is not- // from the latest review, whatever its thread state.- Superseded bool `protobuf:"varint,5,opt,name=superseded,proto3" json:"superseded,omitempty"`+ // A later run of the same reviewer has completed without reporting the+ // result again, whatever its thread state.+ Superseded bool `protobuf:"varint,5,opt,name=superseded,proto3" json:"superseded,omitempty"`+ // The ReviewRunCompletion.attempt of the run that posted the result. A+ // result a later run reports again keeps its thread and its attempt.+ Attempt int64 `protobuf:"varint,6,opt,name=attempt,proto3" json:"attempt,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -2529,6 +2551,13 @@ func (x *IssueComment_ReviewMetadata) GetSuperseded() bool {return false}+func (x *IssueComment_ReviewMetadata) GetAttempt() int64 {+ if x != nil {+ return x.Attempt+ }+ return 0+}+// Approval event information.type IssueComment_Approval struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -2713,6 +2742,90 @@ func (*IssueComment_ReviewSubmission) Descriptor() ([]byte, []int) {return file_v1_issue_service_proto_rawDescGZIP(), []int{21, 3}}+// A review run completed, and what it did to the results of its reviewer.+// Posted by the reviewer, with no creator.+type IssueComment_ReviewRunCompletion struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The reviewer that ran.+ RunType ReviewRun_Type `protobuf:"varint,1,opt,name=run_type,json=runType,proto3,enum=bytebase.v1.ReviewRun_Type" json:"run_type,omitempty"`+ // Identifies the run among its reviewer's runs on the issue. The results+ // it posted carry the same ReviewMetadata.attempt.+ Attempt int64 `protobuf:"varint,2,opt,name=attempt,proto3" json:"attempt,omitempty"`+ // Results the run posted as new threads.+ PostedCount int32 `protobuf:"varint,3,opt,name=posted_count,json=postedCount,proto3" json:"posted_count,omitempty"`+ // Earlier results the run reported again, which kept their threads.+ KeptCount int32 `protobuf:"varint,4,opt,name=kept_count,json=keptCount,proto3" json:"kept_count,omitempty"`+ // Earlier results the run no longer reports, now superseded.+ SupersededCount int32 `protobuf:"varint,5,opt,name=superseded_count,json=supersededCount,proto3" json:"superseded_count,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *IssueComment_ReviewRunCompletion) Reset() {+ *x = IssueComment_ReviewRunCompletion{}+ mi := &file_v1_issue_service_proto_msgTypes[31]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *IssueComment_ReviewRunCompletion) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*IssueComment_ReviewRunCompletion) ProtoMessage() {}++func (x *IssueComment_ReviewRunCompletion) ProtoReflect() protoreflect.Message {+ mi := &file_v1_issue_service_proto_msgTypes[31]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use IssueComment_ReviewRunCompletion.ProtoReflect.Descriptor instead.+func (*IssueComment_ReviewRunCompletion) Descriptor() ([]byte, []int) {+ return file_v1_issue_service_proto_rawDescGZIP(), []int{21, 4}+}++func (x *IssueComment_ReviewRunCompletion) GetRunType() ReviewRun_Type {+ if x != nil {+ return x.RunType+ }+ return ReviewRun_TYPE_UNSPECIFIED+}++func (x *IssueComment_ReviewRunCompletion) GetAttempt() int64 {+ if x != nil {+ return x.Attempt+ }+ return 0+}++func (x *IssueComment_ReviewRunCompletion) GetPostedCount() int32 {+ if x != nil {+ return x.PostedCount+ }+ return 0+}++func (x *IssueComment_ReviewRunCompletion) GetKeptCount() int32 {+ if x != nil {+ return x.KeptCount+ }+ return 0+}++func (x *IssueComment_ReviewRunCompletion) GetSupersededCount() int32 {+ if x != nil {+ return x.SupersededCount+ }+ return 0+}+// Plan update event information (snapshot of plan.config.specs before// and after a PlanService.UpdatePlan call that mutated specs).type IssueComment_PlanUpdate struct {@@ -2725,7 +2838,7 @@ type IssueComment_PlanUpdate struct {func (x *IssueComment_PlanUpdate) Reset() {*x = IssueComment_PlanUpdate{}- mi := &file_v1_issue_service_proto_msgTypes[31]+ mi := &file_v1_issue_service_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2737,7 +2850,7 @@ func (x *IssueComment_PlanUpdate) String() string {func (*IssueComment_PlanUpdate) ProtoMessage() {}func (x *IssueComment_PlanUpdate) ProtoReflect() protoreflect.Message {- mi := &file_v1_issue_service_proto_msgTypes[31]+ mi := &file_v1_issue_service_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2750,7 +2863,7 @@ func (x *IssueComment_PlanUpdate) ProtoReflect() protoreflect.Message {// Deprecated: Use IssueComment_PlanUpdate.ProtoReflect.Descriptor instead.func (*IssueComment_PlanUpdate) Descriptor() ([]byte, []int) {- return file_v1_issue_service_proto_rawDescGZIP(), []int{21, 4}+ return file_v1_issue_service_proto_rawDescGZIP(), []int{21, 5}}func (x *IssueComment_PlanUpdate) GetFromSpecs() []*Plan_Spec {@@ -2903,7 +3016,7 @@ const file_v1_issue_service_proto_rawDesc = "" +"\rissue_comment\x18\x02 \x01(\v2\x19.bytebase.v1.IssueCommentR\fissueComment\x12@\n" +"\vupdate_mask\x18\x03 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +"updateMask\x12#\n" +- "\rallow_missing\x18\x04 \x01(\bR\fallowMissing\"\xf6\x0f\n" ++ "\rallow_missing\x18\x04 \x01(\bR\fallowMissing\"\xcc\x12\n" +"\fIssueComment\x12\x12\n" +"\x04name\x18\x01 \x01(\tR\x04name\x12#\n" +"\acomment\x18\x02 \x01(\tB\t\xbaH\x06r\x04\x18\x80\x80\x04R\acomment\x12\x18\n" +@@ -2921,7 +3034,8 @@ const file_v1_issue_service_proto_rawDesc = "" +"\fissue_update\x18\b \x01(\v2%.bytebase.v1.IssueComment.IssueUpdateH\x00R\vissueUpdate\x12G\n" +"\vplan_update\x18\f \x01(\v2$.bytebase.v1.IssueComment.PlanUpdateH\x00R\n" +"planUpdate\x12Y\n" +- "\x11review_submission\x18\r \x01(\v2*.bytebase.v1.IssueComment.ReviewSubmissionH\x00R\x10reviewSubmission\x1a\xc9\x02\n" ++ "\x11review_submission\x18\r \x01(\v2*.bytebase.v1.IssueComment.ReviewSubmissionH\x00R\x10reviewSubmission\x12c\n" ++ "\x15review_run_completion\x18\x12 \x01(\v2-.bytebase.v1.IssueComment.ReviewRunCompletionH\x00R\x13reviewRunCompletion\x1a\xe3\x02\n" +"\x0eReviewMetadata\x126\n" +"\brun_type\x18\x01 \x01(\x0e2\x1b.bytebase.v1.ReviewRun.TypeR\arunType\x128\n" +"\trule_type\x18\x02 \x01(\x0e2\x1b.bytebase.v1.ReviewRuleTypeR\bruleType\x12M\n" +@@ -2929,7 +3043,8 @@ const file_v1_issue_service_proto_rawDesc = "" +"\atargets\x18\x04 \x03(\tR\atargets\x12\x1e\n" +"\n" +"superseded\x18\x05 \x01(\bR\n" +- "superseded\"<\n" ++ "superseded\x12\x18\n" ++ "\aattempt\x18\x06 \x01(\x03R\aattempt\"<\n" +"\bPriority\x12\x18\n" +"\x14PRIORITY_UNSPECIFIED\x10\x00\x12\x06\n" +"\x02P0\x10\x01\x12\x06\n" +@@ -2961,7 +3076,14 @@ const file_v1_issue_service_proto_rawDesc = "" +"\f_from_statusB\f\n" +"\n" +"_to_status\x1a\x12\n" +- "\x10ReviewSubmission\x1av\n" ++ "\x10ReviewSubmission\x1a\xd4\x01\n" ++ "\x13ReviewRunCompletion\x126\n" ++ "\brun_type\x18\x01 \x01(\x0e2\x1b.bytebase.v1.ReviewRun.TypeR\arunType\x12\x18\n" ++ "\aattempt\x18\x02 \x01(\x03R\aattempt\x12!\n" ++ "\fposted_count\x18\x03 \x01(\x05R\vpostedCount\x12\x1d\n" ++ "\n" ++ "kept_count\x18\x04 \x01(\x05R\tkeptCount\x12)\n" ++ "\x10superseded_count\x18\x05 \x01(\x05R\x0fsupersededCount\x1av\n" +"\n" +"PlanUpdate\x125\n" +"\n" +@@ -3038,7 +3160,7 @@ func file_v1_issue_service_proto_rawDescGZIP() []byte {}var file_v1_issue_service_proto_enumTypes = make([]protoimpl.EnumInfo, 7)-var file_v1_issue_service_proto_msgTypes = make([]protoimpl.MessageInfo, 32)+var file_v1_issue_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33)var file_v1_issue_service_proto_goTypes = []any{(Issue_Type)(0), // 0: bytebase.v1.Issue.Type(Issue_Approver_Status)(0), // 1: bytebase.v1.Issue.Approver.Status@@ -3078,100 +3200,103 @@ var file_v1_issue_service_proto_goTypes = []any{(*IssueComment_Approval)(nil), // 35: bytebase.v1.IssueComment.Approval(*IssueComment_IssueUpdate)(nil), // 36: bytebase.v1.IssueComment.IssueUpdate(*IssueComment_ReviewSubmission)(nil), // 37: bytebase.v1.IssueComment.ReviewSubmission- (*IssueComment_PlanUpdate)(nil), // 38: bytebase.v1.IssueComment.PlanUpdate- (*fieldmaskpb.FieldMask)(nil), // 39: google.protobuf.FieldMask- (IssueStatus)(0), // 40: bytebase.v1.IssueStatus- (*timestamppb.Timestamp)(nil), // 41: google.protobuf.Timestamp- (RiskLevel)(0), // 42: bytebase.v1.RiskLevel- (ApprovalStatus)(0), // 43: bytebase.v1.ApprovalStatus- (*expr.Expr)(nil), // 44: google.type.Expr- (*durationpb.Duration)(nil), // 45: google.protobuf.Duration- (*Position)(nil), // 46: bytebase.v1.Position- (ReviewRuleType)(0), // 47: bytebase.v1.ReviewRuleType- (*Plan_Spec)(nil), // 48: bytebase.v1.Plan.Spec+ (*IssueComment_ReviewRunCompletion)(nil), // 38: bytebase.v1.IssueComment.ReviewRunCompletion+ (*IssueComment_PlanUpdate)(nil), // 39: bytebase.v1.IssueComment.PlanUpdate+ (*fieldmaskpb.FieldMask)(nil), // 40: google.protobuf.FieldMask+ (IssueStatus)(0), // 41: bytebase.v1.IssueStatus+ (*timestamppb.Timestamp)(nil), // 42: google.protobuf.Timestamp+ (RiskLevel)(0), // 43: bytebase.v1.RiskLevel+ (ApprovalStatus)(0), // 44: bytebase.v1.ApprovalStatus+ (*expr.Expr)(nil), // 45: google.type.Expr+ (*durationpb.Duration)(nil), // 46: google.protobuf.Duration+ (*Position)(nil), // 47: bytebase.v1.Position+ (ReviewRuleType)(0), // 48: bytebase.v1.ReviewRuleType+ (*Plan_Spec)(nil), // 49: bytebase.v1.Plan.Spec}var file_v1_issue_service_proto_depIdxs = []int32{20, // 0: bytebase.v1.CreateIssueRequest.issue:type_name -> bytebase.v1.Issue20, // 1: bytebase.v1.ListIssuesResponse.issues:type_name -> bytebase.v1.Issue20, // 2: bytebase.v1.SearchIssuesResponse.issues:type_name -> bytebase.v1.Issue20, // 3: bytebase.v1.UpdateIssueRequest.issue:type_name -> bytebase.v1.Issue- 39, // 4: bytebase.v1.UpdateIssueRequest.update_mask:type_name -> google.protobuf.FieldMask- 40, // 5: bytebase.v1.BatchUpdateIssuesStatusRequest.status:type_name -> bytebase.v1.IssueStatus+ 40, // 4: bytebase.v1.UpdateIssueRequest.update_mask:type_name -> google.protobuf.FieldMask+ 41, // 5: bytebase.v1.BatchUpdateIssuesStatusRequest.status:type_name -> bytebase.v1.IssueStatus0, // 6: bytebase.v1.Issue.type:type_name -> bytebase.v1.Issue.Type- 40, // 7: bytebase.v1.Issue.status:type_name -> bytebase.v1.IssueStatus+ 41, // 7: bytebase.v1.Issue.status:type_name -> bytebase.v1.IssueStatus33, // 8: bytebase.v1.Issue.approvers:type_name -> bytebase.v1.Issue.Approver22, // 9: bytebase.v1.Issue.approval_template:type_name -> bytebase.v1.ApprovalTemplate- 41, // 10: bytebase.v1.Issue.create_time:type_name -> google.protobuf.Timestamp- 41, // 11: bytebase.v1.Issue.update_time:type_name -> google.protobuf.Timestamp+ 42, // 10: bytebase.v1.Issue.create_time:type_name -> google.protobuf.Timestamp+ 42, // 11: bytebase.v1.Issue.update_time:type_name -> google.protobuf.Timestamp21, // 12: bytebase.v1.Issue.role_grant:type_name -> bytebase.v1.RoleGrant- 42, // 13: bytebase.v1.Issue.risk_level:type_name -> bytebase.v1.RiskLevel- 43, // 14: bytebase.v1.Issue.approval_status:type_name -> bytebase.v1.ApprovalStatus- 44, // 15: bytebase.v1.RoleGrant.condition:type_name -> google.type.Expr- 45, // 16: bytebase.v1.RoleGrant.expiration:type_name -> google.protobuf.Duration+ 43, // 13: bytebase.v1.Issue.risk_level:type_name -> bytebase.v1.RiskLevel+ 44, // 14: bytebase.v1.Issue.approval_status:type_name -> bytebase.v1.ApprovalStatus+ 45, // 15: bytebase.v1.RoleGrant.condition:type_name -> google.type.Expr+ 46, // 16: bytebase.v1.RoleGrant.expiration:type_name -> google.protobuf.Duration23, // 17: bytebase.v1.ApprovalTemplate.flow:type_name -> bytebase.v1.ApprovalFlow28, // 18: bytebase.v1.ListIssueCommentsResponse.issue_comments:type_name -> bytebase.v1.IssueComment28, // 19: bytebase.v1.CreateIssueCommentRequest.issue_comment:type_name -> bytebase.v1.IssueComment28, // 20: bytebase.v1.UpdateIssueCommentRequest.issue_comment:type_name -> bytebase.v1.IssueComment- 39, // 21: bytebase.v1.UpdateIssueCommentRequest.update_mask:type_name -> google.protobuf.FieldMask- 41, // 22: bytebase.v1.IssueComment.create_time:type_name -> google.protobuf.Timestamp- 41, // 23: bytebase.v1.IssueComment.update_time:type_name -> google.protobuf.Timestamp+ 40, // 21: bytebase.v1.UpdateIssueCommentRequest.update_mask:type_name -> google.protobuf.FieldMask+ 42, // 22: bytebase.v1.IssueComment.create_time:type_name -> google.protobuf.Timestamp+ 42, // 23: bytebase.v1.IssueComment.update_time:type_name -> google.protobuf.Timestamp2, // 24: bytebase.v1.IssueComment.thread_state:type_name -> bytebase.v1.IssueComment.ThreadState29, // 25: bytebase.v1.IssueComment.statement_anchor:type_name -> bytebase.v1.StatementAnchor34, // 26: bytebase.v1.IssueComment.review_metadata:type_name -> bytebase.v1.IssueComment.ReviewMetadata35, // 27: bytebase.v1.IssueComment.approval:type_name -> bytebase.v1.IssueComment.Approval36, // 28: bytebase.v1.IssueComment.issue_update:type_name -> bytebase.v1.IssueComment.IssueUpdate- 38, // 29: bytebase.v1.IssueComment.plan_update:type_name -> bytebase.v1.IssueComment.PlanUpdate+ 39, // 29: bytebase.v1.IssueComment.plan_update:type_name -> bytebase.v1.IssueComment.PlanUpdate37, // 30: bytebase.v1.IssueComment.review_submission:type_name -> bytebase.v1.IssueComment.ReviewSubmission- 46, // 31: bytebase.v1.StatementAnchor.start_position:type_name -> bytebase.v1.Position- 46, // 32: bytebase.v1.StatementAnchor.end_position:type_name -> bytebase.v1.Position- 5, // 33: bytebase.v1.ReviewRun.type:type_name -> bytebase.v1.ReviewRun.Type- 6, // 34: bytebase.v1.ReviewRun.status:type_name -> bytebase.v1.ReviewRun.Status- 41, // 35: bytebase.v1.ReviewRun.create_time:type_name -> google.protobuf.Timestamp- 41, // 36: bytebase.v1.ReviewRun.end_time:type_name -> google.protobuf.Timestamp- 1, // 37: bytebase.v1.Issue.Approver.status:type_name -> bytebase.v1.Issue.Approver.Status- 5, // 38: bytebase.v1.IssueComment.ReviewMetadata.run_type:type_name -> bytebase.v1.ReviewRun.Type- 47, // 39: bytebase.v1.IssueComment.ReviewMetadata.rule_type:type_name -> bytebase.v1.ReviewRuleType- 3, // 40: bytebase.v1.IssueComment.ReviewMetadata.priority:type_name -> bytebase.v1.IssueComment.ReviewMetadata.Priority- 4, // 41: bytebase.v1.IssueComment.Approval.status:type_name -> bytebase.v1.IssueComment.Approval.Status- 40, // 42: bytebase.v1.IssueComment.IssueUpdate.from_status:type_name -> bytebase.v1.IssueStatus- 40, // 43: bytebase.v1.IssueComment.IssueUpdate.to_status:type_name -> bytebase.v1.IssueStatus- 48, // 44: bytebase.v1.IssueComment.PlanUpdate.from_specs:type_name -> bytebase.v1.Plan.Spec- 48, // 45: bytebase.v1.IssueComment.PlanUpdate.to_specs:type_name -> bytebase.v1.Plan.Spec- 7, // 46: bytebase.v1.IssueService.GetIssue:input_type -> bytebase.v1.GetIssueRequest- 8, // 47: bytebase.v1.IssueService.CreateIssue:input_type -> bytebase.v1.CreateIssueRequest- 9, // 48: bytebase.v1.IssueService.ListIssues:input_type -> bytebase.v1.ListIssuesRequest- 11, // 49: bytebase.v1.IssueService.SearchIssues:input_type -> bytebase.v1.SearchIssuesRequest- 13, // 50: bytebase.v1.IssueService.UpdateIssue:input_type -> bytebase.v1.UpdateIssueRequest- 24, // 51: bytebase.v1.IssueService.ListIssueComments:input_type -> bytebase.v1.ListIssueCommentsRequest- 26, // 52: bytebase.v1.IssueService.CreateIssueComment:input_type -> bytebase.v1.CreateIssueCommentRequest- 27, // 53: bytebase.v1.IssueService.UpdateIssueComment:input_type -> bytebase.v1.UpdateIssueCommentRequest- 14, // 54: bytebase.v1.IssueService.BatchUpdateIssuesStatus:input_type -> bytebase.v1.BatchUpdateIssuesStatusRequest- 16, // 55: bytebase.v1.IssueService.ApproveIssue:input_type -> bytebase.v1.ApproveIssueRequest- 17, // 56: bytebase.v1.IssueService.RejectIssue:input_type -> bytebase.v1.RejectIssueRequest- 18, // 57: bytebase.v1.IssueService.RequestIssue:input_type -> bytebase.v1.RequestIssueRequest- 19, // 58: bytebase.v1.IssueService.RetryIssueApproval:input_type -> bytebase.v1.RetryIssueApprovalRequest- 31, // 59: bytebase.v1.IssueService.GetReviewRun:input_type -> bytebase.v1.GetReviewRunRequest- 32, // 60: bytebase.v1.IssueService.RunReview:input_type -> bytebase.v1.RunReviewRequest- 20, // 61: bytebase.v1.IssueService.GetIssue:output_type -> bytebase.v1.Issue- 20, // 62: bytebase.v1.IssueService.CreateIssue:output_type -> bytebase.v1.Issue- 10, // 63: bytebase.v1.IssueService.ListIssues:output_type -> bytebase.v1.ListIssuesResponse- 12, // 64: bytebase.v1.IssueService.SearchIssues:output_type -> bytebase.v1.SearchIssuesResponse- 20, // 65: bytebase.v1.IssueService.UpdateIssue:output_type -> bytebase.v1.Issue- 25, // 66: bytebase.v1.IssueService.ListIssueComments:output_type -> bytebase.v1.ListIssueCommentsResponse- 28, // 67: bytebase.v1.IssueService.CreateIssueComment:output_type -> bytebase.v1.IssueComment- 28, // 68: bytebase.v1.IssueService.UpdateIssueComment:output_type -> bytebase.v1.IssueComment- 15, // 69: bytebase.v1.IssueService.BatchUpdateIssuesStatus:output_type -> bytebase.v1.BatchUpdateIssuesStatusResponse- 20, // 70: bytebase.v1.IssueService.ApproveIssue:output_type -> bytebase.v1.Issue- 20, // 71: bytebase.v1.IssueService.RejectIssue:output_type -> bytebase.v1.Issue- 20, // 72: bytebase.v1.IssueService.RequestIssue:output_type -> bytebase.v1.Issue- 20, // 73: bytebase.v1.IssueService.RetryIssueApproval:output_type -> bytebase.v1.Issue- 30, // 74: bytebase.v1.IssueService.GetReviewRun:output_type -> bytebase.v1.ReviewRun- 30, // 75: bytebase.v1.IssueService.RunReview:output_type -> bytebase.v1.ReviewRun- 61, // [61:76] is the sub-list for method output_type- 46, // [46:61] is the sub-list for method input_type- 46, // [46:46] is the sub-list for extension type_name- 46, // [46:46] is the sub-list for extension extendee- 0, // [0:46] is the sub-list for field type_name+ 38, // 31: bytebase.v1.IssueComment.review_run_completion:type_name -> bytebase.v1.IssueComment.ReviewRunCompletion+ 47, // 32: bytebase.v1.StatementAnchor.start_position:type_name -> bytebase.v1.Position+ 47, // 33: bytebase.v1.StatementAnchor.end_position:type_name -> bytebase.v1.Position+ 5, // 34: bytebase.v1.ReviewRun.type:type_name -> bytebase.v1.ReviewRun.Type+ 6, // 35: bytebase.v1.ReviewRun.status:type_name -> bytebase.v1.ReviewRun.Status+ 42, // 36: bytebase.v1.ReviewRun.create_time:type_name -> google.protobuf.Timestamp+ 42, // 37: bytebase.v1.ReviewRun.end_time:type_name -> google.protobuf.Timestamp+ 1, // 38: bytebase.v1.Issue.Approver.status:type_name -> bytebase.v1.Issue.Approver.Status+ 5, // 39: bytebase.v1.IssueComment.ReviewMetadata.run_type:type_name -> bytebase.v1.ReviewRun.Type+ 48, // 40: bytebase.v1.IssueComment.ReviewMetadata.rule_type:type_name -> bytebase.v1.ReviewRuleType+ 3, // 41: bytebase.v1.IssueComment.ReviewMetadata.priority:type_name -> bytebase.v1.IssueComment.ReviewMetadata.Priority+ 4, // 42: bytebase.v1.IssueComment.Approval.status:type_name -> bytebase.v1.IssueComment.Approval.Status+ 41, // 43: bytebase.v1.IssueComment.IssueUpdate.from_status:type_name -> bytebase.v1.IssueStatus+ 41, // 44: bytebase.v1.IssueComment.IssueUpdate.to_status:type_name -> bytebase.v1.IssueStatus+ 5, // 45: bytebase.v1.IssueComment.ReviewRunCompletion.run_type:type_name -> bytebase.v1.ReviewRun.Type+ 49, // 46: bytebase.v1.IssueComment.PlanUpdate.from_specs:type_name -> bytebase.v1.Plan.Spec+ 49, // 47: bytebase.v1.IssueComment.PlanUpdate.to_specs:type_name -> bytebase.v1.Plan.Spec+ 7, // 48: bytebase.v1.IssueService.GetIssue:input_type -> bytebase.v1.GetIssueRequest+ 8, // 49: bytebase.v1.IssueService.CreateIssue:input_type -> bytebase.v1.CreateIssueRequest+ 9, // 50: bytebase.v1.IssueService.ListIssues:input_type -> bytebase.v1.ListIssuesRequest+ 11, // 51: bytebase.v1.IssueService.SearchIssues:input_type -> bytebase.v1.SearchIssuesRequest+ 13, // 52: bytebase.v1.IssueService.UpdateIssue:input_type -> bytebase.v1.UpdateIssueRequest+ 24, // 53: bytebase.v1.IssueService.ListIssueComments:input_type -> bytebase.v1.ListIssueCommentsRequest+ 26, // 54: bytebase.v1.IssueService.CreateIssueComment:input_type -> bytebase.v1.CreateIssueCommentRequest+ 27, // 55: bytebase.v1.IssueService.UpdateIssueComment:input_type -> bytebase.v1.UpdateIssueCommentRequest+ 14, // 56: bytebase.v1.IssueService.BatchUpdateIssuesStatus:input_type -> bytebase.v1.BatchUpdateIssuesStatusRequest+ 16, // 57: bytebase.v1.IssueService.ApproveIssue:input_type -> bytebase.v1.ApproveIssueRequest+ 17, // 58: bytebase.v1.IssueService.RejectIssue:input_type -> bytebase.v1.RejectIssueRequest+ 18, // 59: bytebase.v1.IssueService.RequestIssue:input_type -> bytebase.v1.RequestIssueRequest+ 19, // 60: bytebase.v1.IssueService.RetryIssueApproval:input_type -> bytebase.v1.RetryIssueApprovalRequest+ 31, // 61: bytebase.v1.IssueService.GetReviewRun:input_type -> bytebase.v1.GetReviewRunRequest+ 32, // 62: bytebase.v1.IssueService.RunReview:input_type -> bytebase.v1.RunReviewRequest+ 20, // 63: bytebase.v1.IssueService.GetIssue:output_type -> bytebase.v1.Issue+ 20, // 64: bytebase.v1.IssueService.CreateIssue:output_type -> bytebase.v1.Issue+ 10, // 65: bytebase.v1.IssueService.ListIssues:output_type -> bytebase.v1.ListIssuesResponse+ 12, // 66: bytebase.v1.IssueService.SearchIssues:output_type -> bytebase.v1.SearchIssuesResponse+ 20, // 67: bytebase.v1.IssueService.UpdateIssue:output_type -> bytebase.v1.Issue+ 25, // 68: bytebase.v1.IssueService.ListIssueComments:output_type -> bytebase.v1.ListIssueCommentsResponse+ 28, // 69: bytebase.v1.IssueService.CreateIssueComment:output_type -> bytebase.v1.IssueComment+ 28, // 70: bytebase.v1.IssueService.UpdateIssueComment:output_type -> bytebase.v1.IssueComment+ 15, // 71: bytebase.v1.IssueService.BatchUpdateIssuesStatus:output_type -> bytebase.v1.BatchUpdateIssuesStatusResponse+ 20, // 72: bytebase.v1.IssueService.ApproveIssue:output_type -> bytebase.v1.Issue+ 20, // 73: bytebase.v1.IssueService.RejectIssue:output_type -> bytebase.v1.Issue+ 20, // 74: bytebase.v1.IssueService.RequestIssue:output_type -> bytebase.v1.Issue+ 20, // 75: bytebase.v1.IssueService.RetryIssueApproval:output_type -> bytebase.v1.Issue+ 30, // 76: bytebase.v1.IssueService.GetReviewRun:output_type -> bytebase.v1.ReviewRun+ 30, // 77: bytebase.v1.IssueService.RunReview:output_type -> bytebase.v1.ReviewRun+ 63, // [63:78] is the sub-list for method output_type+ 48, // [48:63] is the sub-list for method input_type+ 48, // [48:48] is the sub-list for extension type_name+ 48, // [48:48] is the sub-list for extension extendee+ 0, // [0:48] is the sub-list for field type_name}func init() { file_v1_issue_service_proto_init() }@@ -3188,6 +3313,7 @@ func file_v1_issue_service_proto_init() {(*IssueComment_IssueUpdate_)(nil),(*IssueComment_PlanUpdate_)(nil),(*IssueComment_ReviewSubmission_)(nil),+ (*IssueComment_ReviewRunCompletion_)(nil),}file_v1_issue_service_proto_msgTypes[29].OneofWrappers = []any{}type x struct{}@@ -3196,7 +3322,7 @@ func file_v1_issue_service_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_issue_service_proto_rawDesc), len(file_v1_issue_service_proto_rawDesc)),NumEnums: 7,- NumMessages: 32,+ NumMessages: 33,NumExtensions: 0,NumServices: 1,},diff --git a/backend/generated-go/v1/issue_service_equal.pb.go b/backend/generated-go/v1/issue_service_equal.pb.goindex 540bc9cba1..f02e585d45 100644--- a/backend/generated-go/v1/issue_service_equal.pb.go+++ b/backend/generated-go/v1/issue_service_equal.pb.go@@ -520,6 +520,9 @@ func (x *IssueComment_ReviewMetadata) Equal(y *IssueComment_ReviewMetadata) boolif x.Superseded != y.Superseded {return false}+ if x.Attempt != y.Attempt {+ return false+ }return true}@@ -590,6 +593,31 @@ func (x *IssueComment_ReviewSubmission) Equal(y *IssueComment_ReviewSubmission)return true}+func (x *IssueComment_ReviewRunCompletion) Equal(y *IssueComment_ReviewRunCompletion) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.RunType != y.RunType {+ return false+ }+ if x.Attempt != y.Attempt {+ return false+ }+ if x.PostedCount != y.PostedCount {+ return false+ }+ if x.KeptCount != y.KeptCount {+ return false+ }+ if x.SupersededCount != y.SupersededCount {+ return false+ }+ return true+}+func (x *IssueComment_PlanUpdate) Equal(y *IssueComment_PlanUpdate) bool {if x == y {return true@@ -665,6 +693,9 @@ func (x *IssueComment) Equal(y *IssueComment) bool {if !x.GetReviewSubmission().Equal(y.GetReviewSubmission()) {return false}+ if !x.GetReviewRunCompletion().Equal(y.GetReviewRunCompletion()) {+ return false+ }return true}diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex 6d99f5c39b..3ddf3e18a8 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -362,8 +362,8 @@ CREATE INDEX idx_issue_ts_vector ON issue USING GIN(ts_vector);CREATE TABLE issue_comment (-- global uniqueresource_id text NOT NULL DEFAULT gen_random_uuid()::text,- -- NULL on review results, which a reviewer posts (payload.review_metadata- -- names it), never a person.+ -- NULL on review results and review run completions, which a reviewer+ -- posts (the payload names it), never a person.creator text,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),diff --git a/backend/runner/reviewrun/rule_review.go b/backend/runner/reviewrun/rule_review.goindex 779e283388..f2ea89802a 100644--- a/backend/runner/reviewrun/rule_review.go+++ b/backend/runner/reviewrun/rule_review.go@@ -1,7 +1,12 @@package reviewrunimport (+ "crypto/sha256"+ "encoding/binary"+ "encoding/hex"+ "fmt""slices"+ "strings""github.com/bytebase/omni/review"@@ -118,11 +123,12 @@ func rulePriority(rule storepb.ReviewRuleType) storepb.IssueCommentPayload_Revie// reviewResultComments converts a unit's findings into the review result// comments to post: one OPEN root per finding, anchored to the finding's-// range on the spec's sheet, naming the rule, its priority, and every target-// the finding applies to. A finding for a rule this server does not know is-// dropped, as the contract says.+// range on the spec's sheet, naming the rule, its priority, every target the+// finding applies to, and its fingerprint. A finding for a rule this server+// does not know is dropped, as the contract says.func reviewResultComments(projectID string, issueUID int64, unit *reviewUnit, sql string, result *review.Result) []*store.IssueCommentMessage {text := review.Index(sql)+ occurrences := make(map[string]int)comments := make([]*store.IssueCommentMessage, 0, len(result.Findings))for _, finding := range result.Findings {rule := storepb.ReviewRuleType(storepb.ReviewRuleType_value[string(finding.Rule)])@@ -137,6 +143,10 @@ func reviewResultComments(projectID string, issueUID int64, unit *reviewUnit, sqtargets = append(targets, unit.Targets[i].Check.Target)}slices.Sort(targets)+ // Identical statements give equal keys; their order tells them apart.+ body, at := findingPlace(sql, result, finding)+ key := findingKey(unit, rule, finding.Codes, body, at, targets)+ occurrences[key]++comments = append(comments, &store.IssueCommentMessage{ProjectID: projectID,IssueUID: issueUID,@@ -144,10 +154,11 @@ func reviewResultComments(projectID string, issueUID int64, unit *reviewUnit, sqComment: finding.Message,StatementAnchor: findingAnchor(text, unit, result, finding),ReviewMetadata: &storepb.IssueCommentPayload_ReviewMetadata{- RunType: storepb.ReviewRun_RULE,- RuleType: rule,- Priority: rulePriority(rule),- Targets: targets,+ RunType: storepb.ReviewRun_RULE,+ RuleType: rule,+ Priority: rulePriority(rule),+ Targets: targets,+ Fingerprint: fmt.Sprintf("%s/%d", key, occurrences[key]),},},})@@ -155,6 +166,45 @@ func reviewResultComments(projectID string, issueUID int64, unit *reviewUnit, sqreturn comments}+// findingKey identifies a finding by what was judged: the unit, the rule, the+// codes of the conditions it reports, where it stands in its statement, and+// its databases. The message is left out, so rewording it keeps the finding.+func findingKey(unit *reviewUnit, rule storepb.ReviewRuleType, codes []review.FindingCode, body, at string, targets []string) string {+ names := make([]string, 0, len(codes))+ for _, code := range codes {+ names = append(names, string(code))+ }+ h := sha256.New()+ for _, field := range append([]string{unit.SpecID, unit.Engine.String(), rule.String(), strings.Join(names, ","), body, at}, targets...) {+ _, _ = h.Write(binary.BigEndian.AppendUint64(nil, uint64(len(field))))+ _, _ = h.Write([]byte(field))+ }+ return hex.EncodeToString(h.Sum(nil))+}++// findingPlace is where a finding stands: the body of its statement, and its+// range within that body. A body leaves out the blank lines and comments+// around the statement, so an edit to them, or anywhere else outside the+// statement, keeps the finding, while an edit to the statement makes it a new+// one. A finding on the whole change stands on all of the SQL, so any edit to+// it makes a new one; a finding on the whole statement has no range.+func findingPlace(sql string, result *review.Result, finding review.Finding) (body, at string) {+ if finding.Statement < 0 {+ return sql, ""+ }+ if finding.Statement >= len(result.Bodies) {+ return "", ""+ }+ b := result.Bodies[finding.Statement]+ if b.Start < 0 || b.Start > b.End || b.End > len(sql) {+ return "", ""+ }+ if finding.Range == (review.Range{}) {+ return sql[b.Start:b.End], ""+ }+ return sql[b.Start:b.End], fmt.Sprintf("%d-%d", finding.Range.Start-b.Start, finding.Range.End-b.Start)+}+// findingAnchor anchors a finding on the spec's sheet: its own range, else// its statement's range, else nothing for a finding that addresses the whole// change. An empty range anchors the whole line it starts on.diff --git a/backend/runner/reviewrun/rule_review_test.go b/backend/runner/reviewrun/rule_review_test.goindex 6757df6835..c8d6fbbbad 100644--- a/backend/runner/reviewrun/rule_review_test.go+++ b/backend/runner/reviewrun/rule_review_test.go@@ -163,6 +163,79 @@ func TestReviewResultComments(t *testing.T) {require.Equal(t, &storepb.Position{Line: 3}, line.Payload.StatementAnchor.EndPosition)}+// TestReviewResultFingerprints pins what tells a finding apart across runs,+// on PostgreSQL's own review. An edit outside its statement, blank lines and+// comments above it included, or a reworded message keeps its fingerprint;+// an edit to the statement, another set of databases, or another spec makes+// it a new finding. Findings of one code in one statement are told apart by+// where they stand, and identical statements by their order. A finding on+// the whole change is new once any of the SQL changes.+func TestReviewResultFingerprints(t *testing.T) {+ t.Parallel()+ unitOf := func(specID string, names ...string) *reviewUnit {+ targets := make([]*reviewTarget, 0, len(names))+ for _, name := range names {+ targets = append(targets, target(specID, name, storepb.Engine_POSTGRES, false))+ }+ return groupReviewUnits(nil, targets)[0]+ }+ reviewOf := func(unit *reviewUnit, sql string) *review.Result {+ t.Helper()+ rules := []review.Rule{review.RequireWhere, review.RequireIsNull}+ result, err := reviewFuncs[storepb.Engine_POSTGRES](context.Background(), sql, review.Options{Rules: rules}, make([]review.Target, len(unit.Targets)))+ require.NoError(t, err)+ return result+ }+ fingerprintsOf := func(unit *reviewUnit, sql string, result *review.Result) []string {+ var out []string+ for _, comment := range reviewResultComments("p", 101, unit, sql, result) {+ out = append(out, comment.Payload.ReviewMetadata.Fingerprint)+ }+ return out+ }+ fingerprints := func(unit *reviewUnit, sql string) []string {+ return fingerprintsOf(unit, sql, reviewOf(unit, sql))+ }++ unit := unitOf("spec-1", "instances/pg/databases/a")+ const update = "UPDATE t SET a = 1;"+ base := fingerprints(unit, update)+ require.Len(t, base, 1)+ require.NotEmpty(t, base[0])+ require.Equal(t, base, fingerprints(unit, "SELECT 1;\n\n-- set every row\n"+update), "an edit outside the statement keeps the finding")+ require.NotEqual(t, base, fingerprints(unit, "UPDATE t SET a = 2;"), "an edited statement is a new finding")+ require.NotEqual(t, base, fingerprints(unitOf("spec-1", "instances/pg/databases/a", "instances/pg/databases/b"), update), "other databases make a new finding")+ require.NotEqual(t, base, fingerprints(unitOf("spec-2", "instances/pg/databases/a"), update), "another spec makes a new finding")++ reworded := reviewOf(unit, update)+ reworded.Findings[0].Message = "Reworded."+ require.Equal(t, base, fingerprintsOf(unit, update, reworded), "a reworded message keeps the finding")++ twice := fingerprints(unit, update+"\n"+update)+ require.Len(t, twice, 2)+ require.Equal(t, base[0], twice[0], "the first of identical statements keeps the finding")+ require.NotEqual(t, twice[0], twice[1])++ const nulls = "DELETE FROM t WHERE x = NULL OR y = NULL;"+ both := fingerprints(unit, nulls)+ require.Len(t, both, 2)+ require.NotEqual(t, both[0], both[1])+ // When the schema ends one of two such findings, as it can WALK_THROUGH's,+ // the other keeps its own.+ one := reviewOf(unit, nulls)+ one.Findings = one.Findings[1:]+ require.Equal(t, both[1:], fingerprintsOf(unit, nulls, one))++ // A finding on the whole change stands on all of the SQL.+ wholeChange := func(sql string) []string {+ return fingerprintsOf(unit, sql, &review.Result{Findings: []review.Finding{{+ Rule: review.PriorBackup, Statement: -1, Codes: []review.FindingCode{review.BackupLocationMissing}, Targets: []int{0},+ }}})+ }+ require.Equal(t, wholeChange(update), wholeChange(update))+ require.NotEqual(t, wholeChange(update), wholeChange("DELETE FROM orders WHERE id = 2;"), "an edit to the SQL makes a new finding")+}+// TestBackupDatabaseExistsPostgres reads the PostgreSQL archive schema from// the synced metadata; no store lookup is involved, so the executor has none.func TestBackupDatabaseExistsPostgres(t *testing.T) {diff --git a/backend/store/review_run.go b/backend/store/review_run.goindex 8c01bbf183..b080d1500e 100644--- a/backend/store/review_run.go+++ b/backend/store/review_run.go@@ -3,10 +3,12 @@ package storeimport ("context""database/sql"+ "slices""time""github.com/pkg/errors""google.golang.org/protobuf/encoding/protojson"+ "google.golang.org/protobuf/proto""github.com/bytebase/bytebase/backend/common"storepb "github.com/bytebase/bytebase/backend/generated-go/store"@@ -208,16 +210,22 @@ func (s *Store) ClaimAvailableReviewRuns(ctx context.Context, replicaID string)// CompleteReviewRun moves a RUNNING run this replica owns to a terminal// status, fenced on the claim's attempt. On DONE it posts the run's results in-// the same transaction: every earlier root the same reviewer posted on the-// issue is marked superseded and, if OPEN, resolved; then the results are-// inserted as OPEN roots with no creator. A FAILED run leaves the comments-// alone and takes no results. False means-// superseded: the slot was reset or reaped since the claim, and nothing was-// written.+// the same transaction. A current root of the same reviewer on the issue (one+// no run has superseded) whose fingerprint a result repeats keeps its thread,+// state and replies included, and takes the result's anchor; that result is+// not posted again. Every other current root of the reviewer is marked+// superseded and, if OPEN, resolved; the remaining results are inserted as+// OPEN roots with no creator, carrying the run's attempt; and a+// ReviewRunCompletion event records the counts. A FAILED run leaves the+// comments alone and takes no results. False means superseded: the slot was+// reset or reaped since the claim, and nothing was written.//// Lock order: the issue's review comments, then the run slot, then the issue-// (the result insert's foreign key), the order the project purge deletes them-// in. The fence therefore runs before the insert.+// (the insert's foreign key), the order the project purge deletes them in.+// The fence therefore runs before the inserts. A re-run does not stop the+// execution it supersedes, so two completions of one slot can overlap and+// split the reviewer's roots differently; each locks every root it may+// update, in primary-key order, before updating any.func (s *Store) CompleteReviewRun(ctx context.Context, claimed *ClaimedReviewRun, replicaID string, status storepb.ReviewRun_Status, payload *storepb.ReviewRunPayload, results []*IssueCommentMessage) (bool, error) {switch status {case storepb.ReviewRun_DONE:@@ -235,7 +243,7 @@ func (s *Store) CompleteReviewRun(ctx context.Context, claimed *ClaimedReviewRunif err != nil {return false, errors.Wrapf(err, "failed to marshal review run payload")}- resultPayloads, err := marshalReviewResults(claimed, results)+ resultPayloads, fingerprints, err := marshalReviewResults(claimed, results)if err != nil {return false, err}@@ -246,24 +254,87 @@ func (s *Store) CompleteReviewRun(ctx context.Context, claimed *ClaimedReviewRun}defer tx.Rollback()+ var supersededCount int64if status == storepb.ReviewRun_DONE {- // Each earlier root is marked once, and resolved again if someone- // reopened it. updated_at marks content edits, so it is left alone.q := qb.Q().Space(`+ SELECT resource_id FROM issue_comment+ WHERE project = ? AND issue_id = ?+ AND parent_id IS NULL+ AND payload->'reviewMetadata'->>'runType' = ?+ AND (payload->'reviewMetadata'->'superseded' IS NULL OR thread_state = 'OPEN')+ ORDER BY resource_id+ FOR UPDATE+ `, claimed.ProjectID, claimed.IssueUID, claimed.Type)+ query, args, err := q.ToSQL()+ if err != nil {+ return false, errors.Wrapf(err, "failed to build sql")+ }+ if _, err := tx.ExecContext(ctx, query, args...); err != nil {+ return false, errors.Wrapf(err, "failed to lock previous review results")+ }++ // updated_at marks content edits, so the updates leave it alone.+ q = qb.Q().Space(`UPDATE issue_commentSET thread_state = ?,payload = jsonb_set(payload, '{reviewMetadata,superseded}', 'true'::jsonb)WHERE project = ? AND issue_id = ?AND parent_id IS NULLAND payload->'reviewMetadata'->>'runType' = ?- AND (thread_state = 'OPEN' OR payload->'reviewMetadata'->'superseded' IS NULL)+ AND payload->'reviewMetadata'->'superseded' IS NULL+ AND COALESCE(payload->'reviewMetadata'->>'fingerprint', '') <> ALL(?::TEXT[])+ `, string(ThreadStateResolved), claimed.ProjectID, claimed.IssueUID, claimed.Type, fingerprints)+ query, args, err = q.ToSQL()+ if err != nil {+ return false, errors.Wrapf(err, "failed to build sql")+ }+ result, err := tx.ExecContext(ctx, query, args...)+ if err != nil {+ return false, errors.Wrapf(err, "failed to supersede previous review results")+ }+ if supersededCount, err = result.RowsAffected(); err != nil {+ return false, errors.Wrapf(err, "failed to get rows affected")+ }++ // A superseded root someone reopened is resolved again.+ q = qb.Q().Space(`+ UPDATE issue_comment+ SET thread_state = ?+ WHERE project = ? AND issue_id = ?+ AND parent_id IS NULL+ AND payload->'reviewMetadata'->>'runType' = ?+ AND payload->'reviewMetadata'->'superseded' IS NOT NULL+ AND thread_state = 'OPEN'`, string(ThreadStateResolved), claimed.ProjectID, claimed.IssueUID, claimed.Type)- query, args, err := q.ToSQL()+ query, args, err = q.ToSQL()if err != nil {return false, errors.Wrapf(err, "failed to build sql")}if _, err := tx.ExecContext(ctx, query, args...); err != nil {- return false, errors.Wrapf(err, "failed to resolve previous review results")+ return false, errors.Wrapf(err, "failed to resolve reopened review results")+ }++ // A kept root moves to its statement in the SQL this run reviewed:+ // equal fingerprints mean equal statement text, and an anchor left+ // on an earlier sheet can lose its place in the current one.+ q = qb.Q().Space(`+ UPDATE issue_comment kept+ SET payload = jsonb_set(kept.payload, '{statementAnchor}', r.payload->'statementAnchor')+ FROM unnest(?::JSONB[]) AS r(payload)+ WHERE kept.project = ? AND kept.issue_id = ?+ AND kept.parent_id IS NULL+ AND kept.payload->'reviewMetadata'->>'runType' = ?+ AND kept.payload->'reviewMetadata'->'superseded' IS NULL+ AND kept.payload->'reviewMetadata'->>'fingerprint' = r.payload->'reviewMetadata'->>'fingerprint'+ AND r.payload ?? 'statementAnchor'+ AND kept.payload->'statementAnchor' IS DISTINCT FROM r.payload->'statementAnchor'+ `, resultPayloads, claimed.ProjectID, claimed.IssueUID, claimed.Type)+ query, args, err = q.ToSQL()+ if err != nil {+ return false, errors.Wrapf(err, "failed to build sql")+ }+ if _, err := tx.ExecContext(ctx, query, args...); err != nil {+ return false, errors.Wrapf(err, "failed to move kept review results")}}@@ -291,23 +362,71 @@ func (s *Store) CompleteReviewRun(ctx context.Context, claimed *ClaimedReviewRun// Superseded: the rollback discards the resolution.return false, nil}+ if status != storepb.ReviewRun_DONE {+ if err := tx.Commit(); err != nil {+ return false, errors.Wrapf(err, "failed to commit tx")+ }+ return true, nil+ }+ var postedCount int64if len(resultPayloads) > 0 {- // created_at is offset by the ordinal for the same reason as in- // CreateIssueComments: the batch keeps its order.+ // After the update above, the reviewer's current roots are the kept+ // ones. created_at is offset by the ordinal for the same reason as in+ // CreateIssueComments, starting a microsecond after the completion+ // event inserted below, so the results sort after it.q := qb.Q().Space(`INSERT INTO issue_comment (creator, project, issue_id, payload, thread_state, created_at, updated_at)SELECT NULL, ?, ?, c.payload, 'OPEN', t.at, t.atFROM unnest(?::JSONB[]) WITH ORDINALITY AS c(payload, ordinality),- LATERAL (SELECT now() + ((c.ordinality - 1) * interval '1 microsecond')) AS t(at)- `, claimed.ProjectID, claimed.IssueUID, resultPayloads)+ LATERAL (SELECT now() + (c.ordinality * interval '1 microsecond')) AS t(at)+ WHERE NOT EXISTS (+ SELECT 1 FROM issue_comment kept+ WHERE kept.project = ? AND kept.issue_id = ?+ AND kept.parent_id IS NULL+ AND kept.payload->'reviewMetadata'->>'runType' = ?+ AND kept.payload->'reviewMetadata'->'superseded' IS NULL+ AND kept.payload->'reviewMetadata'->>'fingerprint' = c.payload->'reviewMetadata'->>'fingerprint'+ )+ `, claimed.ProjectID, claimed.IssueUID, resultPayloads, claimed.ProjectID, claimed.IssueUID, claimed.Type)query, args, err := q.ToSQL()if err != nil {return false, errors.Wrapf(err, "failed to build sql")}- if _, err := tx.ExecContext(ctx, query, args...); err != nil {+ result, err := tx.ExecContext(ctx, query, args...)+ if err != nil {return false, errors.Wrapf(err, "failed to post review results")}+ if postedCount, err = result.RowsAffected(); err != nil {+ return false, errors.Wrapf(err, "failed to get rows affected")+ }+ }++ runType := storepb.ReviewRun_Type(storepb.ReviewRun_Type_value[claimed.Type])+ completion, err := protojson.Marshal(&storepb.IssueCommentPayload{+ Event: &storepb.IssueCommentPayload_ReviewRunCompletion_{+ ReviewRunCompletion: &storepb.IssueCommentPayload_ReviewRunCompletion{+ RunType: runType,+ Attempt: claimed.Attempt,+ PostedCount: int32(postedCount),+ KeptCount: int32(int64(len(resultPayloads)) - postedCount),+ SupersededCount: int32(supersededCount),+ },+ },+ })+ if err != nil {+ return false, errors.Wrapf(err, "failed to marshal review run completion")+ }+ q = qb.Q().Space(`+ INSERT INTO issue_comment (creator, project, issue_id, payload, created_at, updated_at)+ VALUES (NULL, ?, ?, ?, now(), now())+ `, claimed.ProjectID, claimed.IssueUID, string(completion))+ query, args, err = q.ToSQL()+ if err != nil {+ return false, errors.Wrapf(err, "failed to build sql")+ }+ if _, err := tx.ExecContext(ctx, query, args...); err != nil {+ return false, errors.Wrapf(err, "failed to record review run completion")}if err := tx.Commit(); err != nil {@@ -316,37 +435,53 @@ func (s *Store) CompleteReviewRun(ctx context.Context, claimed *ClaimedReviewRunreturn true, nil}-// marshalReviewResults checks that every result is a root comment the-// claimed reviewer posted, with no event and no creator, and returns the-// payloads to insert.-func marshalReviewResults(claimed *ClaimedReviewRun, results []*IssueCommentMessage) ([][]byte, error) {+// marshalReviewResults checks that every result is a current root comment+// the claimed reviewer posted, with no event, no creator, and a fingerprint+// no other result repeats, and returns the payloads to insert, stamped with+// the run's attempt, and their fingerprints. The fingerprints are never nil:+// <> ALL(NULL) is NULL, which would keep every current root from being+// superseded.+func marshalReviewResults(claimed *ClaimedReviewRun, results []*IssueCommentMessage) ([][]byte, []string, error) {payloads := make([][]byte, 0, len(results))+ fingerprints := make([]string, 0, len(results))for _, result := range results {if result.ProjectID != claimed.ProjectID || result.IssueUID != claimed.IssueUID {- return nil, errors.Errorf("review result for issue %d in project %s does not belong to the run on issue %d in project %s", result.IssueUID, result.ProjectID, claimed.IssueUID, claimed.ProjectID)+ return nil, nil, errors.Errorf("review result for issue %d in project %s does not belong to the run on issue %d in project %s", result.IssueUID, result.ProjectID, claimed.IssueUID, claimed.ProjectID)}if result.ParentID != nil || result.CreatorEmail != "" {- return nil, errors.New("a review result is a root comment with no creator")+ return nil, nil, errors.New("a review result is a root comment with no creator")}if result.ThreadState != nil && *result.ThreadState != ThreadStateOpen {- return nil, errors.New("a review result starts its thread OPEN")+ return nil, nil, errors.New("a review result starts its thread OPEN")}if result.Payload.GetEvent() != nil {- return nil, errors.New("a review result cannot carry an event")+ return nil, nil, errors.New("a review result cannot carry an event")+ }+ metadata := result.Payload.GetReviewMetadata()+ if metadata.GetRunType().String() != claimed.Type {+ return nil, nil, errors.Errorf("review result names reviewer %q; the run is %q", metadata.GetRunType(), claimed.Type)+ }+ if metadata.GetSuperseded() {+ return nil, nil, errors.New("a review result cannot start superseded")}- if result.Payload.GetReviewMetadata().GetRunType().String() != claimed.Type {- return nil, errors.Errorf("review result names reviewer %q; the run is %q", result.Payload.GetReviewMetadata().GetRunType(), claimed.Type)+ if fingerprint := metadata.GetFingerprint(); fingerprint != "" {+ if slices.Contains(fingerprints, fingerprint) {+ return nil, nil, errors.Errorf("two review results share the fingerprint %q", fingerprint)+ }+ fingerprints = append(fingerprints, fingerprint)}if err := validateIssueCommentPayload(result.Payload); err != nil {- return nil, err+ return nil, nil, err}- payload, err := protojson.Marshal(result.Payload)+ stamped := proto.CloneOf(result.Payload)+ stamped.ReviewMetadata.Attempt = claimed.Attempt+ payload, err := protojson.Marshal(stamped)if err != nil {- return nil, errors.Wrapf(err, "failed to marshal review result")+ return nil, nil, errors.Wrapf(err, "failed to marshal review result")}payloads = append(payloads, payload)}- return payloads, nil+ return payloads, fingerprints, nil}// FailStaleReviewRuns fails RUNNING review runs whose owning replica has nodiff --git a/backend/store/review_run_lock_order_test.go b/backend/store/review_run_lock_order_test.goindex a8ea343405..b814c93f5a 100644--- a/backend/store/review_run_lock_order_test.go+++ b/backend/store/review_run_lock_order_test.go@@ -157,3 +157,84 @@ func TestCompleteReviewRunLockOrder(t *testing.T) {})}}++// TestCompleteReviewRunOverlappingAttempts completes a superseded attempt and+// the current one at once, each keeping a different earlier result whose+// anchor moved. The superseded attempt is parked after its first comment+// update; the current one must wait for it rather than deadlock, then commit.+func TestCompleteReviewRunOverlappingAttempts(t *testing.T) {+ t.Parallel()+ fixture := newStorePostgresFixture(t, `+ INSERT INTO issue (id, creator, project, name, status, type)+ VALUES (301, '[email protected]', 'default', 'Issue', 'OPEN', 'DATABASE_CHANGE');+ `)+ ctx, s := fixture.ctx, fixture.store+ finding := func(comment, fingerprint string, line int32) *store.IssueCommentMessage {+ r := reviewResult("default", comment, storepb.ReviewRuleType_REQUIRE_WHERE)+ r.Payload.ReviewMetadata.Fingerprint = fingerprint+ r.Payload.StatementAnchor.StartPosition = &storepb.Position{Line: line}+ r.Payload.StatementAnchor.EndPosition = &storepb.Position{Line: line}+ return r+ }+ completeReviewRun(t, fixture, "default", store.ReviewRunTypeRule, storepb.ReviewRun_DONE,+ finding("x", "x", 1), finding("y", "y", 2))++ claim := func() *store.ClaimedReviewRun {+ t.Helper()+ _, err := s.CreateReviewRun(ctx, "default", reviewResultIssue, store.ReviewRunTypeRule)+ require.NoError(t, err)+ claimed, err := s.ClaimAvailableReviewRuns(ctx, "replica-1")+ require.NoError(t, err)+ require.Len(t, claimed, 1)+ return claimed[0]+ }+ // A re-run does not stop the execution it supersedes.+ superseded, current := claim(), claim()++ const barrierID = 9974+ barrier := newMaintenanceLockBarrier(ctx, t, fixture.db, barrierID)+ installMaintenanceLockBarrier(t, fixture.db, barrierID, "AFTER UPDATE ON issue_comment FOR EACH STATEMENT")++ type completion struct {+ updated bool+ err error+ }+ complete := func(claimed *store.ClaimedReviewRun, kept *store.IssueCommentMessage) <-chan completion {+ done := make(chan completion, 1)+ go func() {+ updated, err := s.CompleteReviewRun(ctx, claimed, "replica-1", storepb.ReviewRun_DONE, nil, []*store.IssueCommentMessage{kept})+ done <- completion{updated: updated, err: err}+ }()+ return done+ }+ // Each keeps one result, moved down a line, and supersedes the other.+ supersededDone := complete(superseded, finding("x moved", "x", 3))+ waitForMaintenanceBarrier(ctx, t, fixture.db, barrierID)+ supersededPID := maintenanceBarrierWaitingPID(ctx, t, fixture.db, barrierID)+ currentDone := complete(current, finding("y moved", "y", 4))+ require.Eventually(t, func() bool {+ var waiting bool+ err := fixture.db.QueryRowContext(ctx, `SELECT EXISTS (+ SELECT 1 FROM pg_stat_activity+ WHERE datname = current_database() AND pid <> $1 AND cardinality(pg_blocking_pids(pid)) > 0+ )`, supersededPID).Scan(&waiting)+ return err == nil && waiting+ }, maintenanceLockWait, 10*time.Millisecond, "the current attempt should be waiting")+ barrier.release(t)++ for name, done := range map[string]<-chan completion{"superseded": supersededDone, "current": currentDone} {+ select {+ case c := <-done:+ require.NoError(t, c.err, name)+ require.Equal(t, name == "current", c.updated, name)+ case <-time.After(maintenanceLockWait):+ t.Fatalf("timed out waiting for the %s attempt", name)+ }+ }+ got, _ := listSupersession(t, fixture, "default")+ require.Equal(t, []supersession{+ {Comment: "x", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "y", ThreadState: "OPEN"},+ }, got)+ require.Equal(t, reviewResultSheet+"/4", reviewResultAnchors(t, fixture, "default")["y"])+}diff --git a/backend/store/review_run_results_test.go b/backend/store/review_run_results_test.goindex b42eb30b00..823805f533 100644--- a/backend/store/review_run_results_test.go+++ b/backend/store/review_run_results_test.go@@ -1,6 +1,7 @@package store_testimport (+ "strings""testing""time"@@ -249,6 +250,246 @@ func TestCompleteReviewRunPostsResults(t *testing.T) {}}+// TestCompleteReviewRunKeepsResultsReportedAgain pins how a run tells the+// findings it reports again apart: a current root whose fingerprint a result+// repeats keeps its thread state and updated_at, and the result is not posted+// twice. A fingerprint matches only a current root of the same reviewer on+// the same issue: never a superseded root, an AI result, or the colliding+// issue in another project. A result without one matches nothing.+func TestCompleteReviewRunKeepsResultsReportedAgain(t *testing.T) {+ t.Parallel()+ fixture := newStorePostgresFixture(t, `+ INSERT INTO project (resource_id, workspace, name) VALUES ('other', 'default', 'Other');+ INSERT INTO issue (id, creator, project, name, status, type)+ VALUES (301, '[email protected]', 'default', 'Issue Default', 'OPEN', 'DATABASE_CHANGE');+ INSERT INTO issue (id, creator, project, name, status, type)+ VALUES (301, '[email protected]', 'other', 'Issue Other', 'OPEN', 'DATABASE_CHANGE');+ `)+ result := func(projectID, comment, fingerprint string) *store.IssueCommentMessage {+ r := reviewResult(projectID, comment, storepb.ReviewRuleType_REQUIRE_WHERE)+ r.Payload.ReviewMetadata.Fingerprint = fingerprint+ return r+ }+ complete := func(projectID string, results ...*store.IssueCommentMessage) {+ t.Helper()+ completeReviewRun(t, fixture, projectID, store.ReviewRunTypeRule, storepb.ReviewRun_DONE, results...)+ }++ // The colliding issue and an AI result hold the fingerprint the second+ // run reports first.+ complete("other", result("other", "other", "new"))+ aiResult := result("default", "ai", "new")+ aiResult.Payload.ReviewMetadata.RunType = storepb.ReviewRun_AI+ aiResult.Payload.ReviewMetadata.RuleType = storepb.ReviewRuleType_REVIEW_RULE_TYPE_UNSPECIFIED+ completeReviewRun(t, fixture, "default", store.ReviewRunTypeAI, storepb.ReviewRun_DONE, aiResult)++ // A finding on the whole change has no anchor to move.+ wholeChange := func(comment string) *store.IssueCommentMessage {+ r := result("default", comment, "whole")+ r.Payload.StatementAnchor = nil+ return r+ }+ complete("default",+ result("default", "open", "open"),+ result("default", "accepted", "accepted"),+ result("default", "fixed", "fixed"),+ result("default", "no fingerprint", ""),+ wholeChange("whole"),+ )+ setReviewThreadState(t, fixture, "accepted", store.ThreadStateResolved)+ _, updatedBefore := listSupersession(t, fixture, "default")++ // The SQL changed above "open": its statement moved down two lines.+ movedSheet := strings.Repeat("ab", 32)+ openAgain := result("default", "open again", "open")+ openAgain.Payload.StatementAnchor.SheetSha256 = movedSheet+ openAgain.Payload.StatementAnchor.StartPosition = &storepb.Position{Line: 3}+ openAgain.Payload.StatementAnchor.EndPosition = &storepb.Position{Line: 3}+ complete("default",+ result("default", "new", "new"),+ openAgain,+ result("default", "accepted again", "accepted"),+ result("default", "no fingerprint again", ""),+ wholeChange("whole again"),+ )+ got, updatedAfter := listSupersession(t, fixture, "default")+ require.Equal(t, []supersession{+ {Comment: "ai", ThreadState: "OPEN"},+ {Comment: "open", ThreadState: "OPEN"},+ {Comment: "accepted", ThreadState: "RESOLVED"},+ {Comment: "fixed", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "no fingerprint", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "whole", ThreadState: "OPEN"},+ {Comment: "new", ThreadState: "OPEN"},+ {Comment: "no fingerprint again", ThreadState: "OPEN"},+ }, got)+ for _, comment := range []string{"open", "accepted", "whole"} {+ require.Equal(t, updatedBefore[comment], updatedAfter[comment], "keeping %q is no content edit", comment)+ }+ anchors := reviewResultAnchors(t, fixture, "default")+ require.Equal(t, movedSheet+"/3", anchors["open"], "a kept result moves to the statement the run found")+ require.Equal(t, reviewResultSheet+"/1", anchors["accepted"])+ require.Equal(t, "", anchors["whole"])+ require.Equal(t, []reviewRunCompletion{+ {RunType: storepb.ReviewRun_AI, Posted: 1},+ {RunType: storepb.ReviewRun_RULE, Posted: 5},+ {RunType: storepb.ReviewRun_RULE, Attempt: 1, Posted: 2, Kept: 3, Superseded: 2},+ }, listReviewRunCompletions(t, fixture, "default"))+ other, _ := listSupersession(t, fixture, "other")+ require.Equal(t, []supersession{{Comment: "other", ThreadState: "OPEN"}}, other, "the colliding issue in the other project is untouched")++ // A finding reported again after a run superseded it starts a new thread,+ // and its superseded root is resolved again though someone reopened it.+ setReviewThreadState(t, fixture, "fixed", store.ThreadStateOpen)+ complete("default", result("default", "new again", "new"), result("default", "fixed again", "fixed"))+ final, _ := listSupersession(t, fixture, "default")+ require.Equal(t, []supersession{+ {Comment: "ai", ThreadState: "OPEN"},+ {Comment: "open", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "accepted", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "fixed", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "no fingerprint", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "whole", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "new", ThreadState: "OPEN"},+ {Comment: "no fingerprint again", ThreadState: "RESOLVED", Superseded: true},+ {Comment: "fixed again", ThreadState: "OPEN"},+ }, final)+ require.Equal(t, map[string]int64{+ "ai": 0, "open": 0, "accepted": 0, "fixed": 0, "no fingerprint": 0, "whole": 0,+ "new": 1, "no fingerprint again": 1, "fixed again": 2,+ }, reviewResultAttempts(t, fixture, "default"), "a kept result keeps the attempt that posted it")+ completions := listReviewRunCompletions(t, fixture, "default")+ require.Equal(t, reviewRunCompletion{RunType: storepb.ReviewRun_RULE, Attempt: 2, Posted: 1, Kept: 1, Superseded: 4}, completions[len(completions)-1])+ require.Equal(t, []reviewRunCompletion{{RunType: storepb.ReviewRun_RULE, Posted: 1}}, listReviewRunCompletions(t, fixture, "other"))++ // Fingerprints are unique within a run.+ ctx, s := fixture.ctx, fixture.store+ _, err := s.CreateReviewRun(ctx, "default", reviewResultIssue, store.ReviewRunTypeRule)+ require.NoError(t, err)+ claimed, err := s.ClaimAvailableReviewRuns(ctx, "replica-1")+ require.NoError(t, err)+ require.Len(t, claimed, 1)+ _, err = s.CompleteReviewRun(ctx, claimed[0], "replica-1", storepb.ReviewRun_DONE, nil, []*store.IssueCommentMessage{+ result("default", "first", "same"),+ result("default", "second", "same"),+ })+ require.Error(t, err)+ unchanged, _ := listSupersession(t, fixture, "default")+ require.Equal(t, final, unchanged, "a rejected completion writes nothing")+ require.Equal(t, completions, listReviewRunCompletions(t, fixture, "default"))+}++type reviewRunCompletion struct {+ RunType storepb.ReviewRun_Type+ Attempt int64+ Posted int32+ Kept int32+ Superseded int32+}++// listReviewRunCompletions reads the completion events on the shared issue,+// oldest first, checking each is a creatorless event row.+func listReviewRunCompletions(t *testing.T, fixture *storePostgresFixture, projectID string) []reviewRunCompletion {+ t.Helper()+ rows, err := fixture.db.QueryContext(fixture.ctx, `+ SELECT payload, creator IS NULL AND thread_state IS NULL AND parent_id IS NULL+ FROM issue_comment+ WHERE project = $1 AND issue_id = $2 AND payload ? 'reviewRunCompletion'+ ORDER BY created_at, resource_id+ `, projectID, reviewResultIssue)+ require.NoError(t, err)+ defer rows.Close()+ var out []reviewRunCompletion+ for rows.Next() {+ var raw []byte+ var event bool+ require.NoError(t, rows.Scan(&raw, &event))+ require.True(t, event, "a completion is an event with no creator")+ payload := &storepb.IssueCommentPayload{}+ require.NoError(t, common.ProtojsonUnmarshaler.Unmarshal(raw, payload))+ c := payload.GetReviewRunCompletion()+ out = append(out, reviewRunCompletion{+ RunType: c.GetRunType(), Attempt: c.GetAttempt(),+ Posted: c.GetPostedCount(), Kept: c.GetKeptCount(), Superseded: c.GetSupersededCount(),+ })+ }+ require.NoError(t, rows.Err())+ return out+}++// reviewResultAnchors maps each review result's text to its anchor's sheet and+// start line, or "" without one.+func reviewResultAnchors(t *testing.T, fixture *storePostgresFixture, projectID string) map[string]string {+ t.Helper()+ rows, err := fixture.db.QueryContext(fixture.ctx, `+ SELECT payload->>'comment',+ COALESCE((payload->'statementAnchor'->>'sheetSha256') || '/' || (payload->'statementAnchor'->'startPosition'->>'line'), '')+ FROM issue_comment+ WHERE project = $1 AND issue_id = $2 AND payload ? 'reviewMetadata'+ `, projectID, reviewResultIssue)+ require.NoError(t, err)+ defer rows.Close()+ out := make(map[string]string)+ for rows.Next() {+ var comment, anchor string+ require.NoError(t, rows.Scan(&comment, &anchor))+ out[comment] = anchor+ }+ require.NoError(t, rows.Err())+ return out+}++// reviewResultAttempts maps each review result's text to its attempt.+func reviewResultAttempts(t *testing.T, fixture *storePostgresFixture, projectID string) map[string]int64 {+ t.Helper()+ rows, err := fixture.db.QueryContext(fixture.ctx, `+ SELECT payload->>'comment', COALESCE((payload->'reviewMetadata'->>'attempt')::BIGINT, 0)+ FROM issue_comment+ WHERE project = $1 AND issue_id = $2 AND payload ? 'reviewMetadata'+ `, projectID, reviewResultIssue)+ require.NoError(t, err)+ defer rows.Close()+ out := make(map[string]int64)+ for rows.Next() {+ var comment string+ var attempt int64+ require.NoError(t, rows.Scan(&comment, &attempt))+ out[comment] = attempt+ }+ require.NoError(t, rows.Err())+ return out+}++// completeReviewRun starts, claims, and completes one run on the shared issue.+func completeReviewRun(t *testing.T, fixture *storePostgresFixture, projectID, reviewType string, status storepb.ReviewRun_Status, results ...*store.IssueCommentMessage) {+ t.Helper()+ ctx, s := fixture.ctx, fixture.store+ _, err := s.CreateReviewRun(ctx, projectID, reviewResultIssue, reviewType)+ require.NoError(t, err)+ claimed, err := s.ClaimAvailableReviewRuns(ctx, "replica-1")+ require.NoError(t, err)+ require.Len(t, claimed, 1)+ updated, err := s.CompleteReviewRun(ctx, claimed[0], "replica-1", status, &storepb.ReviewRunPayload{}, results)+ require.NoError(t, err)+ require.True(t, updated)+}++// setReviewThreadState sets the thread state of the default project's root+// with the given text, as a person would.+func setReviewThreadState(t *testing.T, fixture *storePostgresFixture, comment string, state store.ThreadState) {+ t.Helper()+ ctx, s := fixture.ctx, fixture.store+ roots, err := s.ListIssueComment(ctx, &store.FindIssueCommentMessage{ProjectID: "default", IssueUID: &[]int64{reviewResultIssue}[0]})+ require.NoError(t, err)+ for _, root := range roots {+ if root.Payload.Comment == comment {+ require.NoError(t, s.UpdateIssueComment(ctx, &store.UpdateIssueCommentMessage{ProjectID: "default", ResourceID: root.ResourceID, ThreadState: &state}))+ return+ }+ }+ t.Fatalf("no comment %q", comment)+}+type supersession struct {Comment stringThreadState string@@ -293,30 +534,13 @@ func TestCompleteReviewRunSupersedesEarlierResults(t *testing.T) {INSERT INTO issue (id, creator, project, name, status, type)VALUES (301, '[email protected]', 'other', 'Issue Other', 'OPEN', 'DATABASE_CHANGE');`)- ctx, s := fixture.ctx, fixture.store- const issueUID = reviewResultIssuecomplete := func(projectID, reviewType string, status storepb.ReviewRun_Status, results ...*store.IssueCommentMessage) {t.Helper()- _, err := s.CreateReviewRun(ctx, projectID, issueUID, reviewType)- require.NoError(t, err)- claimed, err := s.ClaimAvailableReviewRuns(ctx, "replica-1")- require.NoError(t, err)- require.Len(t, claimed, 1)- updated, err := s.CompleteReviewRun(ctx, claimed[0], "replica-1", status, &storepb.ReviewRunPayload{}, results)- require.NoError(t, err)- require.True(t, updated)+ completeReviewRun(t, fixture, projectID, reviewType, status, results...)}setThreadState := func(comment string, state store.ThreadState) {t.Helper()- roots, err := s.ListIssueComment(ctx, &store.FindIssueCommentMessage{ProjectID: "default", IssueUID: &[]int64{issueUID}[0]})- require.NoError(t, err)- for _, root := range roots {- if root.Payload.Comment == comment {- require.NoError(t, s.UpdateIssueComment(ctx, &store.UpdateIssueCommentMessage{ProjectID: "default", ResourceID: root.ResourceID, ThreadState: &state}))- return- }- }- t.Fatalf("no comment %q", comment)+ setReviewThreadState(t, fixture, comment, state)}aiResult := reviewResult("default", "ai", storepb.ReviewRuleType_REVIEW_RULE_TYPE_UNSPECIFIED)aiResult.Payload.ReviewMetadata.RunType = storepb.ReviewRun_AI@@ -347,7 +571,9 @@ func TestCompleteReviewRunSupersedesEarlierResults(t *testing.T) {// A FAILED run supersedes nothing: the latest review is still the last DONE.setThreadState("first", store.ThreadStateOpen)+ completions := listReviewRunCompletions(t, fixture, "default")complete("default", store.ReviewRunTypeRule, storepb.ReviewRun_FAILED)+ require.Equal(t, completions, listReviewRunCompletions(t, fixture, "default"), "a FAILED run records no completion")afterFailure, _ := listSupersession(t, fixture, "default")require.Equal(t, []supersession{{Comment: "ai", ThreadState: "OPEN"},@@ -359,6 +585,9 @@ func TestCompleteReviewRunSupersedesEarlierResults(t *testing.T) {// The next DONE, here with no findings, supersedes the rest and resolves// the reopened result again.complete("default", store.ReviewRunTypeRule, storepb.ReviewRun_DONE)+ completions = listReviewRunCompletions(t, fixture, "default")+ require.Equal(t, reviewRunCompletion{RunType: storepb.ReviewRun_RULE, Attempt: 3, Superseded: 1}, completions[len(completions)-1],+ "only the current result counts as superseded")final, _ := listSupersession(t, fixture, "default")require.Equal(t, []supersession{{Comment: "ai", ThreadState: "OPEN"},diff --git a/backend/tests/review_run_lifecycle_test.go b/backend/tests/review_run_lifecycle_test.goindex 929caf0b17..134c9a3aba 100644--- a/backend/tests/review_run_lifecycle_test.go+++ b/backend/tests/review_run_lifecycle_test.go@@ -14,6 +14,7 @@ import ("time""connectrpc.com/connect"+ "github.com/google/uuid""github.com/stretchr/testify/require""google.golang.org/protobuf/types/known/fieldmaskpb"@@ -347,3 +348,168 @@ func setStoredAISQLReviewEnabled(ctx context.Context, t *testing.T, ctl *controlrequire.NoError(t, err)require.Equal(t, int64(1), affected)}++// TestRuleReviewKeepsThreadsAcrossRuns drives the rule review through a re-run+// and two SQL edits: a finding reported again keeps its thread, a person's+// resolution included, and is not posted twice; a finding the SQL no longer+// has is superseded; an edited statement is judged anew.+func TestRuleReviewKeepsThreadsAcrossRuns(t *testing.T) {+ t.Parallel()+ a := require.New(t)+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)+ defer cancel()+ ctl, ctx := startWorkspace(ctx, t, func(p *component.Profile) { p.SQLReviewV2 = true })+ database := ctl.createTestPostgreSQLDatabase(ctx, t)++ createSheet := func(statement string) string {+ sheet, err := ctl.sheetServiceClient.CreateSheet(ctx, connect.NewRequest(&v1pb.CreateSheetRequest{+ Parent: ctl.project.Name,+ Sheet: &v1pb.Sheet{Content: []byte(statement)},+ }))+ a.NoError(err)+ return sheet.Msg.Name+ }+ specID := uuid.NewString()+ spec := func(sheet string) []*v1pb.Plan_Spec {+ return []*v1pb.Plan_Spec{{+ Id: specID,+ Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{+ ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{Targets: []string{database.Name}, Sheet: sheet},+ },+ }}+ }+ plan, err := ctl.planServiceClient.CreatePlan(ctx, connect.NewRequest(&v1pb.CreatePlanRequest{+ Parent: ctl.project.Name,+ Plan: &v1pb.Plan{Specs: spec(createSheet("DROP TABLE IF EXISTS keep_a;\nDROP TABLE IF EXISTS keep_b;"))},+ }))+ a.NoError(err)+ issue, err := ctl.issueServiceClient.CreateIssue(ctx, connect.NewRequest(&v1pb.CreateIssueRequest{+ Parent: ctl.project.Name,+ Issue: &v1pb.Issue{Title: "Review across runs", Type: v1pb.Issue_DATABASE_CHANGE, Plan: plan.Msg.Name},+ }))+ a.NoError(err)+ projectID, issueUID, err := common.GetProjectIDIssueUID(issue.Msg.Name)+ a.NoError(err)++ waitAttempt := func(attempt int64) {+ t.Helper()+ a.Eventually(func() bool {+ for _, r := range listReviewRuns(ctx, t, ctl, projectID) {+ if r.IssueID == issueUID && r.Type == "RULE" && r.Attempt == attempt && (r.Status == "DONE" || r.Status == "FAILED") {+ a.Equal("DONE", r.Status, "payload %s", r.Payload)+ return true+ }+ }+ return false+ }, 90*time.Second, 500*time.Millisecond, "rule review attempt %d should finish", attempt)+ }+ // The DROP findings, by thread name.+ drops := func() map[string]*v1pb.IssueComment {+ t.Helper()+ resp, err := ctl.issueServiceClient.ListIssueComments(ctx, connect.NewRequest(&v1pb.ListIssueCommentsRequest{Parent: issue.Msg.Name}))+ a.NoError(err)+ out := make(map[string]*v1pb.IssueComment)+ for _, comment := range resp.Msg.IssueComments {+ if comment.GetReviewMetadata().GetRuleType() == v1pb.ReviewRuleType_DISALLOW_DROP_OBJECT {+ out[comment.Name] = comment+ }+ }+ return out+ }+ // The rule review's latest completion event.+ lastCompletion := func() *v1pb.IssueComment_ReviewRunCompletion {+ t.Helper()+ resp, err := ctl.issueServiceClient.ListIssueComments(ctx, connect.NewRequest(&v1pb.ListIssueCommentsRequest{Parent: issue.Msg.Name}))+ a.NoError(err)+ var last *v1pb.IssueComment_ReviewRunCompletion+ for _, comment := range resp.Msg.IssueComments {+ if completion := comment.GetReviewRunCompletion(); completion.GetRunType() == v1pb.ReviewRun_RULE {+ a.Empty(comment.Creator)+ last = completion+ }+ }+ a.NotNil(last)+ return last+ }+ counts := func(c *v1pb.IssueComment_ReviewRunCompletion) []int64 {+ return []int64{c.GetAttempt(), int64(c.GetPostedCount()), int64(c.GetKeptCount()), int64(c.GetSupersededCount())}+ }+ about := func(threads map[string]*v1pb.IssueComment, table string) []*v1pb.IssueComment {+ var out []*v1pb.IssueComment+ for _, thread := range threads {+ if strings.Contains(thread.Comment, table) {+ out = append(out, thread)+ }+ }+ return out+ }+ updateSQL := func(statement string) string {+ t.Helper()+ sheet := createSheet(statement)+ _, err := ctl.planServiceClient.UpdatePlan(ctx, connect.NewRequest(&v1pb.UpdatePlanRequest{+ Plan: &v1pb.Plan{Name: plan.Msg.Name, Specs: spec(sheet)},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"specs"}},+ }))+ a.NoError(err)+ return sheet+ }++ waitAttempt(0)+ a.Equal([]int64{0, 2, 0, 0}, counts(lastCompletion()), "attempt, posted, kept, superseded")+ first := drops()+ a.Len(first, 2, "%v", first)+ a.Len(about(first, "keep_a"), 1)+ a.Len(about(first, "keep_b"), 1)+ threadA, threadB := about(first, "keep_a")[0], about(first, "keep_b")[0]+ _, err = ctl.issueServiceClient.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{+ Parent: issue.Msg.Name,+ IssueComment: &v1pb.IssueComment{Name: threadB.Name, ThreadState: new(v1pb.IssueComment_RESOLVED)},+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"thread_state"}},+ }))+ a.NoError(err)++ // A re-run on the same SQL posts nothing and keeps the person's resolution.+ _, err = runReview(ctx, ctl, issue.Msg.Name, "rule")+ a.NoError(err)+ waitAttempt(1)+ a.Equal([]int64{1, 0, 2, 0}, counts(lastCompletion()))+ second := drops()+ a.Len(second, 2, "%v", second)+ a.Equal(v1pb.IssueComment_OPEN, second[threadA.Name].GetThreadState())+ a.Equal(v1pb.IssueComment_RESOLVED, second[threadB.Name].GetThreadState())+ a.False(second[threadA.Name].GetReviewMetadata().GetSuperseded())+ a.False(second[threadB.Name].GetReviewMetadata().GetSuperseded())++ // Dropping keep_a and moving keep_b down a line supersedes A and keeps B,+ // which moves with its statement.+ moved := updateSQL("SELECT 1;\nDROP TABLE IF EXISTS keep_b;")+ waitAttempt(2)+ a.Equal([]int64{2, 0, 1, 1}, counts(lastCompletion()))+ third := drops()+ a.Len(third, 2, "%v", third)+ a.Equal(v1pb.IssueComment_RESOLVED, third[threadA.Name].GetThreadState())+ a.True(third[threadA.Name].GetReviewMetadata().GetSuperseded())+ a.Equal(v1pb.IssueComment_RESOLVED, third[threadB.Name].GetThreadState())+ a.False(third[threadB.Name].GetReviewMetadata().GetSuperseded())+ a.True(strings.HasSuffix(moved, "/"+third[threadB.Name].GetStatementAnchor().GetSheetSha256()))+ a.Equal(int32(2), third[threadB.Name].GetStatementAnchor().GetStartPosition().GetLine())++ // Editing B's statement judges it anew.+ _ = updateSQL("SELECT 1;\nDROP TABLE IF EXISTS keep_b CASCADE;")+ waitAttempt(3)+ a.Equal([]int64{3, 1, 0, 1}, counts(lastCompletion()))+ fourth := drops()+ a.Len(fourth, 3, "%v", fourth)+ a.True(fourth[threadB.Name].GetReviewMetadata().GetSuperseded())+ var current []*v1pb.IssueComment+ for _, thread := range about(fourth, "keep_b") {+ if !thread.GetReviewMetadata().GetSuperseded() {+ current = append(current, thread)+ }+ }+ a.Len(current, 1)+ a.NotEqual(threadB.Name, current[0].Name)+ a.Equal(v1pb.IssueComment_OPEN, current[0].GetThreadState())+ a.Equal(int64(3), current[0].GetReviewMetadata().GetAttempt())+ a.Equal(int64(0), fourth[threadB.Name].GetReviewMetadata().GetAttempt())+}diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex a0e249d4ac..7137e2de0f 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1945,12 +1945,6 @@"report": "Statement report","rerun": "Rerun","rerun-all": "Re-run all",- "rerun-all-description_one": "This reruns the plan checks and Standard rules. {{count}} Standard rules finding people resolved will come back as open.",- "rerun-all-description_other": "This reruns the plan checks and Standard rules. {{count}} Standard rules findings people resolved will come back as open.",- "rerun-all-title": "Re-run all checks?",- "rerun-reopens_one": "{{count}} finding people resolved will come back as open and need resolving again.",- "rerun-reopens_other": "{{count}} findings people resolved will come back as open and need resolving again.",- "rerun-rule-title": "Rerun Standard rules?","retry": "Retry","running": "Running","sampled": "a sample of {{count}} of {{total}} databases",@@ -2103,6 +2097,13 @@"n-findings_other": "{{count}} findings","n-hidden-events_one": "{{count}} hidden event","n-hidden-events_other": "{{count}} hidden events",+ "n-new_one": "{{count}} new",+ "n-new_other": "{{count}} new",+ "n-no-longer-found_one": "{{count}} no longer found",+ "n-no-longer-found_other": "{{count}} no longer found",+ "n-still-found_one": "{{count}} still found",+ "n-still-found_other": "{{count}} still found",+ "no-findings": "no findings","reviewed-the-sql": "reviewed the SQL","self": "Activity","show-all": "Show all"diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 3b758a034f..8294faeb6b 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1945,12 +1945,6 @@"report": "Informe de sentencias","rerun": "Volver a ejecutar","rerun-all": "Volver a ejecutar todo",- "rerun-all-description_one": "Se vuelven a ejecutar las comprobaciones del plan y Standard rules. {{count}} hallazgo ya resuelto de Standard rules volverá a quedar abierto.",- "rerun-all-description_other": "Se vuelven a ejecutar las comprobaciones del plan y Standard rules. {{count}} hallazgos ya resueltos de Standard rules volverán a quedar abiertos.",- "rerun-all-title": "¿Volver a ejecutar todas las comprobaciones?",- "rerun-reopens_one": "{{count}} hallazgo ya resuelto volverá a quedar abierto y habrá que resolverlo de nuevo.",- "rerun-reopens_other": "{{count}} hallazgos ya resueltos volverán a quedar abiertos y habrá que resolverlos de nuevo.",- "rerun-rule-title": "¿Volver a ejecutar Standard rules?","retry": "Reintentar","running": "En ejecución","sampled": "una muestra de {{count}} de {{total}} bases de datos",@@ -2103,6 +2097,13 @@"n-findings_other": "{{count}} hallazgos","n-hidden-events_one": "{{count}} evento oculto","n-hidden-events_other": "{{count}} eventos ocultos",+ "n-new_one": "{{count}} nuevo",+ "n-new_other": "{{count}} nuevos",+ "n-no-longer-found_one": "{{count}} ya no aparece",+ "n-no-longer-found_other": "{{count}} ya no aparecen",+ "n-still-found_one": "{{count}} sigue presente",+ "n-still-found_other": "{{count}} siguen presentes",+ "no-findings": "sin hallazgos","reviewed-the-sql": "revisó el SQL","self": "Actividad","show-all": "Mostrar todo"diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 338ac66c28..30f9c443ab 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1945,12 +1945,6 @@"report": "ステートメントレポート","rerun": "再実行","rerun-all": "すべて再実行",- "rerun-all-description_one": "プランチェックと Standard rules を再実行します。Standard rules の解決済みの検出事項 {{count}} 件が未解決に戻ります。",- "rerun-all-description_other": "プランチェックと Standard rules を再実行します。Standard rules の解決済みの検出事項 {{count}} 件が未解決に戻ります。",- "rerun-all-title": "すべて再実行しますか?",- "rerun-reopens_one": "解決済みの検出事項 {{count}} 件が未解決に戻り、再度対応が必要になります。",- "rerun-reopens_other": "解決済みの検出事項 {{count}} 件が未解決に戻り、再度対応が必要になります。",- "rerun-rule-title": "Standard rules を再実行しますか?","retry": "再試行","running": "実行中","sampled": "{{total}} 個中 {{count}} 個のデータベースを抽出",@@ -2103,6 +2097,13 @@"n-findings_other": "検出事項 {{count}} 件","n-hidden-events_one": "{{count}} 件の非表示イベント","n-hidden-events_other": "{{count}} 件の非表示イベント",+ "n-new_one": "新規 {{count}} 件",+ "n-new_other": "新規 {{count}} 件",+ "n-no-longer-found_one": "解消 {{count}} 件",+ "n-no-longer-found_other": "解消 {{count}} 件",+ "n-still-found_one": "継続 {{count}} 件",+ "n-still-found_other": "継続 {{count}} 件",+ "no-findings": "検出事項なし","reviewed-the-sql": "が SQL をレビューしました","self": "アクティビティ","show-all": "すべて表示"diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 4d6920a7bc..3c7501ad64 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -1945,12 +1945,6 @@"report": "Báo cáo câu lệnh","rerun": "Chạy lại","rerun-all": "Chạy lại tất cả",- "rerun-all-description_one": "Thao tác này chạy lại kiểm tra kế hoạch và Standard rules. {{count}} phát hiện đã được giải quyết của Standard rules sẽ mở lại.",- "rerun-all-description_other": "Thao tác này chạy lại kiểm tra kế hoạch và Standard rules. {{count}} phát hiện đã được giải quyết của Standard rules sẽ mở lại.",- "rerun-all-title": "Chạy lại tất cả kiểm tra?",- "rerun-reopens_one": "{{count}} phát hiện đã được giải quyết sẽ mở lại và cần giải quyết lại.",- "rerun-reopens_other": "{{count}} phát hiện đã được giải quyết sẽ mở lại và cần giải quyết lại.",- "rerun-rule-title": "Chạy lại Standard rules?","retry": "Thử lại","running": "Đang chạy","sampled": "lấy mẫu {{count}}/{{total}} cơ sở dữ liệu",@@ -2103,6 +2097,13 @@"n-findings_other": "{{count}} phát hiện","n-hidden-events_one": "{{count}} sự kiện ẩn","n-hidden-events_other": "{{count}} sự kiện ẩn",+ "n-new_one": "{{count}} mới",+ "n-new_other": "{{count}} mới",+ "n-no-longer-found_one": "{{count}} không còn",+ "n-no-longer-found_other": "{{count}} không còn",+ "n-still-found_one": "{{count}} vẫn còn",+ "n-still-found_other": "{{count}} vẫn còn",+ "no-findings": "không có phát hiện","reviewed-the-sql": "đã đánh giá SQL","self": "Hoạt động","show-all": "Hiển thị tất cả"diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex d303a5ec06..dfc6f74e77 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1945,12 +1945,6 @@"report": "语句报告","rerun": "重新运行","rerun-all": "全部重新运行",- "rerun-all-description_one": "这会重新运行计划检查和 Standard rules。Standard rules 中已被解决的 {{count}} 项问题会重新变为待处理。",- "rerun-all-description_other": "这会重新运行计划检查和 Standard rules。Standard rules 中已被解决的 {{count}} 项问题会重新变为待处理。",- "rerun-all-title": "全部重新运行?",- "rerun-reopens_one": "已被解决的 {{count}} 项问题会重新变为待处理,需要再次处理。",- "rerun-reopens_other": "已被解决的 {{count}} 项问题会重新变为待处理,需要再次处理。",- "rerun-rule-title": "重新运行 Standard rules?","retry": "重试","running": "运行中","sampled": "抽样 {{count}}/{{total}} 个数据库",@@ -2103,6 +2097,13 @@"n-findings_other": "{{count}} 个发现","n-hidden-events_one": "{{count}} 条隐藏活动","n-hidden-events_other": "{{count}} 条隐藏活动",+ "n-new_one": "{{count}} 个新发现",+ "n-new_other": "{{count}} 个新发现",+ "n-no-longer-found_one": "{{count}} 个已不存在",+ "n-no-longer-found_other": "{{count}} 个已不存在",+ "n-still-found_one": "{{count}} 个仍存在",+ "n-still-found_other": "{{count}} 个仍存在",+ "no-findings": "没有发现","reviewed-the-sql": "审核了 SQL","self": "活动","show-all": "显示全部"diff --git a/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.test.tsx b/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.test.tsxindex 819b246a7d..72f8330253 100644--- a/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.test.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.test.tsx@@ -388,27 +388,17 @@ describe("AutomatedReviewSection", () => {expect(mocks.runReview).toHaveBeenCalledOnce();});- test("a rerun that would reopen resolved findings asks first", async () => {+ test("a rerun keeps resolved findings, so it does not ask", async () => {renderSection([row("rule", "open", findings({ open: 1, p1: 1, resolved: 1, overridden: 1 })),]);- fireEvent.click(- screen.getByRole("button", { name: /plan.automated-review.rerun/ })- );- expect(mocks.runReview).not.toHaveBeenCalled();- expect(- screen.getByText("plan.automated-review.rerun-rule-title")- ).toBeDefined();- expect(- screen.getByText("plan.automated-review.rerun-reopens:2")- ).toBeDefined();- const confirm = screen- .getAllByRole("button", { name: "plan.automated-review.rerun" })- .at(-1);await act(async () => {- fireEvent.click(confirm!);+ fireEvent.click(+ screen.getByRole("button", { name: /plan.automated-review.rerun/ })+ );});expect(mocks.runReview).toHaveBeenCalledOnce();+ expect(screen.queryByRole("dialog")).toBeNull();});test("shows a failed run's error in full", () => {@@ -448,19 +438,13 @@ describe("AutomatedReviewSection", () => {expect(aiState.runReview).toHaveBeenCalledOnce();});- test("Re-run all asks first when it would reopen resolved rule findings", async () => {+ test("Re-run all reruns the checks and the rule review without asking", async () => {renderSection([row("rule", "resolved", findings({ resolved: 3 }))]);fireEvent.click(screen.getByRole("button", { name: "common.more" }));- fireEvent.click(await screen.findByText("plan.automated-review.rerun-all"));- expect(mocks.runChecks).not.toHaveBeenCalled();- expect(- screen.getByText("plan.automated-review.rerun-all-description:3")- ).toBeDefined();- const confirm = screen- .getAllByRole("button", { name: "plan.automated-review.rerun-all" })- .at(-1);await act(async () => {- fireEvent.click(confirm!);+ fireEvent.click(+ await screen.findByText("plan.automated-review.rerun-all")+ );});expect(mocks.runChecks).toHaveBeenCalledOnce();expect(mocks.reload).toHaveBeenCalledOnce();diff --git a/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.tsx b/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.tsxindex e573da161d..513c63c48c 100644--- a/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/AutomatedReviewSection.tsx@@ -70,7 +70,6 @@ import {type FindingGroup,type FindingPriority,findingTitle,- resolvedByPeople,rowNeedsAttention,} from "../../utils/planGates";import { openFindingsLabel, reviewerLabel } from "../../utils/reviewLabels";@@ -107,20 +106,12 @@ export function AutomatedReviewSection({ state }: { state: PlanReviewState }) {const { rows } = state;const attention = rows.filter(rowNeedsAttention).length;const [checksDrawerOpen, setChecksDrawerOpen] = useState(false);- const [confirmChecks, setConfirmChecks] = useState(false);- const ruleRow = rows.find((row) => row.reviewer === "rule");- const ruleResolved = ruleRow ? resolvedByPeople(ruleRow.findings) : 0;-- // Running the checks also starts the rule review on the server, which- // posts its findings again and reopens what people resolved.+ // Running the checks also starts the rule review on the server.const rerunAll = async () => {await runChecks();await ruleReview?.reload();};- const requestRerunChecks = () => {- if (ruleResolved > 0) setConfirmChecks(true);- else void rerunAll();- };+ const requestRerunChecks = () => void rerunAll();if (rows.length === 0) return null;@@ -196,16 +187,6 @@ export function AutomatedReviewSection({ state }: { state: PlanReviewState }) {open={checksDrawerOpen}planCheckRuns={page.planCheckRuns}/>- <RerunConfirmDialog- confirmLabel={t("plan.automated-review.rerun-all")}- description={t("plan.automated-review.rerun-all-description", {- count: ruleResolved,- })}- onConfirm={() => void rerunAll()}- onOpenChange={setConfirmChecks}- open={confirmChecks}- title={t("plan.automated-review.rerun-all-title")}- /></div>);}@@ -274,7 +255,7 @@ function ReviewerRow({const comments = useAppStore((s) =>page.issue ? s.getIssueComments(page.issue.name) : NO_COMMENTS);- const [confirm, setConfirm] = useState<"rule" | "ai">();+ const [confirmAI, setConfirmAI] = useState(false);const rowRef = useRef<HTMLDivElement>(null);// Activity's "Show" brings this row into view.@@ -329,17 +310,12 @@ function ReviewerRow({row.conclusion !== "running" &&row.conclusion !== "loading") {- // A rerun posts the findings again, reopening what people resolved.- const start = () => {- if (resolvedByPeople(row.findings) > 0) setConfirm("rule");- else void rerunRule.run();- };actions.push(<RunButtonconclusion={row.conclusion}disabled={rerunRule.disabled}key="run"- onClick={start}+ onClick={() => void rerunRule.run()}/>);}@@ -363,7 +339,7 @@ function ReviewerRow({conclusion={settled ? "passed" : row.conclusion}disabled={!ai.canStart}label={settled ? undefined : t("plan.ai-review.run")}- onClick={() => (settled ? setConfirm("ai") : void ai.runReview())}+ onClick={() => (settled ? setConfirmAI(true) : void ai.runReview())}/></Tooltip>);@@ -426,24 +402,12 @@ function ReviewerRow({)}<RerunConfirmDialogconfirmLabel={t("plan.automated-review.rerun")}- description={- confirm === "ai"- ? t("plan.ai-review.run-again-description")- : t("plan.automated-review.rerun-reopens", {- count: resolvedByPeople(row.findings),- })- }- disabled={confirm === "ai" ? !ai.canStart : rerunRule.disabled}- onConfirm={() =>- confirm === "ai" ? void ai.runReview() : void rerunRule.run()- }- onOpenChange={(open) => !open && setConfirm(undefined)}- open={confirm !== undefined}- title={- confirm === "ai"- ? t("plan.ai-review.run-again-title")- : t("plan.automated-review.rerun-rule-title")- }+ description={t("plan.ai-review.run-again-description")}+ disabled={!ai.canStart}+ onConfirm={() => void ai.runReview()}+ onOpenChange={setConfirmAI}+ open={confirmAI}+ title={t("plan.ai-review.run-again-title")}/></div>);diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsxindex c21645e90c..d94a55ddd0 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsx@@ -7,6 +7,7 @@ import { shownTimestampModes } from "@/test-utils/humanizeTs";import { PositionSchema } from "@/types/proto-es/v1/common_pb";import {IssueComment_ReviewMetadataSchema,+ IssueComment_ReviewRunCompletionSchema,IssueComment_ReviewSubmissionSchema,IssueComment_ThreadState,IssueCommentSchema,@@ -315,7 +316,28 @@ describe("ReviewActivityTimeline", () => {}),],});- const finding = (id: string, ms: number, superseded: boolean) =>+ const completion = (+ id: string,+ attempt: bigint,+ counts: { postedCount?: number; keptCount?: number; supersededCount?: number }+ ) =>+ create(IssueCommentSchema, {+ name: `projects/p1/issues/1/issueComments/${id}`,+ event: {+ case: "reviewRunCompletion",+ value: create(IssueComment_ReviewRunCompletionSchema, {+ runType: ReviewRun_Type.RULE,+ attempt,+ ...counts,+ }),+ },+ });+ const finding = (+ id: string,+ ms: number,+ superseded: boolean,+ attempt: bigint+ ) =>create(IssueCommentSchema, {name: `projects/p1/issues/1/issueComments/${id}`,comment: "No WHERE clause",@@ -332,6 +354,7 @@ describe("ReviewActivityTimeline", () => {reviewMetadata: create(IssueComment_ReviewMetadataSchema, {runType: ReviewRun_Type.RULE,superseded,+ attempt,}),});const container = document.createElement("div");@@ -339,7 +362,13 @@ describe("ReviewActivityTimeline", () => {act(() => {root.render(<ReviewActivityTimeline- comments={[finding("old", 0, true), finding("new", 60_000, false)]}+ comments={[+ completion("c0", 0n, { postedCount: 1 }),+ finding("old", 0, true, 0n),+ completion("c1", 1n, { postedCount: 1, supersededCount: 1 }),+ finding("new", 60_000, false, 1n),+ completion("c2", 2n, { keptCount: 1 }),+ ]}issue={create(IssueSchema, { name: "projects/p1/issues/1" })}plan={plan}/>@@ -352,10 +381,17 @@ describe("ReviewActivityTimeline", () => {const runButtons = () =>[...container.querySelectorAll("button[aria-expanded]")];expect(cards()).toEqual(["new"]);+ // The run that found nothing new has its line but nothing to show.expect(runButtons().map((button) => button.textContent)).toEqual(["common.show","common.hide",]);+ const text = container.textContent ?? "";+ expect(text).toContain("plan.review.activity.n-findings");+ expect(text).toContain("plan.review.activity.n-no-longer-found");+ expect(text).toContain("plan.review.activity.n-still-found");+ // The re-run posted an open finding, but its line counts only changes.+ expect(text).not.toContain("plan.automated-review.n-open");act(() => (runButtons()[0] as HTMLButtonElement).click());expect(cards()).toEqual(["old", "new"]);diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsxindex ff8bc847a9..e5e7e15be9 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx@@ -351,8 +351,8 @@ function ActivityRow({);}-// One line per run: how many findings it posted and how many are still open.-// "Show" opens the run's finding cards below it.+// One line per completed run: what it found. "Show" opens the cards of the+// findings it posted below it.function ReviewRunActivityRow({isLast,onToggle,@@ -363,46 +363,70 @@ function ReviewRunActivityRow({source: Extract<TimelineSource, { type: "review-run" }>;}) {const { t } = useTranslation();- const open = source.findings.filter(- (finding) => finding.threadState === IssueComment_ThreadState.OPEN- ).length;+ const { runType, postedCount, keptCount, supersededCount } =+ source.completion;+ // A run with nothing earlier to compare reads as a first review, with how+ // many of its findings are still open. A later one says only what changed:+ // an open count beside "still found" would read as covering those too.+ const firstReview = keptCount === 0 && supersededCount === 0;+ const open = firstReview+ ? source.findings.filter(+ (finding) => finding.threadState === IssueComment_ThreadState.OPEN+ ).length+ : 0;+ const summary = firstReview+ ? [+ postedCount === 0+ ? t("plan.review.activity.no-findings")+ : t("plan.review.activity.n-findings", { count: postedCount }),+ ]+ : [+ postedCount > 0 &&+ t("plan.review.activity.n-new", { count: postedCount }),+ keptCount > 0 &&+ t("plan.review.activity.n-still-found", { count: keptCount }),+ supersededCount > 0 &&+ t("plan.review.activity.n-no-longer-found", {+ count: supersededCount,+ }),+ ].filter((part) => part !== false);+ if (open > 0)+ summary.push(t("plan.automated-review.n-open", { count: open }));return (<ActivityRowShellheader={<><span className="font-medium text-main">- {reviewerName(t, source.runType)}+ {reviewerName(t, runType)}</span><span className="wrap-break-word min-w-0 text-control-light">{t("plan.review.activity.reviewed-the-sql")}</span><span className="text-control-light">·</span><span className="text-control">- {t("plan.review.activity.n-findings", {- count: source.findings.length,- })}- {open > 0 &&- `, ${t("plan.automated-review.n-open", { count: open })}`}+ {summary.join(t("plan.findings.separator"))}</span><HumanizeTsclassName="text-xs text-control-light"tsMs={getTimeForPbTimestampProtoEs(source.time)}/>- <Button- aria-expanded={source.open}- appearance="link"- className="text-control-light"- onClick={onToggle}- size="xs"- >- {source.open ? t("common.hide") : t("common.show")}- </Button>+ {source.findings.length > 0 && (+ <Button+ aria-expanded={source.open}+ appearance="link"+ className="text-control-light"+ onClick={onToggle}+ size="xs"+ >+ {source.open ? t("common.hide") : t("common.show")}+ </Button>+ )}</>}icon={<CommentIconBadgeclassName="bg-control-bg text-control"- icon={<ReviewerIcon className="size-4" runType={source.runType} />}+ icon={<ReviewerIcon className="size-4" runType={runType} />}/>}isLast={isLast}diff --git a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.ts b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.tsindex c1cfe60896..0cc238201c 100644--- a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.ts+++ b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.ts@@ -5,6 +5,7 @@ import { describe, expect, test } from "vitest";import {IssueComment_Approval_Status,IssueComment_ReviewMetadataSchema,+ IssueComment_ReviewRunCompletionSchema,IssueComment_ReviewSubmissionSchema,IssueComment_ThreadState,IssueCommentSchema,@@ -106,95 +107,138 @@ describe("buildTimelineEntries", () => {const finding = (name: string,runType: ReviewRun_Type,- superseded: boolean,- seconds: bigint,- nanos = 0+ attempt: bigint,+ superseded = false) =>create(IssueCommentSchema, {name,threadState: superseded? IssueComment_ThreadState.RESOLVED: IssueComment_ThreadState.OPEN,- createTime: create(TimestampSchema, { seconds, nanos }),reviewMetadata: create(IssueComment_ReviewMetadataSchema, {runType,+ attempt,superseded,}),});+ const completion = (+ name: string,+ runType: ReviewRun_Type,+ attempt: bigint,+ postedCount = 0+ ) =>+ create(IssueCommentSchema, {+ name,+ event: {+ case: "reviewRunCompletion",+ value: create(IssueComment_ReviewRunCompletionSchema, {+ runType,+ attempt,+ postedCount,+ }),+ },+ });const rowsOf = (entries: TimelineEntry[]) =>entries.map((entry) =>entry.source.type === "review-run"- ? `run:${entry.source.findings.map((f) => f.name).join("+")}`+ ? `run${entry.source.completion.attempt}:${entry.source.findings.map((f) => f.name).join("+")}`: entry.id);- test("opens each reviewer's latest run and folds a superseded one to the cards asked for", () => {+ test("puts each run's findings under its completion, by reviewer and attempt", () => {const entries = buildTimelineEntries({comments: [- finding("r1", ReviewRun_Type.RULE, true, 10n, 0),- finding("r2", ReviewRun_Type.RULE, true, 10n, 1000),+ completion("c-r0", ReviewRun_Type.RULE, 0n, 2),+ finding("r1", ReviewRun_Type.RULE, 0n),+ finding("r2", ReviewRun_Type.RULE, 0n),+ completion("c-a0", ReviewRun_Type.AI, 0n, 1),+ finding("a1", ReviewRun_Type.AI, 0n),userComment("u", "hello"),- finding("r3", ReviewRun_Type.RULE, false, 60n),- finding("a1", ReviewRun_Type.AI, false, 61n),+ completion("c-r1", ReviewRun_Type.RULE, 1n, 1),+ finding("r3", ReviewRun_Type.RULE, 1n),],- keepFindingCard: (root) => root.name === "r2",+ keepFindingCard: () => false,});expect(rowsOf(entries)).toEqual([- "run:r1+r2",+ "run0:r1+r2",+ "r1","r2",+ "run0:a1",+ "a1","u",- "run:r3",+ "run1:r3","r3",- "run:a1",- "a1",]);});- test("a toggle opens a superseded run and folds the latest one", () => {+ test("a run that found nothing new still gets its line", () => {const entries = buildTimelineEntries({comments: [- finding("r1", ReviewRun_Type.RULE, true, 10n),- finding("r2", ReviewRun_Type.RULE, false, 60n),+ completion("c-r0", ReviewRun_Type.RULE, 0n, 1),+ finding("kept", ReviewRun_Type.RULE, 0n),+ completion("c-r1", ReviewRun_Type.RULE, 1n),],keepFindingCard: () => false,- runToggles: new Map([- ["review-run:r1", true],- ["review-run:r2", false],- ]),});- expect(rowsOf(entries)).toEqual(["run:r1", "r1", "run:r2"]);+ expect(rowsOf(entries)).toEqual(["run0:kept", "kept", "run1:"]);+ expect(entries.at(-1)?.pinned).toBe(false);});- test("pins an open run's line and cards, apart from a superseded run a second before", () => {+ test("opens a run while any of its findings is current, else folds it to the cards asked for", () => {const entries = buildTimelineEntries({comments: [- finding("old-1", ReviewRun_Type.RULE, true, 10n),- finding("old-2", ReviewRun_Type.RULE, true, 10n),- finding("new-1", ReviewRun_Type.RULE, false, 11n),- finding("new-2", ReviewRun_Type.RULE, false, 11n),+ completion("c-r0", ReviewRun_Type.RULE, 0n, 2),+ finding("kept", ReviewRun_Type.RULE, 0n),+ finding("fixed", ReviewRun_Type.RULE, 0n, true),+ completion("c-r1", ReviewRun_Type.RULE, 1n, 2),+ finding("gone", ReviewRun_Type.RULE, 1n, true),+ finding("discussed", ReviewRun_Type.RULE, 1n, true),],- keepFindingCard: () => false,+ keepFindingCard: (root) => root.name === "discussed",});- expect(entries.map((entry) => [entry.id, Boolean(entry.pinned)])).toEqual([- ["review-run:old-1", false],- ["review-run:new-1", true],- ["new-1", true],- ["new-2", true],+ expect(+ entries.map((entry) => [rowsOf([entry])[0], Boolean(entry.pinned)])+ ).toEqual([+ ["run0:kept+fixed", true],+ ["kept", true],+ ["fixed", true],+ ["run1:gone+discussed", false],+ ["discussed", false],]);});- test("without the log, every finding stays its own entry", () => {+ test("a toggle opens a folded run and folds an open one", () => {const entries = buildTimelineEntries({comments: [- create(IssueCommentSchema, {- name: "r1",- threadState: IssueComment_ThreadState.OPEN,- reviewMetadata: create(IssueComment_ReviewMetadataSchema, {- runType: ReviewRun_Type.RULE,- }),- }),+ completion("c-r0", ReviewRun_Type.RULE, 0n, 1),+ finding("r1", ReviewRun_Type.RULE, 0n, true),+ completion("c-r1", ReviewRun_Type.RULE, 1n, 1),+ finding("r2", ReviewRun_Type.RULE, 1n),+ ],+ keepFindingCard: () => false,+ runToggles: new Map([+ ["review-run:c-r0", true],+ ["review-run:c-r1", false],+ ]),+ });+ expect(rowsOf(entries)).toEqual(["run0:r1", "r1", "run1:r2"]);+ });++ test("a finding whose run left no completion stays its own entry", () => {+ const entries = buildTimelineEntries({+ comments: [finding("orphan", ReviewRun_Type.RULE, 0n)],+ keepFindingCard: () => false,+ });+ expect(rowsOf(entries)).toEqual(["orphan"]);+ });++ test("without the log, every finding stays its own entry and completions are left out", () => {+ const entries = buildTimelineEntries({+ comments: [+ completion("c-r0", ReviewRun_Type.RULE, 0n, 1),+ finding("r1", ReviewRun_Type.RULE, 0n),],});- expect(entries.map((entry) => entry.source.type)).toEqual(["comment"]);+ expect(entries.map((entry) => entry.id)).toEqual(["r1"]);});});diff --git a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.ts b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.tsindex eaf483b92d..21ab2927fe 100644--- a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.ts+++ b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.ts@@ -4,9 +4,9 @@// so no weight/tier is stored here. Plan check results are never entries.import type { Timestamp } from "@bufbuild/protobuf/wkt";import { isThreadReply, isThreadRoot } from "@/stores/app/issueComment";-import { getTimeForPbTimestampProtoEs } from "@/types";import type {IssueComment,+ IssueComment_ReviewRunCompletion,ReviewRun_Type,} from "@/types/proto-es/v1/issue_service_pb";@@ -14,17 +14,18 @@ export type TimelineSource =| { type: "plan-created"; creator: string; time?: Timestamp }| { type: "ready-for-review"; creator: string; time?: Timestamp }| { type: "comment"; comment: IssueComment }- // One line for a reviewer's run, which opens to the findings it posted.+ // One line for a reviewer's completed run, which opens to the findings it+ // posted.| {type: "review-run";- runType: ReviewRun_Type;+ completion: IssueComment_ReviewRunCompletion;time?: Timestamp;findings: IssueComment[];open: boolean;};-// A run posts its findings in one batch, a microsecond apart.-const RUN_BATCH_GAP_MS = 1000;+const runKey = (runType: ReviewRun_Type, attempt: bigint) =>+ `${runType}/${attempt}`;export interface TimelineEntry {id: string;@@ -45,11 +46,11 @@ export function buildTimelineEntries(input: {issueCreateTime?: Timestamp;issueDraft?: boolean;comments: IssueComment[];- // Under SQL Review V2, findings become one line per run. An open run shows- // every finding's card; a folded one only those this keeps.+ // Under SQL Review V2, findings become one line per completed run. An open+ // run shows every finding's card; a folded one only those this keeps.keepFindingCard?: (root: IssueComment) => boolean;// Runs someone opened or folded, by entry id. The rest follow the default:- // only each reviewer's latest run is open.+ // only the runs with a finding still current are open.runToggles?: ReadonlyMap<string, boolean>;}): TimelineEntry[] {const reviewSubmission = input.comments.find(@@ -76,14 +77,22 @@ export function buildTimelineEntries(input: {},});}- const runs = new Map<- ReviewRun_Type,- {- at: number;- latest: boolean;- source: Extract<TimelineSource, { type: "review-run" }>;+ // A run's findings follow its completion. A finding a later run reports+ // again keeps its thread, so stays with the run that posted it.+ const findingsByRun = new Map<string, IssueComment[]>();+ const completedRuns = new Set<string>();+ for (const comment of input.comments) {+ const review = comment.reviewMetadata;+ if (review && isThreadRoot(comment)) {+ const key = runKey(review.runType, review.attempt);+ const findings = findingsByRun.get(key);+ if (findings) findings.push(comment);+ else findingsByRun.set(key, [comment]);+ } else if (comment.event.case === "reviewRunCompletion") {+ const { runType, attempt } = comment.event.value;+ completedRuns.add(runKey(runType, attempt));}- >();+ }for (const comment of input.comments) {// Replies render inside their thread's entry, never as their own row.if (isThreadReply(comment)) continue;@@ -100,39 +109,42 @@ export function buildTimelineEntries(input: {}continue;}- const review = comment.reviewMetadata;- if (input.keepFindingCard && review && isThreadRoot(comment)) {- // A completed run supersedes every earlier result of its reviewer, so- // the results still current are the latest run's, and a run's results- // are never split between the two.- const latest = !review.superseded;- const time = getTimeForPbTimestampProtoEs(comment.createTime, 0);- let run = runs.get(review.runType);- if (run && run.latest === latest && time - run.at <= RUN_BATCH_GAP_MS) {- run.source.findings.push(comment);- run.at = time;- } else {- const id = `review-run:${comment.name}`;- run = {- at: time,- latest,- source: {- type: "review-run",- runType: review.runType,- time: comment.createTime,- findings: [comment],- open: input.runToggles?.get(id) ?? latest,- },- };- runs.set(review.runType, run);- entries.push({ id, source: run.source, pinned: run.source.open });- }- if (!run.source.open && !input.keepFindingCard(comment)) continue;+ if (comment.event.case === "reviewRunCompletion") {+ if (!input.keepFindingCard) continue;+ const completion = comment.event.value;+ const findings =+ findingsByRun.get(runKey(completion.runType, completion.attempt)) ?? [];+ const id = `review-run:${comment.name}`;+ const open =+ input.runToggles?.get(id) ??+ findings.some((finding) => !finding.reviewMetadata?.superseded);entries.push({- id: comment.name,- source: { type: "comment", comment },- pinned: run.source.open,+ id,+ source: {+ type: "review-run",+ completion,+ time: comment.createTime,+ findings,+ open,+ },+ pinned: open,});+ for (const finding of findings) {+ if (!open && !input.keepFindingCard(finding)) continue;+ entries.push({+ id: finding.name,+ source: { type: "comment", comment: finding },+ pinned: open,+ });+ }+ continue;+ }+ const review = comment.reviewMetadata;+ if (+ input.keepFindingCard &&+ review &&+ completedRuns.has(runKey(review.runType, review.attempt))+ ) {continue;}entries.push({ id: comment.name, source: { type: "comment", comment } });diff --git a/frontend/src/routes/project/plan-detail/utils/planGates.ts b/frontend/src/routes/project/plan-detail/utils/planGates.tsindex 00b4c0d3eb..db8bd2b1e6 100644--- a/frontend/src/routes/project/plan-detail/utils/planGates.ts+++ b/frontend/src/routes/project/plan-detail/utils/planGates.ts@@ -48,11 +48,11 @@ export type ReviewConclusion =// must change, P1 that a person must accept a real risk, P2 is advice.export type FindingPriority = "p0" | "p1" | "p2";-// Where a finding stands: open findings by priority, and the latest run's-// resolved findings, where a P0 resolved without a change stands apart. A-// run supersedes and resolves everything its reviewer posted before, so a-// resolved finding of the latest run was resolved by a person on the-// current SQL.+// Where a finding stands: open findings by priority, and the resolved+// findings still current, where a P0 resolved without a change stands apart.+// A run supersedes and resolves every earlier finding of its reviewer it+// does not report again, so a resolved finding still current was resolved by+// a person on SQL the latest run still reports.export type FindingSet =| FindingPriority| "overridden"@@ -144,7 +144,7 @@ const runTypeOf: Record<"rule" | "ai", ReviewRun_Type> = {};// Open findings count whatever run posted them, since any open thread holds-// the rollout; resolved ones count for the latest run only.+// the rollout; resolved ones count while still current.export function countFindings(comments: readonly IssueComment[],reviewer: "rule" | "ai"diff --git a/frontend/src/stores/app/issueComment.ts b/frontend/src/stores/app/issueComment.tsindex 3600559bf8..d1e5b9281e 100644--- a/frontend/src/stores/app/issueComment.ts+++ b/frontend/src/stores/app/issueComment.ts@@ -21,6 +21,7 @@ export enum IssueCommentType {ISSUE_UPDATE = "ISSUE_UPDATE",PLAN_UPDATE = "PLAN_UPDATE",REVIEW_SUBMISSION = "REVIEW_SUBMISSION",+ REVIEW_RUN_COMPLETION = "REVIEW_RUN_COMPLETION",}export const getIssueCommentType = (@@ -34,6 +35,8 @@ export const getIssueCommentType = (return IssueCommentType.PLAN_UPDATE;} else if (issueComment.event?.case === "reviewSubmission") {return IssueCommentType.REVIEW_SUBMISSION;+ } else if (issueComment.event?.case === "reviewRunCompletion") {+ return IssueCommentType.REVIEW_RUN_COMPLETION;}return IssueCommentType.USER_COMMENT;};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.tsindex 643f04721e..8cbe4d7dc6 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@@ -998,8 +998,10 @@ export declare type IssueComment = Message<"bytebase.v1.IssueComment"> & {/*** Optional source context on a root or reply. A reply's anchor must share- * the root's spec and sheet_sha256; it may narrow the range.- * Cannot be set on events. Immutable after creation.+ * the root's spec and sheet_sha256 when created; it may narrow the range.+ * Cannot be set on events. Immutable after creation, except that a later+ * review run reporting a review result again moves the result to its+ * statement in the SQL that run reviewed.** @generated from field: bytebase.v1.StatementAnchor statement_anchor = 16;*/@@ -1050,6 +1052,14 @@ export declare type IssueComment = Message<"bytebase.v1.IssueComment"> & {*/value: IssueComment_ReviewSubmission;case: "reviewSubmission";+ } | {+ /**+ * Review run completion event.+ *+ * @generated from field: bytebase.v1.IssueComment.ReviewRunCompletion review_run_completion = 18;+ */+ value: IssueComment_ReviewRunCompletion;+ case: "reviewRunCompletion";} | { case: undefined; value?: undefined };};@@ -1093,12 +1103,20 @@ export declare type IssueComment_ReviewMetadata = Message<"bytebase.v1.IssueCommtargets: string[];/**- * A later run of the same reviewer has completed, so the result is not- * from the latest review, whatever its thread state.+ * A later run of the same reviewer has completed without reporting the+ * result again, whatever its thread state.** @generated from field: bool superseded = 5;*/superseded: boolean;++ /**+ * The ReviewRunCompletion.attempt of the run that posted the result. A+ * result a later run reports again keeps its thread and its attempt.+ *+ * @generated from field: int64 attempt = 6;+ */+ attempt: bigint;};/**@@ -1273,6 +1291,56 @@ export declare type IssueComment_ReviewSubmission = Message<"bytebase.v1.IssueCo*/export declare const IssueComment_ReviewSubmissionSchema: GenMessage<IssueComment_ReviewSubmission>;+/**+ * A review run completed, and what it did to the results of its reviewer.+ * Posted by the reviewer, with no creator.+ *+ * @generated from message bytebase.v1.IssueComment.ReviewRunCompletion+ */+export declare type IssueComment_ReviewRunCompletion = Message<"bytebase.v1.IssueComment.ReviewRunCompletion"> & {+ /**+ * The reviewer that ran.+ *+ * @generated from field: bytebase.v1.ReviewRun.Type run_type = 1;+ */+ runType: ReviewRun_Type;++ /**+ * Identifies the run among its reviewer's runs on the issue. The results+ * it posted carry the same ReviewMetadata.attempt.+ *+ * @generated from field: int64 attempt = 2;+ */+ attempt: bigint;++ /**+ * Results the run posted as new threads.+ *+ * @generated from field: int32 posted_count = 3;+ */+ postedCount: number;++ /**+ * Earlier results the run reported again, which kept their threads.+ *+ * @generated from field: int32 kept_count = 4;+ */+ keptCount: number;++ /**+ * Earlier results the run no longer reports, now superseded.+ *+ * @generated from field: int32 superseded_count = 5;+ */+ supersededCount: number;+};++/**+ * Describes the message bytebase.v1.IssueComment.ReviewRunCompletion.+ * Use `create(IssueComment_ReviewRunCompletionSchema)` to create a new message.+ */+export declare const IssueComment_ReviewRunCompletionSchema: GenMessage<IssueComment_ReviewRunCompletion>;+/*** Plan update event information (snapshot of plan.config.specs before* and after a PlanService.UpdatePlan call that mutated specs).diff --git a/frontend/src/types/proto-es/v1/issue_service_pb.js b/frontend/src/types/proto-es/v1/issue_service_pb.jsindex 3dc73647e7..b8165ff89e 100644--- a/frontend/src/types/proto-es/v1/issue_service_pb.js+++ b/frontend/src/types/proto-es/v1/issue_service_pb.js@@ -19,7 +19,7 @@ import { file_v1_review_rule } from "./review_rule_pb";* Describes the file v1/issue_service.proto.*/export const file_v1_issue_service = /*@__PURE__*/- fileDesc("ChZ2MS9pc3N1ZV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJKCg9HZXRJc3N1ZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vSXNzdWUSDQoFZm9yY2UYAiABKAgiagoSQ3JlYXRlSXNzdWVSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBImCgVpc3N1ZRgCIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQgPgQQIimQEKEUxpc3RJc3N1ZXNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABK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WJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [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, file_v1_plan_service, file_v1_review_rule]);+ fileDesc("ChZ2MS9pc3N1ZV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJKCg9HZXRJc3N1ZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vSXNzdWUSDQoFZm9yY2UYAiABKAgiagoSQ3JlYXRlSXNzdWVSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBImCgVpc3N1ZRgCIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQgPgQQIimQEKEUxpc3RJc3N1ZXNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkSEAoIb3JkZXJfYnkYBiABKAkiUQoSTGlzdElzc3Vlc1Jlc3BvbnNlEiIKBmlzc3VlcxgBIAMoCzISLmJ5dGViYXNlLnYxLklzc3VlEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSKCAQoTU2VhcmNoSXNzdWVzUmVxdWVzdBITCgZwYXJlbnQYASABKAlCA+BBAhIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkSEAoIb3JkZXJfYnkYBiABKAkiUwoUU2VhcmNoSXNzdWVzUmVzcG9uc2USIgoGaXNzdWVzGAEgAygLMhIuYnl0ZWJ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3N1ZVJlcXVlc3QaEi5ieXRlYmFzZS52MS5Jc3N1ZSI9kOowApjqMAGg6jACgtPkkwIrOgEqIiYvdjEve25hbWU9cHJvamVjdHMvKi9pc3N1ZXMvKn06cmVxdWVzdBKZAQoSUmV0cnlJc3N1ZUFwcHJvdmFsEiYuYnl0ZWJhc2UudjEuUmV0cnlJc3N1ZUFwcHJvdmFsUmVxdWVzdBoSLmJ5dGViYXNlLnYxLklzc3VlIkeQ6jACmOowAaDqMAOo6jAIgtPkkwIxOgEqIiwvdjEve25hbWU9cHJvamVjdHMvKi9pc3N1ZXMvKn06cmV0cnlBcHByb3ZhbBKhAQoMR2V0UmV2aWV3UnVuEiAuYnl0ZWJhc2UudjEuR2V0UmV2aWV3UnVuUmVxdWVzdBoWLmJ5dGViYXNlLnYxLlJldmlld1J1biJX2kEEbmFtZYrqMBFiYi5yZXZpZXdSdW5zLmdldJDqMAGg6jABgtPkkwItEisvdjEve25hbWU9cHJvamVjdHMvKi9pc3N1ZXMvKi9yZXZpZXdSdW5zLyp9EqYBCglSdW5SZXZpZXcSHS5ieXRlYmFzZS52MS5SdW5SZXZpZXdSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuUmV2aWV3UnVuImLaQQRuYW1liuowEWJiLnJldmlld1J1bnMucnVukOowAZjqMAGg6jACgtPkkwI0OgEqIi8vdjEve25hbWU9cHJvamVjdHMvKi9pc3N1ZXMvKi9yZXZpZXdSdW5zLyp9OnJ1bkKnAQoPY29tLmJ5dGViYXNlLnYxQhFJc3N1ZVNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [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, file_v1_plan_service, file_v1_review_rule]);/*** Describes the message bytebase.v1.GetIssueRequest.@@ -267,12 +267,19 @@ export const IssueComment_IssueUpdateSchema = /*@__PURE__*/export const IssueComment_ReviewSubmissionSchema = /*@__PURE__*/messageDesc(file_v1_issue_service, 21, 3);+/**+ * Describes the message bytebase.v1.IssueComment.ReviewRunCompletion.+ * Use `create(IssueComment_ReviewRunCompletionSchema)` to create a new message.+ */+export const IssueComment_ReviewRunCompletionSchema = /*@__PURE__*/+ messageDesc(file_v1_issue_service, 21, 4);+/*** Describes the message bytebase.v1.IssueComment.PlanUpdate.* Use `create(IssueComment_PlanUpdateSchema)` to create a new message.*/export const IssueComment_PlanUpdateSchema = /*@__PURE__*/- messageDesc(file_v1_issue_service, 21, 4);+ messageDesc(file_v1_issue_service, 21, 5);/*** Describes the enum bytebase.v1.IssueComment.ThreadState.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 34b5a42227..05b875e2eb 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -22546,6 +22546,14 @@ components:title: plan_updatedescription: Plan update event.title: plan_update+ - type: object+ properties:+ reviewRunCompletion:+ allOf:+ - $ref: '#/components/schemas/bytebase.v1.IssueComment.ReviewRunCompletion'+ title: review_run_completion+ description: Review run completion event.+ title: review_run_completion- type: objectproperties:reviewSubmission:@@ -22564,6 +22572,8 @@ components:- issueUpdate- required:- planUpdate+ - required:+ - reviewRunCompletion- required:- reviewSubmission- not:@@ -22574,6 +22584,8 @@ components:- issueUpdate- required:- planUpdate+ - required:+ - reviewRunCompletion- required:- reviewSubmissionproperties:@@ -22631,8 +22643,10 @@ components:title: statement_anchordescription: |-(IMMUTABLE) Optional source context on a root or reply. A reply's anchor must share- the root's spec and sheet_sha256; it may narrow the range.- Cannot be set on events. Immutable after creation.+ the root's spec and sheet_sha256 when created; it may narrow the range.+ Cannot be set on events. Immutable after creation, except that a later+ review run reporting a review result again moves the result to its+ statement in the SQL that run reviewed.reviewMetadata:allOf:- $ref: '#/components/schemas/bytebase.v1.IssueComment.ReviewMetadata'@@ -22756,8 +22770,15 @@ components:type: booleantitle: supersededdescription: |-- A later run of the same reviewer has completed, so the result is not- from the latest review, whatever its thread state.+ A later run of the same reviewer has completed without reporting the+ result again, whatever its thread state.+ attempt:+ type: string+ title: attempt+ format: int64+ description: |-+ The ReviewRunCompletion.attempt of the run that posted the result. A+ result a later run reports again keeps its thread and its attempt.title: ReviewMetadataadditionalProperties: falsedescription: What a review result carries beyond its text.@@ -22772,6 +22793,41 @@ components:description: |-Priority says what resolving the thread means. It has no bearing onblocking, which thread_state alone decides.+ bytebase.v1.IssueComment.ReviewRunCompletion:+ type: object+ properties:+ runType:+ allOf:+ - $ref: '#/components/schemas/bytebase.v1.ReviewRun.Type'+ title: run_type+ description: The reviewer that ran.+ attempt:+ type: string+ title: attempt+ format: int64+ description: |-+ Identifies the run among its reviewer's runs on the issue. The results+ it posted carry the same ReviewMetadata.attempt.+ postedCount:+ type: integer+ title: posted_count+ format: int32+ description: Results the run posted as new threads.+ keptCount:+ type: integer+ title: kept_count+ format: int32+ description: Earlier results the run reported again, which kept their threads.+ supersededCount:+ type: integer+ title: superseded_count+ format: int32+ description: Earlier results the run no longer reports, now superseded.+ title: ReviewRunCompletion+ additionalProperties: false+ description: |-+ A review run completed, and what it did to the results of its reviewer.+ Posted by the reviewer, with no creator.bytebase.v1.IssueComment.ReviewSubmission:type: objecttitle: ReviewSubmissiondiff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 75b2d64910..950e19386b 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -138,6 +138,7 @@- [IssueCommentPayload.IssueUpdate](#bytebase-store-IssueCommentPayload-IssueUpdate)- [IssueCommentPayload.PlanUpdate](#bytebase-store-IssueCommentPayload-PlanUpdate)- [IssueCommentPayload.ReviewMetadata](#bytebase-store-IssueCommentPayload-ReviewMetadata)+ - [IssueCommentPayload.ReviewRunCompletion](#bytebase-store-IssueCommentPayload-ReviewRunCompletion)- [IssueCommentPayload.ReviewSubmission](#bytebase-store-IssueCommentPayload-ReviewSubmission)- [IssueCommentPayload.StatementAnchor](#bytebase-store-IssueCommentPayload-StatementAnchor)@@ -2233,7 +2234,8 @@ new reviewer is a new value, not a migration.| issue_update | [IssueCommentPayload.IssueUpdate](#bytebase-store-IssueCommentPayload-IssueUpdate) | | || plan_update | [IssueCommentPayload.PlanUpdate](#bytebase-store-IssueCommentPayload-PlanUpdate) | | || review_submission | [IssueCommentPayload.ReviewSubmission](#bytebase-store-IssueCommentPayload-ReviewSubmission) | | |-| statement_anchor | [IssueCommentPayload.StatementAnchor](#bytebase-store-IssueCommentPayload-StatementAnchor) | | The statement context an inline comment references. Set at creation and immutable afterward; never set together with an event. |+| review_run_completion | [IssueCommentPayload.ReviewRunCompletion](#bytebase-store-IssueCommentPayload-ReviewRunCompletion) | | |+| statement_anchor | [IssueCommentPayload.StatementAnchor](#bytebase-store-IssueCommentPayload-StatementAnchor) | | The statement context an inline comment references. Set at creation and immutable afterward, except that a later run reporting a review result again moves the result to its statement in the SQL that run reviewed. Never set together with an event. || review_metadata | [IssueCommentPayload.ReviewMetadata](#bytebase-store-IssueCommentPayload-ReviewMetadata) | | Present on review results only, beside the text and never together with an event. Written by the review executor; CreateIssueComment rejects it. The anchor is statement_anchor; a result without one addresses the whole change. |@@ -2302,10 +2304,11 @@ add/remove/update from the snapshot pair.### IssueCommentPayload.ReviewMetadataReviewMetadata is what a review result carries beyond its text: whichreviewer posted it, what it was judged against, its priority, and the-databases it applies to. Results from the same reviewer are superseded-together: when a run completes, it resolves every OPEN root of its type-and marks every earlier root of its type superseded, in the transaction-that posts the new results.+databases it applies to. When a run completes, an earlier result of its+type whose fingerprint the run reports again keeps its thread, and the+run posts no new result for it; every other earlier root of its type is+resolved and marked superseded, in the transaction that posts the new+results.| Field | Type | Label | Description |@@ -2314,7 +2317,30 @@ that posts the new results.| rule_type | [ReviewRuleType](#bytebase-store-ReviewRuleType) | | The rule judged against. Set if and only if run_type is RULE. || priority | [IssueCommentPayload.ReviewMetadata.Priority](#bytebase-store-IssueCommentPayload-ReviewMetadata-Priority) | | A result merged across databases carries the highest priority among them. || targets | [string](#string) | repeated | Every database the result applies to, sorted. Always complete; the renderer collapses it when it equals the spec's target set. Format: instances/{instance}/databases/{database} |-| superseded | [bool](#bool) | | A later run of the same reviewer has completed, so the result is not from the latest review. Set by that run whatever the thread state, and never cleared. |+| superseded | [bool](#bool) | | A later run of the same reviewer has completed without reporting the result again, so the latest review does not hold it. Set by that run whatever the thread state, and never cleared. |+| fingerprint | [string](#string) | | Identifies the finding across runs: equal fingerprints are the same finding on the same SQL. Unique among the results of one run. Empty when the reviewer cannot tell findings apart across runs, and an empty fingerprint matches nothing. |+| attempt | [int64](#int64) | | The review_run.attempt of the run that posted the result. A result a later run reports again keeps its attempt. |+++++++<a name="bytebase-store-IssueCommentPayload-ReviewRunCompletion"></a>++### IssueCommentPayload.ReviewRunCompletion+ReviewRunCompletion records that a review run completed DONE, and what+it did to the results of its reviewer. Posted with no creator, in the+transaction that posts the run's results.+++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| run_type | [ReviewRun.Type](#bytebase-store-ReviewRun-Type) | | |+| attempt | [int64](#int64) | | The run's review_run.attempt; its new results carry the same ReviewMetadata.attempt. |+| posted_count | [int32](#int32) | | Results the run posted as new threads. |+| kept_count | [int32](#int32) | | Earlier results the run reported again, which kept their threads. |+| superseded_count | [int32](#int32) | | Earlier results the run no longer reports, which it superseded. |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 8f4a4f20aa..f8d1515d75 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -715,6 +715,10 @@<a href="#bytebase.store.IssueCommentPayload.ReviewMetadata"><span class="badge">M</span>IssueCommentPayload.ReviewMetadata</a></li>+ <li>+ <a href="#bytebase.store.IssueCommentPayload.ReviewRunCompletion"><span class="badge">M</span>IssueCommentPayload.ReviewRunCompletion</a>+ </li>+<li><a href="#bytebase.store.IssueCommentPayload.ReviewSubmission"><span class="badge">M</span>IssueCommentPayload.ReviewSubmission</a></li>@@ -6415,12 +6419,21 @@ model.</p></td><td><p> </p></td></tr>+ <tr>+ <td>review_run_completion</td>+ <td><a href="#bytebase.store.IssueCommentPayload.ReviewRunCompletion">IssueCommentPayload.ReviewRunCompletion</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>+<tr><td>statement_anchor</td><td><a href="#bytebase.store.IssueCommentPayload.StatementAnchor">IssueCommentPayload.StatementAnchor</a></td><td></td><td><p>The statement context an inline comment references. Set at creation and-immutable afterward; never set together with an event. </p></td>+immutable afterward, except that a later run reporting a review result+again moves the result to its statement in the SQL that run reviewed.+Never set together with an event. </p></td></tr><tr>@@ -6569,7 +6582,7 @@ change. </p></td><h3 id="bytebase.store.IssueCommentPayload.ReviewMetadata">IssueCommentPayload.ReviewMetadata</h3>- <p>ReviewMetadata is what a review result carries beyond its text: which</p><p>reviewer posted it, what it was judged against, its priority, and the</p><p>databases it applies to. Results from the same reviewer are superseded</p><p>together: when a run completes, it resolves every OPEN root of its type</p><p>and marks every earlier root of its type superseded, in the transaction</p><p>that posts the new results.</p>+ <p>ReviewMetadata is what a review result carries beyond its text: which</p><p>reviewer posted it, what it was judged against, its priority, and the</p><p>databases it applies to. When a run completes, an earlier result of its</p><p>type whose fingerprint the run reports again keeps its thread, and the</p><p>run posts no new result for it; every other earlier root of its type is</p><p>resolved and marked superseded, in the transaction that posts the new</p><p>results.</p><table class="field-table">@@ -6614,9 +6627,80 @@ Format: instances/{instance}/databases/{database} </p></td><td>superseded</td><td><a href="#bool">bool</a></td><td></td>- <td><p>A later run of the same reviewer has completed, so the result is not-from the latest review. Set by that run whatever the thread state, and-never cleared. </p></td>+ <td><p>A later run of the same reviewer has completed without reporting the+result again, so the latest review does not hold it. Set by that run+whatever the thread state, and never cleared. </p></td>+ </tr>++ <tr>+ <td>fingerprint</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>Identifies the finding across runs: equal fingerprints are the same+finding on the same SQL. Unique among the results of one run. Empty+when the reviewer cannot tell findings apart across runs, and an empty+fingerprint matches nothing. </p></td>+ </tr>++ <tr>+ <td>attempt</td>+ <td><a href="#int64">int64</a></td>+ <td></td>+ <td><p>The review_run.attempt of the run that posted the result. A result+a later run reports again keeps its attempt. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.store.IssueCommentPayload.ReviewRunCompletion">IssueCommentPayload.ReviewRunCompletion</h3>+ <p>ReviewRunCompletion records that a review run completed DONE, and what</p><p>it did to the results of its reviewer. Posted with no creator, in the</p><p>transaction that posts the run's results.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>run_type</td>+ <td><a href="#bytebase.store.ReviewRun.Type">ReviewRun.Type</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>attempt</td>+ <td><a href="#int64">int64</a></td>+ <td></td>+ <td><p>The run's review_run.attempt; its new results carry the same+ReviewMetadata.attempt. </p></td>+ </tr>++ <tr>+ <td>posted_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Results the run posted as new threads. </p></td>+ </tr>++ <tr>+ <td>kept_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Earlier results the run reported again, which kept their threads. </p></td>+ </tr>++ <tr>+ <td>superseded_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Earlier results the run no longer reports, which it superseded. </p></td></tr></tbody>diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 1be0ee1603..d7f2758611 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -191,6 +191,7 @@- [IssueComment.IssueUpdate](#bytebase-v1-IssueComment-IssueUpdate)- [IssueComment.PlanUpdate](#bytebase-v1-IssueComment-PlanUpdate)- [IssueComment.ReviewMetadata](#bytebase-v1-IssueComment-ReviewMetadata)+ - [IssueComment.ReviewRunCompletion](#bytebase-v1-IssueComment-ReviewRunCompletion)- [IssueComment.ReviewSubmission](#bytebase-v1-IssueComment-ReviewSubmission)- [ListIssueCommentsRequest](#bytebase-v1-ListIssueCommentsRequest)- [ListIssueCommentsResponse](#bytebase-v1-ListIssueCommentsResponse)@@ -3632,12 +3633,13 @@ A comment on an issue.| creator | [string](#string) | | Format: users/{email} || root | [string](#string) | optional | The thread root's name, set only on replies. Immutable after creation. Format: projects/{project}/issues/{issue}/issueComments/{issueComment} Must name a thread root in the same issue, never a general comment or reply. || thread_state | [IssueComment.ThreadState](#bytebase-v1-IssueComment-ThreadState) | optional | Present only on thread roots. Set OPEN on create to start a thread; an anchored root starts one without it. Omit root, thread_state, and statement_anchor to create a general comment. Update through the thread_state field mask to resolve or reopen. Adding a reply does not reopen a resolved thread. |-| statement_anchor | [StatementAnchor](#bytebase-v1-StatementAnchor) | | Optional source context on a root or reply. A reply's anchor must share the root's spec and sheet_sha256; it may narrow the range. Cannot be set on events. Immutable after creation. |+| statement_anchor | [StatementAnchor](#bytebase-v1-StatementAnchor) | | Optional source context on a root or reply. A reply's anchor must share the root's spec and sheet_sha256 when created; it may narrow the range. Cannot be set on events. Immutable after creation, except that a later review run reporting a review result again moves the result to its statement in the SQL that run reviewed. || review_metadata | [IssueComment.ReviewMetadata](#bytebase-v1-IssueComment-ReviewMetadata) | | Present on review results, the comments the review executor posts. Never accepted on create or update. || approval | [IssueComment.Approval](#bytebase-v1-IssueComment-Approval) | | Approval event. || issue_update | [IssueComment.IssueUpdate](#bytebase-v1-IssueComment-IssueUpdate) | | Issue update event. || plan_update | [IssueComment.PlanUpdate](#bytebase-v1-IssueComment-PlanUpdate) | | Plan update event. || review_submission | [IssueComment.ReviewSubmission](#bytebase-v1-IssueComment-ReviewSubmission) | | Review submission event. |+| review_run_completion | [IssueComment.ReviewRunCompletion](#bytebase-v1-IssueComment-ReviewRunCompletion) | | Review run completion event. |@@ -3710,7 +3712,28 @@ What a review result carries beyond its text.| rule_type | [ReviewRuleType](#bytebase-v1-ReviewRuleType) | | The rule judged against. Set if and only if run_type is RULE. || priority | [IssueComment.ReviewMetadata.Priority](#bytebase-v1-IssueComment-ReviewMetadata-Priority) | | || targets | [string](#string) | repeated | Every database the result applies to, sorted. Format: instances/{instance}/databases/{database} |-| superseded | [bool](#bool) | | A later run of the same reviewer has completed, so the result is not from the latest review, whatever its thread state. |+| superseded | [bool](#bool) | | A later run of the same reviewer has completed without reporting the result again, whatever its thread state. |+| attempt | [int64](#int64) | | The ReviewRunCompletion.attempt of the run that posted the result. A result a later run reports again keeps its thread and its attempt. |+++++++<a name="bytebase-v1-IssueComment-ReviewRunCompletion"></a>++### IssueComment.ReviewRunCompletion+A review run completed, and what it did to the results of its reviewer.+Posted by the reviewer, with no creator.+++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| run_type | [ReviewRun.Type](#bytebase-v1-ReviewRun-Type) | | The reviewer that ran. |+| attempt | [int64](#int64) | | Identifies the run among its reviewer's runs on the issue. The results it posted carry the same ReviewMetadata.attempt. |+| posted_count | [int32](#int32) | | Results the run posted as new threads. |+| kept_count | [int32](#int32) | | Earlier results the run reported again, which kept their threads. |+| superseded_count | [int32](#int32) | | Earlier results the run no longer reports, now superseded. |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 3933570d1d..ffea37dbe1 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -902,6 +902,10 @@<a href="#bytebase.v1.IssueComment.ReviewMetadata"><span class="badge">M</span>IssueComment.ReviewMetadata</a></li>+ <li>+ <a href="#bytebase.v1.IssueComment.ReviewRunCompletion"><span class="badge">M</span>IssueComment.ReviewRunCompletion</a>+ </li>+<li><a href="#bytebase.v1.IssueComment.ReviewSubmission"><span class="badge">M</span>IssueComment.ReviewSubmission</a></li>@@ -11073,8 +11077,10 @@ Adding a reply does not reopen a resolved thread. </p></td><td><a href="#bytebase.v1.StatementAnchor">StatementAnchor</a></td><td></td><td><p>Optional source context on a root or reply. A reply's anchor must share-the root's spec and sheet_sha256; it may narrow the range.-Cannot be set on events. Immutable after creation. </p></td>+the root's spec and sheet_sha256 when created; it may narrow the range.+Cannot be set on events. Immutable after creation, except that a later+review run reporting a review result again moves the result to its+statement in the SQL that run reviewed. </p></td></tr><tr>@@ -11113,6 +11119,13 @@ Never accepted on create or update. </p></td><td><p>Review submission event. </p></td></tr>+ <tr>+ <td>review_run_completion</td>+ <td><a href="#bytebase.v1.IssueComment.ReviewRunCompletion">IssueComment.ReviewRunCompletion</a></td>+ <td></td>+ <td><p>Review run completion event. </p></td>+ </tr>+</tbody></table>@@ -11291,8 +11304,69 @@ Format: instances/{instance}/databases/{database} </p></td><td>superseded</td><td><a href="#bool">bool</a></td><td></td>- <td><p>A later run of the same reviewer has completed, so the result is not-from the latest review, whatever its thread state. </p></td>+ <td><p>A later run of the same reviewer has completed without reporting the+result again, whatever its thread state. </p></td>+ </tr>++ <tr>+ <td>attempt</td>+ <td><a href="#int64">int64</a></td>+ <td></td>+ <td><p>The ReviewRunCompletion.attempt of the run that posted the result. A+result a later run reports again keeps its thread and its attempt. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.IssueComment.ReviewRunCompletion">IssueComment.ReviewRunCompletion</h3>+ <p>A review run completed, and what it did to the results of its reviewer.</p><p>Posted by the reviewer, with no creator.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>run_type</td>+ <td><a href="#bytebase.v1.ReviewRun.Type">ReviewRun.Type</a></td>+ <td></td>+ <td><p>The reviewer that ran. </p></td>+ </tr>++ <tr>+ <td>attempt</td>+ <td><a href="#int64">int64</a></td>+ <td></td>+ <td><p>Identifies the run among its reviewer's runs on the issue. The results+it posted carry the same ReviewMetadata.attempt. </p></td>+ </tr>++ <tr>+ <td>posted_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Results the run posted as new threads. </p></td>+ </tr>++ <tr>+ <td>kept_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Earlier results the run reported again, which kept their threads. </p></td>+ </tr>++ <tr>+ <td>superseded_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Earlier results the run no longer reports, now superseded. </p></td></tr></tbody>diff --git a/proto/store/store/issue_comment.proto b/proto/store/store/issue_comment.protoindex 0a06fce318..6899aa720f 100644--- a/proto/store/store/issue_comment.proto+++ b/proto/store/store/issue_comment.proto@@ -20,10 +20,13 @@ message IssueCommentPayload {IssueUpdate issue_update = 3;PlanUpdate plan_update = 7;ReviewSubmission review_submission = 8;+ ReviewRunCompletion review_run_completion = 11;}// The statement context an inline comment references. Set at creation and- // immutable afterward; never set together with an event.+ // immutable afterward, except that a later run reporting a review result+ // again moves the result to its statement in the SQL that run reviewed.+ // Never set together with an event.StatementAnchor statement_anchor = 9;// Present on review results only, beside the text and never together with@@ -50,6 +53,22 @@ message IssueCommentPayload {// ReviewSubmission records that an issue entered review.message ReviewSubmission {}+ // ReviewRunCompletion records that a review run completed DONE, and what+ // it did to the results of its reviewer. Posted with no creator, in the+ // transaction that posts the run's results.+ message ReviewRunCompletion {+ ReviewRun.Type run_type = 1;+ // The run's review_run.attempt; its new results carry the same+ // ReviewMetadata.attempt.+ int64 attempt = 2;+ // Results the run posted as new threads.+ int32 posted_count = 3;+ // Earlier results the run reported again, which kept their threads.+ int32 kept_count = 4;+ // Earlier results the run no longer reports, which it superseded.+ int32 superseded_count = 5;+ }+// PlanUpdate carries before/after snapshots of plan.config.specs,// emitted once per PlanService.UpdatePlan call whose specs branch// produces a non-cosmetic diff. The renderer computes per-spec@@ -61,10 +80,11 @@ message IssueCommentPayload {// ReviewMetadata is what a review result carries beyond its text: which// reviewer posted it, what it was judged against, its priority, and the- // databases it applies to. Results from the same reviewer are superseded- // together: when a run completes, it resolves every OPEN root of its type- // and marks every earlier root of its type superseded, in the transaction- // that posts the new results.+ // databases it applies to. When a run completes, an earlier result of its+ // type whose fingerprint the run reports again keeps its thread, and the+ // run posts no new result for it; every other earlier root of its type is+ // resolved and marked superseded, in the transaction that posts the new+ // results.message ReviewMetadata {// Priority says what resolving the thread means. It has no bearing on// blocking: an OPEN root thread blocks whatever its priority, and a@@ -92,10 +112,18 @@ message IssueCommentPayload {// renderer collapses it when it equals the spec's target set.// Format: instances/{instance}/databases/{database}repeated string targets = 4;- // A later run of the same reviewer has completed, so the result is not- // from the latest review. Set by that run whatever the thread state, and- // never cleared.+ // A later run of the same reviewer has completed without reporting the+ // result again, so the latest review does not hold it. Set by that run+ // whatever the thread state, and never cleared.bool superseded = 5;+ // Identifies the finding across runs: equal fingerprints are the same+ // finding on the same SQL. Unique among the results of one run. Empty+ // when the reviewer cannot tell findings apart across runs, and an empty+ // fingerprint matches nothing.+ string fingerprint = 6;+ // The review_run.attempt of the run that posted the result. A result+ // a later run reports again keeps its attempt.+ int64 attempt = 7;}// StatementAnchor records the anchored statement revision and range.diff --git a/proto/v1/v1/issue_service.proto b/proto/v1/v1/issue_service.protoindex 892956363c..8c4b35b9f2 100644--- a/proto/v1/v1/issue_service.proto+++ b/proto/v1/v1/issue_service.proto@@ -677,8 +677,10 @@ message IssueComment {optional ThreadState thread_state = 15;// Optional source context on a root or reply. A reply's anchor must share- // the root's spec and sheet_sha256; it may narrow the range.- // Cannot be set on events. Immutable after creation.+ // the root's spec and sheet_sha256 when created; it may narrow the range.+ // Cannot be set on events. Immutable after creation, except that a later+ // review run reporting a review result again moves the result to its+ // statement in the SQL that run reviewed.StatementAnchor statement_anchor = 16 [(google.api.field_behavior) = IMMUTABLE];// Present on review results, the comments the review executor posts.@@ -707,9 +709,12 @@ message IssueComment {// Every database the result applies to, sorted.// Format: instances/{instance}/databases/{database}repeated string targets = 4;- // A later run of the same reviewer has completed, so the result is not- // from the latest review, whatever its thread state.+ // A later run of the same reviewer has completed without reporting the+ // result again, whatever its thread state.bool superseded = 5;+ // The ReviewRunCompletion.attempt of the run that posted the result. A+ // result a later run reports again keeps its thread and its attempt.+ int64 attempt = 6;}enum ThreadState {@@ -728,6 +733,8 @@ message IssueComment {PlanUpdate plan_update = 12;// Review submission event.ReviewSubmission review_submission = 13;+ // Review run completion event.+ ReviewRunCompletion review_run_completion = 18;}// Approval event information.@@ -764,6 +771,22 @@ message IssueComment {// Review submission event information.message ReviewSubmission {}+ // A review run completed, and what it did to the results of its reviewer.+ // Posted by the reviewer, with no creator.+ message ReviewRunCompletion {+ // The reviewer that ran.+ ReviewRun.Type run_type = 1;+ // Identifies the run among its reviewer's runs on the issue. The results+ // it posted carry the same ReviewMetadata.attempt.+ int64 attempt = 2;+ // Results the run posted as new threads.+ int32 posted_count = 3;+ // Earlier results the run reported again, which kept their threads.+ int32 kept_count = 4;+ // Earlier results the run no longer reports, now superseded.+ int32 superseded_count = 5;+ }+// Plan update event information (snapshot of plan.config.specs before// and after a PlanService.UpdatePlan call that mutated specs).message PlanUpdate {