Skip to content

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

feat(proto): type the review result's reviewer with a store enum

rebelice6c164206aa15
diff --git a/backend/generated-go/store/issue_comment.pb.go b/backend/generated-go/store/issue_comment.pb.go
index 533eac5f12..a6b6aa2244 100644
--- a/backend/generated-go/store/issue_comment.pb.go
+++ b/backend/generated-go/store/issue_comment.pb.go
@@ -468,10 +468,10 @@ func (x *IssueCommentPayload_PlanUpdate) GetToSpecs() []*PlanConfig_Spec {
// 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, same value domain as
- // review_run.type: "RULE" or "GUIDELINE".
- Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
- // The rule judged against. Set if and only if type is "RULE".
+ // The reviewer slot that posted the result; review_run.type stores the
+ // same enum by name.
+ Type ReviewRun_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.store.ReviewRun_Type" json:"type,omitempty"`
+ // The rule judged against. Set if and only if type is RULE.
Rule ReviewRule_Type `protobuf:"varint,2,opt,name=rule,proto3,enum=bytebase.store.ReviewRule_Type" json:"rule,omitempty"`
// A result merged across databases carries the highest priority among
// them.
@@ -514,11 +514,11 @@ func (*IssueCommentPayload_ReviewMetadata) Descriptor() ([]byte, []int) {
return file_store_issue_comment_proto_rawDescGZIP(), []int{0, 4}
}
-func (x *IssueCommentPayload_ReviewMetadata) GetType() string {
+func (x *IssueCommentPayload_ReviewMetadata) GetType() ReviewRun_Type {
if x != nil {
return x.Type
}
- return ""
+ return ReviewRun_TYPE_UNSPECIFIED
}
func (x *IssueCommentPayload_ReviewMetadata) GetRule() ReviewRule_Type {
@@ -626,7 +626,7 @@ var File_store_issue_comment_proto protoreflect.FileDescriptor
const 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\"\xfd\r\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\"\x9d\x0e\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" +
@@ -663,9 +663,9 @@ const file_store_issue_comment_proto_rawDesc = "" +
"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\x8a\x02\n" +
- "\x0eReviewMetadata\x12\x12\n" +
- "\x04type\x18\x01 \x01(\tR\x04type\x123\n" +
+ "\bto_specs\x18\x02 \x03(\v2\x1f.bytebase.store.PlanConfig.SpecR\atoSpecs\x1a\xaa\x02\n" +
+ "\x0eReviewMetadata\x122\n" +
+ "\x04type\x18\x01 \x01(\x0e2\x1e.bytebase.store.ReviewRun.TypeR\x04type\x123\n" +
"\x04rule\x18\x02 \x01(\x0e2\x1f.bytebase.store.ReviewRule.TypeR\x04rule\x12W\n" +
"\bpriority\x18\x03 \x01(\x0e2;.bytebase.store.IssueCommentPayload.ReviewMetadata.PriorityR\bpriority\x12\x18\n" +
"\atargets\x18\x04 \x03(\tR\atargets\"<\n" +
@@ -708,8 +708,9 @@ var file_store_issue_comment_proto_goTypes = []any{
(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
- (ReviewRule_Type)(0), // 11: bytebase.store.ReviewRule.Type
- (*Position)(nil), // 12: bytebase.store.Position
+ (ReviewRun_Type)(0), // 11: bytebase.store.ReviewRun.Type
+ (ReviewRule_Type)(0), // 12: bytebase.store.ReviewRule.Type
+ (*Position)(nil), // 13: bytebase.store.Position
}
var file_store_issue_comment_proto_depIdxs = []int32{
2, // 0: bytebase.store.IssueCommentPayload.approval:type_name -> bytebase.store.IssueCommentPayload.Approval
@@ -723,15 +724,16 @@ var file_store_issue_comment_proto_depIdxs = []int32{
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.rule:type_name -> bytebase.store.ReviewRule.Type
- 0, // 12: bytebase.store.IssueCommentPayload.ReviewMetadata.priority:type_name -> bytebase.store.IssueCommentPayload.ReviewMetadata.Priority
- 12, // 13: bytebase.store.IssueCommentPayload.StatementAnchor.start_position:type_name -> bytebase.store.Position
- 12, // 14: bytebase.store.IssueCommentPayload.StatementAnchor.end_position:type_name -> bytebase.store.Position
- 15, // [15:15] is the sub-list for method output_type
- 15, // [15:15] is the sub-list for method input_type
- 15, // [15:15] is the sub-list for extension type_name
- 15, // [15:15] is the sub-list for extension extendee
- 0, // [0:15] is the sub-list for field type_name
+ 11, // 11: bytebase.store.IssueCommentPayload.ReviewMetadata.type:type_name -> bytebase.store.ReviewRun.Type
+ 12, // 12: bytebase.store.IssueCommentPayload.ReviewMetadata.rule:type_name -> bytebase.store.ReviewRule.Type
+ 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
}
func init() { file_store_issue_comment_proto_init() }
@@ -744,6 +746,7 @@ func file_store_issue_comment_proto_init() {
file_store_issue_proto_init()
file_store_plan_proto_init()
file_store_review_rule_proto_init()
+ file_store_review_run_proto_init()
file_store_issue_comment_proto_msgTypes[0].OneofWrappers = []any{
(*IssueCommentPayload_Approval_)(nil),
(*IssueCommentPayload_IssueUpdate_)(nil),
diff --git a/backend/generated-go/store/review_run.pb.go b/backend/generated-go/store/review_run.pb.go
index e8e85b0dcc..186ead7b21 100644
--- a/backend/generated-go/store/review_run.pb.go
+++ b/backend/generated-go/store/review_run.pb.go
@@ -21,6 +21,60 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
+// The reviewer. Stored by name in review_run.type, which has no CHECK:
+// like Issue.Type and Task.Type, the enum is the source of truth and a
+// new reviewer is a new value, not a migration.
+type ReviewRun_Type int32
+
+const (
+ ReviewRun_TYPE_UNSPECIFIED ReviewRun_Type = 0
+ // Review against the standard rules.
+ ReviewRun_RULE ReviewRun_Type = 1
+ // Review against natural-language guidelines, performed by AI.
+ ReviewRun_GUIDELINE ReviewRun_Type = 2
+)
+
+// Enum value maps for ReviewRun_Type.
+var (
+ ReviewRun_Type_name = map[int32]string{
+ 0: "TYPE_UNSPECIFIED",
+ 1: "RULE",
+ 2: "GUIDELINE",
+ }
+ ReviewRun_Type_value = map[string]int32{
+ "TYPE_UNSPECIFIED": 0,
+ "RULE": 1,
+ "GUIDELINE": 2,
+ }
+)
+
+func (x ReviewRun_Type) Enum() *ReviewRun_Type {
+ p := new(ReviewRun_Type)
+ *p = x
+ return p
+}
+
+func (x ReviewRun_Type) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (ReviewRun_Type) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_review_run_proto_enumTypes[0].Descriptor()
+}
+
+func (ReviewRun_Type) Type() protoreflect.EnumType {
+ return &file_store_review_run_proto_enumTypes[0]
+}
+
+func (x ReviewRun_Type) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use ReviewRun_Type.Descriptor instead.
+func (ReviewRun_Type) EnumDescriptor() ([]byte, []int) {
+ return file_store_review_run_proto_rawDescGZIP(), []int{0, 0}
+}
+
// Strictly 1:1 with the status CHECK constraint — no unpersisted values.
type ReviewRun_Status int32
@@ -61,11 +115,11 @@ func (x ReviewRun_Status) String() string {
}
func (ReviewRun_Status) Descriptor() protoreflect.EnumDescriptor {
- return file_store_review_run_proto_enumTypes[0].Descriptor()
+ return file_store_review_run_proto_enumTypes[1].Descriptor()
}
func (ReviewRun_Status) Type() protoreflect.EnumType {
- return &file_store_review_run_proto_enumTypes[0]
+ return &file_store_review_run_proto_enumTypes[1]
}
func (x ReviewRun_Status) Number() protoreflect.EnumNumber {
@@ -74,7 +128,7 @@ func (x ReviewRun_Status) Number() protoreflect.EnumNumber {
// Deprecated: Use ReviewRun_Status.Descriptor instead.
func (ReviewRun_Status) EnumDescriptor() ([]byte, []int) {
- return file_store_review_run_proto_rawDescGZIP(), []int{0, 0}
+ return file_store_review_run_proto_rawDescGZIP(), []int{0, 1}
}
// ReviewRun is the status slot of one reviewer (rule engine or AI) on one
@@ -166,8 +220,12 @@ var File_store_review_run_proto protoreflect.FileDescriptor
const file_store_review_run_proto_rawDesc = "" +
"\n" +
- "\x16store/review_run.proto\x12\x0ebytebase.store\"_\n" +
- "\tReviewRun\"R\n" +
+ "\x16store/review_run.proto\x12\x0ebytebase.store\"\x96\x01\n" +
+ "\tReviewRun\"5\n" +
+ "\x04Type\x12\x14\n" +
+ "\x10TYPE_UNSPECIFIED\x10\x00\x12\b\n" +
+ "\x04RULE\x10\x01\x12\r\n" +
+ "\tGUIDELINE\x10\x02\"R\n" +
"\x06Status\x12\x16\n" +
"\x12STATUS_UNSPECIFIED\x10\x00\x12\r\n" +
"\tAVAILABLE\x10\x01\x12\v\n" +
@@ -191,12 +249,13 @@ func file_store_review_run_proto_rawDescGZIP() []byte {
return file_store_review_run_proto_rawDescData
}
-var file_store_review_run_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_store_review_run_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_store_review_run_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_store_review_run_proto_goTypes = []any{
- (ReviewRun_Status)(0), // 0: bytebase.store.ReviewRun.Status
- (*ReviewRun)(nil), // 1: bytebase.store.ReviewRun
- (*ReviewRunPayload)(nil), // 2: bytebase.store.ReviewRunPayload
+ (ReviewRun_Type)(0), // 0: bytebase.store.ReviewRun.Type
+ (ReviewRun_Status)(0), // 1: bytebase.store.ReviewRun.Status
+ (*ReviewRun)(nil), // 2: bytebase.store.ReviewRun
+ (*ReviewRunPayload)(nil), // 3: bytebase.store.ReviewRunPayload
}
var file_store_review_run_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -216,7 +275,7 @@ func file_store_review_run_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_review_run_proto_rawDesc), len(file_store_review_run_proto_rawDesc)),
- NumEnums: 1,
+ NumEnums: 2,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 5af1a50051..6584027b07 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -127,6 +127,13 @@
- [ReviewRule.Type](#bytebase-store-ReviewRule-Type)
+- [store/review_run.proto](#store_review_run-proto)
+ - [ReviewRun](#bytebase-store-ReviewRun)
+ - [ReviewRunPayload](#bytebase-store-ReviewRunPayload)
+
+ - [ReviewRun.Status](#bytebase-store-ReviewRun-Status)
+ - [ReviewRun.Type](#bytebase-store-ReviewRun-Type)
+
- [store/issue_comment.proto](#store_issue_comment-proto)
- [IssueCommentPayload](#bytebase-store-IssueCommentPayload)
- [IssueCommentPayload.Approval](#bytebase-store-IssueCommentPayload-Approval)
@@ -205,12 +212,6 @@
- [SQLReviewRule.Level](#bytebase-store-SQLReviewRule-Level)
- [SQLReviewRule.Type](#bytebase-store-SQLReviewRule-Type)
-- [store/review_run.proto](#store_review_run-proto)
- - [ReviewRun](#bytebase-store-ReviewRun)
- - [ReviewRunPayload](#bytebase-store-ReviewRunPayload)
-
- - [ReviewRun.Status](#bytebase-store-ReviewRun-Status)
-
- [store/revision.proto](#store_revision-proto)
- [RevisionPayload](#bytebase-store-RevisionPayload)
@@ -2145,6 +2146,78 @@ stored comment that used it.
+<a name="store_review_run-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## store/review_run.proto
+
+
+
+<a name="bytebase-store-ReviewRun"></a>
+
+### ReviewRun
+ReviewRun is the status slot of one reviewer (rule engine or AI) on one
+issue. Results live in issue comments; the run carries none.
+
+
+
+
+
+
+<a name="bytebase-store-ReviewRunPayload"></a>
+
+### ReviewRunPayload
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| error | [string](#string) | | Fatal execution error for the FAILED status, e.g. &#34;metadata not synced: instances/prod/databases/db1, db2, db3 (&#43;497 more)&#34;. Written by the executor or by the reaper. |
+
+
+
+
+
+
+
+
+<a name="bytebase-store-ReviewRun-Status"></a>
+
+### ReviewRun.Status
+Strictly 1:1 with the status CHECK constraint — no unpersisted values.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| STATUS_UNSPECIFIED | 0 | |
+| AVAILABLE | 1 | |
+| RUNNING | 2 | |
+| DONE | 3 | |
+| FAILED | 4 | |
+
+
+
+<a name="bytebase-store-ReviewRun-Type"></a>
+
+### ReviewRun.Type
+The reviewer. Stored by name in review_run.type, which has no CHECK:
+like Issue.Type and Task.Type, the enum is the source of truth and a
+new reviewer is a new value, not a migration.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| TYPE_UNSPECIFIED | 0 | |
+| RULE | 1 | Review against the standard rules. |
+| GUIDELINE | 2 | Review against natural-language guidelines, performed by AI. |
+
+
+
+
+
+
+
+
+
+
<a name="store_issue_comment-proto"></a>
<p align="right"><a href="#top">Top</a></p>
@@ -2241,8 +2314,8 @@ in the transaction that posts the new results.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| type | [string](#string) | | The reviewer slot that posted the result, same value domain as review_run.type: &#34;RULE&#34; or &#34;GUIDELINE&#34;. |
-| rule | [ReviewRule.Type](#bytebase-store-ReviewRule-Type) | | The rule judged against. Set if and only if type is &#34;RULE&#34;. |
+| type | [ReviewRun.Type](#bytebase-store-ReviewRun-Type) | | The reviewer slot that posted the result; review_run.type stores the same enum by name. |
+| rule | [ReviewRule.Type](#bytebase-store-ReviewRule-Type) | | The rule judged against. Set if and only if 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&#39;s target set. Format: instances/{instance}/databases/{database} |
@@ -3317,63 +3390,6 @@ The severity level for SQL review rules.
-<a name="store_review_run-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## store/review_run.proto
-
-
-
-<a name="bytebase-store-ReviewRun"></a>
-
-### ReviewRun
-ReviewRun is the status slot of one reviewer (rule engine or AI) on one
-issue. Results live in issue comments; the run carries none.
-
-
-
-
-
-
-<a name="bytebase-store-ReviewRunPayload"></a>
-
-### ReviewRunPayload
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| error | [string](#string) | | Fatal execution error for the FAILED status, e.g. &#34;metadata not synced: instances/prod/databases/db1, db2, db3 (&#43;497 more)&#34;. Written by the executor or by the reaper. |
-
-
-
-
-
-
-
-
-<a name="bytebase-store-ReviewRun-Status"></a>
-
-### ReviewRun.Status
-Strictly 1:1 with the status CHECK constraint — no unpersisted values.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| STATUS_UNSPECIFIED | 0 | |
-| AVAILABLE | 1 | |
-| RUNNING | 2 | |
-| DONE | 3 | |
-| FAILED | 4 | |
-
-
-
-
-
-
-
-
-
-
<a name="store_revision-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index b45f5fbe71..2e4dd6455f 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -668,6 +668,33 @@
</li>
+ <li>
+ <a href="#store%2freview_run.proto">store/review_run.proto</a>
+ <ul>
+
+ <li>
+ <a href="#bytebase.store.ReviewRun"><span class="badge">M</span>ReviewRun</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.store.ReviewRunPayload"><span class="badge">M</span>ReviewRunPayload</a>
+ </li>
+
+
+ <li>
+ <a href="#bytebase.store.ReviewRun.Status"><span class="badge">E</span>ReviewRun.Status</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.store.ReviewRun.Type"><span class="badge">E</span>ReviewRun.Type</a>
+ </li>
+
+
+
+ </ul>
+ </li>
+
+
<li>
<a href="#store%2fissue_comment.proto">store/issue_comment.proto</a>
<ul>
@@ -987,29 +1014,6 @@
</li>
- <li>
- <a href="#store%2freview_run.proto">store/review_run.proto</a>
- <ul>
-
- <li>
- <a href="#bytebase.store.ReviewRun"><span class="badge">M</span>ReviewRun</a>
- </li>
-
- <li>
- <a href="#bytebase.store.ReviewRunPayload"><span class="badge">M</span>ReviewRunPayload</a>
- </li>
-
-
- <li>
- <a href="#bytebase.store.ReviewRun.Status"><span class="badge">E</span>ReviewRun.Status</a>
- </li>
-
-
-
- </ul>
- </li>
-
-
<li>
<a href="#store%2frevision.proto">store/revision.proto</a>
<ul>
@@ -6216,6 +6220,123 @@ Format: environments/prod where prod is the environment resource ID. </p></td>
+ <div class="file-heading">
+ <h2 id="store/review_run.proto">store/review_run.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+ <h3 id="bytebase.store.ReviewRun">ReviewRun</h3>
+ <p>ReviewRun is the status slot of one reviewer (rule engine or AI) on one</p><p>issue. Results live in issue comments; the run carries none.</p>
+
+
+
+
+
+ <h3 id="bytebase.store.ReviewRunPayload">ReviewRunPayload</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>error</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Fatal execution error for the FAILED status, e.g. &#34;metadata not synced:
+instances/prod/databases/db1, db2, db3 (&#43;497 more)&#34;. Written by the
+executor or by the reaper. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
+ <h3 id="bytebase.store.ReviewRun.Status">ReviewRun.Status</h3>
+ <p>Strictly 1:1 with the status CHECK constraint — no unpersisted values.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>STATUS_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>AVAILABLE</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>RUNNING</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DONE</td>
+ <td>3</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>FAILED</td>
+ <td>4</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.store.ReviewRun.Type">ReviewRun.Type</h3>
+ <p>The reviewer. Stored by name in review_run.type, which has no CHECK:</p><p>like Issue.Type and Task.Type, the enum is the source of truth and a</p><p>new reviewer is a new value, not a migration.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>RULE</td>
+ <td>1</td>
+ <td><p>Review against the standard rules.</p></td>
+ </tr>
+
+ <tr>
+ <td>GUIDELINE</td>
+ <td>2</td>
+ <td><p>Review against natural-language guidelines, performed by AI.</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
<div class="file-heading">
<h2 id="store/issue_comment.proto">store/issue_comment.proto</h2><a href="#title">Top</a>
</div>
@@ -6432,17 +6553,17 @@ change. </p></td>
<tr>
<td>type</td>
- <td><a href="#string">string</a></td>
+ <td><a href="#bytebase.store.ReviewRun.Type">ReviewRun.Type</a></td>
<td></td>
- <td><p>The reviewer slot that posted the result, same value domain as
-review_run.type: &#34;RULE&#34; or &#34;GUIDELINE&#34;. </p></td>
+ <td><p>The reviewer slot that posted the result; review_run.type stores the
+same enum by name. </p></td>
</tr>
<tr>
<td>rule</td>
<td><a href="#bytebase.store.ReviewRule.Type">ReviewRule.Type</a></td>
<td></td>
- <td><p>The rule judged against. Set if and only if type is &#34;RULE&#34;. </p></td>
+ <td><p>The rule judged against. Set if and only if type is RULE. </p></td>
</tr>
<tr>
@@ -9054,94 +9175,6 @@ IM integration setting should be set for this function to work. </p></td>
- <div class="file-heading">
- <h2 id="store/review_run.proto">store/review_run.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.store.ReviewRun">ReviewRun</h3>
- <p>ReviewRun is the status slot of one reviewer (rule engine or AI) on one</p><p>issue. Results live in issue comments; the run carries none.</p>
-
-
-
-
-
- <h3 id="bytebase.store.ReviewRunPayload">ReviewRunPayload</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>error</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Fatal execution error for the FAILED status, e.g. &#34;metadata not synced:
-instances/prod/databases/db1, db2, db3 (&#43;497 more)&#34;. Written by the
-executor or by the reaper. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
- <h3 id="bytebase.store.ReviewRun.Status">ReviewRun.Status</h3>
- <p>Strictly 1:1 with the status CHECK constraint — no unpersisted values.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>STATUS_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>AVAILABLE</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>RUNNING</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>DONE</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>FAILED</td>
- <td>4</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
<div class="file-heading">
<h2 id="store/revision.proto">store/revision.proto</h2><a href="#title">Top</a>
</div>
diff --git a/proto/store/store/issue_comment.proto b/proto/store/store/issue_comment.proto
index 771fd47ab3..89b9d8207e 100644
--- a/proto/store/store/issue_comment.proto
+++ b/proto/store/store/issue_comment.proto
@@ -7,6 +7,7 @@ import "store/common.proto";
import "store/issue.proto";
import "store/plan.proto";
import "store/review_rule.proto";
+import "store/review_run.proto";
option go_package = "generated-go/store";
@@ -78,10 +79,10 @@ message IssueCommentPayload {
P2 = 3;
}
- // The reviewer slot that posted the result, same value domain as
- // review_run.type: "RULE" or "GUIDELINE".
- string type = 1;
- // The rule judged against. Set if and only if type is "RULE".
+ // The reviewer slot that posted the result; review_run.type stores the
+ // same enum by name.
+ ReviewRun.Type type = 1;
+ // The rule judged against. Set if and only if type is RULE.
ReviewRule.Type rule = 2;
// A result merged across databases carries the highest priority among
// them.
diff --git a/proto/store/store/review_run.proto b/proto/store/store/review_run.proto
index 2e303a02df..109236f913 100644
--- a/proto/store/store/review_run.proto
+++ b/proto/store/store/review_run.proto
@@ -7,6 +7,17 @@ option go_package = "generated-go/store";
// ReviewRun is the status slot of one reviewer (rule engine or AI) on one
// issue. Results live in issue comments; the run carries none.
message ReviewRun {
+ // The reviewer. Stored by name in review_run.type, which has no CHECK:
+ // like Issue.Type and Task.Type, the enum is the source of truth and a
+ // new reviewer is a new value, not a migration.
+ enum Type {
+ TYPE_UNSPECIFIED = 0;
+ // Review against the standard rules.
+ RULE = 1;
+ // Review against natural-language guidelines, performed by AI.
+ GUIDELINE = 2;
+ }
+
// Strictly 1:1 with the status CHECK constraint — no unpersisted values.
enum Status {
STATUS_UNSPECIFIED = 0;