diff --git a/api b/api index 5fa7d154d..c6bab4bbb 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit 5fa7d154db9f26c2f654a91a982d2748027f0522 +Subproject commit c6bab4bbba3bb5ee3b733caa2612c1d3a8c1e2fd diff --git a/internal/core/kernel/chat.go b/internal/core/kernel/chat.go index 5694eaba7..003caecc3 100644 --- a/internal/core/kernel/chat.go +++ b/internal/core/kernel/chat.go @@ -12,6 +12,11 @@ type ( // NotifyLinesExceed sends a message indicating a line exceed message. // // This method must not be called from the workflow. - NotifyLinesExceed(ctx context.Context, event *events.Event[eventsv1.ChatHook, eventsv1.Diff]) error // TODO - need to handle branch + NotifyLinesExceed(ctx context.Context, event *events.Event[eventsv1.ChatHook, eventsv1.Diff]) error + + // NotifyMergeConflict sends a message indicating a merge conflict. + // + // This method must not be called from the workflow. + NotifyMergeConflict(ctx context.Context, event *events.Event[eventsv1.ChatHook, eventsv1.Merge]) error } ) diff --git a/internal/events/payload.go b/internal/events/payload.go index 22950acff..2082a0262 100644 --- a/internal/events/payload.go +++ b/internal/events/payload.go @@ -13,6 +13,7 @@ type ( eventsv1.Push | eventsv1.Rebase | eventsv1.Diff | - eventsv1.PullRequest + eventsv1.PullRequest | + eventsv1.Merge } ) diff --git a/internal/hooks/slack/activities/kernel.go b/internal/hooks/slack/activities/kernel.go index c3abcca59..9ee0b29d9 100644 --- a/internal/hooks/slack/activities/kernel.go +++ b/internal/hooks/slack/activities/kernel.go @@ -64,6 +64,12 @@ func (k *Kernel) NotifyLinesExceed( return fns.SendMessage(client, target, attachment) } +func (k *Kernel) NotifyMergeConflict( + ctx context.Context, event *events.Event[eventsv1.ChatHook, eventsv1.Merge], +) error { + return nil +} + func (k *Kernel) to_user(ctx context.Context, link_to uuid.UUID) (string, string, error) { msg, err := db.Queries().GetMessagesByLinkTo(ctx, link_to) if err != nil { diff --git a/internal/proto/ctrlplane/events/v1/merge.pb.go b/internal/proto/ctrlplane/events/v1/merge.pb.go new file mode 100644 index 000000000..358961d1a --- /dev/null +++ b/internal/proto/ctrlplane/events/v1/merge.pb.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: ctrlplane/events/v1/merge.proto + +package eventsv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Merge struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HeadBranch string `protobuf:"bytes,1,opt,name=head_branch,json=headBranch,proto3" json:"head_branch,omitempty"` + HeadCommit string `protobuf:"bytes,2,opt,name=head_commit,json=headCommit,proto3" json:"head_commit,omitempty"` + BaseBranch string `protobuf:"bytes,3,opt,name=base_branch,json=baseBranch,proto3" json:"base_branch,omitempty"` + BaseCommit string `protobuf:"bytes,4,opt,name=base_commit,json=baseCommit,proto3" json:"base_commit,omitempty"` +} + +func (x *Merge) Reset() { + *x = Merge{} + mi := &file_ctrlplane_events_v1_merge_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Merge) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Merge) ProtoMessage() {} + +func (x *Merge) ProtoReflect() protoreflect.Message { + mi := &file_ctrlplane_events_v1_merge_proto_msgTypes[0] + 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 Merge.ProtoReflect.Descriptor instead. +func (*Merge) Descriptor() ([]byte, []int) { + return file_ctrlplane_events_v1_merge_proto_rawDescGZIP(), []int{0} +} + +func (x *Merge) GetHeadBranch() string { + if x != nil { + return x.HeadBranch + } + return "" +} + +func (x *Merge) GetHeadCommit() string { + if x != nil { + return x.HeadCommit + } + return "" +} + +func (x *Merge) GetBaseBranch() string { + if x != nil { + return x.BaseBranch + } + return "" +} + +func (x *Merge) GetBaseCommit() string { + if x != nil { + return x.BaseCommit + } + return "" +} + +var File_ctrlplane_events_v1_merge_proto protoreflect.FileDescriptor + +var file_ctrlplane_events_v1_merge_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x63, 0x74, 0x72, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x13, 0x63, 0x74, 0x72, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x8b, 0x01, 0x0a, 0x05, 0x4d, 0x65, 0x72, 0x67, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x42, 0x72, 0x61, 0x6e, 0x63, + 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x73, 0x65, 0x42, 0x72, 0x61, + 0x6e, 0x63, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x42, 0xd2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x74, 0x72, + 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x42, 0x0a, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, + 0x67, 0x6f, 0x2e, 0x62, 0x72, 0x65, 0x75, 0x2e, 0x69, 0x6f, 0x2f, 0x71, 0x75, 0x61, 0x6e, 0x74, + 0x6d, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x63, 0x74, 0x72, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x45, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x74, 0x72, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x43, 0x74, 0x72, 0x6c, + 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x1f, 0x43, 0x74, 0x72, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5c, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x15, 0x43, 0x74, 0x72, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x3a, 0x3a, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_ctrlplane_events_v1_merge_proto_rawDescOnce sync.Once + file_ctrlplane_events_v1_merge_proto_rawDescData = file_ctrlplane_events_v1_merge_proto_rawDesc +) + +func file_ctrlplane_events_v1_merge_proto_rawDescGZIP() []byte { + file_ctrlplane_events_v1_merge_proto_rawDescOnce.Do(func() { + file_ctrlplane_events_v1_merge_proto_rawDescData = protoimpl.X.CompressGZIP(file_ctrlplane_events_v1_merge_proto_rawDescData) + }) + return file_ctrlplane_events_v1_merge_proto_rawDescData +} + +var file_ctrlplane_events_v1_merge_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ctrlplane_events_v1_merge_proto_goTypes = []any{ + (*Merge)(nil), // 0: ctrlplane.events.v1.Merge +} +var file_ctrlplane_events_v1_merge_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ctrlplane_events_v1_merge_proto_init() } +func file_ctrlplane_events_v1_merge_proto_init() { + if File_ctrlplane_events_v1_merge_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ctrlplane_events_v1_merge_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ctrlplane_events_v1_merge_proto_goTypes, + DependencyIndexes: file_ctrlplane_events_v1_merge_proto_depIdxs, + MessageInfos: file_ctrlplane_events_v1_merge_proto_msgTypes, + }.Build() + File_ctrlplane_events_v1_merge_proto = out.File + file_ctrlplane_events_v1_merge_proto_rawDesc = nil + file_ctrlplane_events_v1_merge_proto_goTypes = nil + file_ctrlplane_events_v1_merge_proto_depIdxs = nil +}