Skip to content

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

feat(issue): expose comment threads and statement anchors in API (#21360)

boojackd200b78ccb5b
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 9fb0155406..f8afd4f333 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -13693,6 +13693,33 @@ components:
type: string
title: creator
description: 'Format: users/{email}'
+ root:
+ type:
+ - string
+ - "null"
+ title: root
+ description: |-
+ 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.
+ threadState:
+ oneOf:
+ - $ref: '#/components/schemas/bytebase.v1.IssueComment.ThreadState'
+ - type: "null"
+ title: thread_state
+ description: |-
+ 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.
+ statementAnchor:
+ title: statement_anchor
+ description: |-
+ 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.
+ $ref: '#/components/schemas/bytebase.v1.StatementAnchor'
- oneOf:
- type: object
properties:
@@ -13821,6 +13848,13 @@ components:
title: ReviewSubmission
additionalProperties: false
description: Review submission event information.
+ bytebase.v1.IssueComment.ThreadState:
+ type: string
+ title: ThreadState
+ enum:
+ - THREAD_STATE_UNSPECIFIED
+ - OPEN
+ - RESOLVED
bytebase.v1.IssueStatus:
type: string
title: IssueStatus
@@ -14528,6 +14562,14 @@ components:
When paginating, all other parameters provided to `ListIssueComments` must match
the call that provided the page token.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ CEL filter over events, root comments, and replies.
+ Supported: root == null, root == "<comment name>", or root in ["<comment name>", ...].
+ Root names must belong to parent. Empty and root == null return the
+ timeline (events and root comments); other filters return replies only.
title: ListIssueCommentsRequest
additionalProperties: false
bytebase.v1.ListIssueCommentsResponse:
@@ -19767,6 +19809,33 @@ components:
- ACTIVE
- DELETED
description: Resource lifecycle state.
+ bytebase.v1.StatementAnchor:
+ type: object
+ properties:
+ spec:
+ type: string
+ title: spec
+ description: The Plan.Spec.id in the issue's plan; may no longer resolve after deletion.
+ sheetSha256:
+ type: string
+ title: sheet_sha256
+ description: SHA256 of the saved sheet, as 64 lowercase hexadecimal characters.
+ startPosition:
+ title: start_position
+ description: |-
+ One-based lines and Unicode code-point columns. When both columns are zero,
+ the range covers whole lines, including the end line. Otherwise both columns
+ must be positive, start_position is inclusive, and end_position is exclusive.
+ $ref: '#/components/schemas/bytebase.v1.Position'
+ endPosition:
+ title: end_position
+ $ref: '#/components/schemas/bytebase.v1.Position'
+ title: StatementAnchor
+ additionalProperties: false
+ description: |-
+ 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.
bytebase.v1.StatementType:
type: string
title: StatementType
diff --git a/backend/api/v1/audit_redact_inventory_test.go b/backend/api/v1/audit_redact_inventory_test.go
index 1e1ea30d39..76d6a255d4 100644
--- a/backend/api/v1/audit_redact_inventory_test.go
+++ b/backend/api/v1/audit_redact_inventory_test.go
@@ -586,6 +586,7 @@ var auditRecordedFields = []string{
"bytebase.v1.IssueComment.creator",
"bytebase.v1.IssueComment.name",
"bytebase.v1.IssueComment.payload",
+ "bytebase.v1.IssueComment.root",
"bytebase.v1.KerberosConfig.instance",
"bytebase.v1.KerberosConfig.kdc_host",
"bytebase.v1.KerberosConfig.kdc_port",
@@ -629,6 +630,7 @@ var auditRecordedFields = []string{
"bytebase.v1.ListInstancesRequest.page_token",
"bytebase.v1.ListInstancesRequest.parent",
"bytebase.v1.ListInstancesResponse.next_page_token",
+ "bytebase.v1.ListIssueCommentsRequest.filter",
"bytebase.v1.ListIssueCommentsRequest.page_token",
"bytebase.v1.ListIssueCommentsRequest.parent",
"bytebase.v1.ListIssueCommentsResponse.next_page_token",
@@ -926,6 +928,8 @@ var auditRecordedFields = []string{
"bytebase.v1.Stage.id",
"bytebase.v1.Stage.name",
"bytebase.v1.StartMFAEnrollmentRequest.name",
+ "bytebase.v1.StatementAnchor.sheet_sha256",
+ "bytebase.v1.StatementAnchor.spec",
"bytebase.v1.StorageConfig.buffering",
"bytebase.v1.StorageConfig.data_compression",
"bytebase.v1.StorageConfig.sort_in_tempdb",
diff --git a/backend/api/v1/issue_comment.go b/backend/api/v1/issue_comment.go
new file mode 100644
index 0000000000..205cd257f6
--- /dev/null
+++ b/backend/api/v1/issue_comment.go
@@ -0,0 +1,106 @@
+package v1
+
+import (
+ "context"
+ "strings"
+ "unicode/utf8"
+
+ "connectrpc.com/connect"
+ "github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/backend/common"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+ "github.com/bytebase/bytebase/backend/store"
+)
+
+// Only new roots require a current spec; replies may reference a deleted spec.
+func (s *IssueService) validateStatementAnchorSpec(ctx context.Context, issue *store.IssueMessage, anchor *v1pb.StatementAnchor) error {
+ if issue.PlanUID == nil {
+ return connect.NewError(connect.CodeInvalidArgument, errors.New("statement_anchor requires an issue with a plan"))
+ }
+ plan, err := s.store.GetPlan(ctx, &store.FindPlanMessage{ProjectID: issue.ProjectID, UID: issue.PlanUID})
+ if err != nil {
+ return connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to get plan"))
+ }
+ if plan != nil {
+ for _, spec := range plan.Config.GetSpecs() {
+ if spec.GetId() != anchor.Spec {
+ continue
+ }
+ if spec.GetChangeDatabaseConfig() == nil {
+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("statement_anchor.spec %q does not have a statement-bearing configuration", anchor.Spec))
+ }
+ return nil
+ }
+ }
+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("statement_anchor.spec %q is not a spec of the issue's plan", anchor.Spec))
+}
+
+func (s *IssueService) validateStatementAnchor(ctx context.Context, issue *store.IssueMessage, anchor *v1pb.StatementAnchor) error {
+ sheet, err := s.store.GetSheetForProject(ctx, issue.ProjectID, anchor.SheetSha256, true)
+ if err != nil {
+ return connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to get anchor sheet"))
+ }
+ if sheet == nil {
+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("statement_anchor.sheet_sha256 %q is not a sheet of project %s", anchor.SheetSha256, issue.ProjectID))
+ }
+ if err := validateStatementAnchorBounds(anchor, sheet.Statement); err != nil {
+ return connect.NewError(connect.CodeInvalidArgument, err)
+ }
+ return nil
+}
+
+// The store validates range ordering and reply containment; both endpoints
+// must also exist in the saved SQL, even for replies inside a whole-line root.
+func validateStatementAnchorBounds(anchor *v1pb.StatementAnchor, statement string) error {
+ start, end := anchor.GetStartPosition(), anchor.GetEndPosition()
+ if start == nil || end == nil || start.Line < 1 || end.Line < 1 || start.Column < 0 || end.Column < 0 {
+ return errors.New("statement_anchor requires valid start and end positions")
+ }
+ // Match editor line endings and retain the empty line after a final newline.
+ statement = strings.NewReplacer("\r\n", "\n", "\r", "\n").Replace(statement)
+ lineNumber := int64(0)
+ for line := range strings.SplitSeq(statement, "\n") {
+ lineNumber++
+ if lineNumber == int64(start.Line) || lineNumber == int64(end.Line) {
+ maxColumn := int64(utf8.RuneCountInString(line)) + 1
+ for _, position := range []*v1pb.Position{start, end} {
+ if int64(position.Line) == lineNumber && int64(position.Column) > maxColumn {
+ return errors.Errorf("statement_anchor column %d exceeds line %d's last position %d", position.Column, position.Line, maxColumn)
+ }
+ }
+ }
+ if lineNumber >= int64(start.Line) && lineNumber >= int64(end.Line) {
+ return nil
+ }
+ }
+ return errors.Errorf("statement_anchor range exceeds the sheet's %d lines", lineNumber)
+}
+
+// issueCommentError maps a store error to the connect code the rest of the
+// package uses for the same class: Conflict is FailedPrecondition, as in
+// rollout_service.go and instance_service.go.
+func issueCommentError(err error) error {
+ code := connect.CodeInternal
+ switch common.ErrorCode(err) {
+ case common.Invalid:
+ code = connect.CodeInvalidArgument
+ case common.NotFound:
+ code = connect.CodeNotFound
+ case common.Conflict:
+ code = connect.CodeFailedPrecondition
+ default:
+ }
+ return connect.NewError(code, err)
+}
+
+func convertToStoreThreadState(state v1pb.IssueComment_ThreadState) (store.ThreadState, error) {
+ switch state {
+ case v1pb.IssueComment_OPEN:
+ return store.ThreadStateOpen, nil
+ case v1pb.IssueComment_RESOLVED:
+ return store.ThreadStateResolved, nil
+ default:
+ return "", connect.NewError(connect.CodeInvalidArgument, errors.New("thread_state must be OPEN or RESOLVED"))
+ }
+}
diff --git a/backend/api/v1/issue_comment_test.go b/backend/api/v1/issue_comment_test.go
new file mode 100644
index 0000000000..664314350e
--- /dev/null
+++ b/backend/api/v1/issue_comment_test.go
@@ -0,0 +1,488 @@
+package v1
+
+import (
+ "fmt"
+ "strings"
+ "testing"
+
+ "connectrpc.com/connect"
+ "github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/fieldmaskpb"
+
+ "github.com/bytebase/bytebase/backend/common"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+ "github.com/bytebase/bytebase/backend/store"
+)
+
+func TestIssueCommentAPI(t *testing.T) {
+ t.Parallel()
+ ctx := issueServiceTestContext()
+ stores := setupIssueServiceTestStore(ctx, t)
+ service := newIssueServiceForTest(t, stores)
+ _, issue := createIssueServiceApprovalIssue(ctx, t, stores)
+ parent := common.FormatIssue(issue.ProjectID, issue.UID)
+ create := func(comment *v1pb.IssueComment) *v1pb.IssueComment {
+ t.Helper()
+ resp, err := service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
+ Parent: parent, IssueComment: comment,
+ }))
+ require.NoError(t, err)
+ return resp.Msg
+ }
+ list := func(filter string) []*v1pb.IssueComment {
+ t.Helper()
+ var comments []*v1pb.IssueComment
+ token := ""
+ for {
+ resp, err := service.ListIssueComments(ctx, connect.NewRequest(&v1pb.ListIssueCommentsRequest{
+ Parent: parent, Filter: filter, PageSize: 1, PageToken: token,
+ }))
+ require.NoError(t, err)
+ comments = append(comments, resp.Msg.IssueComments...)
+ token = resp.Msg.NextPageToken
+ if token == "" {
+ return comments
+ }
+ }
+ }
+ update := func(comment *v1pb.IssueComment, paths ...string) (*v1pb.IssueComment, error) {
+ t.Helper()
+ resp, err := service.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{
+ Parent: parent, IssueComment: comment, UpdateMask: &fieldmaskpb.FieldMask{Paths: paths},
+ }))
+ if err != nil {
+ return nil, err
+ }
+ return resp.Msg, nil
+ }
+
+ general := create(&v1pb.IssueComment{Comment: "general"})
+ require.Nil(t, general.Root)
+ require.Nil(t, general.ThreadState)
+ require.Nil(t, general.StatementAnchor)
+ sheets, err := stores.CreateSheets(ctx, issue.ProjectID, &store.SheetMessage{Statement: "SELECT 1;\nSELECT 2;\nSELECT 3;\nSELECT 4;"})
+ require.NoError(t, err)
+ anchor := &v1pb.StatementAnchor{
+ Spec: "spec-1", SheetSha256: sheets[0].Sha256,
+ StartPosition: &v1pb.Position{Line: 2}, EndPosition: &v1pb.Position{Line: 4},
+ }
+ root := create(&v1pb.IssueComment{Comment: "root", ThreadState: v1pb.IssueComment_OPEN.Enum(), StatementAnchor: anchor})
+ require.True(t, proto.Equal(anchor, root.StatementAnchor))
+ require.Equal(t, v1pb.IssueComment_OPEN, root.GetThreadState())
+ unanchored := create(&v1pb.IssueComment{Comment: "unanchored thread", ThreadState: v1pb.IssueComment_OPEN.Enum()})
+ require.Nil(t, unanchored.StatementAnchor)
+ require.Equal(t, v1pb.IssueComment_OPEN, unanchored.GetThreadState())
+
+ resolved, err := update(&v1pb.IssueComment{Name: root.Name, ThreadState: v1pb.IssueComment_RESOLVED.Enum()}, "thread_state")
+ require.NoError(t, err)
+ require.True(t, proto.Equal(root.UpdateTime, resolved.UpdateTime), "resolution is not a text edit")
+ replyAnchor := proto.CloneOf(anchor)
+ replyAnchor.StartPosition = &v1pb.Position{Line: 2, Column: 1}
+ replyAnchor.EndPosition = &v1pb.Position{Line: 2, Column: 3}
+ reply := create(&v1pb.IssueComment{Comment: "reply", Root: &root.Name, StatementAnchor: replyAnchor})
+ require.Equal(t, root.Name, reply.GetRoot())
+ require.Nil(t, reply.ThreadState)
+ require.True(t, proto.Equal(replyAnchor, reply.StatementAnchor))
+ replies := list(fmt.Sprintf("root == %q", root.Name))
+ require.Len(t, replies, 1)
+ require.Equal(t, reply.Name, replies[0].Name)
+ require.Equal(t, []string{reply.Name}, commentNames(list(fmt.Sprintf("root in [%q, %q]", root.Name, unanchored.Name))))
+ require.Empty(t, list("root in []"))
+
+ event, err := stores.CreateIssueComments(ctx, "[email protected]", &store.IssueCommentMessage{
+ ProjectID: issue.ProjectID, IssueUID: issue.UID,
+ Payload: &storepb.IssueCommentPayload{Event: &storepb.IssueCommentPayload_ReviewSubmission_{
+ ReviewSubmission: &storepb.IssueCommentPayload_ReviewSubmission{},
+ }},
+ })
+ require.NoError(t, err)
+ eventName := common.FormatIssueComment(parent, event.ResourceID)
+ timeline := list("root == null")
+ require.Equal(t, []string{general.Name, root.Name, unanchored.Name, eventName}, commentNames(timeline))
+ require.Equal(t, v1pb.IssueComment_RESOLVED, timeline[1].GetThreadState(), "reply must not reopen")
+ require.Equal(t, commentNames(timeline), commentNames(list("")), "clients that predate threads keep the timeline")
+
+ edited, err := update(&v1pb.IssueComment{Name: reply.Name, Comment: "edited"}, "comment")
+ require.NoError(t, err)
+ require.Equal(t, "edited", edited.Comment)
+ require.Equal(t, root.Name, edited.GetRoot())
+ require.True(t, proto.Equal(replyAnchor, edited.StatementAnchor))
+ reopened, err := update(&v1pb.IssueComment{Name: root.Name, ThreadState: v1pb.IssueComment_OPEN.Enum()}, "thread_state")
+ require.NoError(t, err)
+ require.Equal(t, v1pb.IssueComment_OPEN, reopened.GetThreadState())
+
+ for _, name := range []string{general.Name, reply.Name, eventName} {
+ _, err := update(&v1pb.IssueComment{Name: name, ThreadState: v1pb.IssueComment_RESOLVED.Enum()}, "thread_state")
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
+ Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "invalid reply", Root: &name},
+ }))
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ }
+ for _, path := range []string{"root", "statement_anchor", "event"} {
+ _, err := update(&v1pb.IssueComment{Name: root.Name, Comment: "must not change"}, "comment", path)
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ }
+ require.Equal(t, "root", list("root == null")[1].Comment)
+ _, err = update(&v1pb.IssueComment{Name: general.Name}, "comment")
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ require.Equal(t, "general", list("root == null")[0].Comment)
+ for _, state := range []*v1pb.IssueComment_ThreadState{nil, v1pb.IssueComment_THREAD_STATE_UNSPECIFIED.Enum(), v1pb.IssueComment_ThreadState(99).Enum()} {
+ _, err := update(&v1pb.IssueComment{Name: root.Name, ThreadState: state}, "thread_state")
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ }
+
+ _, otherIssue := createIssueServiceApprovalIssue(ctx, t, stores)
+ otherParent := common.FormatIssue(issue.ProjectID, otherIssue.UID)
+ for _, foreign := range []string{
+ strings.Replace(root.Name, "projects/project-a/", "projects/project-b/", 1),
+ strings.Replace(root.Name, parent+"/", otherParent+"/", 1),
+ } {
+ _, err := service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
+ Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "foreign reply", Root: &foreign},
+ }))
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ _, err = update(&v1pb.IssueComment{Name: foreign, Comment: "foreign edit"}, "comment")
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ }
+
+ missing := common.FormatIssueComment(parent, "no-such-comment")
+ invalid := []*v1pb.IssueComment{
+ nil, {}, {Comment: "empty root", Root: proto.String("")},
+ {Comment: "dangling root", Root: &missing},
+ {Comment: "resolved", ThreadState: v1pb.IssueComment_RESOLVED.Enum()},
+ {Comment: "unspecified", ThreadState: v1pb.IssueComment_THREAD_STATE_UNSPECIFIED.Enum()},
+ {Comment: "reply state", Root: &root.Name, ThreadState: v1pb.IssueComment_OPEN.Enum()},
+ {Comment: "bad anchor", ThreadState: v1pb.IssueComment_OPEN.Enum(), StatementAnchor: &v1pb.StatementAnchor{}},
+ {Comment: "unknown spec", StatementAnchor: &v1pb.StatementAnchor{Spec: "spec-9", SheetSha256: anchor.SheetSha256}},
+ {Comment: "unknown sheet", StatementAnchor: &v1pb.StatementAnchor{Spec: "spec-1", SheetSha256: strings.Repeat("a", 64)}},
+ {Comment: "anchor elsewhere", Root: &root.Name, StatementAnchor: &v1pb.StatementAnchor{Spec: "spec-2", SheetSha256: anchor.SheetSha256, StartPosition: anchor.StartPosition, EndPosition: anchor.EndPosition}},
+ {Comment: "anchor on unanchored thread", Root: &unanchored.Name, StatementAnchor: anchor},
+ {Comment: "event", Event: &v1pb.IssueComment_ReviewSubmission_{ReviewSubmission: &v1pb.IssueComment_ReviewSubmission{}}},
+ }
+ for _, comment := range invalid {
+ _, err := service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{Parent: parent, IssueComment: comment}))
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ }
+ derived := create(&v1pb.IssueComment{Comment: "anchor derives the thread", StatementAnchor: anchor})
+ require.Equal(t, v1pb.IssueComment_OPEN, derived.GetThreadState())
+}
+
+func commentNames(comments []*v1pb.IssueComment) []string {
+ names := make([]string, 0, len(comments))
+ for _, comment := range comments {
+ names = append(names, comment.Name)
+ }
+ return names
+}
+
+func TestIssueCommentAllowMissing(t *testing.T) {
+ ctx := issueServiceTestContext()
+ stores := setupIssueServiceTestStore(ctx, t)
+ service := newIssueServiceForTest(t, stores)
+ _, issue := createIssueServiceApprovalIssue(ctx, t, stores)
+ parent := common.FormatIssue(issue.ProjectID, issue.UID)
+ sheets, err := stores.CreateSheets(ctx, issue.ProjectID, &store.SheetMessage{Statement: "SELECT 1;\nSELECT 2;\nSELECT 3;\nSELECT 4;\nSELECT 5;"})
+ require.NoError(t, err)
+ anchor := &v1pb.StatementAnchor{
+ Spec: "spec-1", SheetSha256: sheets[0].Sha256,
+ StartPosition: &v1pb.Position{Line: 2}, EndPosition: &v1pb.Position{Line: 4},
+ }
+ root, err := service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
+ Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "root", StatementAnchor: anchor},
+ }))
+ require.NoError(t, err)
+ missing := common.FormatIssueComment(parent, "missing")
+ foreignRoot := strings.Replace(root.Msg.Name, "projects/project-a/", "projects/other/", 1)
+ expanded := proto.CloneOf(anchor)
+ expanded.EndPosition.Line = 5
+ wrongSpec := proto.CloneOf(anchor)
+ wrongSpec.Spec = "spec-2"
+
+ count := func() int {
+ t.Helper()
+ comments, err := stores.ListIssueComment(ctx, &store.FindIssueCommentMessage{
+ ProjectID: issue.ProjectID, IssueUID: &issue.UID,
+ })
+ require.NoError(t, err)
+ return len(comments)
+ }
+ for _, tc := range []struct {
+ name string
+ comment *v1pb.IssueComment
+ invalid bool
+ }{
+ {"general", &v1pb.IssueComment{Comment: "general"}, false},
+ {"open thread", &v1pb.IssueComment{Comment: "thread", ThreadState: v1pb.IssueComment_OPEN.Enum()}, false},
+ {"anchored thread", &v1pb.IssueComment{Comment: "thread", ThreadState: v1pb.IssueComment_OPEN.Enum(), StatementAnchor: anchor}, false},
+ {"derived thread", &v1pb.IssueComment{Comment: "thread", StatementAnchor: anchor}, false},
+ {"reply", &v1pb.IssueComment{Comment: "reply", Root: &root.Msg.Name}, false},
+ {"anchored reply", &v1pb.IssueComment{Comment: "reply", Root: &root.Msg.Name, StatementAnchor: anchor}, false},
+ {"reply with state", &v1pb.IssueComment{Comment: "reply", Root: &root.Msg.Name, ThreadState: v1pb.IssueComment_OPEN.Enum()}, true},
+ {"resolved on create", &v1pb.IssueComment{Comment: "thread", ThreadState: v1pb.IssueComment_RESOLVED.Enum()}, true},
+ {"unspecified state", &v1pb.IssueComment{Comment: "thread", ThreadState: v1pb.IssueComment_THREAD_STATE_UNSPECIFIED.Enum()}, true},
+ {"unknown state", &v1pb.IssueComment{Comment: "thread", ThreadState: v1pb.IssueComment_ThreadState(99).Enum()}, true},
+ {"empty comment", &v1pb.IssueComment{StatementAnchor: anchor}, true},
+ {"missing root", &v1pb.IssueComment{Comment: "reply", Root: &missing}, true},
+ {"foreign root", &v1pb.IssueComment{Comment: "reply", Root: &foreignRoot}, true},
+ {"malformed anchor", &v1pb.IssueComment{Comment: "thread", StatementAnchor: &v1pb.StatementAnchor{}}, true},
+ {"expanded reply", &v1pb.IssueComment{Comment: "reply", Root: &root.Msg.Name, StatementAnchor: expanded}, true},
+ {"different spec", &v1pb.IssueComment{Comment: "reply", Root: &root.Msg.Name, StatementAnchor: wrongSpec}, true},
+ {"event", &v1pb.IssueComment{Comment: "event", Event: &v1pb.IssueComment_ReviewSubmission_{ReviewSubmission: &v1pb.IssueComment_ReviewSubmission{}}}, true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ before := count()
+ input := proto.CloneOf(tc.comment)
+ input.Name = missing
+ response, err := service.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{
+ Parent: parent, AllowMissing: true, IssueComment: input,
+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"comment"}},
+ }))
+ if tc.invalid {
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ require.Equal(t, before, count(), "invalid creation must not write a general comment")
+ return
+ }
+ require.NoError(t, err)
+ require.Equal(t, before+1, count())
+ require.Equal(t, input.Comment, response.Msg.Comment)
+ require.Equal(t, input.Root, response.Msg.Root)
+ require.True(t, proto.Equal(input.StatementAnchor, response.Msg.StatementAnchor))
+ state := input.ThreadState
+ if input.Root == nil && input.StatementAnchor != nil {
+ state = v1pb.IssueComment_OPEN.Enum()
+ }
+ require.Equal(t, state, response.Msg.ThreadState)
+
+ _, _, id, err := common.GetProjectIDIssueUIDIssueCommentID(response.Msg.Name)
+ require.NoError(t, err)
+ persisted, err := stores.GetIssueComment(ctx, &store.FindIssueCommentMessage{
+ ProjectID: issue.ProjectID, IssueUID: &issue.UID, ResourceID: &id,
+ })
+ require.NoError(t, err)
+ require.True(t, proto.Equal(response.Msg, convertToIssueComment(parent, persisted)))
+ })
+ }
+
+ // A present resource still applies only the mask, even with allow_missing.
+ updated, err := service.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{
+ Parent: parent, AllowMissing: true, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"comment"}},
+ IssueComment: &v1pb.IssueComment{
+ Name: root.Msg.Name, Comment: "edited",
+ Root: &foreignRoot, ThreadState: v1pb.IssueComment_RESOLVED.Enum(), StatementAnchor: expanded,
+ },
+ }))
+ require.NoError(t, err)
+ require.Equal(t, "edited", updated.Msg.Comment)
+ require.Nil(t, updated.Msg.Root)
+ require.Equal(t, v1pb.IssueComment_OPEN, updated.Msg.GetThreadState())
+ require.True(t, proto.Equal(anchor, updated.Msg.StatementAnchor))
+
+ before := count()
+ _, err = service.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{
+ Parent: parent, IssueComment: &v1pb.IssueComment{Name: missing, Comment: "missing", StatementAnchor: anchor},
+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"comment"}},
+ }))
+ require.Equal(t, connect.CodeNotFound, connect.CodeOf(err))
+ require.Equal(t, before, count())
+}
+
+func TestIssueCommentAnchorSpec(t *testing.T) {
+ ctx := issueServiceTestContext()
+ stores := setupIssueServiceTestStore(ctx, t)
+ service := newIssueServiceForTest(t, stores)
+ sheets, err := stores.CreateSheets(ctx, "project-a", &store.SheetMessage{Statement: "SELECT 1;"}, &store.SheetMessage{Statement: "SELECT 2;"})
+ require.NoError(t, err)
+ anchor := &v1pb.StatementAnchor{
+ Spec: "spec-1", SheetSha256: sheets[0].Sha256,
+ StartPosition: &v1pb.Position{Line: 1}, EndPosition: &v1pb.Position{Line: 1},
+ }
+ for _, tc := range []struct {
+ name string
+ spec *storepb.PlanConfig_Spec
+ invalid bool
+ }{
+ {"sheet", &storepb.PlanConfig_Spec{Id: "spec-1", Config: &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
+ ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{SheetSha256: sheets[0].Sha256},
+ }}, false},
+ {"historical sheet", &storepb.PlanConfig_Spec{Id: "spec-1", Config: &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
+ ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{SheetSha256: sheets[1].Sha256},
+ }}, false},
+ {"release", &storepb.PlanConfig_Spec{Id: "spec-1", Config: &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
+ ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{Release: "projects/project-a/releases/release-a"},
+ }}, false},
+ {"create database", &storepb.PlanConfig_Spec{Id: "spec-1", Config: &storepb.PlanConfig_Spec_CreateDatabaseConfig{
+ CreateDatabaseConfig: &storepb.PlanConfig_CreateDatabaseConfig{Target: "instances/prod", Database: "app"},
+ }}, true},
+ {"missing config", &storepb.PlanConfig_Spec{Id: "spec-1"}, true},
+ {"missing spec", &storepb.PlanConfig_Spec{Id: "other-spec"}, true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ plan, err := stores.CreatePlan(ctx, &store.PlanMessage{
+ ProjectID: "project-a", Name: tc.name,
+ Config: &storepb.PlanConfig{Specs: []*storepb.PlanConfig_Spec{
+ tc.spec,
+ {Id: "another-sql-spec", Config: &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
+ ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{SheetSha256: sheets[0].Sha256},
+ }},
+ }},
+ require.NoError(t, err)
+ issue, err := stores.CreateIssue(ctx, &store.IssueMessage{
+ ProjectID: "project-a", CreatorEmail: "[email protected]", Title: tc.name,
+ Type: storepb.Issue_DATABASE_CHANGE, PlanUID: &plan.UID, Payload: &storepb.Issue{},
+ })
+ require.NoError(t, err)
+ parent := common.FormatIssue(issue.ProjectID, issue.UID)
+ for _, allowMissing := range []bool{false, true} {
+ t.Run(fmt.Sprintf("allowMissing=%t", allowMissing), func(t *testing.T) {
+ input := &v1pb.IssueComment{Comment: "root", StatementAnchor: anchor}
+ if allowMissing {
+ input.Name = common.FormatIssueComment(parent, "missing")
+ _, err = service.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{
+ Parent: parent, IssueComment: input, AllowMissing: true,
+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"comment"}},
+ }))
+ } else {
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{Parent: parent, IssueComment: input}))
+ }
+ if tc.invalid {
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ comments, err := stores.ListIssueComment(ctx, &store.FindIssueCommentMessage{ProjectID: issue.ProjectID, IssueUID: &issue.UID})
+ require.NoError(t, err)
+ require.Empty(t, comments)
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
+ Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "general"},
+ }))
+ require.NoError(t, err)
+ // A previously valid root remains replyable after its spec changes or disappears.
+ historical, err := stores.CreateIssueComments(ctx, "[email protected]", &store.IssueCommentMessage{
+ ProjectID: issue.ProjectID, IssueUID: issue.UID,
+ Payload: &storepb.IssueCommentPayload{Comment: "historical", StatementAnchor: &storepb.IssueCommentPayload_StatementAnchor{
+ SpecId: anchor.Spec, SheetSha256: anchor.SheetSha256,
+ StartPosition: &storepb.Position{Line: 1}, EndPosition: &storepb.Position{Line: 1},
+ }},
+ })
+ require.NoError(t, err)
+ root := common.FormatIssueComment(parent, historical.ResourceID)
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
+ Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "reply", Root: &root, StatementAnchor: anchor},
+ }))
+ require.NoError(t, err)
+ })
+ }
+}
+
+func TestStatementAnchorBounds(t *testing.T) {
+ t.Parallel()
+ for _, tc := range []struct {
+ name string
+ statement string
+ start, end *v1pb.Position
+ invalid bool
+ }{
+ {"whole line", "SELECT 1;", &v1pb.Position{Line: 1}, &v1pb.Position{Line: 1}, false},
+ {"line past EOF", "SELECT 1;", &v1pb.Position{Line: 1}, &v1pb.Position{Line: 999}, true},
+ {"start past EOF", "SELECT 1;", &v1pb.Position{Line: 999}, &v1pb.Position{Line: 1000}, true},
+ {"exclusive end", "abc", &v1pb.Position{Line: 1, Column: 1}, &v1pb.Position{Line: 1, Column: 4}, false},
+ {"end past EOL", "abc", &v1pb.Position{Line: 1, Column: 1}, &v1pb.Position{Line: 1, Column: 5}, true},
+ {"start past EOL", "a\nbc", &v1pb.Position{Line: 1, Column: 3}, &v1pb.Position{Line: 2, Column: 2}, true},
+ {"Unicode code points", "你😀é", &v1pb.Position{Line: 1, Column: 2}, &v1pb.Position{Line: 1, Column: 5}, false},
+ {"UTF16 is not code points", "你😀é", &v1pb.Position{Line: 1, Column: 2}, &v1pb.Position{Line: 1, Column: 6}, true},
+ {"newline range", "a\nb", &v1pb.Position{Line: 1, Column: 2}, &v1pb.Position{Line: 2, Column: 1}, false},
+ {"final empty line", "a\n", &v1pb.Position{Line: 2}, &v1pb.Position{Line: 2}, false},
+ {"final newline end", "a\n", &v1pb.Position{Line: 1, Column: 1}, &v1pb.Position{Line: 2, Column: 1}, false},
+ {"past final empty line", "a\n", &v1pb.Position{Line: 1, Column: 1}, &v1pb.Position{Line: 2, Column: 2}, true},
+ {"empty sheet", "", &v1pb.Position{Line: 1}, &v1pb.Position{Line: 1}, false},
+ {"empty sheet column", "", &v1pb.Position{Line: 1, Column: 1}, &v1pb.Position{Line: 1, Column: 2}, true},
+ {"CRLF", "a\r\nb\r\n", &v1pb.Position{Line: 1, Column: 2}, &v1pb.Position{Line: 3, Column: 1}, false},
+ {"CRLF past EOL", "a\r\nb", &v1pb.Position{Line: 1, Column: 3}, &v1pb.Position{Line: 2, Column: 1}, true},
+ {"CR", "a\rb", &v1pb.Position{Line: 2, Column: 1}, &v1pb.Position{Line: 2, Column: 2}, false},
+ {"missing start", "a", nil, &v1pb.Position{Line: 1}, true},
+ {"missing end", "a", &v1pb.Position{Line: 1}, nil, true},
+ {"zero line", "a", &v1pb.Position{}, &v1pb.Position{Line: 1}, true},
+ {"negative column", "a", &v1pb.Position{Line: 1, Column: -1}, &v1pb.Position{Line: 1}, true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+ err := validateStatementAnchorBounds(&v1pb.StatementAnchor{StartPosition: tc.start, EndPosition: tc.end}, tc.statement)
+ if tc.invalid {
+ require.Error(t, err)
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+}
+
+func TestIssueCommentAnchorBounds(t *testing.T) {
+ ctx := issueServiceTestContext()
+ stores := setupIssueServiceTestStore(ctx, t)
+ service := newIssueServiceForTest(t, stores)
+ _, issue := createIssueServiceApprovalIssue(ctx, t, stores)
+ parent := common.FormatIssue(issue.ProjectID, issue.UID)
+ sheets, err := stores.CreateSheets(ctx, issue.ProjectID, &store.SheetMessage{Statement: "SELECT 1;\n你😀\nSELECT 3;"})
+ require.NoError(t, err)
+ anchor := &v1pb.StatementAnchor{Spec: "spec-1", SheetSha256: sheets[0].Sha256, StartPosition: &v1pb.Position{Line: 1}, EndPosition: &v1pb.Position{Line: 3}}
+ root, err := service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "root", StatementAnchor: anchor}}))
+ require.NoError(t, err)
+ for _, tc := range []struct {
+ name string
+ start, end *v1pb.Position
+ invalid bool
+ }{
+ {"whole lines", &v1pb.Position{Line: 1}, &v1pb.Position{Line: 3}, false},
+ {"Unicode exclusive end", &v1pb.Position{Line: 2, Column: 1}, &v1pb.Position{Line: 2, Column: 3}, false},
+ {"invalid line", &v1pb.Position{Line: 1}, &v1pb.Position{Line: 999}, true},
+ {"invalid columns inside whole-line root", &v1pb.Position{Line: 2, Column: 999}, &v1pb.Position{Line: 2, Column: 1000}, true},
+ {"invalid start inside multiline root", &v1pb.Position{Line: 2, Column: 4}, &v1pb.Position{Line: 3, Column: 1}, true},
+ {"Unicode end overflow", &v1pb.Position{Line: 2, Column: 1}, &v1pb.Position{Line: 2, Column: 4}, true},
+ } {
+ for _, reply := range []bool{false, true} {
+ for _, allowMissing := range []bool{false, true} {
+ t.Run(fmt.Sprintf("%s/reply=%t/allowMissing=%t", tc.name, reply, allowMissing), func(t *testing.T) {
+ input := &v1pb.IssueComment{Comment: "comment", StatementAnchor: proto.CloneOf(anchor)}
+ input.StatementAnchor.StartPosition, input.StatementAnchor.EndPosition = tc.start, tc.end
+ if reply {
+ input.Root = &root.Msg.Name
+ }
+ if allowMissing {
+ input.Name = common.FormatIssueComment(parent, "missing")
+ _, err = service.UpdateIssueComment(ctx, connect.NewRequest(&v1pb.UpdateIssueCommentRequest{Parent: parent, AllowMissing: true, IssueComment: input, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"comment"}}}))
+ } else {
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{Parent: parent, IssueComment: input}))
+ }
+ if tc.invalid {
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+ }
+ }
+
+ // Seed a historical root whose spec no longer exists in the current plan.
+ historical, err := stores.CreateIssueComments(ctx, "[email protected]", &store.IssueCommentMessage{
+ ProjectID: issue.ProjectID, IssueUID: issue.UID,
+ Payload: &storepb.IssueCommentPayload{Comment: "historical", StatementAnchor: &storepb.IssueCommentPayload_StatementAnchor{
+ SpecId: "removed-spec", SheetSha256: anchor.SheetSha256, StartPosition: &storepb.Position{Line: 1}, EndPosition: &storepb.Position{Line: 3},
+ }},
+ })
+ require.NoError(t, err)
+ historicalName := common.FormatIssueComment(parent, historical.ResourceID)
+ historicalAnchor := proto.CloneOf(anchor)
+ historicalAnchor.Spec = "removed-spec"
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "historical reply", Root: &historicalName, StatementAnchor: historicalAnchor}}))
+ require.NoError(t, err)
+ _, err = service.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{Parent: parent, IssueComment: &v1pb.IssueComment{Comment: "new root", StatementAnchor: historicalAnchor}}))
+ require.Equal(t, connect.CodeInvalidArgument, connect.CodeOf(err))
+}
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index d5cfa30be3..8d0b7b69e7 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -1221,6 +1221,11 @@ func (s *IssueService) ListIssueComments(ctx context.Context, req *connect.Reque
if err != nil {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("%v", err.Error()))
}
+ find, err := store.GetIssueCommentListFilter(req.Msg.Filter, projectID, issueUID)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, err)
+ }
+
issue, err := s.store.GetIssue(ctx, &store.FindIssueMessage{
Workspace: common.GetWorkspaceIDFromContext(ctx),
UID: &issueUID,
@@ -1243,16 +1248,9 @@ func (s *IssueService) ListIssueComments(ctx context.Context, req *connect.Reque
}
limitPlusOne := offset.limit + 1
- issueComments, err := s.store.ListIssueComment(ctx, &store.FindIssueCommentMessage{
- ProjectID: projectID,
- IssueUID: &issue.UID,
- // The activity timeline holds events and root comments only. The v1
- // message cannot represent a reply yet, and a reply must not consume
- // a page slot; replies are read per thread through ParentIDs.
- TopLevelOnly: true,
- Limit: &limitPlusOne,
- Offset: &offset.offset,
- })
+ find.Limit = &limitPlusOne
+ find.Offset = &offset.offset
+ issueComments, err := s.store.ListIssueComment(ctx, find)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to list issue comments, err: %v", err))
}
@@ -1272,9 +1270,16 @@ func (s *IssueService) ListIssueComments(ctx context.Context, req *connect.Reque
// CreateIssueComment creates the issue comment.
func (s *IssueService) CreateIssueComment(ctx context.Context, req *connect.Request[v1pb.CreateIssueCommentRequest]) (*connect.Response[v1pb.IssueComment], error) {
- if req.Msg.IssueComment.Comment == "" {
+ if req.Msg.IssueComment.GetComment() == "" {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("issue comment is empty"))
}
+ comment := req.Msg.IssueComment
+ // The store never sees the v1 event, so this is the one rule it cannot
+ // enforce; every thread invariant is the store's.
+ if comment.Event != nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("events cannot be created through CreateIssueComment"))
+ }
+
user, ok := GetUserFromContext(ctx)
if !ok {
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
@@ -1292,15 +1297,58 @@ func (s *IssueService) CreateIssueComment(ctx context.Context, req *connect.Requ
return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("project %s not found", issue.ProjectID))
}
- ic, err := s.store.CreateIssueComments(ctx, user.Email, &store.IssueCommentMessage{
+ create := &store.IssueCommentMessage{
ProjectID: issue.ProjectID,
IssueUID: issue.UID,
- Payload: &storepb.IssueCommentPayload{
- Comment: req.Msg.IssueComment.Comment,
- },
- })
+ Payload: &storepb.IssueCommentPayload{Comment: comment.Comment},
+ }
+ if comment.Root != nil {
+ p, uid, id, err := common.GetProjectIDIssueUIDIssueCommentID(comment.GetRoot())
+ if err != nil || p != issue.ProjectID || uid != issue.UID {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("root must name a comment in the same issue"))
+ }
+ create.ParentID = &id
+ }
+ if comment.ThreadState != nil {
+ state, err := convertToStoreThreadState(comment.GetThreadState())
+ if err != nil {
+ return nil, err
+ }
+ create.ThreadState = &state
+ }
+ if anchor := comment.StatementAnchor; anchor != nil {
+ if comment.Root == nil {
+ if err := s.validateStatementAnchorSpec(ctx, issue, anchor); err != nil {
+ return nil, err
+ }
+ }
+ if err := s.validateStatementAnchor(ctx, issue, anchor); err != nil {
+ return nil, err
+ }
+ create.Payload.StatementAnchor = &storepb.IssueCommentPayload_StatementAnchor{
+ SpecId: anchor.Spec,
+ SheetSha256: anchor.SheetSha256,
+ }
+ if anchor.StartPosition != nil {
+ create.Payload.StatementAnchor.StartPosition = &storepb.Position{Line: anchor.StartPosition.Line, Column: anchor.StartPosition.Column}
+ }
+ if anchor.EndPosition != nil {
+ create.Payload.StatementAnchor.EndPosition = &storepb.Position{Line: anchor.EndPosition.Line, Column: anchor.EndPosition.Column}
+ }
+ }
+ var ic *store.IssueCommentMessage
+ if create.ParentID != nil {
+ ic, err = s.store.CreateIssueCommentReply(ctx, user.Email, create)
+ // root is a request field, not the requested resource: a missing
+ // root is a bad request, not a missing parent.
+ if err != nil && common.ErrorCode(err) == common.NotFound {
+ return nil, connect.NewError(connect.CodeInvalidArgument, err)
+ }
+ } else {
+ ic, err = s.store.CreateIssueComments(ctx, user.Email, create)
+ }
if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to create issue comment: %v", err))
+ return nil, issueCommentError(err)
}
return connect.NewResponse(convertToIssueComment(req.Msg.Parent, ic)), nil
@@ -1308,10 +1356,14 @@ func (s *IssueService) CreateIssueComment(ctx context.Context, req *connect.Requ
// UpdateIssueComment updates the issue comment.
func (s *IssueService) UpdateIssueComment(ctx context.Context, req *connect.Request[v1pb.UpdateIssueCommentRequest]) (*connect.Response[v1pb.IssueComment], error) {
- if req.Msg.UpdateMask.Paths == nil {
+ if len(req.Msg.UpdateMask.GetPaths()) == 0 {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("update_mask is required"))
}
+ if req.Msg.IssueComment == nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("issue_comment is required"))
+ }
+
user, ok := GetUserFromContext(ctx)
if !ok {
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
@@ -1322,11 +1374,11 @@ func (s *IssueService) UpdateIssueComment(ctx context.Context, req *connect.Requ
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid parent %q: %v", req.Msg.Parent, err))
}
- _, commentIssueUID, issueCommentID, err := common.GetProjectIDIssueUIDIssueCommentID(req.Msg.IssueComment.Name)
+ commentProjectID, commentIssueUID, issueCommentID, err := common.GetProjectIDIssueUIDIssueCommentID(req.Msg.IssueComment.Name)
if err != nil {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid comment name %q: %v", req.Msg.IssueComment.Name, err))
}
- if parentIssueUID != commentIssueUID {
+ if parentProjectID != commentProjectID || parentIssueUID != commentIssueUID {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("issue comment %q does not belong to parent %q", req.Msg.IssueComment.Name, req.Msg.Parent))
}
issueComment, err := s.store.GetIssueComment(ctx, &store.FindIssueCommentMessage{ProjectID: parentProjectID, ResourceID: &issueCommentID, IssueUID: &parentIssueUID})
@@ -1342,6 +1394,7 @@ func (s *IssueService) UpdateIssueComment(ctx context.Context, req *connect.Requ
if !ok {
return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("user does not have permission %q", permission.IssueCommentsCreate))
}
+ // Creation applies the complete resource regardless of the update mask.
return s.CreateIssueComment(ctx, connect.NewRequest(&v1pb.CreateIssueCommentRequest{
Parent: req.Msg.Parent,
IssueComment: req.Msg.IssueComment,
@@ -1356,20 +1409,26 @@ func (s *IssueService) UpdateIssueComment(ctx context.Context, req *connect.Requ
for _, path := range req.Msg.UpdateMask.Paths {
switch path {
case "comment":
- if req.Msg.IssueComment.Comment == "" {
+ if req.Msg.IssueComment.GetComment() == "" {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("issue comment is empty"))
}
update.Comment = &req.Msg.IssueComment.Comment
+ case "thread_state":
+ if issueComment.ThreadState == nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("only thread roots can be resolved or reopened"))
+ }
+ state, err := convertToStoreThreadState(req.Msg.IssueComment.GetThreadState())
+ if err != nil {
+ return nil, err
+ }
+ update.ThreadState = &state
default:
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf(`unsupport update_mask: "%s"`, path))
}
}
if err := s.store.UpdateIssueComment(ctx, update); err != nil {
- if common.ErrorCode(err) == common.NotFound {
- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("cannot found the issue comment %s", req.Msg.IssueComment.Name))
- }
- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to update the issue comment with error: %v", err.Error()))
+ return nil, issueCommentError(err)
}
issueComment, err = s.store.GetIssueComment(ctx, &store.FindIssueCommentMessage{ProjectID: parentProjectID, ResourceID: &issueCommentID})
if err != nil {
diff --git a/backend/api/v1/issue_service_converter.go b/backend/api/v1/issue_service_converter.go
index 4e94686ed8..d8dbe0941e 100644
--- a/backend/api/v1/issue_service_converter.go
+++ b/backend/api/v1/issue_service_converter.go
@@ -1,8 +1,6 @@
package v1
import (
- "fmt"
-
"github.com/pkg/errors"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -190,10 +188,30 @@ func convertToIssueComment(issueName string, ic *store.IssueCommentMessage) *v1p
Comment: ic.Payload.Comment,
CreateTime: timestamppb.New(ic.CreatedAt),
UpdateTime: timestamppb.New(ic.UpdatedAt),
- Name: fmt.Sprintf("%s/%s%s", issueName, common.IssueCommentNamePrefix, ic.ResourceID),
+ Name: common.FormatIssueComment(issueName, ic.ResourceID),
Creator: common.FormatUserEmail(ic.CreatorEmail),
}
+ if ic.ParentID != nil {
+ root := common.FormatIssueComment(issueName, *ic.ParentID)
+ r.Root = &root
+ }
+ if ic.ThreadState != nil {
+ state := v1pb.IssueComment_OPEN
+ if *ic.ThreadState == store.ThreadStateResolved {
+ state = v1pb.IssueComment_RESOLVED
+ }
+ r.ThreadState = &state
+ }
+ if anchor := ic.Payload.GetStatementAnchor(); anchor != nil {
+ r.StatementAnchor = &v1pb.StatementAnchor{
+ Spec: anchor.SpecId,
+ SheetSha256: anchor.SheetSha256,
+ StartPosition: convertToPosition(anchor.StartPosition),
+ EndPosition: convertToPosition(anchor.EndPosition),
+ }
+ }
+
switch e := ic.Payload.Event.(type) {
case *storepb.IssueCommentPayload_Approval_:
r.Event = convertToIssueCommentEventApproval(e)
diff --git a/backend/api/v1/issue_service_test.go b/backend/api/v1/issue_service_test.go
index e288424d6f..9de8f9c7a0 100644
--- a/backend/api/v1/issue_service_test.go
+++ b/backend/api/v1/issue_service_test.go
@@ -337,6 +337,7 @@ func createIssueServiceApprovalIssue(ctx context.Context, t *testing.T, stores *
ApprovalInputVersion: 2,
Specs: []*storepb.PlanConfig_Spec{
{
+ Id: "spec-1",
Config: &storepb.PlanConfig_Spec_ChangeDatabaseConfig{
ChangeDatabaseConfig: &storepb.PlanConfig_ChangeDatabaseConfig{
Targets: []string{"instances/prod/databases/app"},
diff --git a/backend/common/resource_name.go b/backend/common/resource_name.go
index 94c45f871a..9284db5d5f 100644
--- a/backend/common/resource_name.go
+++ b/backend/common/resource_name.go
@@ -725,6 +725,11 @@ func FormatReviewRun(projectID string, issueUID int64, reviewRunID string) strin
return fmt.Sprintf("%s/%s%s", FormatIssue(projectID, issueUID), ReviewRunNamePrefix, reviewRunID)
}
+// FormatIssueComment formats an issue comment resource name under its issue.
+func FormatIssueComment(issueName, issueCommentID string) string {
+ return fmt.Sprintf("%s/%s%s", issueName, IssueCommentNamePrefix, issueCommentID)
+}
+
func FormatIssue(projectID string, issueUID int64) string {
return fmt.Sprintf("%s/%s%d", FormatProject(projectID), IssueNamePrefix, issueUID)
}
diff --git a/backend/generated-go/v1/issue_service.pb.go b/backend/generated-go/v1/issue_service.pb.go
index 6b6e28c2a5..a972654bf7 100644
--- a/backend/generated-go/v1/issue_service.pb.go
+++ b/backend/generated-go/v1/issue_service.pb.go
@@ -141,6 +141,55 @@ func (Issue_Approver_Status) EnumDescriptor() ([]byte, []int) {
return file_v1_issue_service_proto_rawDescGZIP(), []int{13, 0, 0}
}
+type IssueComment_ThreadState int32
+
+const (
+ IssueComment_THREAD_STATE_UNSPECIFIED IssueComment_ThreadState = 0
+ IssueComment_OPEN IssueComment_ThreadState = 1
+ IssueComment_RESOLVED IssueComment_ThreadState = 2
+)
+
+// Enum value maps for IssueComment_ThreadState.
+var (
+ IssueComment_ThreadState_name = map[int32]string{
+ 0: "THREAD_STATE_UNSPECIFIED",
+ 1: "OPEN",
+ 2: "RESOLVED",
+ }
+ IssueComment_ThreadState_value = map[string]int32{
+ "THREAD_STATE_UNSPECIFIED": 0,
+ "OPEN": 1,
+ "RESOLVED": 2,
+ }
+)
+
+func (x IssueComment_ThreadState) Enum() *IssueComment_ThreadState {
+ p := new(IssueComment_ThreadState)
+ *p = x
+ return p
+}
+
+func (x IssueComment_ThreadState) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (IssueComment_ThreadState) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_issue_service_proto_enumTypes[2].Descriptor()
+}
+
+func (IssueComment_ThreadState) Type() protoreflect.EnumType {
+ return &file_v1_issue_service_proto_enumTypes[2]
+}
+
+func (x IssueComment_ThreadState) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use IssueComment_ThreadState.Descriptor instead.
+func (IssueComment_ThreadState) EnumDescriptor() ([]byte, []int) {
+ return file_v1_issue_service_proto_rawDescGZIP(), []int{21, 0}
+}
+
// Approval status values.
type IssueComment_Approval_Status int32
@@ -182,11 +231,11 @@ func (x IssueComment_Approval_Status) String() string {
}
func (IssueComment_Approval_Status) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_issue_service_proto_enumTypes[2].Descriptor()
+ return file_v1_issue_service_proto_enumTypes[3].Descriptor()
}
func (IssueComment_Approval_Status) Type() protoreflect.EnumType {
- return &file_v1_issue_service_proto_enumTypes[2]
+ return &file_v1_issue_service_proto_enumTypes[3]
}
func (x IssueComment_Approval_Status) Number() protoreflect.EnumNumber {
@@ -233,11 +282,11 @@ func (x ReviewRun_Type) String() string {
}
func (ReviewRun_Type) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_issue_service_proto_enumTypes[3].Descriptor()
+ return file_v1_issue_service_proto_enumTypes[4].Descriptor()
}
func (ReviewRun_Type) Type() protoreflect.EnumType {
- return &file_v1_issue_service_proto_enumTypes[3]
+ return &file_v1_issue_service_proto_enumTypes[4]
}
func (x ReviewRun_Type) Number() protoreflect.EnumNumber {
@@ -246,7 +295,7 @@ func (x ReviewRun_Type) Number() protoreflect.EnumNumber {
// Deprecated: Use ReviewRun_Type.Descriptor instead.
func (ReviewRun_Type) EnumDescriptor() ([]byte, []int) {
- return file_v1_issue_service_proto_rawDescGZIP(), []int{22, 0}
+ return file_v1_issue_service_proto_rawDescGZIP(), []int{23, 0}
}
// States follow task_run, minus PENDING (review needs no admission
@@ -295,11 +344,11 @@ func (x ReviewRun_Status) String() string {
}
func (ReviewRun_Status) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_issue_service_proto_enumTypes[4].Descriptor()
+ return file_v1_issue_service_proto_enumTypes[5].Descriptor()
}
func (ReviewRun_Status) Type() protoreflect.EnumType {
- return &file_v1_issue_service_proto_enumTypes[4]
+ return &file_v1_issue_service_proto_enumTypes[5]
}
func (x ReviewRun_Status) Number() protoreflect.EnumNumber {
@@ -308,7 +357,7 @@ func (x ReviewRun_Status) Number() protoreflect.EnumNumber {
// Deprecated: Use ReviewRun_Status.Descriptor instead.
func (ReviewRun_Status) EnumDescriptor() ([]byte, []int) {
- return file_v1_issue_service_proto_rawDescGZIP(), []int{22, 1}
+ return file_v1_issue_service_proto_rawDescGZIP(), []int{23, 1}
}
type GetIssueRequest struct {
@@ -1539,7 +1588,12 @@ type ListIssueCommentsRequest struct {
//
// When paginating, all other parameters provided to `ListIssueComments` must match
// the call that provided the page token.
- PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ // CEL filter over events, root comments, and replies.
+ // Supported: root == null, root == "<comment name>", or root in ["<comment name>", ...].
+ // Root names must belong to parent. Empty and root == null return the
+ // timeline (events and root comments); other filters return replies only.
+ Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1595,6 +1649,13 @@ func (x *ListIssueCommentsRequest) GetPageToken() string {
return ""
}
+func (x *ListIssueCommentsRequest) GetFilter() string {
+ if x != nil {
+ return x.Filter
+ }
+ return ""
+}
+
type ListIssueCommentsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The issue comments from the specified request.
@@ -1792,6 +1853,20 @@ type IssueComment struct {
UpdateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
// Format: users/{email}
Creator string `protobuf:"bytes,6,opt,name=creator,proto3" json:"creator,omitempty"`
+ // 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.
+ Root *string `protobuf:"bytes,14,opt,name=root,proto3,oneof" json:"root,omitempty"`
+ // 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.
+ 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.
+ StatementAnchor *StatementAnchor `protobuf:"bytes,16,opt,name=statement_anchor,json=statementAnchor,proto3" json:"statement_anchor,omitempty"`
// The event associated with this comment.
//
// Types that are valid to be assigned to Event:
@@ -1877,6 +1952,27 @@ func (x *IssueComment) GetCreator() string {
return ""
}
+func (x *IssueComment) GetRoot() string {
+ if x != nil && x.Root != nil {
+ return *x.Root
+ }
+ return ""
+}
+
+func (x *IssueComment) GetThreadState() IssueComment_ThreadState {
+ if x != nil && x.ThreadState != nil {
+ return *x.ThreadState
+ }
+ return IssueComment_THREAD_STATE_UNSPECIFIED
+}
+
+func (x *IssueComment) GetStatementAnchor() *StatementAnchor {
+ if x != nil {
+ return x.StatementAnchor
+ }
+ return nil
+}
+
func (x *IssueComment) GetEvent() isIssueComment_Event {
if x != nil {
return x.Event
@@ -1952,6 +2048,82 @@ func (*IssueComment_PlanUpdate_) isIssueComment_Event() {}
func (*IssueComment_ReviewSubmission_) 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.
+type StatementAnchor struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The Plan.Spec.id in the issue's plan; may no longer resolve after deletion.
+ Spec string `protobuf:"bytes,1,opt,name=spec,proto3" json:"spec,omitempty"`
+ // SHA256 of the saved sheet, as 64 lowercase hexadecimal characters.
+ SheetSha256 string `protobuf:"bytes,2,opt,name=sheet_sha256,json=sheetSha256,proto3" json:"sheet_sha256,omitempty"`
+ // One-based lines and Unicode code-point columns. When both columns are zero,
+ // the range covers whole lines, including the end line. Otherwise both columns
+ // must be positive, start_position is inclusive, and end_position is exclusive.
+ StartPosition *Position `protobuf:"bytes,3,opt,name=start_position,json=startPosition,proto3" json:"start_position,omitempty"`
+ EndPosition *Position `protobuf:"bytes,4,opt,name=end_position,json=endPosition,proto3" json:"end_position,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *StatementAnchor) Reset() {
+ *x = StatementAnchor{}
+ mi := &file_v1_issue_service_proto_msgTypes[22]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *StatementAnchor) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StatementAnchor) ProtoMessage() {}
+
+func (x *StatementAnchor) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_issue_service_proto_msgTypes[22]
+ 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 StatementAnchor.ProtoReflect.Descriptor instead.
+func (*StatementAnchor) Descriptor() ([]byte, []int) {
+ return file_v1_issue_service_proto_rawDescGZIP(), []int{22}
+}
+
+func (x *StatementAnchor) GetSpec() string {
+ if x != nil {
+ return x.Spec
+ }
+ return ""
+}
+
+func (x *StatementAnchor) GetSheetSha256() string {
+ if x != nil {
+ return x.SheetSha256
+ }
+ return ""
+}
+
+func (x *StatementAnchor) GetStartPosition() *Position {
+ if x != nil {
+ return x.StartPosition
+ }
+ return nil
+}
+
+func (x *StatementAnchor) GetEndPosition() *Position {
+ if x != nil {
+ return x.EndPosition
+ }
+ return nil
+}
+
type ReviewRun struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Format: projects/{project}/issues/{issue}/reviewRuns/{reviewRun}
@@ -1976,7 +2148,7 @@ type ReviewRun struct {
func (x *ReviewRun) Reset() {
*x = ReviewRun{}
- mi := &file_v1_issue_service_proto_msgTypes[22]
+ mi := &file_v1_issue_service_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1988,7 +2160,7 @@ func (x *ReviewRun) String() string {
func (*ReviewRun) ProtoMessage() {}
func (x *ReviewRun) ProtoReflect() protoreflect.Message {
- mi := &file_v1_issue_service_proto_msgTypes[22]
+ mi := &file_v1_issue_service_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2001,7 +2173,7 @@ func (x *ReviewRun) ProtoReflect() protoreflect.Message {
// Deprecated: Use ReviewRun.ProtoReflect.Descriptor instead.
func (*ReviewRun) Descriptor() ([]byte, []int) {
- return file_v1_issue_service_proto_rawDescGZIP(), []int{22}
+ return file_v1_issue_service_proto_rawDescGZIP(), []int{23}
}
func (x *ReviewRun) GetName() string {
@@ -2056,7 +2228,7 @@ type RunReviewRequest struct {
func (x *RunReviewRequest) Reset() {
*x = RunReviewRequest{}
- mi := &file_v1_issue_service_proto_msgTypes[23]
+ mi := &file_v1_issue_service_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2068,7 +2240,7 @@ func (x *RunReviewRequest) String() string {
func (*RunReviewRequest) ProtoMessage() {}
func (x *RunReviewRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_issue_service_proto_msgTypes[23]
+ mi := &file_v1_issue_service_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2081,7 +2253,7 @@ func (x *RunReviewRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RunReviewRequest.ProtoReflect.Descriptor instead.
func (*RunReviewRequest) Descriptor() ([]byte, []int) {
- return file_v1_issue_service_proto_rawDescGZIP(), []int{23}
+ return file_v1_issue_service_proto_rawDescGZIP(), []int{24}
}
func (x *RunReviewRequest) GetName() string {
@@ -2104,7 +2276,7 @@ type Issue_Approver struct {
func (x *Issue_Approver) Reset() {
*x = Issue_Approver{}
- mi := &file_v1_issue_service_proto_msgTypes[24]
+ mi := &file_v1_issue_service_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2116,7 +2288,7 @@ func (x *Issue_Approver) String() string {
func (*Issue_Approver) ProtoMessage() {}
func (x *Issue_Approver) ProtoReflect() protoreflect.Message {
- mi := &file_v1_issue_service_proto_msgTypes[24]
+ mi := &file_v1_issue_service_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2157,7 +2329,7 @@ type IssueComment_Approval struct {
func (x *IssueComment_Approval) Reset() {
*x = IssueComment_Approval{}
- mi := &file_v1_issue_service_proto_msgTypes[25]
+ mi := &file_v1_issue_service_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2169,7 +2341,7 @@ func (x *IssueComment_Approval) String() string {
func (*IssueComment_Approval) ProtoMessage() {}
func (x *IssueComment_Approval) ProtoReflect() protoreflect.Message {
- mi := &file_v1_issue_service_proto_msgTypes[25]
+ mi := &file_v1_issue_service_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2209,7 +2381,7 @@ type IssueComment_IssueUpdate struct {
func (x *IssueComment_IssueUpdate) Reset() {
*x = IssueComment_IssueUpdate{}
- mi := &file_v1_issue_service_proto_msgTypes[26]
+ mi := &file_v1_issue_service_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2221,7 +2393,7 @@ func (x *IssueComment_IssueUpdate) String() string {
func (*IssueComment_IssueUpdate) ProtoMessage() {}
func (x *IssueComment_IssueUpdate) ProtoReflect() protoreflect.Message {
- mi := &file_v1_issue_service_proto_msgTypes[26]
+ mi := &file_v1_issue_service_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2302,7 +2474,7 @@ type IssueComment_ReviewSubmission struct {
func (x *IssueComment_ReviewSubmission) Reset() {
*x = IssueComment_ReviewSubmission{}
- mi := &file_v1_issue_service_proto_msgTypes[27]
+ mi := &file_v1_issue_service_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2314,7 +2486,7 @@ func (x *IssueComment_ReviewSubmission) String() string {
func (*IssueComment_ReviewSubmission) ProtoMessage() {}
func (x *IssueComment_ReviewSubmission) ProtoReflect() protoreflect.Message {
- mi := &file_v1_issue_service_proto_msgTypes[27]
+ mi := &file_v1_issue_service_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2342,7 +2514,7 @@ type IssueComment_PlanUpdate struct {
func (x *IssueComment_PlanUpdate) Reset() {
*x = IssueComment_PlanUpdate{}
- mi := &file_v1_issue_service_proto_msgTypes[28]
+ mi := &file_v1_issue_service_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2354,7 +2526,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[28]
+ mi := &file_v1_issue_service_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2499,13 +2671,14 @@ const file_v1_issue_service_proto_rawDesc = "" +
"\x05title\x18\x02 \x01(\tR\x05title\x12 \n" +
"\vdescription\x18\x03 \x01(\tR\vdescription\"$\n" +
"\fApprovalFlow\x12\x14\n" +
- "\x05roles\x18\x01 \x03(\tR\x05roles\"\x8a\x01\n" +
+ "\x05roles\x18\x01 \x03(\tR\x05roles\"\xa2\x01\n" +
"\x18ListIssueCommentsRequest\x122\n" +
"\x06parent\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" +
"\x12bytebase.com/IssueR\x06parent\x12\x1b\n" +
"\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x1d\n" +
"\n" +
- "page_token\x18\x03 \x01(\tR\tpageToken\"\x85\x01\n" +
+ "page_token\x18\x03 \x01(\tR\tpageToken\x12\x16\n" +
+ "\x06filter\x18\x04 \x01(\tR\x06filter\"\x85\x01\n" +
"\x19ListIssueCommentsResponse\x12@\n" +
"\x0eissue_comments\x18\x01 \x03(\v2\x19.bytebase.v1.IssueCommentR\rissueComments\x12&\n" +
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x8f\x01\n" +
@@ -2519,8 +2692,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\"\xb8\n" +
- "\n" +
+ "\rallow_missing\x18\x04 \x01(\bR\fallowMissing\"\xd2\f\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" +
@@ -2529,7 +2701,10 @@ const file_v1_issue_service_proto_rawDesc = "" +
"createTime\x12@\n" +
"\vupdate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
"updateTime\x12\x1d\n" +
- "\acreator\x18\x06 \x01(\tB\x03\xe0A\x03R\acreator\x12@\n" +
+ "\acreator\x18\x06 \x01(\tB\x03\xe0A\x03R\acreator\x12\x1c\n" +
+ "\x04root\x18\x0e \x01(\tB\x03\xe0A\x05H\x01R\x04root\x88\x01\x01\x12M\n" +
+ "\fthread_state\x18\x0f \x01(\x0e2%.bytebase.v1.IssueComment.ThreadStateH\x02R\vthreadState\x88\x01\x01\x12L\n" +
+ "\x10statement_anchor\x18\x10 \x01(\v2\x1c.bytebase.v1.StatementAnchorB\x03\xe0A\x05R\x0fstatementAnchor\x12@\n" +
"\bapproval\x18\a \x01(\v2\".bytebase.v1.IssueComment.ApprovalH\x00R\bapproval\x12J\n" +
"\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" +
@@ -2566,8 +2741,19 @@ const file_v1_issue_service_proto_rawDesc = "" +
"PlanUpdate\x125\n" +
"\n" +
"from_specs\x18\x01 \x03(\v2\x16.bytebase.v1.Plan.SpecR\tfromSpecs\x121\n" +
- "\bto_specs\x18\x02 \x03(\v2\x16.bytebase.v1.Plan.SpecR\atoSpecsB\a\n" +
- "\x05eventJ\x04\b\t\x10\f\"\x8c\x04\n" +
+ "\bto_specs\x18\x02 \x03(\v2\x16.bytebase.v1.Plan.SpecR\atoSpecs\"C\n" +
+ "\vThreadState\x12\x1c\n" +
+ "\x18THREAD_STATE_UNSPECIFIED\x10\x00\x12\b\n" +
+ "\x04OPEN\x10\x01\x12\f\n" +
+ "\bRESOLVED\x10\x02B\a\n" +
+ "\x05eventB\a\n" +
+ "\x05_rootB\x0f\n" +
+ "\r_thread_stateJ\x04\b\t\x10\f\"\xc0\x01\n" +
+ "\x0fStatementAnchor\x12\x12\n" +
+ "\x04spec\x18\x01 \x01(\tR\x04spec\x12!\n" +
+ "\fsheet_sha256\x18\x02 \x01(\tR\vsheetSha256\x12<\n" +
+ "\x0estart_position\x18\x03 \x01(\v2\x15.bytebase.v1.PositionR\rstartPosition\x128\n" +
+ "\fend_position\x18\x04 \x01(\v2\x15.bytebase.v1.PositionR\vendPosition\"\x8c\x04\n" +
"\tReviewRun\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x124\n" +
"\x04type\x18\x02 \x01(\x0e2\x1b.bytebase.v1.ReviewRun.TypeB\x03\xe0A\x03R\x04type\x12:\n" +
@@ -2621,124 +2807,131 @@ func file_v1_issue_service_proto_rawDescGZIP() []byte {
return file_v1_issue_service_proto_rawDescData
}
-var file_v1_issue_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
-var file_v1_issue_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
+var file_v1_issue_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
+var file_v1_issue_service_proto_msgTypes = make([]protoimpl.MessageInfo, 30)
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
- (IssueComment_Approval_Status)(0), // 2: bytebase.v1.IssueComment.Approval.Status
- (ReviewRun_Type)(0), // 3: bytebase.v1.ReviewRun.Type
- (ReviewRun_Status)(0), // 4: bytebase.v1.ReviewRun.Status
- (*GetIssueRequest)(nil), // 5: bytebase.v1.GetIssueRequest
- (*CreateIssueRequest)(nil), // 6: bytebase.v1.CreateIssueRequest
- (*ListIssuesRequest)(nil), // 7: bytebase.v1.ListIssuesRequest
- (*ListIssuesResponse)(nil), // 8: bytebase.v1.ListIssuesResponse
- (*SearchIssuesRequest)(nil), // 9: bytebase.v1.SearchIssuesRequest
- (*SearchIssuesResponse)(nil), // 10: bytebase.v1.SearchIssuesResponse
- (*UpdateIssueRequest)(nil), // 11: bytebase.v1.UpdateIssueRequest
- (*BatchUpdateIssuesStatusRequest)(nil), // 12: bytebase.v1.BatchUpdateIssuesStatusRequest
- (*BatchUpdateIssuesStatusResponse)(nil), // 13: bytebase.v1.BatchUpdateIssuesStatusResponse
- (*ApproveIssueRequest)(nil), // 14: bytebase.v1.ApproveIssueRequest
- (*RejectIssueRequest)(nil), // 15: bytebase.v1.RejectIssueRequest
- (*RequestIssueRequest)(nil), // 16: bytebase.v1.RequestIssueRequest
- (*RetryIssueApprovalRequest)(nil), // 17: bytebase.v1.RetryIssueApprovalRequest
- (*Issue)(nil), // 18: bytebase.v1.Issue
- (*RoleGrant)(nil), // 19: bytebase.v1.RoleGrant
- (*ApprovalTemplate)(nil), // 20: bytebase.v1.ApprovalTemplate
- (*ApprovalFlow)(nil), // 21: bytebase.v1.ApprovalFlow
- (*ListIssueCommentsRequest)(nil), // 22: bytebase.v1.ListIssueCommentsRequest
- (*ListIssueCommentsResponse)(nil), // 23: bytebase.v1.ListIssueCommentsResponse
- (*CreateIssueCommentRequest)(nil), // 24: bytebase.v1.CreateIssueCommentRequest
- (*UpdateIssueCommentRequest)(nil), // 25: bytebase.v1.UpdateIssueCommentRequest
- (*IssueComment)(nil), // 26: bytebase.v1.IssueComment
- (*ReviewRun)(nil), // 27: bytebase.v1.ReviewRun
- (*RunReviewRequest)(nil), // 28: bytebase.v1.RunReviewRequest
- (*Issue_Approver)(nil), // 29: bytebase.v1.Issue.Approver
- (*IssueComment_Approval)(nil), // 30: bytebase.v1.IssueComment.Approval
- (*IssueComment_IssueUpdate)(nil), // 31: bytebase.v1.IssueComment.IssueUpdate
- (*IssueComment_ReviewSubmission)(nil), // 32: bytebase.v1.IssueComment.ReviewSubmission
- (*IssueComment_PlanUpdate)(nil), // 33: bytebase.v1.IssueComment.PlanUpdate
- (*fieldmaskpb.FieldMask)(nil), // 34: google.protobuf.FieldMask
- (IssueStatus)(0), // 35: bytebase.v1.IssueStatus
- (*timestamppb.Timestamp)(nil), // 36: google.protobuf.Timestamp
- (RiskLevel)(0), // 37: bytebase.v1.RiskLevel
- (ApprovalStatus)(0), // 38: bytebase.v1.ApprovalStatus
- (*expr.Expr)(nil), // 39: google.type.Expr
- (*durationpb.Duration)(nil), // 40: google.protobuf.Duration
- (*Plan_Spec)(nil), // 41: bytebase.v1.Plan.Spec
+ (IssueComment_ThreadState)(0), // 2: bytebase.v1.IssueComment.ThreadState
+ (IssueComment_Approval_Status)(0), // 3: bytebase.v1.IssueComment.Approval.Status
+ (ReviewRun_Type)(0), // 4: bytebase.v1.ReviewRun.Type
+ (ReviewRun_Status)(0), // 5: bytebase.v1.ReviewRun.Status
+ (*GetIssueRequest)(nil), // 6: bytebase.v1.GetIssueRequest
+ (*CreateIssueRequest)(nil), // 7: bytebase.v1.CreateIssueRequest
+ (*ListIssuesRequest)(nil), // 8: bytebase.v1.ListIssuesRequest
+ (*ListIssuesResponse)(nil), // 9: bytebase.v1.ListIssuesResponse
+ (*SearchIssuesRequest)(nil), // 10: bytebase.v1.SearchIssuesRequest
+ (*SearchIssuesResponse)(nil), // 11: bytebase.v1.SearchIssuesResponse
+ (*UpdateIssueRequest)(nil), // 12: bytebase.v1.UpdateIssueRequest
+ (*BatchUpdateIssuesStatusRequest)(nil), // 13: bytebase.v1.BatchUpdateIssuesStatusRequest
+ (*BatchUpdateIssuesStatusResponse)(nil), // 14: bytebase.v1.BatchUpdateIssuesStatusResponse
+ (*ApproveIssueRequest)(nil), // 15: bytebase.v1.ApproveIssueRequest
+ (*RejectIssueRequest)(nil), // 16: bytebase.v1.RejectIssueRequest
+ (*RequestIssueRequest)(nil), // 17: bytebase.v1.RequestIssueRequest
+ (*RetryIssueApprovalRequest)(nil), // 18: bytebase.v1.RetryIssueApprovalRequest
+ (*Issue)(nil), // 19: bytebase.v1.Issue
+ (*RoleGrant)(nil), // 20: bytebase.v1.RoleGrant
+ (*ApprovalTemplate)(nil), // 21: bytebase.v1.ApprovalTemplate
+ (*ApprovalFlow)(nil), // 22: bytebase.v1.ApprovalFlow
+ (*ListIssueCommentsRequest)(nil), // 23: bytebase.v1.ListIssueCommentsRequest
+ (*ListIssueCommentsResponse)(nil), // 24: bytebase.v1.ListIssueCommentsResponse
+ (*CreateIssueCommentRequest)(nil), // 25: bytebase.v1.CreateIssueCommentRequest
+ (*UpdateIssueCommentRequest)(nil), // 26: bytebase.v1.UpdateIssueCommentRequest
+ (*IssueComment)(nil), // 27: bytebase.v1.IssueComment
+ (*StatementAnchor)(nil), // 28: bytebase.v1.StatementAnchor
+ (*ReviewRun)(nil), // 29: bytebase.v1.ReviewRun
+ (*RunReviewRequest)(nil), // 30: bytebase.v1.RunReviewRequest
+ (*Issue_Approver)(nil), // 31: bytebase.v1.Issue.Approver
+ (*IssueComment_Approval)(nil), // 32: bytebase.v1.IssueComment.Approval
+ (*IssueComment_IssueUpdate)(nil), // 33: bytebase.v1.IssueComment.IssueUpdate
+ (*IssueComment_ReviewSubmission)(nil), // 34: bytebase.v1.IssueComment.ReviewSubmission
+ (*IssueComment_PlanUpdate)(nil), // 35: bytebase.v1.IssueComment.PlanUpdate
+ (*fieldmaskpb.FieldMask)(nil), // 36: google.protobuf.FieldMask
+ (IssueStatus)(0), // 37: bytebase.v1.IssueStatus
+ (*timestamppb.Timestamp)(nil), // 38: google.protobuf.Timestamp
+ (RiskLevel)(0), // 39: bytebase.v1.RiskLevel
+ (ApprovalStatus)(0), // 40: bytebase.v1.ApprovalStatus
+ (*expr.Expr)(nil), // 41: google.type.Expr
+ (*durationpb.Duration)(nil), // 42: google.protobuf.Duration
+ (*Position)(nil), // 43: bytebase.v1.Position
+ (*Plan_Spec)(nil), // 44: bytebase.v1.Plan.Spec
}
var file_v1_issue_service_proto_depIdxs = []int32{
- 18, // 0: bytebase.v1.CreateIssueRequest.issue:type_name -> bytebase.v1.Issue
- 18, // 1: bytebase.v1.ListIssuesResponse.issues:type_name -> bytebase.v1.Issue
- 18, // 2: bytebase.v1.SearchIssuesResponse.issues:type_name -> bytebase.v1.Issue
- 18, // 3: bytebase.v1.UpdateIssueRequest.issue:type_name -> bytebase.v1.Issue
- 34, // 4: bytebase.v1.UpdateIssueRequest.update_mask:type_name -> google.protobuf.FieldMask
- 35, // 5: bytebase.v1.BatchUpdateIssuesStatusRequest.status:type_name -> bytebase.v1.IssueStatus
+ 19, // 0: bytebase.v1.CreateIssueRequest.issue:type_name -> bytebase.v1.Issue
+ 19, // 1: bytebase.v1.ListIssuesResponse.issues:type_name -> bytebase.v1.Issue
+ 19, // 2: bytebase.v1.SearchIssuesResponse.issues:type_name -> bytebase.v1.Issue
+ 19, // 3: bytebase.v1.UpdateIssueRequest.issue:type_name -> bytebase.v1.Issue
+ 36, // 4: bytebase.v1.UpdateIssueRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 37, // 5: bytebase.v1.BatchUpdateIssuesStatusRequest.status:type_name -> bytebase.v1.IssueStatus
0, // 6: bytebase.v1.Issue.type:type_name -> bytebase.v1.Issue.Type
- 35, // 7: bytebase.v1.Issue.status:type_name -> bytebase.v1.IssueStatus
- 29, // 8: bytebase.v1.Issue.approvers:type_name -> bytebase.v1.Issue.Approver
- 20, // 9: bytebase.v1.Issue.approval_template:type_name -> bytebase.v1.ApprovalTemplate
- 36, // 10: bytebase.v1.Issue.create_time:type_name -> google.protobuf.Timestamp
- 36, // 11: bytebase.v1.Issue.update_time:type_name -> google.protobuf.Timestamp
- 19, // 12: bytebase.v1.Issue.role_grant:type_name -> bytebase.v1.RoleGrant
- 37, // 13: bytebase.v1.Issue.risk_level:type_name -> bytebase.v1.RiskLevel
- 38, // 14: bytebase.v1.Issue.approval_status:type_name -> bytebase.v1.ApprovalStatus
- 39, // 15: bytebase.v1.RoleGrant.condition:type_name -> google.type.Expr
- 40, // 16: bytebase.v1.RoleGrant.expiration:type_name -> google.protobuf.Duration
- 21, // 17: bytebase.v1.ApprovalTemplate.flow:type_name -> bytebase.v1.ApprovalFlow
- 26, // 18: bytebase.v1.ListIssueCommentsResponse.issue_comments:type_name -> bytebase.v1.IssueComment
- 26, // 19: bytebase.v1.CreateIssueCommentRequest.issue_comment:type_name -> bytebase.v1.IssueComment
- 26, // 20: bytebase.v1.UpdateIssueCommentRequest.issue_comment:type_name -> bytebase.v1.IssueComment
- 34, // 21: bytebase.v1.UpdateIssueCommentRequest.update_mask:type_name -> google.protobuf.FieldMask
- 36, // 22: bytebase.v1.IssueComment.create_time:type_name -> google.protobuf.Timestamp
- 36, // 23: bytebase.v1.IssueComment.update_time:type_name -> google.protobuf.Timestamp
- 30, // 24: bytebase.v1.IssueComment.approval:type_name -> bytebase.v1.IssueComment.Approval
- 31, // 25: bytebase.v1.IssueComment.issue_update:type_name -> bytebase.v1.IssueComment.IssueUpdate
- 33, // 26: bytebase.v1.IssueComment.plan_update:type_name -> bytebase.v1.IssueComment.PlanUpdate
- 32, // 27: bytebase.v1.IssueComment.review_submission:type_name -> bytebase.v1.IssueComment.ReviewSubmission
- 3, // 28: bytebase.v1.ReviewRun.type:type_name -> bytebase.v1.ReviewRun.Type
- 4, // 29: bytebase.v1.ReviewRun.status:type_name -> bytebase.v1.ReviewRun.Status
- 36, // 30: bytebase.v1.ReviewRun.create_time:type_name -> google.protobuf.Timestamp
- 36, // 31: bytebase.v1.ReviewRun.end_time:type_name -> google.protobuf.Timestamp
- 1, // 32: bytebase.v1.Issue.Approver.status:type_name -> bytebase.v1.Issue.Approver.Status
- 2, // 33: bytebase.v1.IssueComment.Approval.status:type_name -> bytebase.v1.IssueComment.Approval.Status
- 35, // 34: bytebase.v1.IssueComment.IssueUpdate.from_status:type_name -> bytebase.v1.IssueStatus
- 35, // 35: bytebase.v1.IssueComment.IssueUpdate.to_status:type_name -> bytebase.v1.IssueStatus
- 41, // 36: bytebase.v1.IssueComment.PlanUpdate.from_specs:type_name -> bytebase.v1.Plan.Spec
- 41, // 37: bytebase.v1.IssueComment.PlanUpdate.to_specs:type_name -> bytebase.v1.Plan.Spec
- 5, // 38: bytebase.v1.IssueService.GetIssue:input_type -> bytebase.v1.GetIssueRequest
- 6, // 39: bytebase.v1.IssueService.CreateIssue:input_type -> bytebase.v1.CreateIssueRequest
- 7, // 40: bytebase.v1.IssueService.ListIssues:input_type -> bytebase.v1.ListIssuesRequest
- 9, // 41: bytebase.v1.IssueService.SearchIssues:input_type -> bytebase.v1.SearchIssuesRequest
- 11, // 42: bytebase.v1.IssueService.UpdateIssue:input_type -> bytebase.v1.UpdateIssueRequest
- 22, // 43: bytebase.v1.IssueService.ListIssueComments:input_type -> bytebase.v1.ListIssueCommentsRequest
- 24, // 44: bytebase.v1.IssueService.CreateIssueComment:input_type -> bytebase.v1.CreateIssueCommentRequest
- 25, // 45: bytebase.v1.IssueService.UpdateIssueComment:input_type -> bytebase.v1.UpdateIssueCommentRequest
- 12, // 46: bytebase.v1.IssueService.BatchUpdateIssuesStatus:input_type -> bytebase.v1.BatchUpdateIssuesStatusRequest
- 14, // 47: bytebase.v1.IssueService.ApproveIssue:input_type -> bytebase.v1.ApproveIssueRequest
- 15, // 48: bytebase.v1.IssueService.RejectIssue:input_type -> bytebase.v1.RejectIssueRequest
- 16, // 49: bytebase.v1.IssueService.RequestIssue:input_type -> bytebase.v1.RequestIssueRequest
- 17, // 50: bytebase.v1.IssueService.RetryIssueApproval:input_type -> bytebase.v1.RetryIssueApprovalRequest
- 28, // 51: bytebase.v1.IssueService.RunReview:input_type -> bytebase.v1.RunReviewRequest
- 18, // 52: bytebase.v1.IssueService.GetIssue:output_type -> bytebase.v1.Issue
- 18, // 53: bytebase.v1.IssueService.CreateIssue:output_type -> bytebase.v1.Issue
- 8, // 54: bytebase.v1.IssueService.ListIssues:output_type -> bytebase.v1.ListIssuesResponse
- 10, // 55: bytebase.v1.IssueService.SearchIssues:output_type -> bytebase.v1.SearchIssuesResponse
- 18, // 56: bytebase.v1.IssueService.UpdateIssue:output_type -> bytebase.v1.Issue
- 23, // 57: bytebase.v1.IssueService.ListIssueComments:output_type -> bytebase.v1.ListIssueCommentsResponse
- 26, // 58: bytebase.v1.IssueService.CreateIssueComment:output_type -> bytebase.v1.IssueComment
- 26, // 59: bytebase.v1.IssueService.UpdateIssueComment:output_type -> bytebase.v1.IssueComment
- 13, // 60: bytebase.v1.IssueService.BatchUpdateIssuesStatus:output_type -> bytebase.v1.BatchUpdateIssuesStatusResponse
- 18, // 61: bytebase.v1.IssueService.ApproveIssue:output_type -> bytebase.v1.Issue
- 18, // 62: bytebase.v1.IssueService.RejectIssue:output_type -> bytebase.v1.Issue
- 18, // 63: bytebase.v1.IssueService.RequestIssue:output_type -> bytebase.v1.Issue
- 18, // 64: bytebase.v1.IssueService.RetryIssueApproval:output_type -> bytebase.v1.Issue
- 27, // 65: bytebase.v1.IssueService.RunReview:output_type -> bytebase.v1.ReviewRun
- 52, // [52:66] is the sub-list for method output_type
- 38, // [38:52] is the sub-list for method input_type
- 38, // [38:38] is the sub-list for extension type_name
- 38, // [38:38] is the sub-list for extension extendee
- 0, // [0:38] is the sub-list for field type_name
+ 37, // 7: bytebase.v1.Issue.status:type_name -> bytebase.v1.IssueStatus
+ 31, // 8: bytebase.v1.Issue.approvers:type_name -> bytebase.v1.Issue.Approver
+ 21, // 9: bytebase.v1.Issue.approval_template:type_name -> bytebase.v1.ApprovalTemplate
+ 38, // 10: bytebase.v1.Issue.create_time:type_name -> google.protobuf.Timestamp
+ 38, // 11: bytebase.v1.Issue.update_time:type_name -> google.protobuf.Timestamp
+ 20, // 12: bytebase.v1.Issue.role_grant:type_name -> bytebase.v1.RoleGrant
+ 39, // 13: bytebase.v1.Issue.risk_level:type_name -> bytebase.v1.RiskLevel
+ 40, // 14: bytebase.v1.Issue.approval_status:type_name -> bytebase.v1.ApprovalStatus
+ 41, // 15: bytebase.v1.RoleGrant.condition:type_name -> google.type.Expr
+ 42, // 16: bytebase.v1.RoleGrant.expiration:type_name -> google.protobuf.Duration
+ 22, // 17: bytebase.v1.ApprovalTemplate.flow:type_name -> bytebase.v1.ApprovalFlow
+ 27, // 18: bytebase.v1.ListIssueCommentsResponse.issue_comments:type_name -> bytebase.v1.IssueComment
+ 27, // 19: bytebase.v1.CreateIssueCommentRequest.issue_comment:type_name -> bytebase.v1.IssueComment
+ 27, // 20: bytebase.v1.UpdateIssueCommentRequest.issue_comment:type_name -> bytebase.v1.IssueComment
+ 36, // 21: bytebase.v1.UpdateIssueCommentRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 38, // 22: bytebase.v1.IssueComment.create_time:type_name -> google.protobuf.Timestamp
+ 38, // 23: bytebase.v1.IssueComment.update_time:type_name -> google.protobuf.Timestamp
+ 2, // 24: bytebase.v1.IssueComment.thread_state:type_name -> bytebase.v1.IssueComment.ThreadState
+ 28, // 25: bytebase.v1.IssueComment.statement_anchor:type_name -> bytebase.v1.StatementAnchor
+ 32, // 26: bytebase.v1.IssueComment.approval:type_name -> bytebase.v1.IssueComment.Approval
+ 33, // 27: bytebase.v1.IssueComment.issue_update:type_name -> bytebase.v1.IssueComment.IssueUpdate
+ 35, // 28: bytebase.v1.IssueComment.plan_update:type_name -> bytebase.v1.IssueComment.PlanUpdate
+ 34, // 29: bytebase.v1.IssueComment.review_submission:type_name -> bytebase.v1.IssueComment.ReviewSubmission
+ 43, // 30: bytebase.v1.StatementAnchor.start_position:type_name -> bytebase.v1.Position
+ 43, // 31: bytebase.v1.StatementAnchor.end_position:type_name -> bytebase.v1.Position
+ 4, // 32: bytebase.v1.ReviewRun.type:type_name -> bytebase.v1.ReviewRun.Type
+ 5, // 33: bytebase.v1.ReviewRun.status:type_name -> bytebase.v1.ReviewRun.Status
+ 38, // 34: bytebase.v1.ReviewRun.create_time:type_name -> google.protobuf.Timestamp
+ 38, // 35: bytebase.v1.ReviewRun.end_time:type_name -> google.protobuf.Timestamp
+ 1, // 36: bytebase.v1.Issue.Approver.status:type_name -> bytebase.v1.Issue.Approver.Status
+ 3, // 37: bytebase.v1.IssueComment.Approval.status:type_name -> bytebase.v1.IssueComment.Approval.Status
+ 37, // 38: bytebase.v1.IssueComment.IssueUpdate.from_status:type_name -> bytebase.v1.IssueStatus
+ 37, // 39: bytebase.v1.IssueComment.IssueUpdate.to_status:type_name -> bytebase.v1.IssueStatus
+ 44, // 40: bytebase.v1.IssueComment.PlanUpdate.from_specs:type_name -> bytebase.v1.Plan.Spec
+ 44, // 41: bytebase.v1.IssueComment.PlanUpdate.to_specs:type_name -> bytebase.v1.Plan.Spec
+ 6, // 42: bytebase.v1.IssueService.GetIssue:input_type -> bytebase.v1.GetIssueRequest
+ 7, // 43: bytebase.v1.IssueService.CreateIssue:input_type -> bytebase.v1.CreateIssueRequest
+ 8, // 44: bytebase.v1.IssueService.ListIssues:input_type -> bytebase.v1.ListIssuesRequest
+ 10, // 45: bytebase.v1.IssueService.SearchIssues:input_type -> bytebase.v1.SearchIssuesRequest
+ 12, // 46: bytebase.v1.IssueService.UpdateIssue:input_type -> bytebase.v1.UpdateIssueRequest
+ 23, // 47: bytebase.v1.IssueService.ListIssueComments:input_type -> bytebase.v1.ListIssueCommentsRequest
+ 25, // 48: bytebase.v1.IssueService.CreateIssueComment:input_type -> bytebase.v1.CreateIssueCommentRequest
+ 26, // 49: bytebase.v1.IssueService.UpdateIssueComment:input_type -> bytebase.v1.UpdateIssueCommentRequest
+ 13, // 50: bytebase.v1.IssueService.BatchUpdateIssuesStatus:input_type -> bytebase.v1.BatchUpdateIssuesStatusRequest
+ 15, // 51: bytebase.v1.IssueService.ApproveIssue:input_type -> bytebase.v1.ApproveIssueRequest
+ 16, // 52: bytebase.v1.IssueService.RejectIssue:input_type -> bytebase.v1.RejectIssueRequest
+ 17, // 53: bytebase.v1.IssueService.RequestIssue:input_type -> bytebase.v1.RequestIssueRequest
+ 18, // 54: bytebase.v1.IssueService.RetryIssueApproval:input_type -> bytebase.v1.RetryIssueApprovalRequest
+ 30, // 55: bytebase.v1.IssueService.RunReview:input_type -> bytebase.v1.RunReviewRequest
+ 19, // 56: bytebase.v1.IssueService.GetIssue:output_type -> bytebase.v1.Issue
+ 19, // 57: bytebase.v1.IssueService.CreateIssue:output_type -> bytebase.v1.Issue
+ 9, // 58: bytebase.v1.IssueService.ListIssues:output_type -> bytebase.v1.ListIssuesResponse
+ 11, // 59: bytebase.v1.IssueService.SearchIssues:output_type -> bytebase.v1.SearchIssuesResponse
+ 19, // 60: bytebase.v1.IssueService.UpdateIssue:output_type -> bytebase.v1.Issue
+ 24, // 61: bytebase.v1.IssueService.ListIssueComments:output_type -> bytebase.v1.ListIssueCommentsResponse
+ 27, // 62: bytebase.v1.IssueService.CreateIssueComment:output_type -> bytebase.v1.IssueComment
+ 27, // 63: bytebase.v1.IssueService.UpdateIssueComment:output_type -> bytebase.v1.IssueComment
+ 14, // 64: bytebase.v1.IssueService.BatchUpdateIssuesStatus:output_type -> bytebase.v1.BatchUpdateIssuesStatusResponse
+ 19, // 65: bytebase.v1.IssueService.ApproveIssue:output_type -> bytebase.v1.Issue
+ 19, // 66: bytebase.v1.IssueService.RejectIssue:output_type -> bytebase.v1.Issue
+ 19, // 67: bytebase.v1.IssueService.RequestIssue:output_type -> bytebase.v1.Issue
+ 19, // 68: bytebase.v1.IssueService.RetryIssueApproval:output_type -> bytebase.v1.Issue
+ 29, // 69: bytebase.v1.IssueService.RunReview:output_type -> bytebase.v1.ReviewRun
+ 56, // [56:70] is the sub-list for method output_type
+ 42, // [42:56] is the sub-list for method input_type
+ 42, // [42:42] is the sub-list for extension type_name
+ 42, // [42:42] is the sub-list for extension extendee
+ 0, // [0:42] is the sub-list for field type_name
}
func init() { file_v1_issue_service_proto_init() }
@@ -2755,14 +2948,14 @@ func file_v1_issue_service_proto_init() {
(*IssueComment_PlanUpdate_)(nil),
(*IssueComment_ReviewSubmission_)(nil),
}
- file_v1_issue_service_proto_msgTypes[26].OneofWrappers = []any{}
+ file_v1_issue_service_proto_msgTypes[27].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_issue_service_proto_rawDesc), len(file_v1_issue_service_proto_rawDesc)),
- NumEnums: 5,
- NumMessages: 29,
+ NumEnums: 6,
+ NumMessages: 30,
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.go
index 64e542c473..2600dcef04 100644
--- a/backend/generated-go/v1/issue_service_equal.pb.go
+++ b/backend/generated-go/v1/issue_service_equal.pb.go
@@ -424,6 +424,9 @@ func (x *ListIssueCommentsRequest) Equal(y *ListIssueCommentsRequest) bool {
if x.PageToken != y.PageToken {
return false
}
+ if x.Filter != y.Filter {
+ return false
+ }
return true
}
@@ -608,6 +611,15 @@ func (x *IssueComment) Equal(y *IssueComment) bool {
if x.Creator != y.Creator {
return false
}
+ if p, q := x.Root, y.Root; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {
+ return false
+ }
+ if p, q := x.ThreadState, y.ThreadState; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) {
+ return false
+ }
+ if !x.StatementAnchor.Equal(y.StatementAnchor) {
+ return false
+ }
if !x.GetApproval().Equal(y.GetApproval()) {
return false
}
@@ -623,6 +635,28 @@ func (x *IssueComment) Equal(y *IssueComment) bool {
return true
}
+func (x *StatementAnchor) Equal(y *StatementAnchor) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Spec != y.Spec {
+ return false
+ }
+ if x.SheetSha256 != y.SheetSha256 {
+ return false
+ }
+ if !x.StartPosition.Equal(y.StartPosition) {
+ return false
+ }
+ if !x.EndPosition.Equal(y.EndPosition) {
+ return false
+ }
+ return true
+}
+
func (x *ReviewRun) Equal(y *ReviewRun) bool {
if x == y {
return true
diff --git a/backend/store/issue_comment.go b/backend/store/issue_comment.go
index 67672db6bb..3cb39af11a 100644
--- a/backend/store/issue_comment.go
+++ b/backend/store/issue_comment.go
@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"encoding/hex"
+ "slices"
"strings"
"time"
@@ -16,7 +17,7 @@ import (
)
// ThreadState is the resolvable state carried by a thread's root comment: a
-// comment created with a statement anchor. Plain comments, events, and
+// comment created with OPEN or a statement anchor. Plain comments, events, and
// replies have no state (NULL thread_state).
type ThreadState string
@@ -253,8 +254,8 @@ func (s *Store) CreateIssueComments(ctx context.Context, creator string, creates
if create.ParentID != nil {
return nil, common.Errorf(common.Invalid, "replies must be created through CreateIssueCommentReply")
}
- if create.ThreadState != nil {
- return nil, common.Errorf(common.Invalid, "thread state is derived on create; an anchored root starts OPEN")
+ if create.ThreadState != nil && (*create.ThreadState != ThreadStateOpen || create.Payload.GetEvent() != nil) {
+ return nil, common.Errorf(common.Invalid, "only a comment can start a thread, in OPEN state")
}
if err := validateIssueCommentPayload(create.Payload); err != nil {
return nil, err
@@ -266,10 +267,9 @@ func (s *Store) CreateIssueComments(ctx context.Context, creator string, creates
projectIDs = append(projectIDs, create.ProjectID)
issueIDs = append(issueIDs, create.IssueUID)
payloads = append(payloads, payload)
- // An anchored comment starts a thread; validateIssueCommentPayload
- // already rejects an anchor on an event. Plain comments, events, and
- // hybrid rows remain outside threads.
- threadRoots = append(threadRoots, create.Payload.GetStatementAnchor() != nil)
+ // Internal reviewers start threads with anchors; API clients can also
+ // explicitly start an unanchored thread.
+ threadRoots = append(threadRoots, create.ThreadState != nil || create.Payload.GetStatementAnchor() != nil)
}
// Use UNNEST to insert all comments in one query.
@@ -323,11 +323,10 @@ func (s *Store) CreateIssueComments(ctx context.Context, creator string, creates
// CreateIssueCommentReply creates a reply in the thread rooted at
// create.ParentID and returns it with ResourceID, CreatedAt, and UpdatedAt
-// filled in. The insert-select pins every reply invariant in one statement:
-// the parent is a thread root (thread_state set, so never a plain comment,
-// an event, or a reply) in the same project and issue, and replying never
-// changes the thread state. Like CreateIssueComments, it requires only the referenced
-// rows to exist, regardless of project lifecycle.
+// filled in. The insert-select pins thread membership in one statement:
+// the parent is a thread root in the same project and issue, and replying
+// never changes the thread state. Like CreateIssueComments, it requires only
+// the referenced rows to exist, regardless of project lifecycle.
func (s *Store) CreateIssueCommentReply(ctx context.Context, creator string, create *IssueCommentMessage) (*IssueCommentMessage, error) {
if create.ParentID == nil {
return nil, common.Errorf(common.Invalid, "a reply must name its thread root")
@@ -346,6 +345,22 @@ func (s *Store) CreateIssueCommentReply(ctx context.Context, creator string, cre
return nil, errors.Wrapf(err, "failed to marshal payload")
}
+ if anchor := create.Payload.GetStatementAnchor(); anchor != nil {
+ root, err := s.GetIssueComment(ctx, &FindIssueCommentMessage{
+ ProjectID: create.ProjectID, IssueUID: &create.IssueUID, ResourceID: create.ParentID,
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get thread root")
+ }
+ if root == nil {
+ return nil, common.Errorf(common.NotFound, "thread root %s not found in issue %d", *create.ParentID, create.IssueUID)
+ }
+ // Anchors are immutable, so this check remains valid through the
+ // insert, which still checks thread membership atomically.
+ if !anchorWithinRoot(anchor, root.Payload.GetStatementAnchor()) {
+ return nil, common.Errorf(common.Invalid, "a reply anchor must lie within the spec, sheet, and range of thread root %s", *create.ParentID)
+ }
+ }
q := qb.Q().Space(`
INSERT INTO issue_comment (creator, project, issue_id, payload, parent_id)
SELECT ?, root.project, root.issue_id, ?, root.resource_id
@@ -397,6 +412,30 @@ func (s *Store) replyTargetError(ctx context.Context, create *IssueCommentMessag
}
}
+// anchorWithinRoot compares ranges on the same saved statement revision.
+func anchorWithinRoot(anchor, root *storepb.IssueCommentPayload_StatementAnchor) bool {
+ if root == nil || root.SpecId != anchor.SpecId || root.SheetSha256 != anchor.SheetSha256 ||
+ root.StartPosition == nil || root.EndPosition == nil {
+ return false
+ }
+ start, end := statementAnchorBounds(anchor)
+ rootStart, rootEnd := statementAnchorBounds(root)
+ return slices.Compare(rootStart[:], start[:]) <= 0 && slices.Compare(end[:], rootEnd[:]) <= 0
+}
+
+// Normalize to [line, column] pairs with an exclusive end. Whole-line ranges
+// end at the next line's first column; int64 avoids overflowing the last line.
+func statementAnchorBounds(anchor *storepb.IssueCommentPayload_StatementAnchor) (start, end [2]int64) {
+ start = [2]int64{int64(anchor.StartPosition.Line), int64(anchor.StartPosition.Column)}
+ end = [2]int64{int64(anchor.EndPosition.Line), int64(anchor.EndPosition.Column)}
+ if start[1] == 0 && end[1] == 0 {
+ start[1] = 1
+ end[0]++
+ end[1] = 1
+ }
+ return start, end
+}
+
func (s *Store) UpdateIssueComment(ctx context.Context, patch *UpdateIssueCommentMessage) error {
if patch.Comment == nil && patch.ThreadState == nil {
return common.Errorf(common.Invalid, "no fields to update")
diff --git a/backend/store/issue_comment_filter.go b/backend/store/issue_comment_filter.go
new file mode 100644
index 0000000000..29c4d413ef
--- /dev/null
+++ b/backend/store/issue_comment_filter.go
@@ -0,0 +1,67 @@
+package store
+
+import (
+ celast "github.com/google/cel-go/common/ast"
+ celoperators "github.com/google/cel-go/common/operators"
+ celtypes "github.com/google/cel-go/common/types"
+ "github.com/pkg/errors"
+
+ "github.com/bytebase/bytebase/backend/common"
+)
+
+// GetIssueCommentListFilter accepts only the documented root predicates. An
+// empty filter is the timeline: events and root comments, so a reply never
+// consumes a page slot for clients that predate threads.
+func GetIssueCommentListFilter(filter, projectID string, issueUID int64) (*FindIssueCommentMessage, error) {
+ find := &FindIssueCommentMessage{ProjectID: projectID, IssueUID: &issueUID}
+ if filter == "" {
+ find.TopLevelOnly = true
+ return find, nil
+ }
+ ast, err := common.ParseCELFilter(filter)
+ if err != nil {
+ return nil, err
+ }
+ expr := ast.NativeRep().Expr()
+ if expr.Kind() != celast.CallKind {
+ return nil, errors.New("expected a root comparison")
+ }
+ call := expr.AsCall()
+ args := call.Args()
+ if call.IsMemberFunction() || len(args) != 2 || args[0].Kind() != celast.IdentKind || args[0].AsIdent() != "root" {
+ return nil, errors.New("expected root == null, root == a comment name, or root in a list of comment names")
+ }
+ var values []celast.Expr
+ switch call.FunctionName() {
+ case celoperators.Equals:
+ if args[1].Kind() == celast.LiteralKind && args[1].AsLiteral() == celtypes.NullValue {
+ find.TopLevelOnly = true
+ return find, nil
+ }
+ values = []celast.Expr{args[1]}
+ case celoperators.In:
+ if args[1].Kind() != celast.ListKind {
+ return nil, errors.New("root in requires a list of comment names")
+ }
+ values = args[1].AsList().Elements()
+ default:
+ return nil, errors.New("unsupported root filter operator")
+ }
+ ids := make([]string, 0, len(values))
+ for _, value := range values {
+ if value.Kind() != celast.LiteralKind {
+ return nil, errors.New("root must be a literal comment name")
+ }
+ name, ok := value.AsLiteral().Value().(string)
+ if !ok {
+ return nil, errors.New("root must be a string comment name")
+ }
+ p, i, id, err := common.GetProjectIDIssueUIDIssueCommentID(name)
+ if err != nil || p != projectID || i != issueUID {
+ return nil, errors.Errorf("root %q must name a comment in the parent issue", name)
+ }
+ ids = append(ids, id)
+ }
+ find.ParentIDs = &ids
+ return find, nil
+}
diff --git a/backend/store/issue_comment_filter_test.go b/backend/store/issue_comment_filter_test.go
new file mode 100644
index 0000000000..66dfec4d60
--- /dev/null
+++ b/backend/store/issue_comment_filter_test.go
@@ -0,0 +1,50 @@
+package store_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/backend/store"
+)
+
+func TestIssueCommentListFilter(t *testing.T) {
+ const root = "projects/p/issues/101/issueComments/root"
+ for _, tc := range []struct {
+ filter string
+ top bool
+ ids []string
+ }{
+ {"", true, nil},
+ {"root == null", true, nil},
+ {"root == '" + root + "'", false, []string{"root"}},
+ {"root in ['" + root + "']", false, []string{"root"}},
+ {"root in []", false, []string{}},
+ } {
+ t.Run(tc.filter, func(t *testing.T) {
+ find, err := store.GetIssueCommentListFilter(tc.filter, "p", 101)
+ require.NoError(t, err)
+ require.Equal(t, "p", find.ProjectID)
+ require.Equal(t, int64(101), *find.IssueUID)
+ require.Equal(t, tc.top, find.TopLevelOnly)
+ if tc.ids == nil {
+ require.Nil(t, find.ParentIDs)
+ } else {
+ require.Equal(t, tc.ids, *find.ParentIDs)
+ }
+ })
+ }
+ for _, filter := range []string{
+ "true", "root", "root !=", "root != null", "name == 'x'", "null == root",
+ "root == 1", "root == ''", "root == other", "root == 'root'",
+ "root == 'projects/q/issues/101/issueComments/root'",
+ "root == 'projects/p/issues/102/issueComments/root'",
+ "root in null", "root in [null]", "root in [1]", "root in [other]",
+ "root == null || root == '" + root + "'", "root.contains('x')",
+ } {
+ t.Run(filter, func(t *testing.T) {
+ _, err := store.GetIssueCommentListFilter(filter, "p", 101)
+ require.Error(t, err)
+ })
+ }
+}
diff --git a/backend/store/issue_comment_thread_test.go b/backend/store/issue_comment_thread_test.go
index 8c8d968348..d2234761f0 100644
--- a/backend/store/issue_comment_thread_test.go
+++ b/backend/store/issue_comment_thread_test.go
@@ -2,6 +2,7 @@ package store_test
import (
"context"
+ "strings"
"testing"
"github.com/bytebase/bytebase/backend/common/testcontainer"
@@ -173,7 +174,7 @@ func TestIssueCommentThreads(t *testing.T) {
Payload: &storepb.IssueCommentPayload{Comment: "preset"},
ThreadState: &preset,
})
- require.Equal(t, common.Invalid, common.ErrorCode(err), "thread state is not settable on create")
+ require.Equal(t, common.Invalid, common.ErrorCode(err), "only OPEN can start a thread on create")
_, err = stores.CreateIssueCommentReply(ctx, creator, &store.IssueCommentMessage{
ProjectID: projectID,
IssueUID: issueUID,
@@ -392,4 +393,156 @@ func TestIssueCommentThreads(t *testing.T) {
require.Equal(t, root.ResourceID, openRoots[0].ResourceID)
require.True(t, editStamp.Equal(openRoots[0].UpdatedAt),
"resolve and reopen must not mark the comment as edited")
+
+ // An explicit OPEN starts an unanchored thread; an event never does.
+ unanchored, err := stores.CreateIssueComments(ctx, creator, &store.IssueCommentMessage{
+ ProjectID: projectID,
+ IssueUID: issueUID,
+ Payload: &storepb.IssueCommentPayload{Comment: "unanchored thread"},
+ ThreadState: &open,
+ })
+ require.NoError(t, err)
+ require.Equal(t, store.ThreadStateOpen, *unanchored.ThreadState)
+ _, err = stores.CreateIssueComments(ctx, creator, &store.IssueCommentMessage{
+ ProjectID: projectID,
+ IssueUID: issueUID,
+ Payload: &storepb.IssueCommentPayload{
+ Comment: "approved",
+ Event: &storepb.IssueCommentPayload_Approval_{
+ Approval: &storepb.IssueCommentPayload_Approval{},
+ },
+ },
+ ThreadState: &open,
+ })
+ require.Equal(t, common.Invalid, common.ErrorCode(err), "an event cannot start a thread")
+
+ // An anchored reply narrows the root's range; it cannot point elsewhere.
+ narrowed, err := stores.CreateIssueCommentReply(ctx, creator, &store.IssueCommentMessage{
+ ProjectID: projectID,
+ IssueUID: issueUID,
+ ParentID: &root.ResourceID,
+ Payload: &storepb.IssueCommentPayload{
+ Comment: "narrowed",
+ StatementAnchor: &storepb.IssueCommentPayload_StatementAnchor{
+ SpecId: anchor.SpecId,
+ SheetSha256: anchor.SheetSha256,
+ StartPosition: &storepb.Position{Line: 6, Column: 1},
+ EndPosition: &storepb.Position{Line: 6, Column: 9},
+ },
+ },
+ })
+ require.NoError(t, err)
+ require.Equal(t, root.ResourceID, *narrowed.ParentID)
+ for _, mismatch := range []*storepb.IssueCommentPayload_StatementAnchor{
+ {SpecId: "spec-2", SheetSha256: anchor.SheetSha256},
+ {SpecId: anchor.SpecId, SheetSha256: strings.Repeat("f", 64)},
+ } {
+ mismatch.StartPosition = &storepb.Position{Line: 6}
+ mismatch.EndPosition = &storepb.Position{Line: 6}
+ _, err = stores.CreateIssueCommentReply(ctx, creator, &store.IssueCommentMessage{
+ ProjectID: projectID,
+ IssueUID: issueUID,
+ ParentID: &root.ResourceID,
+ Payload: &storepb.IssueCommentPayload{Comment: "elsewhere", StatementAnchor: mismatch},
+ })
+ require.Equal(t, common.Invalid, common.ErrorCode(err), "a reply anchor must share the root's spec and sheet")
+ }
+ _, err = stores.CreateIssueCommentReply(ctx, creator, &store.IssueCommentMessage{
+ ProjectID: projectID,
+ IssueUID: issueUID,
+ ParentID: &unanchored.ResourceID,
+ Payload: &storepb.IssueCommentPayload{Comment: "anchored", StatementAnchor: anchor},
+ })
+ require.Equal(t, common.Invalid, common.ErrorCode(err), "an unanchored thread has no source context for a reply to share")
+}
+
+func TestIssueCommentReplyAnchorContainment(t *testing.T) {
+ ctx := context.Background()
+ db, stores, _ := testcontainer.NewMetadataDB(t)
+ _, err := db.ExecContext(ctx, `
+ INSERT INTO workspace (resource_id) VALUES ('anchor-ws');
+ INSERT INTO project (resource_id, workspace, name) VALUES ('anchor-p', 'anchor-ws', 'Anchors');
+ INSERT INTO issue (id, project, creator, name, status, type, description)
+ VALUES (101, 'anchor-p', '[email protected]', 'review', 'OPEN', 'DATABASE_CHANGE', '');
+ `)
+ require.NoError(t, err)
+ anchor := func(startLine, startColumn, endLine, endColumn int32) *storepb.IssueCommentPayload_StatementAnchor {
+ return &storepb.IssueCommentPayload_StatementAnchor{
+ SpecId: "spec-1", SheetSha256: strings.Repeat("a", 64),
+ StartPosition: &storepb.Position{Line: startLine, Column: startColumn},
+ EndPosition: &storepb.Position{Line: endLine, Column: endColumn},
+ }
+ }
+ lines := anchor(2, 0, 4, 0)
+ chars := anchor(2, 3, 4, 7)
+ for _, tc := range []struct {
+ name string
+ root, reply *storepb.IssueCommentPayload_StatementAnchor
+ valid bool
+ }{
+ {"equal lines", lines, anchor(2, 0, 4, 0), true},
+ {"inner lines", lines, anchor(3, 0, 3, 0), true},
+ {"first line", lines, anchor(2, 0, 2, 0), true},
+ {"last line", lines, anchor(4, 0, 4, 0), true},
+ {"starts before", lines, anchor(1, 0, 4, 0), false},
+ {"ends after", lines, anchor(2, 0, 5, 0), false},
+ {"disjoint before", lines, anchor(1, 0, 1, 0), false},
+ {"disjoint after", lines, anchor(5, 0, 5, 0), false},
+ {"chars within lines", lines, anchor(2, 1, 4, 99), true},
+ {"equivalent exclusive end", lines, anchor(2, 1, 5, 1), true},
+ {"one character beyond lines", lines, anchor(2, 1, 5, 2), false},
+ {"chars before lines", lines, anchor(1, 99, 2, 3), false},
+ {"equal chars", chars, anchor(2, 3, 4, 7), true},
+ {"inner chars", chars, anchor(2, 4, 4, 6), true},
+ {"one column before", chars, anchor(2, 2, 4, 7), false},
+ {"one column after", chars, anchor(2, 3, 4, 8), false},
+ {"inner whole line", chars, anchor(3, 0, 3, 0), true},
+ {"whole first partial line", chars, anchor(2, 0, 2, 0), false},
+ {"whole last partial line", chars, anchor(4, 0, 4, 0), false},
+ {"whole lines equal chars", anchor(2, 1, 5, 1), lines, true},
+ {"exclusive end excludes next line", anchor(2, 1, 4, 1), anchor(4, 0, 4, 0), false},
+ {"whole line before exclusive end", anchor(2, 1, 4, 1), anchor(3, 0, 3, 0), true},
+ {"last representable whole line", anchor(2147483647, 0, 2147483647, 0), anchor(2147483647, 1, 2147483647, 2), true},
+ {"unanchored reply", lines, nil, true},
+ {"unanchored thread and reply", nil, nil, true},
+ {"anchor on unanchored thread", nil, lines, false},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ open := store.ThreadStateOpen
+ root, err := stores.CreateIssueComments(ctx, "[email protected]", &store.IssueCommentMessage{
+ ProjectID: "anchor-p", IssueUID: 101, ThreadState: &open,
+ Payload: &storepb.IssueCommentPayload{Comment: "root", StatementAnchor: tc.root},
+ })
+ require.NoError(t, err)
+ resolved := store.ThreadStateResolved
+ require.NoError(t, stores.UpdateIssueComment(ctx, &store.UpdateIssueCommentMessage{
+ ProjectID: "anchor-p", ResourceID: root.ResourceID, ThreadState: &resolved,
+ }))
+ reply, err := stores.CreateIssueCommentReply(ctx, "[email protected]", &store.IssueCommentMessage{
+ ProjectID: "anchor-p", IssueUID: 101, ParentID: &root.ResourceID,
+ Payload: &storepb.IssueCommentPayload{Comment: "reply", StatementAnchor: tc.reply},
+ })
+ if tc.valid {
+ require.NoError(t, err)
+ require.Equal(t, root.ResourceID, *reply.ParentID)
+ } else {
+ require.Equal(t, common.Invalid, common.ErrorCode(err))
+ }
+ replies, err := stores.ListIssueComment(ctx, &store.FindIssueCommentMessage{
+ ProjectID: "anchor-p", IssueUID: &root.IssueUID, ParentIDs: &[]string{root.ResourceID},
+ })
+ require.NoError(t, err)
+ if tc.valid {
+ require.Len(t, replies, 1)
+ require.Equal(t, reply.ResourceID, replies[0].ResourceID)
+ } else {
+ require.Empty(t, replies, "rejected anchors must not persist a reply")
+ }
+ persisted, err := stores.GetIssueComment(ctx, &store.FindIssueCommentMessage{
+ ProjectID: "anchor-p", ResourceID: &root.ResourceID,
+ })
+ require.NoError(t, err)
+ require.Equal(t, store.ThreadStateResolved, *persisted.ThreadState, "replies never reopen a thread")
+ })
+ }
}
diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx
index 6cf0d79002..205568c6c3 100644
--- a/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx
+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailActionBar.tsx
@@ -58,7 +58,6 @@ import { IssueStatus } from "@/types/proto-es/v1/common_pb";
import {
ApproveIssueRequestSchema,
BatchUpdateIssuesStatusRequestSchema,
- ListIssueCommentsRequestSchema,
RejectIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
import {
@@ -219,12 +218,10 @@ export function IssueDetailActionBar() {
if (!page.issue?.name) {
return;
}
- await useAppStore.getState().listIssueComments(
- create(ListIssueCommentsRequestSchema, {
- parent: page.issue.name,
- pageSize: 1000,
- })
- );
+ await useAppStore.getState().fetchIssueCommentTimeline({
+ parent: page.issue.name,
+ pageSize: 1000,
+ });
}, [page.issue?.name]);
const handleRefreshIssueDetailState = useCallback(async () => {
diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx
index f6de27bb6d..b3facea997 100644
--- a/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx
+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx
@@ -24,7 +24,6 @@ import { getTimeForPbTimestampProtoEs, unknownUser } from "@/types";
import {
type IssueComment,
IssueSchema,
- ListIssueCommentsRequestSchema,
UpdateIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
import { extractProjectResourceName } from "@/utils";
@@ -127,12 +126,10 @@ export function IssueDetailCommentList() {
const run = async () => {
try {
setIsRefreshing(true);
- await useAppStore.getState().listIssueComments(
- create(ListIssueCommentsRequestSchema, {
- parent: issueName,
- pageSize: 1000,
- })
- );
+ await useAppStore.getState().fetchIssueCommentTimeline({
+ parent: issueName,
+ pageSize: 1000,
+ });
} finally {
if (!canceled) {
setIsRefreshing(false);
@@ -175,12 +172,10 @@ export function IssueDetailCommentList() {
if (!issueName) {
return;
}
- await useAppStore.getState().listIssueComments(
- create(ListIssueCommentsRequestSchema, {
- parent: issueName,
- pageSize: 1000,
- })
- );
+ await useAppStore.getState().fetchIssueCommentTimeline({
+ parent: issueName,
+ pageSize: 1000,
+ });
};
const allowEditComment = (comment: IssueComment): boolean =>
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.test.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.test.tsx
index d3a789ae85..2008d248b7 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.test.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.test.tsx
@@ -130,7 +130,7 @@ vi.mock("@/app/router", () => ({
vi.mock("@/stores/app", () => {
const getState = () => ({
createSheet: vi.fn(),
- listIssueComments: vi.fn(),
+ fetchIssueCommentTimeline: vi.fn(),
});
return { useAppStore: { getState } };
});
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.tsx
index 8887720ec7..268083dcdb 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailHeader.tsx
@@ -25,7 +25,6 @@ import { IssueStatus, State } from "@/types/proto-es/v1/common_pb";
import {
BatchUpdateIssuesStatusRequestSchema,
IssueSchema,
- ListIssueCommentsRequestSchema,
UpdateIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
import {
@@ -298,12 +297,10 @@ export function PlanDetailHeader() {
// issue comments so the review timeline reflects it (like issue detail).
await Promise.all([
page.refreshState(),
- useAppStore.getState().listIssueComments(
- create(ListIssueCommentsRequestSchema, {
- parent: issue.name,
- pageSize: 1000,
- })
- ),
+ useAppStore.getState().fetchIssueCommentTimeline({
+ parent: issue.name,
+ pageSize: 1000,
+ }),
]);
if (pageKeyRef.current !== actionPageKey) return;
// Land on the review section so the close/reopen system comment and the
diff --git a/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.test.tsx b/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.test.tsx
index caa78a89d7..2777d0da90 100644
--- a/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.test.tsx
+++ b/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.test.tsx
@@ -24,7 +24,7 @@ import { PlanReviewSection } from "./PlanReviewSection";
const mocks = vi.hoisted(() => ({
comments: [] as IssueComment[],
getIssueComments: vi.fn((_issueName: string) => [] as IssueComment[]),
- listIssueComments: vi.fn(async () => ({ issueComments: [] })),
+ fetchIssueCommentTimeline: vi.fn(async () => ({ issueComments: [] })),
getOrFetchProjectByName: vi.fn(async () => ({})),
loadProjectIamPolicy: vi.fn(async () => ({})),
getUserByIdentifier: vi.fn(() => undefined),
@@ -89,7 +89,7 @@ vi.mock("@/stores/app", () => ({
}),
{
getState: () => ({
- listIssueComments: mocks.listIssueComments,
+ fetchIssueCommentTimeline: mocks.fetchIssueCommentTimeline,
getOrFetchProjectByName: mocks.getOrFetchProjectByName,
loadProjectIamPolicy: mocks.loadProjectIamPolicy,
getProjectByName: mocks.getProjectByName,
diff --git a/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.tsx b/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.tsx
index ecc315f930..918cd039a9 100644
--- a/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.tsx
+++ b/frontend/src/routes/project/plan-detail/components/review/PlanReviewSection.tsx
@@ -1,11 +1,9 @@
-import { create } from "@bufbuild/protobuf";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useAppStore } from "@/stores/app";
import { projectNamePrefix } from "@/stores/modules/v1/common";
import { ApprovalStatus } from "@/types/proto-es/v1/common_pb";
import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import { ListIssueCommentsRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import { usePlanDetailContext } from "../../shell/PlanDetailContext";
import { ReviewActivityTimeline } from "./ReviewActivityTimeline";
import { ReviewApprovalFlow } from "./ReviewApprovalFlow";
@@ -41,12 +39,10 @@ export function PlanReviewSection() {
if (!issueName) return;
void useAppStore
.getState()
- .listIssueComments(
- create(ListIssueCommentsRequestSchema, {
- parent: issueName,
- pageSize: 1000,
- })
- )
+ .fetchIssueCommentTimeline({
+ parent: issueName,
+ pageSize: 1000,
+ })
.catch(() => undefined);
}, [issueName, issueUpdateKey]);
diff --git a/frontend/src/stores/app/issueComment.test.ts b/frontend/src/stores/app/issueComment.test.ts
new file mode 100644
index 0000000000..3075ce7999
--- /dev/null
+++ b/frontend/src/stores/app/issueComment.test.ts
@@ -0,0 +1,160 @@
+import { create } from "@bufbuild/protobuf";
+import { beforeEach, expect, test, vi } from "vitest";
+import {
+ IssueCommentSchema,
+ ListIssueCommentsRequestSchema,
+} from "@/types/proto-es/v1/issue_service_pb";
+import { createIssueCommentSlice } from "./issueComment";
+
+const mocks = vi.hoisted(() => ({
+ createIssueComment: vi.fn(),
+ listIssueComments: vi.fn(),
+}));
+vi.mock("@/api", () => ({
+ issueServiceClientConnect: mocks,
+}));
+
+const createStore = () => {
+ const state: Record<string, unknown> = {};
+ const set = (updater: unknown) => {
+ Object.assign(
+ state,
+ typeof updater === "function" ? updater(state) : updater
+ );
+ };
+ Object.assign(
+ state,
+ createIssueCommentSlice(set as never, (() => state) as never, {} as never)
+ );
+ return state as ReturnType<typeof createIssueCommentSlice>;
+};
+
+beforeEach(() => {
+ vi.clearAllMocks();
+});
+
+test("the frontend composer still creates a general comment", async () => {
+ const store = createStore();
+ const parent = "projects/p/issues/101";
+ const comment = create(IssueCommentSchema, {
+ name: parent + "/issueComments/comment",
+ comment: "Looks good",
+ });
+ mocks.createIssueComment.mockResolvedValue(comment);
+ await store.createIssueComment({ issueName: parent, comment: "Looks good" });
+ const request = mocks.createIssueComment.mock.calls[0][0];
+ expect(request.parent).toBe(parent);
+ expect(request.issueComment.comment).toBe("Looks good");
+ expect(request.issueComment.root).toBeUndefined();
+ expect(request.issueComment.threadState).toBeUndefined();
+ expect(request.issueComment.statementAnchor).toBeUndefined();
+ expect(store.getIssueComments(parent)).toEqual([comment]);
+});
+
+test("timeline loading caches the requested page and preserves other issues", async () => {
+ const store = createStore();
+ const parent = "projects/p/issues/101";
+ const other = "projects/p/issues/102";
+ const otherComments = [
+ create(IssueCommentSchema, { comment: "other issue" }),
+ ];
+ mocks.listIssueComments.mockResolvedValueOnce({
+ issueComments: otherComments,
+ nextPageToken: "",
+ });
+ await store.fetchIssueCommentTimeline({ parent: other });
+
+ const timeline = [
+ create(IssueCommentSchema, { name: parent + "/issueComments/root" }),
+ ];
+ mocks.listIssueComments.mockResolvedValueOnce({
+ issueComments: timeline,
+ nextPageToken: "next",
+ });
+ const response = await store.fetchIssueCommentTimeline({
+ parent,
+ pageSize: 50,
+ pageToken: "page",
+ });
+ expect(mocks.listIssueComments).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ parent,
+ filter: "",
+ pageSize: 50,
+ pageToken: "page",
+ })
+ );
+ expect(response).toEqual({ issueComments: timeline, nextPageToken: "next" });
+ expect(store.getIssueComments(parent)).toEqual(timeline);
+ expect(store.getIssueComments(other)).toEqual(otherComments);
+
+ mocks.listIssueComments.mockResolvedValueOnce({
+ issueComments: [],
+ nextPageToken: "",
+ });
+ await store.fetchIssueCommentTimeline({ parent });
+ expect(store.getIssueComments(parent)).toEqual([]);
+ expect(store.getIssueComments(other)).toEqual(otherComments);
+});
+
+test.each([
+ "",
+ "root == null",
+ "(root == null)",
+ "root == (null)",
+ "((root) == (null))",
+ "root == null // timeline",
+ 'root == "projects/p/issues/101/issueComments/root"',
+ 'root in ["projects/p/issues/101/issueComments/root"]',
+ "root in []",
+])("arbitrary queries never change the timeline cache: %s", async (filter) => {
+ const store = createStore();
+ const parent = "projects/p/issues/101";
+ const cached = [create(IssueCommentSchema, { comment: "cached timeline" })];
+ mocks.listIssueComments.mockResolvedValueOnce({
+ issueComments: cached,
+ nextPageToken: "",
+ });
+ await store.fetchIssueCommentTimeline({ parent });
+
+ for (const issueComments of [
+ [],
+ [create(IssueCommentSchema, { comment: "query result" })],
+ ]) {
+ const result = { issueComments, nextPageToken: "next" };
+ mocks.listIssueComments.mockResolvedValueOnce(result);
+ const response = await store.listIssueComments(
+ create(ListIssueCommentsRequestSchema, {
+ parent,
+ filter,
+ pageSize: 10,
+ pageToken: "page",
+ })
+ );
+ expect(response).toEqual(result);
+ expect(mocks.listIssueComments).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ parent,
+ filter,
+ pageSize: 10,
+ pageToken: "page",
+ })
+ );
+ expect(store.getIssueComments(parent)).toEqual(cached);
+ }
+});
+
+test("failed timeline refresh preserves the cached content and propagates the error", async () => {
+ const store = createStore();
+ const parent = "projects/p/issues/101";
+ const cached = [create(IssueCommentSchema, { comment: "cached timeline" })];
+ mocks.listIssueComments.mockResolvedValueOnce({
+ issueComments: cached,
+ nextPageToken: "",
+ });
+ await store.fetchIssueCommentTimeline({ parent });
+ const error = new Error("unavailable");
+ mocks.listIssueComments.mockRejectedValueOnce(error);
+ await expect(store.fetchIssueCommentTimeline({ parent })).rejects.toBe(error);
+ expect(store.getIssueComments(parent)).toEqual(cached);
+});
diff --git a/frontend/src/stores/app/issueComment.ts b/frontend/src/stores/app/issueComment.ts
index 9ec71c544f..ecc57d2eb2 100644
--- a/frontend/src/stores/app/issueComment.ts
+++ b/frontend/src/stores/app/issueComment.ts
@@ -53,18 +53,30 @@ export const createIssueCommentSlice: AppSliceCreator<IssueCommentSlice> = (
parent: request.parent,
pageSize: request.pageSize,
pageToken: request.pageToken,
+ filter: request.filter,
+ })
+ );
+ return {
+ nextPageToken: resp.nextPageToken,
+ issueComments: resp.issueComments,
+ };
+ },
+
+ fetchIssueCommentTimeline: async ({ parent, pageSize, pageToken }) => {
+ const resp = await get().listIssueComments(
+ createProto(ListIssueCommentsRequestSchema, {
+ parent,
+ pageSize,
+ pageToken,
})
);
set((state) => ({
issueCommentsByIssue: {
...state.issueCommentsByIssue,
- [request.parent]: resp.issueComments,
+ [parent]: resp.issueComments,
},
}));
- return {
- nextPageToken: resp.nextPageToken,
- issueComments: resp.issueComments,
- };
+ return resp;
},
createIssueComment: async ({ issueName, comment }) => {
diff --git a/frontend/src/stores/app/types.ts b/frontend/src/stores/app/types.ts
index 66ddf5df15..ddd2ac1026 100644
--- a/frontend/src/stores/app/types.ts
+++ b/frontend/src/stores/app/types.ts
@@ -1103,11 +1103,18 @@ export type DatabaseCatalogSlice = {
};
export type IssueCommentSlice = {
- // Cache keyed by issue resource name → its comment list.
+ // Cache keyed by issue resource name → its timeline page (no replies).
issueCommentsByIssue: Record<string, IssueComment[]>;
+ // Arbitrary CEL queries return results without changing the timeline cache.
listIssueComments: (
request: ListIssueCommentsRequest
) => Promise<{ nextPageToken: string; issueComments: IssueComment[] }>;
+ // Fetch an unfiltered timeline page and replace the cached page for this issue.
+ fetchIssueCommentTimeline: (request: {
+ parent: string;
+ pageSize?: number;
+ pageToken?: string;
+ }) => Promise<{ nextPageToken: string; issueComments: IssueComment[] }>;
createIssueComment: (params: {
issueName: string;
comment: string;
diff --git a/frontend/src/types/proto-es/v1/issue_service_pb.d.ts b/frontend/src/types/proto-es/v1/issue_service_pb.d.ts
index 8d650bb53a..15542fdb82 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
@@ -5,7 +5,7 @@
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
import type { Duration, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt";
-import type { ApprovalStatus, IssueStatus, RiskLevel } from "./common_pb";
+import type { ApprovalStatus, IssueStatus, Position, RiskLevel } from "./common_pb";
import type { Expr } from "../google/type/expr_pb";
import type { Plan_Spec } from "./plan_service_pb";
@@ -820,6 +820,16 @@ export declare type ListIssueCommentsRequest = Message<"bytebase.v1.ListIssueCom
* @generated from field: string page_token = 3;
*/
pageToken: string;
+
+ /**
+ * CEL filter over events, root comments, and replies.
+ * Supported: root == null, root == "<comment name>", or root in ["<comment name>", ...].
+ * Root names must belong to parent. Empty and root == null return the
+ * timeline (events and root comments); other filters return replies only.
+ *
+ * @generated from field: string filter = 4;
+ */
+ filter: string;
};
/**
@@ -965,6 +975,35 @@ export declare type IssueComment = Message<"bytebase.v1.IssueComment"> & {
*/
creator: string;
+ /**
+ * 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.
+ *
+ * @generated from field: optional string root = 14;
+ */
+ root?: string | undefined;
+
+ /**
+ * 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.
+ *
+ * @generated from field: optional bytebase.v1.IssueComment.ThreadState thread_state = 15;
+ */
+ threadState?: IssueComment_ThreadState | undefined;
+
+ /**
+ * 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.
+ *
+ * @generated from field: bytebase.v1.StatementAnchor statement_anchor = 16;
+ */
+ statementAnchor?: StatementAnchor | undefined;
+
/**
* The event associated with this comment.
*
@@ -1162,6 +1201,74 @@ export declare type IssueComment_PlanUpdate = Message<"bytebase.v1.IssueComment.
*/
export declare const IssueComment_PlanUpdateSchema: GenMessage<IssueComment_PlanUpdate>;
+/**
+ * @generated from enum bytebase.v1.IssueComment.ThreadState
+ */
+export enum IssueComment_ThreadState {
+ /**
+ * @generated from enum value: THREAD_STATE_UNSPECIFIED = 0;
+ */
+ THREAD_STATE_UNSPECIFIED = 0,
+
+ /**
+ * @generated from enum value: OPEN = 1;
+ */
+ OPEN = 1,
+
+ /**
+ * @generated from enum value: RESOLVED = 2;
+ */
+ RESOLVED = 2,
+}
+
+/**
+ * Describes the enum bytebase.v1.IssueComment.ThreadState.
+ */
+export declare const IssueComment_ThreadStateSchema: GenEnum<IssueComment_ThreadState>;
+
+/**
+ * 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.
+ *
+ * @generated from message bytebase.v1.StatementAnchor
+ */
+export declare type StatementAnchor = Message<"bytebase.v1.StatementAnchor"> & {
+ /**
+ * The Plan.Spec.id in the issue's plan; may no longer resolve after deletion.
+ *
+ * @generated from field: string spec = 1;
+ */
+ spec: string;
+
+ /**
+ * SHA256 of the saved sheet, as 64 lowercase hexadecimal characters.
+ *
+ * @generated from field: string sheet_sha256 = 2;
+ */
+ sheetSha256: string;
+
+ /**
+ * One-based lines and Unicode code-point columns. When both columns are zero,
+ * the range covers whole lines, including the end line. Otherwise both columns
+ * must be positive, start_position is inclusive, and end_position is exclusive.
+ *
+ * @generated from field: bytebase.v1.Position start_position = 3;
+ */
+ startPosition?: Position | undefined;
+
+ /**
+ * @generated from field: bytebase.v1.Position end_position = 4;
+ */
+ endPosition?: Position | undefined;
+};
+
+/**
+ * Describes the message bytebase.v1.StatementAnchor.
+ * Use `create(StatementAnchorSchema)` to create a new message.
+ */
+export declare const StatementAnchorSchema: GenMessage<StatementAnchor>;
+
/**
* @generated from message bytebase.v1.ReviewRun
*/
diff --git a/frontend/src/types/proto-es/v1/issue_service_pb.js b/frontend/src/types/proto-es/v1/issue_service_pb.js
index 023b0010c3..e1043b927b 100644
--- a/frontend/src/types/proto-es/v1/issue_service_pb.js
+++ b/frontend/src/types/proto-es/v1/issue_service_pb.js
@@ -18,7 +18,7 @@ import { file_v1_plan_service } from "./plan_service_pb";
* Describes the file v1/issue_service.proto.
*/
export const file_v1_issue_service = /*@__PURE__*/
- fileDesc("ChZ2MS9pc3N1ZV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJKCg9HZXRJc3N1ZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vSXNzdWUSDQoFZm9yY2UYAiABKAgiagoSQ3JlYXRlSXNzdWVSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBImCgVpc3N1ZRgCIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQgPgQQIimQEKEUxpc3RJc3N1ZXNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkSEAoIb3JkZXJfYnkYBiABKAkiUQoSTGlzdElzc3Vlc1Jlc3BvbnNlEiIKBmlzc3VlcxgBIAMoCzISLmJ5dGViYXNlLnYxLklzc3VlEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSKCAQoTU2VhcmNoSXNzdWVzUmVxdWVzdBITCgZwYXJlbnQYASABKAlCA+BBAhIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkSEAoIb3JkZXJfYnkYBiABKAkiUwoUU2VhcmNoSXNzdWVzUmVzcG9uc2USIgoGaXNzdWVzGAEgAygLMhIuYnl0ZWJhc2UudjEuSXNzdWUSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIqABChJVcGRhdGVJc3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dW4iYtpBBG5hbWWK6jARYmIucmV2aWV3UnVucy5ydW6Q6jABmOowAaDqMAKC0+STAjQ6ASoiLy92MS97bmFtZT1wcm9qZWN0cy8qL2lzc3Vlcy8qL3Jldmlld1J1bnMvKn06cnVuQqcBCg9jb20uYnl0ZWJhc2UudjFCEUlzc3VlU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [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]);
+ fileDesc("ChZ2MS9pc3N1ZV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJKCg9HZXRJc3N1ZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vSXNzdWUSDQoFZm9yY2UYAiABKAgiagoSQ3JlYXRlSXNzdWVSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBImCgVpc3N1ZRgCIAEoCzISLmJ5dGViYXNlLnYxLklzc3VlQgPgQQIimQEKEUxpc3RJc3N1ZXNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIRCglwYWdlX3NpemUYAiABKAUSEgoKcGFnZV90b2tlbhgDIAEoCRIOCgZmaWx0ZXIYBCABKAkSDQoFcXVlcnkYBSABKAkSEAoIb3JkZXJfYnkYBiABKAkiUQoSTGlzdElzc3Vlc1Jlc3BvbnNlEiIKBmlzc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W5CpwEKD2NvbS5ieXRlYmFzZS52MUIRSXNzdWVTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [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]);
/**
* Describes the message bytebase.v1.GetIssueRequest.
@@ -251,18 +251,37 @@ export const IssueComment_ReviewSubmissionSchema = /*@__PURE__*/
export const IssueComment_PlanUpdateSchema = /*@__PURE__*/
messageDesc(file_v1_issue_service, 21, 3);
+/**
+ * Describes the enum bytebase.v1.IssueComment.ThreadState.
+ */
+export const IssueComment_ThreadStateSchema = /*@__PURE__*/
+ enumDesc(file_v1_issue_service, 21, 0);
+
+/**
+ * @generated from enum bytebase.v1.IssueComment.ThreadState
+ */
+export const IssueComment_ThreadState = /*@__PURE__*/
+ tsEnum(IssueComment_ThreadStateSchema);
+
+/**
+ * Describes the message bytebase.v1.StatementAnchor.
+ * Use `create(StatementAnchorSchema)` to create a new message.
+ */
+export const StatementAnchorSchema = /*@__PURE__*/
+ messageDesc(file_v1_issue_service, 22);
+
/**
* Describes the message bytebase.v1.ReviewRun.
* Use `create(ReviewRunSchema)` to create a new message.
*/
export const ReviewRunSchema = /*@__PURE__*/
- messageDesc(file_v1_issue_service, 22);
+ messageDesc(file_v1_issue_service, 23);
/**
* Describes the enum bytebase.v1.ReviewRun.Type.
*/
export const ReviewRun_TypeSchema = /*@__PURE__*/
- enumDesc(file_v1_issue_service, 22, 0);
+ enumDesc(file_v1_issue_service, 23, 0);
/**
* @generated from enum bytebase.v1.ReviewRun.Type
@@ -274,7 +293,7 @@ export const ReviewRun_Type = /*@__PURE__*/
* Describes the enum bytebase.v1.ReviewRun.Status.
*/
export const ReviewRun_StatusSchema = /*@__PURE__*/
- enumDesc(file_v1_issue_service, 22, 1);
+ enumDesc(file_v1_issue_service, 23, 1);
/**
* States follow task_run, minus PENDING (review needs no admission
@@ -291,7 +310,7 @@ export const ReviewRun_Status = /*@__PURE__*/
* Use `create(RunReviewRequestSchema)` to create a new message.
*/
export const RunReviewRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_issue_service, 23);
+ messageDesc(file_v1_issue_service, 24);
/**
* IssueService manages issues for tracking database changes and tasks.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index f15aec6950..29949160e4 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -11209,6 +11209,16 @@ paths:
schema:
type: string
title: page_token
+ - name: filter
+ in: query
+ description: |-
+ CEL filter over events, root comments, and replies.
+ Supported: root == null, root == "<comment name>", or root in ["<comment name>", ...].
+ Root names must belong to parent. Empty and root == null return the
+ timeline (events and root comments); other filters return replies only.
+ schema:
+ type: string
+ title: filter
responses:
"200":
description: Success
@@ -24832,6 +24842,33 @@ components:
title: creator
description: 'Format: users/{email}'
readOnly: true
+ root:
+ type:
+ - string
+ - "null"
+ title: root
+ description: |-
+ (IMMUTABLE) 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.
+ threadState:
+ oneOf:
+ - $ref: '#/components/schemas/bytebase.v1.IssueComment.ThreadState'
+ - type: "null"
+ title: thread_state
+ description: |-
+ 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.
+ statementAnchor:
+ title: statement_anchor
+ description: |-
+ (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.
+ $ref: '#/components/schemas/bytebase.v1.StatementAnchor'
- oneOf:
- type: object
properties:
@@ -24960,6 +24997,13 @@ components:
title: ReviewSubmission
additionalProperties: false
description: Review submission event information.
+ bytebase.v1.IssueComment.ThreadState:
+ type: string
+ title: ThreadState
+ enum:
+ - THREAD_STATE_UNSPECIFIED
+ - OPEN
+ - RESOLVED
bytebase.v1.IssueStatus:
type: string
title: IssueStatus
@@ -25683,6 +25727,14 @@ components:
When paginating, all other parameters provided to `ListIssueComments` must match
the call that provided the page token.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ CEL filter over events, root comments, and replies.
+ Supported: root == null, root == "<comment name>", or root in ["<comment name>", ...].
+ Root names must belong to parent. Empty and root == null return the
+ timeline (events and root comments); other filters return replies only.
title: ListIssueCommentsRequest
required:
- parent
@@ -31075,6 +31127,33 @@ components:
- ACTIVE
- DELETED
description: Resource lifecycle state.
+ bytebase.v1.StatementAnchor:
+ type: object
+ properties:
+ spec:
+ type: string
+ title: spec
+ description: The Plan.Spec.id in the issue's plan; may no longer resolve after deletion.
+ sheetSha256:
+ type: string
+ title: sheet_sha256
+ description: SHA256 of the saved sheet, as 64 lowercase hexadecimal characters.
+ startPosition:
+ title: start_position
+ description: |-
+ One-based lines and Unicode code-point columns. When both columns are zero,
+ the range covers whole lines, including the end line. Otherwise both columns
+ must be positive, start_position is inclusive, and end_position is exclusive.
+ $ref: '#/components/schemas/bytebase.v1.Position'
+ endPosition:
+ title: end_position
+ $ref: '#/components/schemas/bytebase.v1.Position'
+ title: StatementAnchor
+ additionalProperties: false
+ description: |-
+ 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.
bytebase.v1.StatementType:
type: string
title: StatementType
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index f38c889dd1..fb46aeda3f 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -197,12 +197,14 @@
- [RunReviewRequest](#bytebase-v1-RunReviewRequest)
- [SearchIssuesRequest](#bytebase-v1-SearchIssuesRequest)
- [SearchIssuesResponse](#bytebase-v1-SearchIssuesResponse)
+ - [StatementAnchor](#bytebase-v1-StatementAnchor)
- [UpdateIssueCommentRequest](#bytebase-v1-UpdateIssueCommentRequest)
- [UpdateIssueRequest](#bytebase-v1-UpdateIssueRequest)
- [Issue.Approver.Status](#bytebase-v1-Issue-Approver-Status)
- [Issue.Type](#bytebase-v1-Issue-Type)
- [IssueComment.Approval.Status](#bytebase-v1-IssueComment-Approval-Status)
+ - [IssueComment.ThreadState](#bytebase-v1-IssueComment-ThreadState)
- [ReviewRun.Status](#bytebase-v1-ReviewRun-Status)
- [ReviewRun.Type](#bytebase-v1-ReviewRun-Type)
@@ -3509,6 +3511,9 @@ A comment on an issue.
| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
| creator | [string](#string) | | Format: users/{email} |
+| root | [string](#string) | optional | The thread root&#39;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&#39;s anchor must share the root&#39;s spec and sheet_sha256; it may narrow the range. Cannot be set on events. Immutable after creation. |
| 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. |
@@ -3596,6 +3601,7 @@ Review submission event information.
| page_token | [string](#string) | | A page token, received from a previous `ListIssueComments` call. Provide this to retrieve the subsequent page.
When paginating, all other parameters provided to `ListIssueComments` must match the call that provided the page token. |
+| filter | [string](#string) | | CEL filter over events, root comments, and replies. Supported: root == null, root == &#34;&lt;comment name&gt;&#34;, or root in [&#34;&lt;comment name&gt;&#34;, ...]. Root names must belong to parent. Empty and root == null return the timeline (events and root comments); other filters return replies only. |
@@ -3798,6 +3804,26 @@ When paginating, all other parameters provided to `SearchIssues` must match the
+<a name="bytebase-v1-StatementAnchor"></a>
+
+### StatementAnchor
+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.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| spec | [string](#string) | | The Plan.Spec.id in the issue&#39;s plan; may no longer resolve after deletion. |
+| sheet_sha256 | [string](#string) | | SHA256 of the saved sheet, as 64 lowercase hexadecimal characters. |
+| start_position | [Position](#bytebase-v1-Position) | | One-based lines and Unicode code-point columns. When both columns are zero, the range covers whole lines, including the end line. Otherwise both columns must be positive, start_position is inclusive, and end_position is exclusive. |
+| end_position | [Position](#bytebase-v1-Position) | | |
+
+
+
+
+
+
<a name="bytebase-v1-UpdateIssueCommentRequest"></a>
### UpdateIssueCommentRequest
@@ -3879,6 +3905,19 @@ Approval status values.
+<a name="bytebase-v1-IssueComment-ThreadState"></a>
+
+### IssueComment.ThreadState
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| THREAD_STATE_UNSPECIFIED | 0 | |
+| OPEN | 1 | |
+| RESOLVED | 2 | |
+
+
+
<a name="bytebase-v1-ReviewRun-Status"></a>
### ReviewRun.Status
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 966dc1f060..7d9d63f704 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -923,6 +923,10 @@
<a href="#bytebase.v1.SearchIssuesResponse"><span class="badge">M</span>SearchIssuesResponse</a>
</li>
+ <li>
+ <a href="#bytebase.v1.StatementAnchor"><span class="badge">M</span>StatementAnchor</a>
+ </li>
+
<li>
<a href="#bytebase.v1.UpdateIssueCommentRequest"><span class="badge">M</span>UpdateIssueCommentRequest</a>
</li>
@@ -944,6 +948,10 @@
<a href="#bytebase.v1.IssueComment.Approval.Status"><span class="badge">E</span>IssueComment.Approval.Status</a>
</li>
+ <li>
+ <a href="#bytebase.v1.IssueComment.ThreadState"><span class="badge">E</span>IssueComment.ThreadState</a>
+ </li>
+
<li>
<a href="#bytebase.v1.ReviewRun.Status"><span class="badge">E</span>ReviewRun.Status</a>
</li>
@@ -10694,6 +10702,35 @@ Format: projects/{project}/accessGrants/{access_grant} </p></td>
<td><p>Format: users/{email} </p></td>
</tr>
+ <tr>
+ <td>root</td>
+ <td><a href="#string">string</a></td>
+ <td>optional</td>
+ <td><p>The thread root&#39;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. </p></td>
+ </tr>
+
+ <tr>
+ <td>thread_state</td>
+ <td><a href="#bytebase.v1.IssueComment.ThreadState">IssueComment.ThreadState</a></td>
+ <td>optional</td>
+ <td><p>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. </p></td>
+ </tr>
+
+ <tr>
+ <td>statement_anchor</td>
+ <td><a href="#bytebase.v1.StatementAnchor">StatementAnchor</a></td>
+ <td></td>
+ <td><p>Optional source context on a root or reply. A reply&#39;s anchor must share
+the root&#39;s spec and sheet_sha256; it may narrow the range.
+Cannot be set on events. Immutable after creation. </p></td>
+ </tr>
+
<tr>
<td>approval</td>
<td><a href="#bytebase.v1.IssueComment.Approval">IssueComment.Approval</a></td>
@@ -10902,6 +10939,16 @@ When paginating, all other parameters provided to `ListIssueComments` must match
the call that provided the page token. </p></td>
</tr>
+ <tr>
+ <td>filter</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>CEL filter over events, root comments, and replies.
+Supported: root == null, root == &#34;&lt;comment name&gt;&#34;, or root in [&#34;&lt;comment name&gt;&#34;, ...].
+Root names must belong to parent. Empty and root == null return the
+timeline (events and root comments); other filters return replies only. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -11400,6 +11447,53 @@ If this field is omitted, there are no subsequent pages. </p></td>
+ <h3 id="bytebase.v1.StatementAnchor">StatementAnchor</h3>
+ <p>The saved statement revision and range referenced by a comment.</p><p>Source currency is derived by comparing the spec and hash with the current plan.</p><p>Historical SQL is available through SheetService.GetSheet with this hash.</p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>spec</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The Plan.Spec.id in the issue&#39;s plan; may no longer resolve after deletion. </p></td>
+ </tr>
+
+ <tr>
+ <td>sheet_sha256</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>SHA256 of the saved sheet, as 64 lowercase hexadecimal characters. </p></td>
+ </tr>
+
+ <tr>
+ <td>start_position</td>
+ <td><a href="#bytebase.v1.Position">Position</a></td>
+ <td></td>
+ <td><p>One-based lines and Unicode code-point columns. When both columns are zero,
+the range covers whole lines, including the end line. Otherwise both columns
+must be positive, start_position is inclusive, and end_position is exclusive. </p></td>
+ </tr>
+
+ <tr>
+ <td>end_position</td>
+ <td><a href="#bytebase.v1.Position">Position</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.UpdateIssueCommentRequest">UpdateIssueCommentRequest</h3>
<p></p>
@@ -11596,6 +11690,35 @@ In this situation, `update_mask` is ignored. </p></td>
</tbody>
</table>
+ <h3 id="bytebase.v1.IssueComment.ThreadState">IssueComment.ThreadState</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>THREAD_STATE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>OPEN</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>RESOLVED</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
<h3 id="bytebase.v1.ReviewRun.Status">ReviewRun.Status</h3>
<p>States follow task_run, minus PENDING (review needs no admission</p><p>control) and minus CANCELED (runs are side-effect-free until the fenced</p><p>completion transaction, so re-running supersedes instead of canceling).</p>
<table class="enum-table">
diff --git a/proto/v1/v1/issue_service.proto b/proto/v1/v1/issue_service.proto
index 11fc7a5254..b6d050f882 100644
--- a/proto/v1/v1/issue_service.proto
+++ b/proto/v1/v1/issue_service.proto
@@ -605,6 +605,12 @@ message ListIssueCommentsRequest {
// When paginating, all other parameters provided to `ListIssueComments` must match
// the call that provided the page token.
string page_token = 3;
+
+ // CEL filter over events, root comments, and replies.
+ // Supported: root == null, root == "<comment name>", or root in ["<comment name>", ...].
+ // Root names must belong to parent. Empty and root == null return the
+ // timeline (events and root comments); other filters return replies only.
+ string filter = 4;
}
message ListIssueCommentsResponse {
@@ -666,6 +672,29 @@ message IssueComment {
// Format: users/{email}
string creator = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // 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.
+ optional string root = 14 [(google.api.field_behavior) = IMMUTABLE];
+
+ // 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.
+ 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.
+ StatementAnchor statement_anchor = 16 [(google.api.field_behavior) = IMMUTABLE];
+
+ enum ThreadState {
+ THREAD_STATE_UNSPECIFIED = 0;
+ OPEN = 1;
+ RESOLVED = 2;
+ }
+
// The event associated with this comment.
oneof event {
// Approval event.
@@ -720,6 +749,21 @@ message IssueComment {
}
}
+// 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.
+message StatementAnchor {
+ // The Plan.Spec.id in the issue's plan; may no longer resolve after deletion.
+ string spec = 1;
+ // SHA256 of the saved sheet, as 64 lowercase hexadecimal characters.
+ string sheet_sha256 = 2;
+ // One-based lines and Unicode code-point columns. When both columns are zero,
+ // the range covers whole lines, including the end line. Otherwise both columns
+ // must be positive, start_position is inclusive, and end_position is exclusive.
+ Position start_position = 3;
+ Position end_position = 4;
+}
+
message ReviewRun {
option (google.api.resource) = {
type: "bytebase.com/ReviewRun"