feat(eda): playbook dispatch idempotency ledger
Add the playbook_dispatches at-most-once ledger (docs/prds/eda-playbook-engine.md gap 2) and the record-then-invoke coordinator helper, with the cross-process plumbing the State Store boundary requires. - proto: RecordPlaybookDispatch and DeletePlaybookDispatches RPCs (string keys) - storecontract: PlaybookDispatcher interface (no *sql.Tx, reuses ErrAlreadyDispatched) - store: playbook_dispatches table + INSERT OR IGNORE dedup + delete-by-playbook - staterpc: client/server methods and Deps field; error sentinel survives the hop - eda/playbook: InvokeOnce record-before-invoke helper, keyed on (playbook, version, event, action) with a "1" action-position fallback The ledger is administrative-only: task-scoped grants never reach it, matching TaskGrants' Update/Transition/InsertEvent allowlist. Not wired into the daemon workflow pin; the production call site arrives with the first side-effecting position.
This commit is contained in:
1 parent
4267e9cb0a
commit
1465718519
13 files changed
+720
-111
No files matched your search
@@ -6606,6 +6606,190 @@ func (*RecordDispatchResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{122}
|
||||
}
|
||||
|
||||
type RecordPlaybookDispatchRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PlaybookId string `protobuf:"bytes,1,opt,name=playbook_id,json=playbookId,proto3" json:"playbook_id,omitempty"`
|
||||
PlaybookVersion string `protobuf:"bytes,2,opt,name=playbook_version,json=playbookVersion,proto3" json:"playbook_version,omitempty"`
|
||||
EventId string `protobuf:"bytes,3,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"`
|
||||
ActionId string `protobuf:"bytes,4,opt,name=action_id,json=actionId,proto3" json:"action_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) Reset() {
|
||||
*x = RecordPlaybookDispatchRequest{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[123]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RecordPlaybookDispatchRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[123]
|
||||
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 RecordPlaybookDispatchRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RecordPlaybookDispatchRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{123}
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) GetPlaybookId() string {
|
||||
if x != nil {
|
||||
return x.PlaybookId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) GetPlaybookVersion() string {
|
||||
if x != nil {
|
||||
return x.PlaybookVersion
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) GetEventId() string {
|
||||
if x != nil {
|
||||
return x.EventId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchRequest) GetActionId() string {
|
||||
if x != nil {
|
||||
return x.ActionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RecordPlaybookDispatchResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchResponse) Reset() {
|
||||
*x = RecordPlaybookDispatchResponse{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[124]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RecordPlaybookDispatchResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RecordPlaybookDispatchResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RecordPlaybookDispatchResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[124]
|
||||
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 RecordPlaybookDispatchResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RecordPlaybookDispatchResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{124}
|
||||
}
|
||||
|
||||
type DeletePlaybookDispatchesRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PlaybookId string `protobuf:"bytes,1,opt,name=playbook_id,json=playbookId,proto3" json:"playbook_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeletePlaybookDispatchesRequest) Reset() {
|
||||
*x = DeletePlaybookDispatchesRequest{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[125]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeletePlaybookDispatchesRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeletePlaybookDispatchesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeletePlaybookDispatchesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[125]
|
||||
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 DeletePlaybookDispatchesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeletePlaybookDispatchesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{125}
|
||||
}
|
||||
|
||||
func (x *DeletePlaybookDispatchesRequest) GetPlaybookId() string {
|
||||
if x != nil {
|
||||
return x.PlaybookId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeletePlaybookDispatchesResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeletePlaybookDispatchesResponse) Reset() {
|
||||
*x = DeletePlaybookDispatchesResponse{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[126]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeletePlaybookDispatchesResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeletePlaybookDispatchesResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeletePlaybookDispatchesResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[126]
|
||||
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 DeletePlaybookDispatchesResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeletePlaybookDispatchesResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{126}
|
||||
}
|
||||
|
||||
type ListUndispatchedCapturesRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Sources []string `protobuf:"bytes,1,rep,name=sources,proto3" json:"sources,omitempty"`
|
||||
@@ -6616,7 +6800,7 @@ type ListUndispatchedCapturesRequest struct {
|
||||
|
||||
func (x *ListUndispatchedCapturesRequest) Reset() {
|
||||
*x = ListUndispatchedCapturesRequest{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[123]
|
||||
mi := &file_state_v1_state_proto_msgTypes[127]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -6628,7 +6812,7 @@ func (x *ListUndispatchedCapturesRequest) String() string {
|
||||
func (*ListUndispatchedCapturesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListUndispatchedCapturesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[123]
|
||||
mi := &file_state_v1_state_proto_msgTypes[127]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -6641,7 +6825,7 @@ func (x *ListUndispatchedCapturesRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ListUndispatchedCapturesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListUndispatchedCapturesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{123}
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{127}
|
||||
}
|
||||
|
||||
func (x *ListUndispatchedCapturesRequest) GetSources() []string {
|
||||
@@ -6667,7 +6851,7 @@ type ListUndispatchedCapturesResponse struct {
|
||||
|
||||
func (x *ListUndispatchedCapturesResponse) Reset() {
|
||||
*x = ListUndispatchedCapturesResponse{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[124]
|
||||
mi := &file_state_v1_state_proto_msgTypes[128]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -6679,7 +6863,7 @@ func (x *ListUndispatchedCapturesResponse) String() string {
|
||||
func (*ListUndispatchedCapturesResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListUndispatchedCapturesResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[124]
|
||||
mi := &file_state_v1_state_proto_msgTypes[128]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -6692,7 +6876,7 @@ func (x *ListUndispatchedCapturesResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ListUndispatchedCapturesResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListUndispatchedCapturesResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{124}
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{128}
|
||||
}
|
||||
|
||||
func (x *ListUndispatchedCapturesResponse) GetCaptures() []*CapturedEvent {
|
||||
@@ -6712,7 +6896,7 @@ type StreamUndispatchedCapturesRequest struct {
|
||||
|
||||
func (x *StreamUndispatchedCapturesRequest) Reset() {
|
||||
*x = StreamUndispatchedCapturesRequest{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[125]
|
||||
mi := &file_state_v1_state_proto_msgTypes[129]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -6724,7 +6908,7 @@ func (x *StreamUndispatchedCapturesRequest) String() string {
|
||||
func (*StreamUndispatchedCapturesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *StreamUndispatchedCapturesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[125]
|
||||
mi := &file_state_v1_state_proto_msgTypes[129]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -6737,7 +6921,7 @@ func (x *StreamUndispatchedCapturesRequest) ProtoReflect() protoreflect.Message
|
||||
|
||||
// Deprecated: Use StreamUndispatchedCapturesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*StreamUndispatchedCapturesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{125}
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{129}
|
||||
}
|
||||
|
||||
func (x *StreamUndispatchedCapturesRequest) GetSources() []string {
|
||||
@@ -6764,7 +6948,7 @@ type StreamUndispatchedCapturesResponse struct {
|
||||
|
||||
func (x *StreamUndispatchedCapturesResponse) Reset() {
|
||||
*x = StreamUndispatchedCapturesResponse{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[126]
|
||||
mi := &file_state_v1_state_proto_msgTypes[130]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -6776,7 +6960,7 @@ func (x *StreamUndispatchedCapturesResponse) String() string {
|
||||
func (*StreamUndispatchedCapturesResponse) ProtoMessage() {}
|
||||
|
||||
func (x *StreamUndispatchedCapturesResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[126]
|
||||
mi := &file_state_v1_state_proto_msgTypes[130]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -6789,7 +6973,7 @@ func (x *StreamUndispatchedCapturesResponse) ProtoReflect() protoreflect.Message
|
||||
|
||||
// Deprecated: Use StreamUndispatchedCapturesResponse.ProtoReflect.Descriptor instead.
|
||||
func (*StreamUndispatchedCapturesResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{126}
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{130}
|
||||
}
|
||||
|
||||
func (x *StreamUndispatchedCapturesResponse) GetCapture() *CapturedEvent {
|
||||
@@ -6815,7 +6999,7 @@ type EnqueueBindingTaskRequest struct {
|
||||
|
||||
func (x *EnqueueBindingTaskRequest) Reset() {
|
||||
*x = EnqueueBindingTaskRequest{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[127]
|
||||
mi := &file_state_v1_state_proto_msgTypes[131]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -6827,7 +7011,7 @@ func (x *EnqueueBindingTaskRequest) String() string {
|
||||
func (*EnqueueBindingTaskRequest) ProtoMessage() {}
|
||||
|
||||
func (x *EnqueueBindingTaskRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[127]
|
||||
mi := &file_state_v1_state_proto_msgTypes[131]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -6840,7 +7024,7 @@ func (x *EnqueueBindingTaskRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use EnqueueBindingTaskRequest.ProtoReflect.Descriptor instead.
|
||||
func (*EnqueueBindingTaskRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{127}
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{131}
|
||||
}
|
||||
|
||||
func (x *EnqueueBindingTaskRequest) GetOwner() string {
|
||||
@@ -6908,7 +7092,7 @@ type EnqueueBindingTaskResponse struct {
|
||||
|
||||
func (x *EnqueueBindingTaskResponse) Reset() {
|
||||
*x = EnqueueBindingTaskResponse{}
|
||||
mi := &file_state_v1_state_proto_msgTypes[128]
|
||||
mi := &file_state_v1_state_proto_msgTypes[132]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -6920,7 +7104,7 @@ func (x *EnqueueBindingTaskResponse) String() string {
|
||||
func (*EnqueueBindingTaskResponse) ProtoMessage() {}
|
||||
|
||||
func (x *EnqueueBindingTaskResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_state_v1_state_proto_msgTypes[128]
|
||||
mi := &file_state_v1_state_proto_msgTypes[132]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -6933,7 +7117,7 @@ func (x *EnqueueBindingTaskResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use EnqueueBindingTaskResponse.ProtoReflect.Descriptor instead.
|
||||
func (*EnqueueBindingTaskResponse) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{128}
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{132}
|
||||
}
|
||||
|
||||
func (x *EnqueueBindingTaskResponse) GetTask() *Task {
|
||||
@@ -7370,7 +7554,18 @@ const file_state_v1_state_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"capture_id\x18\x03 \x01(\x03R\tcaptureId\x12\x17\n" +
|
||||
"\atask_id\x18\x04 \x01(\x03R\x06taskId\"\x18\n" +
|
||||
"\x16RecordDispatchResponse\"Q\n" +
|
||||
"\x16RecordDispatchResponse\"\xa3\x01\n" +
|
||||
"\x1dRecordPlaybookDispatchRequest\x12\x1f\n" +
|
||||
"\vplaybook_id\x18\x01 \x01(\tR\n" +
|
||||
"playbookId\x12)\n" +
|
||||
"\x10playbook_version\x18\x02 \x01(\tR\x0fplaybookVersion\x12\x19\n" +
|
||||
"\bevent_id\x18\x03 \x01(\tR\aeventId\x12\x1b\n" +
|
||||
"\taction_id\x18\x04 \x01(\tR\bactionId\" \n" +
|
||||
"\x1eRecordPlaybookDispatchResponse\"B\n" +
|
||||
"\x1fDeletePlaybookDispatchesRequest\x12\x1f\n" +
|
||||
"\vplaybook_id\x18\x01 \x01(\tR\n" +
|
||||
"playbookId\"\"\n" +
|
||||
" DeletePlaybookDispatchesResponse\"Q\n" +
|
||||
"\x1fListUndispatchedCapturesRequest\x12\x18\n" +
|
||||
"\asources\x18\x01 \x03(\tR\asources\x12\x14\n" +
|
||||
"\x05limit\x18\x02 \x01(\x03R\x05limit\"W\n" +
|
||||
@@ -7392,7 +7587,7 @@ const file_state_v1_state_proto_rawDesc = "" +
|
||||
"binding_id\x18\a \x01(\x03R\tbindingId\x12'\n" +
|
||||
"\x0fbinding_version\x18\b \x01(\x03R\x0ebindingVersion\"@\n" +
|
||||
"\x1aEnqueueBindingTaskResponse\x12\"\n" +
|
||||
"\x04task\x18\x01 \x01(\v2\x0e.state.v1.TaskR\x04task2\xf7$\n" +
|
||||
"\x04task\x18\x01 \x01(\v2\x0e.state.v1.TaskR\x04task2\xd7&\n" +
|
||||
"\x11StateStoreService\x12\\\n" +
|
||||
"\x11RegisterTaskGrant\x12\".state.v1.RegisterTaskGrantRequest\x1a#.state.v1.RegisterTaskGrantResponse\x12V\n" +
|
||||
"\x0fRevokeTaskGrant\x12 .state.v1.RevokeTaskGrantRequest\x1a!.state.v1.RevokeTaskGrantResponse\x12S\n" +
|
||||
@@ -7452,7 +7647,9 @@ const file_state_v1_state_proto_rawDesc = "" +
|
||||
"\rDeleteBinding\x12\x1e.state.v1.DeleteBindingRequest\x1a\x1f.state.v1.DeleteBindingResponse\x12S\n" +
|
||||
"\x0eApproveBinding\x12\x1f.state.v1.ApproveBindingRequest\x1a .state.v1.ApproveBindingResponse\x12k\n" +
|
||||
"\x16ArmedBindingsForSource\x12'.state.v1.ArmedBindingsForSourceRequest\x1a(.state.v1.ArmedBindingsForSourceResponse\x12S\n" +
|
||||
"\x0eRecordDispatch\x12\x1f.state.v1.RecordDispatchRequest\x1a .state.v1.RecordDispatchResponse\x12v\n" +
|
||||
"\x0eRecordDispatch\x12\x1f.state.v1.RecordDispatchRequest\x1a .state.v1.RecordDispatchResponse\x12k\n" +
|
||||
"\x16RecordPlaybookDispatch\x12'.state.v1.RecordPlaybookDispatchRequest\x1a(.state.v1.RecordPlaybookDispatchResponse\x12q\n" +
|
||||
"\x18DeletePlaybookDispatches\x12).state.v1.DeletePlaybookDispatchesRequest\x1a*.state.v1.DeletePlaybookDispatchesResponse\x12v\n" +
|
||||
"\x18ListUndispatchedCaptures\x12).state.v1.ListUndispatchedCapturesRequest\x1a*.state.v1.ListUndispatchedCapturesResponse\"\x03\x88\x02\x01\x12y\n" +
|
||||
"\x1aStreamUndispatchedCaptures\x12+.state.v1.StreamUndispatchedCapturesRequest\x1a,.state.v1.StreamUndispatchedCapturesResponse0\x01\x12_\n" +
|
||||
"\x12EnqueueBindingTask\x12#.state.v1.EnqueueBindingTaskRequest\x1a$.state.v1.EnqueueBindingTaskResponseB\xa4\x01\n" +
|
||||
@@ -7471,7 +7668,7 @@ func file_state_v1_state_proto_rawDescGZIP() []byte {
|
||||
return file_state_v1_state_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_state_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 130)
|
||||
var file_state_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 134)
|
||||
var file_state_v1_state_proto_goTypes = []any{
|
||||
(*RegisterTaskGrantRequest)(nil), // 0: state.v1.RegisterTaskGrantRequest
|
||||
(*RegisterTaskGrantResponse)(nil), // 1: state.v1.RegisterTaskGrantResponse
|
||||
@@ -7596,18 +7793,22 @@ var file_state_v1_state_proto_goTypes = []any{
|
||||
(*ArmedBindingsForSourceResponse)(nil), // 120: state.v1.ArmedBindingsForSourceResponse
|
||||
(*RecordDispatchRequest)(nil), // 121: state.v1.RecordDispatchRequest
|
||||
(*RecordDispatchResponse)(nil), // 122: state.v1.RecordDispatchResponse
|
||||
(*ListUndispatchedCapturesRequest)(nil), // 123: state.v1.ListUndispatchedCapturesRequest
|
||||
(*ListUndispatchedCapturesResponse)(nil), // 124: state.v1.ListUndispatchedCapturesResponse
|
||||
(*StreamUndispatchedCapturesRequest)(nil), // 125: state.v1.StreamUndispatchedCapturesRequest
|
||||
(*StreamUndispatchedCapturesResponse)(nil), // 126: state.v1.StreamUndispatchedCapturesResponse
|
||||
(*EnqueueBindingTaskRequest)(nil), // 127: state.v1.EnqueueBindingTaskRequest
|
||||
(*EnqueueBindingTaskResponse)(nil), // 128: state.v1.EnqueueBindingTaskResponse
|
||||
nil, // 129: state.v1.StatusCountsResponse.CountsEntry
|
||||
(*timestamppb.Timestamp)(nil), // 130: google.protobuf.Timestamp
|
||||
(*RecordPlaybookDispatchRequest)(nil), // 123: state.v1.RecordPlaybookDispatchRequest
|
||||
(*RecordPlaybookDispatchResponse)(nil), // 124: state.v1.RecordPlaybookDispatchResponse
|
||||
(*DeletePlaybookDispatchesRequest)(nil), // 125: state.v1.DeletePlaybookDispatchesRequest
|
||||
(*DeletePlaybookDispatchesResponse)(nil), // 126: state.v1.DeletePlaybookDispatchesResponse
|
||||
(*ListUndispatchedCapturesRequest)(nil), // 127: state.v1.ListUndispatchedCapturesRequest
|
||||
(*ListUndispatchedCapturesResponse)(nil), // 128: state.v1.ListUndispatchedCapturesResponse
|
||||
(*StreamUndispatchedCapturesRequest)(nil), // 129: state.v1.StreamUndispatchedCapturesRequest
|
||||
(*StreamUndispatchedCapturesResponse)(nil), // 130: state.v1.StreamUndispatchedCapturesResponse
|
||||
(*EnqueueBindingTaskRequest)(nil), // 131: state.v1.EnqueueBindingTaskRequest
|
||||
(*EnqueueBindingTaskResponse)(nil), // 132: state.v1.EnqueueBindingTaskResponse
|
||||
nil, // 133: state.v1.StatusCountsResponse.CountsEntry
|
||||
(*timestamppb.Timestamp)(nil), // 134: google.protobuf.Timestamp
|
||||
}
|
||||
var file_state_v1_state_proto_depIdxs = []int32{
|
||||
130, // 0: state.v1.Identity.created_at:type_name -> google.protobuf.Timestamp
|
||||
130, // 1: state.v1.Identity.updated_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 0: state.v1.Identity.created_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 1: state.v1.Identity.updated_at:type_name -> google.protobuf.Timestamp
|
||||
4, // 2: state.v1.ListIdentitiesResponse.identities:type_name -> state.v1.Identity
|
||||
4, // 3: state.v1.GetIdentityResponse.identity:type_name -> state.v1.Identity
|
||||
5, // 4: state.v1.CreateIdentityRequest.audit:type_name -> state.v1.IdentityAudit
|
||||
@@ -7620,16 +7821,16 @@ var file_state_v1_state_proto_depIdxs = []int32{
|
||||
4, // 11: state.v1.SuspendIdentityResponse.identity:type_name -> state.v1.Identity
|
||||
4, // 12: state.v1.ReactivateIdentityResponse.identity:type_name -> state.v1.Identity
|
||||
4, // 13: state.v1.RetireIdentityResponse.identity:type_name -> state.v1.Identity
|
||||
130, // 14: state.v1.Task.created_at:type_name -> google.protobuf.Timestamp
|
||||
130, // 15: state.v1.Task.updated_at:type_name -> google.protobuf.Timestamp
|
||||
130, // 16: state.v1.Event.at:type_name -> google.protobuf.Timestamp
|
||||
130, // 17: state.v1.CapturedEvent.received_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 14: state.v1.Task.created_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 15: state.v1.Task.updated_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 16: state.v1.Event.at:type_name -> google.protobuf.Timestamp
|
||||
134, // 17: state.v1.CapturedEvent.received_at:type_name -> google.protobuf.Timestamp
|
||||
23, // 18: state.v1.Mapping.fields:type_name -> state.v1.MappingField
|
||||
130, // 19: state.v1.Mapping.created_at:type_name -> google.protobuf.Timestamp
|
||||
130, // 20: state.v1.Mapping.updated_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 19: state.v1.Mapping.created_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 20: state.v1.Mapping.updated_at:type_name -> google.protobuf.Timestamp
|
||||
25, // 21: state.v1.Binding.matcher:type_name -> state.v1.BindingMatcher
|
||||
130, // 22: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
|
||||
130, // 23: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 22: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 23: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
|
||||
20, // 24: state.v1.EnqueueChatTaskResponse.task:type_name -> state.v1.Task
|
||||
20, // 25: state.v1.ClaimNextResponse.task:type_name -> state.v1.Task
|
||||
20, // 26: state.v1.ClaimByIssueResponse.task:type_name -> state.v1.Task
|
||||
@@ -7640,22 +7841,22 @@ var file_state_v1_state_proto_depIdxs = []int32{
|
||||
20, // 31: state.v1.TaskByIDResponse.task:type_name -> state.v1.Task
|
||||
20, // 32: state.v1.OpenPRsResponse.tasks:type_name -> state.v1.Task
|
||||
20, // 33: state.v1.TasksResponse.tasks:type_name -> state.v1.Task
|
||||
129, // 34: state.v1.StatusCountsResponse.counts:type_name -> state.v1.StatusCountsResponse.CountsEntry
|
||||
133, // 34: state.v1.StatusCountsResponse.counts:type_name -> state.v1.StatusCountsResponse.CountsEntry
|
||||
21, // 35: state.v1.InsertEventRequest.event:type_name -> state.v1.Event
|
||||
21, // 36: state.v1.EventsSinceResponse.events:type_name -> state.v1.Event
|
||||
21, // 37: state.v1.TaskEventsResponse.events:type_name -> state.v1.Event
|
||||
27, // 38: state.v1.WorkflowStatsResponse.stats:type_name -> state.v1.WorkflowStat
|
||||
28, // 39: state.v1.StageStatsResponse.stats:type_name -> state.v1.StageStat
|
||||
29, // 40: state.v1.TokensByDayResponse.tokens:type_name -> state.v1.DayTokens
|
||||
130, // 41: state.v1.ConfigSnapshot.published_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 41: state.v1.ConfigSnapshot.published_at:type_name -> google.protobuf.Timestamp
|
||||
76, // 42: state.v1.PutConfigSnapshotRequest.snapshot:type_name -> state.v1.ConfigSnapshot
|
||||
76, // 43: state.v1.GetConfigSnapshotResponse.snapshot:type_name -> state.v1.ConfigSnapshot
|
||||
130, // 44: state.v1.ApplyStatus.reported_at:type_name -> google.protobuf.Timestamp
|
||||
134, // 44: state.v1.ApplyStatus.reported_at:type_name -> google.protobuf.Timestamp
|
||||
81, // 45: state.v1.PutApplyStatusRequest.status:type_name -> state.v1.ApplyStatus
|
||||
81, // 46: state.v1.ListApplyStatusResponse.statuses:type_name -> state.v1.ApplyStatus
|
||||
130, // 47: state.v1.TaskLogEntry.time:type_name -> google.protobuf.Timestamp
|
||||
130, // 48: state.v1.ReadTaskLogRequest.since:type_name -> google.protobuf.Timestamp
|
||||
130, // 49: state.v1.ReadTaskLogRequest.until:type_name -> google.protobuf.Timestamp
|
||||
134, // 47: state.v1.TaskLogEntry.time:type_name -> google.protobuf.Timestamp
|
||||
134, // 48: state.v1.ReadTaskLogRequest.since:type_name -> google.protobuf.Timestamp
|
||||
134, // 49: state.v1.ReadTaskLogRequest.until:type_name -> google.protobuf.Timestamp
|
||||
86, // 50: state.v1.ReadTaskLogResponse.entries:type_name -> state.v1.TaskLogEntry
|
||||
22, // 51: state.v1.InsertCaptureRequest.capture:type_name -> state.v1.CapturedEvent
|
||||
22, // 52: state.v1.ListCapturesResponse.captures:type_name -> state.v1.CapturedEvent
|
||||
@@ -7726,68 +7927,72 @@ var file_state_v1_state_proto_depIdxs = []int32{
|
||||
117, // 117: state.v1.StateStoreService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
|
||||
119, // 118: state.v1.StateStoreService.ArmedBindingsForSource:input_type -> state.v1.ArmedBindingsForSourceRequest
|
||||
121, // 119: state.v1.StateStoreService.RecordDispatch:input_type -> state.v1.RecordDispatchRequest
|
||||
123, // 120: state.v1.StateStoreService.ListUndispatchedCaptures:input_type -> state.v1.ListUndispatchedCapturesRequest
|
||||
125, // 121: state.v1.StateStoreService.StreamUndispatchedCaptures:input_type -> state.v1.StreamUndispatchedCapturesRequest
|
||||
127, // 122: state.v1.StateStoreService.EnqueueBindingTask:input_type -> state.v1.EnqueueBindingTaskRequest
|
||||
1, // 123: state.v1.StateStoreService.RegisterTaskGrant:output_type -> state.v1.RegisterTaskGrantResponse
|
||||
3, // 124: state.v1.StateStoreService.RevokeTaskGrant:output_type -> state.v1.RevokeTaskGrantResponse
|
||||
7, // 125: state.v1.StateStoreService.ListIdentities:output_type -> state.v1.ListIdentitiesResponse
|
||||
9, // 126: state.v1.StateStoreService.GetIdentity:output_type -> state.v1.GetIdentityResponse
|
||||
15, // 127: state.v1.StateStoreService.CreateIdentity:output_type -> state.v1.CreateIdentityResponse
|
||||
16, // 128: state.v1.StateStoreService.RenameIdentity:output_type -> state.v1.RenameIdentityResponse
|
||||
17, // 129: state.v1.StateStoreService.SuspendIdentity:output_type -> state.v1.SuspendIdentityResponse
|
||||
18, // 130: state.v1.StateStoreService.ReactivateIdentity:output_type -> state.v1.ReactivateIdentityResponse
|
||||
19, // 131: state.v1.StateStoreService.RetireIdentity:output_type -> state.v1.RetireIdentityResponse
|
||||
31, // 132: state.v1.StateStoreService.EnqueueIssue:output_type -> state.v1.EnqueueIssueResponse
|
||||
33, // 133: state.v1.StateStoreService.EnqueueChatTask:output_type -> state.v1.EnqueueChatTaskResponse
|
||||
35, // 134: state.v1.StateStoreService.ClaimNext:output_type -> state.v1.ClaimNextResponse
|
||||
37, // 135: state.v1.StateStoreService.ClaimByIssue:output_type -> state.v1.ClaimByIssueResponse
|
||||
39, // 136: state.v1.StateStoreService.Transition:output_type -> state.v1.TransitionResponse
|
||||
41, // 137: state.v1.StateStoreService.Update:output_type -> state.v1.UpdateResponse
|
||||
43, // 138: state.v1.StateStoreService.Requeue:output_type -> state.v1.RequeueResponse
|
||||
45, // 139: state.v1.StateStoreService.RecoverStale:output_type -> state.v1.RecoverStaleResponse
|
||||
47, // 140: state.v1.StateStoreService.ArchiveTask:output_type -> state.v1.ArchiveTaskResponse
|
||||
49, // 141: state.v1.StateStoreService.RetryTask:output_type -> state.v1.RetryTaskResponse
|
||||
51, // 142: state.v1.StateStoreService.TaskByIssue:output_type -> state.v1.TaskByIssueResponse
|
||||
53, // 143: state.v1.StateStoreService.OpenTaskByPR:output_type -> state.v1.OpenTaskByPRResponse
|
||||
55, // 144: state.v1.StateStoreService.TaskByID:output_type -> state.v1.TaskByIDResponse
|
||||
57, // 145: state.v1.StateStoreService.OpenPRs:output_type -> state.v1.OpenPRsResponse
|
||||
59, // 146: state.v1.StateStoreService.ClearTerminalTasks:output_type -> state.v1.ClearTerminalTasksResponse
|
||||
61, // 147: state.v1.StateStoreService.Tasks:output_type -> state.v1.TasksResponse
|
||||
63, // 148: state.v1.StateStoreService.StatusCounts:output_type -> state.v1.StatusCountsResponse
|
||||
65, // 149: state.v1.StateStoreService.InsertEvent:output_type -> state.v1.InsertEventResponse
|
||||
67, // 150: state.v1.StateStoreService.EventsSince:output_type -> state.v1.EventsSinceResponse
|
||||
69, // 151: state.v1.StateStoreService.TaskEvents:output_type -> state.v1.TaskEventsResponse
|
||||
71, // 152: state.v1.StateStoreService.WorkflowStats:output_type -> state.v1.WorkflowStatsResponse
|
||||
73, // 153: state.v1.StateStoreService.StageStats:output_type -> state.v1.StageStatsResponse
|
||||
75, // 154: state.v1.StateStoreService.TokensByDay:output_type -> state.v1.TokensByDayResponse
|
||||
78, // 155: state.v1.StateStoreService.PutConfigSnapshot:output_type -> state.v1.PutConfigSnapshotResponse
|
||||
80, // 156: state.v1.StateStoreService.GetConfigSnapshot:output_type -> state.v1.GetConfigSnapshotResponse
|
||||
83, // 157: state.v1.StateStoreService.PutApplyStatus:output_type -> state.v1.PutApplyStatusResponse
|
||||
85, // 158: state.v1.StateStoreService.ListApplyStatus:output_type -> state.v1.ListApplyStatusResponse
|
||||
88, // 159: state.v1.StateStoreService.ReadTaskLog:output_type -> state.v1.ReadTaskLogResponse
|
||||
90, // 160: state.v1.StateStoreService.StreamTaskLogContent:output_type -> state.v1.StreamTaskLogContentResponse
|
||||
92, // 161: state.v1.StateStoreService.InsertCapture:output_type -> state.v1.InsertCaptureResponse
|
||||
94, // 162: state.v1.StateStoreService.ListCaptures:output_type -> state.v1.ListCapturesResponse
|
||||
96, // 163: state.v1.StateStoreService.StreamCaptures:output_type -> state.v1.StreamCapturesResponse
|
||||
98, // 164: state.v1.StateStoreService.InsertMapping:output_type -> state.v1.InsertMappingResponse
|
||||
100, // 165: state.v1.StateStoreService.GetMapping:output_type -> state.v1.GetMappingResponse
|
||||
102, // 166: state.v1.StateStoreService.ListMappings:output_type -> state.v1.ListMappingsResponse
|
||||
104, // 167: state.v1.StateStoreService.UpdateMapping:output_type -> state.v1.UpdateMappingResponse
|
||||
106, // 168: state.v1.StateStoreService.DeleteMapping:output_type -> state.v1.DeleteMappingResponse
|
||||
108, // 169: state.v1.StateStoreService.InsertBinding:output_type -> state.v1.InsertBindingResponse
|
||||
110, // 170: state.v1.StateStoreService.GetBinding:output_type -> state.v1.GetBindingResponse
|
||||
112, // 171: state.v1.StateStoreService.ListBindings:output_type -> state.v1.ListBindingsResponse
|
||||
114, // 172: state.v1.StateStoreService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
|
||||
116, // 173: state.v1.StateStoreService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
|
||||
118, // 174: state.v1.StateStoreService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
|
||||
120, // 175: state.v1.StateStoreService.ArmedBindingsForSource:output_type -> state.v1.ArmedBindingsForSourceResponse
|
||||
122, // 176: state.v1.StateStoreService.RecordDispatch:output_type -> state.v1.RecordDispatchResponse
|
||||
124, // 177: state.v1.StateStoreService.ListUndispatchedCaptures:output_type -> state.v1.ListUndispatchedCapturesResponse
|
||||
126, // 178: state.v1.StateStoreService.StreamUndispatchedCaptures:output_type -> state.v1.StreamUndispatchedCapturesResponse
|
||||
128, // 179: state.v1.StateStoreService.EnqueueBindingTask:output_type -> state.v1.EnqueueBindingTaskResponse
|
||||
123, // [123:180] is the sub-list for method output_type
|
||||
66, // [66:123] is the sub-list for method input_type
|
||||
123, // 120: state.v1.StateStoreService.RecordPlaybookDispatch:input_type -> state.v1.RecordPlaybookDispatchRequest
|
||||
125, // 121: state.v1.StateStoreService.DeletePlaybookDispatches:input_type -> state.v1.DeletePlaybookDispatchesRequest
|
||||
127, // 122: state.v1.StateStoreService.ListUndispatchedCaptures:input_type -> state.v1.ListUndispatchedCapturesRequest
|
||||
129, // 123: state.v1.StateStoreService.StreamUndispatchedCaptures:input_type -> state.v1.StreamUndispatchedCapturesRequest
|
||||
131, // 124: state.v1.StateStoreService.EnqueueBindingTask:input_type -> state.v1.EnqueueBindingTaskRequest
|
||||
1, // 125: state.v1.StateStoreService.RegisterTaskGrant:output_type -> state.v1.RegisterTaskGrantResponse
|
||||
3, // 126: state.v1.StateStoreService.RevokeTaskGrant:output_type -> state.v1.RevokeTaskGrantResponse
|
||||
7, // 127: state.v1.StateStoreService.ListIdentities:output_type -> state.v1.ListIdentitiesResponse
|
||||
9, // 128: state.v1.StateStoreService.GetIdentity:output_type -> state.v1.GetIdentityResponse
|
||||
15, // 129: state.v1.StateStoreService.CreateIdentity:output_type -> state.v1.CreateIdentityResponse
|
||||
16, // 130: state.v1.StateStoreService.RenameIdentity:output_type -> state.v1.RenameIdentityResponse
|
||||
17, // 131: state.v1.StateStoreService.SuspendIdentity:output_type -> state.v1.SuspendIdentityResponse
|
||||
18, // 132: state.v1.StateStoreService.ReactivateIdentity:output_type -> state.v1.ReactivateIdentityResponse
|
||||
19, // 133: state.v1.StateStoreService.RetireIdentity:output_type -> state.v1.RetireIdentityResponse
|
||||
31, // 134: state.v1.StateStoreService.EnqueueIssue:output_type -> state.v1.EnqueueIssueResponse
|
||||
33, // 135: state.v1.StateStoreService.EnqueueChatTask:output_type -> state.v1.EnqueueChatTaskResponse
|
||||
35, // 136: state.v1.StateStoreService.ClaimNext:output_type -> state.v1.ClaimNextResponse
|
||||
37, // 137: state.v1.StateStoreService.ClaimByIssue:output_type -> state.v1.ClaimByIssueResponse
|
||||
39, // 138: state.v1.StateStoreService.Transition:output_type -> state.v1.TransitionResponse
|
||||
41, // 139: state.v1.StateStoreService.Update:output_type -> state.v1.UpdateResponse
|
||||
43, // 140: state.v1.StateStoreService.Requeue:output_type -> state.v1.RequeueResponse
|
||||
45, // 141: state.v1.StateStoreService.RecoverStale:output_type -> state.v1.RecoverStaleResponse
|
||||
47, // 142: state.v1.StateStoreService.ArchiveTask:output_type -> state.v1.ArchiveTaskResponse
|
||||
49, // 143: state.v1.StateStoreService.RetryTask:output_type -> state.v1.RetryTaskResponse
|
||||
51, // 144: state.v1.StateStoreService.TaskByIssue:output_type -> state.v1.TaskByIssueResponse
|
||||
53, // 145: state.v1.StateStoreService.OpenTaskByPR:output_type -> state.v1.OpenTaskByPRResponse
|
||||
55, // 146: state.v1.StateStoreService.TaskByID:output_type -> state.v1.TaskByIDResponse
|
||||
57, // 147: state.v1.StateStoreService.OpenPRs:output_type -> state.v1.OpenPRsResponse
|
||||
59, // 148: state.v1.StateStoreService.ClearTerminalTasks:output_type -> state.v1.ClearTerminalTasksResponse
|
||||
61, // 149: state.v1.StateStoreService.Tasks:output_type -> state.v1.TasksResponse
|
||||
63, // 150: state.v1.StateStoreService.StatusCounts:output_type -> state.v1.StatusCountsResponse
|
||||
65, // 151: state.v1.StateStoreService.InsertEvent:output_type -> state.v1.InsertEventResponse
|
||||
67, // 152: state.v1.StateStoreService.EventsSince:output_type -> state.v1.EventsSinceResponse
|
||||
69, // 153: state.v1.StateStoreService.TaskEvents:output_type -> state.v1.TaskEventsResponse
|
||||
71, // 154: state.v1.StateStoreService.WorkflowStats:output_type -> state.v1.WorkflowStatsResponse
|
||||
73, // 155: state.v1.StateStoreService.StageStats:output_type -> state.v1.StageStatsResponse
|
||||
75, // 156: state.v1.StateStoreService.TokensByDay:output_type -> state.v1.TokensByDayResponse
|
||||
78, // 157: state.v1.StateStoreService.PutConfigSnapshot:output_type -> state.v1.PutConfigSnapshotResponse
|
||||
80, // 158: state.v1.StateStoreService.GetConfigSnapshot:output_type -> state.v1.GetConfigSnapshotResponse
|
||||
83, // 159: state.v1.StateStoreService.PutApplyStatus:output_type -> state.v1.PutApplyStatusResponse
|
||||
85, // 160: state.v1.StateStoreService.ListApplyStatus:output_type -> state.v1.ListApplyStatusResponse
|
||||
88, // 161: state.v1.StateStoreService.ReadTaskLog:output_type -> state.v1.ReadTaskLogResponse
|
||||
90, // 162: state.v1.StateStoreService.StreamTaskLogContent:output_type -> state.v1.StreamTaskLogContentResponse
|
||||
92, // 163: state.v1.StateStoreService.InsertCapture:output_type -> state.v1.InsertCaptureResponse
|
||||
94, // 164: state.v1.StateStoreService.ListCaptures:output_type -> state.v1.ListCapturesResponse
|
||||
96, // 165: state.v1.StateStoreService.StreamCaptures:output_type -> state.v1.StreamCapturesResponse
|
||||
98, // 166: state.v1.StateStoreService.InsertMapping:output_type -> state.v1.InsertMappingResponse
|
||||
100, // 167: state.v1.StateStoreService.GetMapping:output_type -> state.v1.GetMappingResponse
|
||||
102, // 168: state.v1.StateStoreService.ListMappings:output_type -> state.v1.ListMappingsResponse
|
||||
104, // 169: state.v1.StateStoreService.UpdateMapping:output_type -> state.v1.UpdateMappingResponse
|
||||
106, // 170: state.v1.StateStoreService.DeleteMapping:output_type -> state.v1.DeleteMappingResponse
|
||||
108, // 171: state.v1.StateStoreService.InsertBinding:output_type -> state.v1.InsertBindingResponse
|
||||
110, // 172: state.v1.StateStoreService.GetBinding:output_type -> state.v1.GetBindingResponse
|
||||
112, // 173: state.v1.StateStoreService.ListBindings:output_type -> state.v1.ListBindingsResponse
|
||||
114, // 174: state.v1.StateStoreService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
|
||||
116, // 175: state.v1.StateStoreService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
|
||||
118, // 176: state.v1.StateStoreService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
|
||||
120, // 177: state.v1.StateStoreService.ArmedBindingsForSource:output_type -> state.v1.ArmedBindingsForSourceResponse
|
||||
122, // 178: state.v1.StateStoreService.RecordDispatch:output_type -> state.v1.RecordDispatchResponse
|
||||
124, // 179: state.v1.StateStoreService.RecordPlaybookDispatch:output_type -> state.v1.RecordPlaybookDispatchResponse
|
||||
126, // 180: state.v1.StateStoreService.DeletePlaybookDispatches:output_type -> state.v1.DeletePlaybookDispatchesResponse
|
||||
128, // 181: state.v1.StateStoreService.ListUndispatchedCaptures:output_type -> state.v1.ListUndispatchedCapturesResponse
|
||||
130, // 182: state.v1.StateStoreService.StreamUndispatchedCaptures:output_type -> state.v1.StreamUndispatchedCapturesResponse
|
||||
132, // 183: state.v1.StateStoreService.EnqueueBindingTask:output_type -> state.v1.EnqueueBindingTaskResponse
|
||||
125, // [125:184] is the sub-list for method output_type
|
||||
66, // [66:125] is the sub-list for method input_type
|
||||
66, // [66:66] is the sub-list for extension type_name
|
||||
66, // [66:66] is the sub-list for extension extendee
|
||||
0, // [0:66] is the sub-list for field type_name
|
||||
@@ -7804,7 +8009,7 @@ func file_state_v1_state_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_state_v1_state_proto_rawDesc), len(file_state_v1_state_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 130,
|
||||
NumMessages: 134,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -73,6 +73,8 @@ const (
|
||||
StateStoreService_ApproveBinding_FullMethodName = "/state.v1.StateStoreService/ApproveBinding"
|
||||
StateStoreService_ArmedBindingsForSource_FullMethodName = "/state.v1.StateStoreService/ArmedBindingsForSource"
|
||||
StateStoreService_RecordDispatch_FullMethodName = "/state.v1.StateStoreService/RecordDispatch"
|
||||
StateStoreService_RecordPlaybookDispatch_FullMethodName = "/state.v1.StateStoreService/RecordPlaybookDispatch"
|
||||
StateStoreService_DeletePlaybookDispatches_FullMethodName = "/state.v1.StateStoreService/DeletePlaybookDispatches"
|
||||
StateStoreService_ListUndispatchedCaptures_FullMethodName = "/state.v1.StateStoreService/ListUndispatchedCaptures"
|
||||
StateStoreService_StreamUndispatchedCaptures_FullMethodName = "/state.v1.StateStoreService/StreamUndispatchedCaptures"
|
||||
StateStoreService_EnqueueBindingTask_FullMethodName = "/state.v1.StateStoreService/EnqueueBindingTask"
|
||||
@@ -180,6 +182,12 @@ type StateStoreServiceClient interface {
|
||||
// Dispatch
|
||||
ArmedBindingsForSource(ctx context.Context, in *ArmedBindingsForSourceRequest, opts ...grpc.CallOption) (*ArmedBindingsForSourceResponse, error)
|
||||
RecordDispatch(ctx context.Context, in *RecordDispatchRequest, opts ...grpc.CallOption) (*RecordDispatchResponse, error)
|
||||
// Playbook dispatch ledger (eda-playbook-engine.md gap 2): one durable
|
||||
// at-most-once record per (playbook, version, event, action) for the
|
||||
// side-effecting positions. Administrative, like RecordDispatch: a
|
||||
// task-scoped grant cannot reach either (see TaskGrants).
|
||||
RecordPlaybookDispatch(ctx context.Context, in *RecordPlaybookDispatchRequest, opts ...grpc.CallOption) (*RecordPlaybookDispatchResponse, error)
|
||||
DeletePlaybookDispatches(ctx context.Context, in *DeletePlaybookDispatchesRequest, opts ...grpc.CallOption) (*DeletePlaybookDispatchesResponse, error)
|
||||
// Deprecated: Do not use.
|
||||
// ListUndispatchedCaptures is superseded by StreamUndispatchedCaptures; see
|
||||
// ListCaptures above.
|
||||
@@ -756,6 +764,26 @@ func (c *stateStoreServiceClient) RecordDispatch(ctx context.Context, in *Record
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *stateStoreServiceClient) RecordPlaybookDispatch(ctx context.Context, in *RecordPlaybookDispatchRequest, opts ...grpc.CallOption) (*RecordPlaybookDispatchResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RecordPlaybookDispatchResponse)
|
||||
err := c.cc.Invoke(ctx, StateStoreService_RecordPlaybookDispatch_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *stateStoreServiceClient) DeletePlaybookDispatches(ctx context.Context, in *DeletePlaybookDispatchesRequest, opts ...grpc.CallOption) (*DeletePlaybookDispatchesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DeletePlaybookDispatchesResponse)
|
||||
err := c.cc.Invoke(ctx, StateStoreService_DeletePlaybookDispatches_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Deprecated: Do not use.
|
||||
func (c *stateStoreServiceClient) ListUndispatchedCaptures(ctx context.Context, in *ListUndispatchedCapturesRequest, opts ...grpc.CallOption) (*ListUndispatchedCapturesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
@@ -898,6 +926,12 @@ type StateStoreServiceServer interface {
|
||||
// Dispatch
|
||||
ArmedBindingsForSource(context.Context, *ArmedBindingsForSourceRequest) (*ArmedBindingsForSourceResponse, error)
|
||||
RecordDispatch(context.Context, *RecordDispatchRequest) (*RecordDispatchResponse, error)
|
||||
// Playbook dispatch ledger (eda-playbook-engine.md gap 2): one durable
|
||||
// at-most-once record per (playbook, version, event, action) for the
|
||||
// side-effecting positions. Administrative, like RecordDispatch: a
|
||||
// task-scoped grant cannot reach either (see TaskGrants).
|
||||
RecordPlaybookDispatch(context.Context, *RecordPlaybookDispatchRequest) (*RecordPlaybookDispatchResponse, error)
|
||||
DeletePlaybookDispatches(context.Context, *DeletePlaybookDispatchesRequest) (*DeletePlaybookDispatchesResponse, error)
|
||||
// Deprecated: Do not use.
|
||||
// ListUndispatchedCaptures is superseded by StreamUndispatchedCaptures; see
|
||||
// ListCaptures above.
|
||||
@@ -1077,6 +1111,12 @@ func (UnimplementedStateStoreServiceServer) ArmedBindingsForSource(context.Conte
|
||||
func (UnimplementedStateStoreServiceServer) RecordDispatch(context.Context, *RecordDispatchRequest) (*RecordDispatchResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RecordDispatch not implemented")
|
||||
}
|
||||
func (UnimplementedStateStoreServiceServer) RecordPlaybookDispatch(context.Context, *RecordPlaybookDispatchRequest) (*RecordPlaybookDispatchResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RecordPlaybookDispatch not implemented")
|
||||
}
|
||||
func (UnimplementedStateStoreServiceServer) DeletePlaybookDispatches(context.Context, *DeletePlaybookDispatchesRequest) (*DeletePlaybookDispatchesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DeletePlaybookDispatches not implemented")
|
||||
}
|
||||
func (UnimplementedStateStoreServiceServer) ListUndispatchedCaptures(context.Context, *ListUndispatchedCapturesRequest) (*ListUndispatchedCapturesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ListUndispatchedCaptures not implemented")
|
||||
}
|
||||
@@ -2065,6 +2105,42 @@ func _StateStoreService_RecordDispatch_Handler(srv interface{}, ctx context.Cont
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StateStoreService_RecordPlaybookDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecordPlaybookDispatchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StateStoreServiceServer).RecordPlaybookDispatch(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: StateStoreService_RecordPlaybookDispatch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StateStoreServiceServer).RecordPlaybookDispatch(ctx, req.(*RecordPlaybookDispatchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StateStoreService_DeletePlaybookDispatches_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeletePlaybookDispatchesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StateStoreServiceServer).DeletePlaybookDispatches(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: StateStoreService_DeletePlaybookDispatches_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StateStoreServiceServer).DeletePlaybookDispatches(ctx, req.(*DeletePlaybookDispatchesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StateStoreService_ListUndispatchedCaptures_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListUndispatchedCapturesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -2327,6 +2403,14 @@ var StateStoreService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "RecordDispatch",
|
||||
Handler: _StateStoreService_RecordDispatch_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RecordPlaybookDispatch",
|
||||
Handler: _StateStoreService_RecordPlaybookDispatch_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeletePlaybookDispatches",
|
||||
Handler: _StateStoreService_DeletePlaybookDispatches_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListUndispatchedCaptures",
|
||||
Handler: _StateStoreService_ListUndispatchedCaptures_Handler,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package playbook
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
)
|
||||
|
||||
// InvokeOnce runs one playbook action at most once per
|
||||
// (playbook, version, event, action) tuple, record-before-invoke: the ledger
|
||||
// row is committed before fn runs, so a redelivered action (the same
|
||||
// structural key) skips without repeating a non-revocable side effect
|
||||
// (docs/prds/eda-playbook-engine.md gap 2). The structural key is computed
|
||||
// from Decision.PlaybookID, Decision.Version, input.TaskID (the event_id) and
|
||||
// Decision.ActionID, falling back to the 1-based action position ("1") when
|
||||
// the action declares no id -- it is never a CEL expression.
|
||||
func InvokeOnce(ctx context.Context, ledger storecontract.PlaybookDispatcher, log *slog.Logger, decision Decision, input DispatchInput, fn func(context.Context) error) error {
|
||||
actionID := decision.ActionID
|
||||
if actionID == "" {
|
||||
actionID = "1"
|
||||
}
|
||||
err := ledger.RecordPlaybookDispatch(ctx, decision.PlaybookID, decision.Version, input.TaskID, actionID)
|
||||
if err != nil {
|
||||
if errors.Is(err, storecontract.ErrAlreadyDispatched) {
|
||||
if log != nil {
|
||||
log.Debug("playbook action already dispatched; skipping", "playbook", decision.PlaybookID, "version", decision.Version, "event_id", input.TaskID, "action_id", actionID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return fn(ctx)
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package playbook
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
||||
)
|
||||
|
||||
// fakePlaybookLedger is an in-memory PlaybookDispatcher for the coordinator
|
||||
// helper tests: it records each structural key and reports a duplicate as
|
||||
// storecontract.ErrAlreadyDispatched, exactly as the SQL INSERT OR IGNORE
|
||||
// path does.
|
||||
type fakePlaybookLedger struct {
|
||||
records []playbookRecord
|
||||
}
|
||||
|
||||
type playbookRecord struct {
|
||||
playbookID string
|
||||
playbookVersion string
|
||||
eventID string
|
||||
actionID string
|
||||
}
|
||||
|
||||
func (f *fakePlaybookLedger) RecordPlaybookDispatch(ctx context.Context, playbookID, playbookVersion, eventID, actionID string) error {
|
||||
key := playbookRecord{playbookID, playbookVersion, eventID, actionID}
|
||||
for _, r := range f.records {
|
||||
if r == key {
|
||||
return storecontract.ErrAlreadyDispatched
|
||||
}
|
||||
}
|
||||
f.records = append(f.records, key)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *fakePlaybookLedger) DeletePlaybookDispatches(ctx context.Context, playbookID string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func discardLogger() *slog.Logger {
|
||||
return slog.New(slog.NewTextHandler(&testDiscardWriter{}, nil))
|
||||
}
|
||||
|
||||
type testDiscardWriter struct{}
|
||||
|
||||
func (testDiscardWriter) Write(p []byte) (int, error) { return len(p), nil }
|
||||
|
||||
func TestInvokeOnceSkipsRedeliveredAction(t *testing.T) {
|
||||
ledger := &fakePlaybookLedger{}
|
||||
decision := Decision{PlaybookID: "pb.yaml", Version: "v1", Workflow: "notify", ActionID: "notify"}
|
||||
input := DispatchInput{TaskID: "archie:acme/widget/7"}
|
||||
calls := 0
|
||||
action := func(ctx context.Context) error { calls++; return nil }
|
||||
|
||||
if err := InvokeOnce(t.Context(), ledger, discardLogger(), decision, input, action); err != nil {
|
||||
t.Fatalf("first InvokeOnce: %v", err)
|
||||
}
|
||||
if err := InvokeOnce(t.Context(), ledger, discardLogger(), decision, input, action); err != nil {
|
||||
t.Fatalf("second InvokeOnce: %v", err)
|
||||
}
|
||||
if calls != 1 {
|
||||
t.Fatalf("action invoked %d times, want 1 (a redelivered action must be skipped)", calls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvokeOnceFallsBackToActionPosition(t *testing.T) {
|
||||
ledger := &fakePlaybookLedger{}
|
||||
decision := Decision{PlaybookID: "pb.yaml", Version: "v1", Workflow: "notify"}
|
||||
input := DispatchInput{TaskID: "archie:acme/widget/7"}
|
||||
|
||||
if err := InvokeOnce(t.Context(), ledger, discardLogger(), decision, input, func(ctx context.Context) error { return nil }); err != nil {
|
||||
t.Fatalf("InvokeOnce: %v", err)
|
||||
}
|
||||
if len(ledger.records) != 1 {
|
||||
t.Fatalf("ledger records = %d, want 1", len(ledger.records))
|
||||
}
|
||||
got := ledger.records[0]
|
||||
want := playbookRecord{playbookID: "pb.yaml", playbookVersion: "v1", eventID: "archie:acme/widget/7", actionID: "1"}
|
||||
if got != want {
|
||||
t.Fatalf("ledger record = %+v, want %+v (an action without an id keys on its 1-based position)", got, want)
|
||||
}
|
||||
}
|
||||
@@ -173,6 +173,20 @@ type BindingTaskCreator interface {
|
||||
EnqueueBindingTask(ctx context.Context, owner, repo, title, body, wf, identity string, bindingID int64, bindingVersion int) (*task.Task, error)
|
||||
}
|
||||
|
||||
// PlaybookDispatcher is the idempotency-ledger surface for side-effecting
|
||||
// playbook actions (docs/prds/eda-playbook-engine.md gap 2).
|
||||
// RecordPlaybookDispatch writes the (playbook, version, event, action) row
|
||||
// BEFORE the action's side effect fires -- the deliberate reverse of
|
||||
// BindingDispatcher.RecordDispatch -- so a duplicate returns
|
||||
// ErrAlreadyDispatched and the caller skips the invoke rather than repeating
|
||||
// a non-revocable side effect. DeletePlaybookDispatches frees one playbook's
|
||||
// rows when the playbook is removed. There is deliberately no *sql.Tx: any
|
||||
// transaction stays server-side inside internal/store.
|
||||
type PlaybookDispatcher interface {
|
||||
RecordPlaybookDispatch(ctx context.Context, playbookID, playbookVersion, eventID, actionID string) error
|
||||
DeletePlaybookDispatches(ctx context.Context, playbookID string) error
|
||||
}
|
||||
|
||||
// TaskLogStore reads one task attempt's persisted log. Deliberately separate
|
||||
// from TaskQueries: the log is not a row, it is a file the logging package
|
||||
// owns the format of, and a process that can read the task board should not
|
||||
|
||||
@@ -49,6 +49,7 @@ var (
|
||||
_ storecontract.BindingStore = (*Client)(nil)
|
||||
_ storecontract.BindingDispatcher = (*Client)(nil)
|
||||
_ storecontract.BindingTaskCreator = (*Client)(nil)
|
||||
_ storecontract.PlaybookDispatcher = (*Client)(nil)
|
||||
_ storecontract.ConfigSnapshotStore = (*Client)(nil)
|
||||
_ storecontract.ApplyStatusStore = (*Client)(nil)
|
||||
_ identity.Repository = (*Client)(nil)
|
||||
@@ -433,6 +434,18 @@ func (c *Client) RecordDispatch(ctx context.Context, bindingID, bindingVersion,
|
||||
return unmapError(err)
|
||||
}
|
||||
|
||||
// Playbook dispatch
|
||||
|
||||
func (c *Client) RecordPlaybookDispatch(ctx context.Context, playbookID, playbookVersion, eventID, actionID string) error {
|
||||
_, err := c.client.RecordPlaybookDispatch(ctx, &pb.RecordPlaybookDispatchRequest{PlaybookId: playbookID, PlaybookVersion: playbookVersion, EventId: eventID, ActionId: actionID})
|
||||
return unmapError(err)
|
||||
}
|
||||
|
||||
func (c *Client) DeletePlaybookDispatches(ctx context.Context, playbookID string) error {
|
||||
_, err := c.client.DeletePlaybookDispatches(ctx, &pb.DeletePlaybookDispatchesRequest{PlaybookId: playbookID})
|
||||
return unmapError(err)
|
||||
}
|
||||
|
||||
// ListUndispatchedCaptures calls StreamUndispatchedCaptures; see ListCaptures
|
||||
// above.
|
||||
func (c *Client) ListUndispatchedCaptures(ctx context.Context, sources []string, limit int) ([]storecontract.CapturedEvent, error) {
|
||||
|
||||
@@ -28,6 +28,7 @@ type contract interface {
|
||||
store.BindingStore
|
||||
store.BindingDispatcher
|
||||
store.BindingTaskCreator
|
||||
store.PlaybookDispatcher
|
||||
store.ConfigSnapshotStore
|
||||
store.ApplyStatusStore
|
||||
}
|
||||
@@ -55,7 +56,7 @@ func remoteTaskStore(t *testing.T, local *store.Store, logs store.TaskLogStore)
|
||||
server := grpc.NewServer()
|
||||
RegisterServer(server, Deps{
|
||||
Tasks: local, Captures: local, Mappings: local, Bindings: local,
|
||||
BindingDispatcher: local, BindingTaskCreator: local, ConfigSnapshots: local, ApplyStatus: local,
|
||||
BindingDispatcher: local, BindingTaskCreator: local, PlaybookDispatcher: local, ConfigSnapshots: local, ApplyStatus: local,
|
||||
TaskLogs: logs,
|
||||
})
|
||||
go func() { _ = server.Serve(listener) }()
|
||||
@@ -332,6 +333,23 @@ func TestStateStoreConformance(t *testing.T) {
|
||||
if _, err := c.ListUndispatchedCaptures(ctx, []string{"sentry"}, 10); err != nil {
|
||||
t.Fatalf("ListUndispatchedCaptures: %v", err)
|
||||
}
|
||||
|
||||
// Playbook dispatch ledger: ErrAlreadyDispatched survives the hop
|
||||
// via errors.Is, and DeletePlaybookDispatches actually clears the
|
||||
// row (the same key records again after delete).
|
||||
if err := c.RecordPlaybookDispatch(ctx, "pb.yaml", "v1", "archie:acme/widget/7", "notify"); err != nil {
|
||||
t.Fatalf("RecordPlaybookDispatch: %v", err)
|
||||
}
|
||||
err = c.RecordPlaybookDispatch(ctx, "pb.yaml", "v1", "archie:acme/widget/7", "notify")
|
||||
if !errors.Is(err, store.ErrAlreadyDispatched) {
|
||||
t.Fatalf("RecordPlaybookDispatch dup = %v, want ErrAlreadyDispatched", err)
|
||||
}
|
||||
if err := c.DeletePlaybookDispatches(ctx, "pb.yaml"); err != nil {
|
||||
t.Fatalf("DeletePlaybookDispatches: %v", err)
|
||||
}
|
||||
if err := c.RecordPlaybookDispatch(ctx, "pb.yaml", "v1", "archie:acme/widget/7", "notify"); err != nil {
|
||||
t.Fatalf("RecordPlaybookDispatch after delete = %v, want success (delete must clear the row)", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ var (
|
||||
errBindingUnavailable = status.Error(codes.Unavailable, "binding store unavailable")
|
||||
errBindingDispatchUnavailable = status.Error(codes.Unavailable, "binding dispatcher unavailable")
|
||||
errBindingTaskCreatorUnavailable = status.Error(codes.Unavailable, "binding task creator unavailable")
|
||||
errPlaybookDispatcherUnavailable = status.Error(codes.Unavailable, "playbook dispatcher unavailable")
|
||||
// errTaskLogsUnavailable is the "this process cannot read task logs at
|
||||
// all" answer, and it is deliberately distinct from a found=false read
|
||||
// result: only the first is a deployment matter. A dashboard that receives
|
||||
@@ -69,6 +70,10 @@ type Deps struct {
|
||||
Bindings storecontract.BindingStore
|
||||
BindingDispatcher storecontract.BindingDispatcher
|
||||
BindingTaskCreator storecontract.BindingTaskCreator
|
||||
// PlaybookDispatcher is the side-effecting-action idempotency ledger
|
||||
// (docs/prds/eda-playbook-engine.md gap 2). Optional: nil disables the
|
||||
// two playbook dispatch RPCs with codes.Unavailable.
|
||||
PlaybookDispatcher storecontract.PlaybookDispatcher
|
||||
// TaskLogs reads one task attempt's persisted log out of the state
|
||||
// directory this process owns. Optional, and nil is the honest default for
|
||||
// a store service that shares no state directory with the daemon:
|
||||
@@ -597,6 +602,28 @@ func (s *server) RecordDispatch(ctx context.Context, r *pb.RecordDispatchRequest
|
||||
return &pb.RecordDispatchResponse{}, nil
|
||||
}
|
||||
|
||||
// Playbook dispatch
|
||||
|
||||
func (s *server) RecordPlaybookDispatch(ctx context.Context, r *pb.RecordPlaybookDispatchRequest) (*pb.RecordPlaybookDispatchResponse, error) {
|
||||
if s.deps.PlaybookDispatcher == nil {
|
||||
return nil, errPlaybookDispatcherUnavailable
|
||||
}
|
||||
if err := s.deps.PlaybookDispatcher.RecordPlaybookDispatch(ctx, r.PlaybookId, r.PlaybookVersion, r.EventId, r.ActionId); err != nil {
|
||||
return nil, s.logErr("RecordPlaybookDispatch", err)
|
||||
}
|
||||
return &pb.RecordPlaybookDispatchResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *server) DeletePlaybookDispatches(ctx context.Context, r *pb.DeletePlaybookDispatchesRequest) (*pb.DeletePlaybookDispatchesResponse, error) {
|
||||
if s.deps.PlaybookDispatcher == nil {
|
||||
return nil, errPlaybookDispatcherUnavailable
|
||||
}
|
||||
if err := s.deps.PlaybookDispatcher.DeletePlaybookDispatches(ctx, r.PlaybookId); err != nil {
|
||||
return nil, s.logErr("DeletePlaybookDispatches", err)
|
||||
}
|
||||
return &pb.DeletePlaybookDispatchesResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *server) ListUndispatchedCaptures(ctx context.Context, r *pb.ListUndispatchedCapturesRequest) (*pb.ListUndispatchedCapturesResponse, error) {
|
||||
if s.deps.BindingDispatcher == nil {
|
||||
return nil, errBindingDispatchUnavailable
|
||||
|
||||
@@ -33,6 +33,7 @@ type (
|
||||
BindingStore = storecontract.BindingStore
|
||||
BindingDispatcher = storecontract.BindingDispatcher
|
||||
BindingTaskCreator = storecontract.BindingTaskCreator
|
||||
PlaybookDispatcher = storecontract.PlaybookDispatcher
|
||||
CapturedEvent = storecontract.CapturedEvent
|
||||
ConfigSnapshot = storecontract.ConfigSnapshot
|
||||
ApplyStatus = storecontract.ApplyStatus
|
||||
@@ -70,3 +71,6 @@ var _ BindingDispatcher = (*Store)(nil)
|
||||
|
||||
// Compile-time check: *Store satisfies BindingTaskCreator.
|
||||
var _ BindingTaskCreator = (*Store)(nil)
|
||||
|
||||
// Compile-time check: *Store satisfies PlaybookDispatcher.
|
||||
var _ PlaybookDispatcher = (*Store)(nil)
|
||||
@@ -0,0 +1,62 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
// playbookDispatchesSchema is the durable idempotency ledger for
|
||||
// side-effecting playbook actions (docs/prds/eda-playbook-engine.md gap 2).
|
||||
// It copies binding_dispatches' conventions exactly: a durable table whose
|
||||
// PRIMARY KEY is the structural (playbook_id, playbook_version, event_id,
|
||||
// action_id) tuple, written with INSERT OR IGNORE so a duplicate is a no-op
|
||||
// write rather than a constraint error.
|
||||
const playbookDispatchesSchema = `
|
||||
CREATE TABLE IF NOT EXISTS playbook_dispatches (
|
||||
playbook_id TEXT NOT NULL,
|
||||
playbook_version TEXT NOT NULL,
|
||||
event_id TEXT NOT NULL,
|
||||
action_id TEXT NOT NULL,
|
||||
dispatched_at TEXT NOT NULL,
|
||||
PRIMARY KEY (playbook_id, playbook_version, event_id, action_id)
|
||||
);
|
||||
`
|
||||
|
||||
// RecordPlaybookDispatch writes one (playbook, version, event, action) dedup
|
||||
// row. INSERT OR IGNORE + RowsAffected is the dedup test: a duplicate is a
|
||||
// no-op write and returns ErrAlreadyDispatched rather than a constraint
|
||||
// error. The row is written and committed BEFORE the action's side effect is
|
||||
// invoked by the coordinator, which is the deliberate reverse of
|
||||
// binding_dispatches: an at-most-once ledger for non-revocable side effects.
|
||||
func (s *Store) RecordPlaybookDispatch(
|
||||
ctx context.Context,
|
||||
playbookID string,
|
||||
playbookVersion string,
|
||||
eventID string,
|
||||
actionID string,
|
||||
) error {
|
||||
res, err := s.db.ExecContext(ctx, `
|
||||
INSERT OR IGNORE INTO playbook_dispatches (playbook_id, playbook_version, event_id, action_id, dispatched_at)
|
||||
VALUES (?, ?, ?, ?, ?)`,
|
||||
playbookID, playbookVersion, eventID, actionID,
|
||||
time.Now().UTC().Format(bindingTimeLayout))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n, err := res.RowsAffected()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n == 0 {
|
||||
return ErrAlreadyDispatched
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeletePlaybookDispatches removes every ledger row for the given playbook,
|
||||
// mirroring DeleteBinding's row cleanup so a recreated playbook does not
|
||||
// inherit stale dedup state.
|
||||
func (s *Store) DeletePlaybookDispatches(ctx context.Context, playbookID string) error {
|
||||
_, err := s.db.ExecContext(ctx, `DELETE FROM playbook_dispatches WHERE playbook_id = ?`, playbookID)
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRecordPlaybookDispatchIsIdempotent(t *testing.T) {
|
||||
s := openTest(t)
|
||||
ctx := t.Context()
|
||||
if err := s.RecordPlaybookDispatch(ctx, "pb.yaml", "abc123", "archie:acme/widget/7", "notify"); err != nil {
|
||||
t.Fatalf("first RecordPlaybookDispatch: %v", err)
|
||||
}
|
||||
err := s.RecordPlaybookDispatch(ctx, "pb.yaml", "abc123", "archie:acme/widget/7", "notify")
|
||||
if !errors.Is(err, ErrAlreadyDispatched) {
|
||||
t.Fatalf("second RecordPlaybookDispatch = %v, want ErrAlreadyDispatched", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeletePlaybookDispatchesRemovesOnlyThatPlaybook(t *testing.T) {
|
||||
s := openTest(t)
|
||||
ctx := t.Context()
|
||||
if err := s.RecordPlaybookDispatch(ctx, "pb.yaml", "v1", "archie:acme/widget/7", "notify"); err != nil {
|
||||
t.Fatalf("RecordPlaybookDispatch pb.yaml: %v", err)
|
||||
}
|
||||
if err := s.RecordPlaybookDispatch(ctx, "other.yaml", "v2", "archie:acme/widget/8", "notify"); err != nil {
|
||||
t.Fatalf("RecordPlaybookDispatch other.yaml: %v", err)
|
||||
}
|
||||
|
||||
if err := s.DeletePlaybookDispatches(ctx, "pb.yaml"); err != nil {
|
||||
t.Fatalf("DeletePlaybookDispatches: %v", err)
|
||||
}
|
||||
|
||||
var deleted, other int
|
||||
if err := s.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM playbook_dispatches WHERE playbook_id=?`, "pb.yaml").Scan(&deleted); err != nil {
|
||||
t.Fatalf("COUNT pb.yaml: %v", err)
|
||||
}
|
||||
if err := s.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM playbook_dispatches WHERE playbook_id=?`, "other.yaml").Scan(&other); err != nil {
|
||||
t.Fatalf("COUNT other.yaml: %v", err)
|
||||
}
|
||||
if deleted != 0 {
|
||||
t.Fatalf("playbook_dispatches rows for pb.yaml = %d, want 0", deleted)
|
||||
}
|
||||
if other != 1 {
|
||||
t.Fatalf("playbook_dispatches rows for other.yaml = %d, want 1 (delete must not touch other playbooks)", other)
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func Open(ctx context.Context, path string, opts ...OpenOption) (*Store, error)
|
||||
return nil, err
|
||||
}
|
||||
db.SetMaxOpenConns(1)
|
||||
if _, err := db.ExecContext(ctx, schema+eventsSchema+capturesSchema+mappingsSchema+bindingsSchema+configSnapshotSchema+applyStatusSchema+resourcesSchema+identitiesSchema); err != nil {
|
||||
if _, err := db.ExecContext(ctx, schema+eventsSchema+capturesSchema+mappingsSchema+bindingsSchema+playbookDispatchesSchema+configSnapshotSchema+applyStatusSchema+resourcesSchema+identitiesSchema); err != nil {
|
||||
return nil, errors.Join(fmt.Errorf("store: init schema: %w", err), db.Close())
|
||||
}
|
||||
if err := migrateTasks(ctx, db); err != nil {
|
||||
|
||||
@@ -113,6 +113,12 @@ service StateStoreService {
|
||||
// Dispatch
|
||||
rpc ArmedBindingsForSource(ArmedBindingsForSourceRequest) returns (ArmedBindingsForSourceResponse);
|
||||
rpc RecordDispatch(RecordDispatchRequest) returns (RecordDispatchResponse);
|
||||
// Playbook dispatch ledger (eda-playbook-engine.md gap 2): one durable
|
||||
// at-most-once record per (playbook, version, event, action) for the
|
||||
// side-effecting positions. Administrative, like RecordDispatch: a
|
||||
// task-scoped grant cannot reach either (see TaskGrants).
|
||||
rpc RecordPlaybookDispatch(RecordPlaybookDispatchRequest) returns (RecordPlaybookDispatchResponse);
|
||||
rpc DeletePlaybookDispatches(DeletePlaybookDispatchesRequest) returns (DeletePlaybookDispatchesResponse);
|
||||
// ListUndispatchedCaptures is superseded by StreamUndispatchedCaptures; see
|
||||
// ListCaptures above.
|
||||
rpc ListUndispatchedCaptures(ListUndispatchedCapturesRequest) returns (ListUndispatchedCapturesResponse) {
|
||||
@@ -607,6 +613,17 @@ message RecordDispatchRequest {
|
||||
}
|
||||
message RecordDispatchResponse {}
|
||||
|
||||
message RecordPlaybookDispatchRequest {
|
||||
string playbook_id = 1;
|
||||
string playbook_version = 2;
|
||||
string event_id = 3;
|
||||
string action_id = 4;
|
||||
}
|
||||
message RecordPlaybookDispatchResponse {}
|
||||
|
||||
message DeletePlaybookDispatchesRequest { string playbook_id = 1; }
|
||||
message DeletePlaybookDispatchesResponse {}
|
||||
|
||||
message ListUndispatchedCapturesRequest {
|
||||
repeated string sources = 1;
|
||||
int64 limit = 2;
|
||||
|
||||
Reference in new issue
Block a user