Skip to content

Commit e335985

Browse files
authored
Add indentity/description to the rule, propagate then in PauseInfo (#577)
<!-- Describe what has changed in this PR --> **What changed?** 1. Add identity/description to the rules. 2. Add new message with "rule_id, identity, reason" to the PauseInfo <!-- Tell your future self why have you made these changes --> **Why?** Product request - identity/reason should be always populated, for both manual/rule. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** Not really. But old "rule_id" in oneof is effectively deprecated.
1 parent 0d92325 commit e335985

File tree

6 files changed

+100
-8
lines changed

6 files changed

+100
-8
lines changed

buf.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ breaking:
1313
- WIRE_JSON
1414
ignore:
1515
- google
16+
# TODO (yuri) remove this
17+
- temporal/api/workflow/v1/message.proto
1618
lint:
1719
use:
1820
- DEFAULT

openapi/openapiv2.json

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6772,6 +6772,23 @@
67726772
}
67736773
}
67746774
},
6775+
"PauseInfoRule": {
6776+
"type": "object",
6777+
"properties": {
6778+
"ruleId": {
6779+
"type": "string",
6780+
"description": "The rule that paused the activity."
6781+
},
6782+
"identity": {
6783+
"type": "string",
6784+
"description": "The identity of the actor that created the rule."
6785+
},
6786+
"reason": {
6787+
"type": "string",
6788+
"description": "Reason why rule was created. Populated from rule description."
6789+
}
6790+
}
6791+
},
67756792
"PendingActivityInfoPauseInfo": {
67766793
"type": "object",
67776794
"properties": {
@@ -6784,9 +6801,9 @@
67846801
"$ref": "#/definitions/PauseInfoManual",
67856802
"title": "activity was paused by the manual intervention"
67866803
},
6787-
"ruleId": {
6788-
"type": "string",
6789-
"description": "Id of the rule that paused the activity."
6804+
"rule": {
6805+
"$ref": "#/definitions/PauseInfoRule",
6806+
"title": "activity was paused by the rule"
67906807
}
67916808
}
67926809
},
@@ -7046,6 +7063,14 @@
70467063
"requestId": {
70477064
"type": "string",
70487065
"description": "Used to de-dupe requests. Typically should be UUID."
7066+
},
7067+
"identity": {
7068+
"type": "string",
7069+
"description": "Identity of the actor who created the rule. Will be stored with the rule."
7070+
},
7071+
"description": {
7072+
"type": "string",
7073+
"description": "Rule description.Will be stored with the rule."
70497074
}
70507075
}
70517076
},
@@ -15493,6 +15518,14 @@
1549315518
"spec": {
1549415519
"$ref": "#/definitions/v1WorkflowRuleSpec",
1549515520
"title": "Rule specification"
15521+
},
15522+
"createdByIdentity": {
15523+
"type": "string",
15524+
"title": "Identity of the actor that created the rule"
15525+
},
15526+
"description": {
15527+
"type": "string",
15528+
"description": "Rule description."
1549615529
}
1549715530
},
1549815531
"description": "WorkflowRule describes a rule that can be applied to any workflow in this namespace."

openapi/openapiv3.yaml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6914,6 +6914,12 @@ components:
69146914
requestId:
69156915
type: string
69166916
description: Used to de-dupe requests. Typically should be UUID.
6917+
identity:
6918+
type: string
6919+
description: Identity of the actor who created the rule. Will be stored with the rule.
6920+
description:
6921+
type: string
6922+
description: Rule description.Will be stored with the rule.
69176923
CreateWorkflowRuleResponse:
69186924
type: object
69196925
properties:
@@ -8715,6 +8721,18 @@ components:
87158721
reason:
87168722
type: string
87178723
description: Reason for pausing the activity.
8724+
PauseInfo_Rule:
8725+
type: object
8726+
properties:
8727+
ruleId:
8728+
type: string
8729+
description: The rule that paused the activity.
8730+
identity:
8731+
type: string
8732+
description: The identity of the actor that created the rule.
8733+
reason:
8734+
type: string
8735+
description: Reason why rule was created. Populated from rule description.
87188736
Payload:
87198737
description: |-
87208738
Represents some binary (byte array) data (ex: activity input parameters or workflow result) with
@@ -8830,9 +8848,10 @@ components:
88308848
allOf:
88318849
- $ref: '#/components/schemas/PauseInfo_Manual'
88328850
description: activity was paused by the manual intervention
8833-
ruleId:
8834-
type: string
8835-
description: Id of the rule that paused the activity.
8851+
rule:
8852+
allOf:
8853+
- $ref: '#/components/schemas/PauseInfo_Rule'
8854+
description: activity was paused by the rule
88368855
PendingChildExecutionInfo:
88378856
type: object
88388857
properties:
@@ -13001,6 +13020,17 @@ components:
1300113020
allOf:
1300213021
- $ref: '#/components/schemas/WorkflowRuleSpec'
1300313022
description: Rule specification
13023+
createdByIdentity:
13024+
type: string
13025+
description: |-
13026+
Identity of the actor that created the rule
13027+
(-- api-linter: core::0140::prepositions=disabled
13028+
aip.dev/not-precedent: It is better reflect the intent this way, we will also have updated_by. --)
13029+
(-- api-linter: core::0142::time-field-names=disabled
13030+
aip.dev/not-precedent: Same as above. All other options sounds clumsy --)
13031+
description:
13032+
type: string
13033+
description: Rule description.
1300413034
description: WorkflowRule describes a rule that can be applied to any workflow in this namespace.
1300513035
WorkflowRuleAction:
1300613036
type: object

temporal/api/rules/v1/message.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,14 @@ message WorkflowRule {
9999

100100
// Rule specification
101101
WorkflowRuleSpec spec = 2;
102+
103+
// Identity of the actor that created the rule
104+
// (-- api-linter: core::0140::prepositions=disabled
105+
// aip.dev/not-precedent: It is better reflect the intent this way, we will also have updated_by. --)
106+
// (-- api-linter: core::0142::time-field-names=disabled
107+
// aip.dev/not-precedent: Same as above. All other options sounds clumsy --)
108+
string created_by_identity = 3;
109+
110+
// Rule description.
111+
string description = 4;
102112
}

temporal/api/workflow/v1/message.proto

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,23 @@ message PendingActivityInfo {
322322
// Reason for pausing the activity.
323323
string reason = 2;
324324
}
325+
326+
message Rule {
327+
// The rule that paused the activity.
328+
string rule_id = 1;
329+
// The identity of the actor that created the rule.
330+
string identity = 2;
331+
// Reason why rule was created. Populated from rule description.
332+
string reason = 3;
333+
}
334+
325335
oneof paused_by {
326336
// activity was paused by the manual intervention
327337
Manual manual = 2;
328338

329-
// Id of the rule that paused the activity.
330-
string rule_id = 3;
339+
340+
// activity was paused by the rule
341+
Rule rule = 4;
331342
}
332343
}
333344

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,6 +2220,12 @@ message CreateWorkflowRuleRequest {
22202220

22212221
// Used to de-dupe requests. Typically should be UUID.
22222222
string request_id = 4;
2223+
2224+
// Identity of the actor who created the rule. Will be stored with the rule.
2225+
string identity = 5;
2226+
2227+
// Rule description.Will be stored with the rule.
2228+
string description = 6;
22232229
}
22242230

22252231
message CreateWorkflowRuleResponse {

0 commit comments

Comments
 (0)