Skip to content

Commit 1a8f67f

Browse files
authored
ACT-1185: Expose standalone activity principals in Describe API (#882)
**What changed?** Added new fields to read and return `start_by_principal`, `close_by_principal` and `end_by_principal` to users by `DescribeActivityExecution`. **Why?** This is to enable the read path for SAA Principal Attribute task - https://temporalio.atlassian.net/browse/ACT-1185. **Server PR** temporalio/temporal#12550
1 parent 168d38f commit 1a8f67f

4 files changed

Lines changed: 90 additions & 0 deletions

File tree

‎openapi/openapiv2.json‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13938,6 +13938,18 @@
1393813938
"eagerExecutionAccepted": {
1393913939
"type": "boolean",
1394013940
"description": "Indicates whether eager execution was requested for this activity and accepted by the server\nfor its first task."
13941+
},
13942+
"startedByPrincipal": {
13943+
"$ref": "#/definitions/v1ResolvedPrincipal",
13944+
"description": "Authenticated principal by which this activity execution was started.\n"
13945+
},
13946+
"closedByPrincipal": {
13947+
"$ref": "#/definitions/v1ResolvedPrincipal",
13948+
"description": "Authenticated principal by which this activity execution was closed.\n"
13949+
},
13950+
"lastWorkerPrincipal": {
13951+
"$ref": "#/definitions/v1ResolvedPrincipal",
13952+
"description": "Authenticated principal of the worker that most recently interacted with this activity execution."
1394113953
}
1394213954
},
1394313955
"description": "Information about a standalone activity."
@@ -19338,6 +19350,20 @@
1933819350
}
1933919351
}
1934019352
},
19353+
"v1ResolvedPrincipal": {
19354+
"type": "object",
19355+
"properties": {
19356+
"type": {
19357+
"type": "string",
19358+
"description": "Low-cardinality category of the principal (e.g., \"jwt\", \"users\")."
19359+
},
19360+
"nameAtWriteTime": {
19361+
"type": "string",
19362+
"description": "Identifier within that category (e.g., sub JWT claim, email address).\n"
19363+
}
19364+
},
19365+
"description": "ResolvedPrincipal is a principal returned to an API caller."
19366+
},
1934119367
"v1RespondActivityTaskCanceledByIdResponse": {
1934219368
"type": "object"
1934319369
},

‎openapi/openapiv3.yaml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9924,6 +9924,26 @@ components:
99249924
description: |-
99259925
Indicates whether eager execution was requested for this activity and accepted by the server
99269926
for its first task.
9927+
startedByPrincipal:
9928+
allOf:
9929+
- $ref: '#/components/schemas/ResolvedPrincipal'
9930+
description: |-
9931+
Authenticated principal by which this activity execution was started.
9932+
9933+
(-- api-linter: core::0140::prepositions=disabled
9934+
aip.dev/not-precedent: "by" identifies the authenticated actor. --)
9935+
closedByPrincipal:
9936+
allOf:
9937+
- $ref: '#/components/schemas/ResolvedPrincipal'
9938+
description: |-
9939+
Authenticated principal by which this activity execution was closed.
9940+
9941+
(-- api-linter: core::0140::prepositions=disabled
9942+
aip.dev/not-precedent: "by" identifies the authenticated actor. --)
9943+
lastWorkerPrincipal:
9944+
allOf:
9945+
- $ref: '#/components/schemas/ResolvedPrincipal'
9946+
description: Authenticated principal of the worker that most recently interacted with this activity execution.
99279947
description: Information about a standalone activity.
99289948
ActivityExecutionListInfo:
99299949
type: object
@@ -15990,6 +16010,22 @@ components:
1599016010
properties:
1599116011
lastHeartbeatDetails:
1599216012
$ref: '#/components/schemas/Payloads'
16013+
ResolvedPrincipal:
16014+
type: object
16015+
properties:
16016+
type:
16017+
type: string
16018+
description: Low-cardinality category of the principal (e.g., "jwt", "users").
16019+
nameAtWriteTime:
16020+
type: string
16021+
description: |-
16022+
Identifier within that category (e.g., sub JWT claim, email address).
16023+
16024+
(-- api-linter: core::0140::prepositions=disabled
16025+
aip.dev/not-precedent: Identifies the principal name snapshot used for this response. --)
16026+
(-- api-linter: core::0142::time-field-type=disabled
16027+
aip.dev/not-precedent: This string is a principal name snapshot, not a timestamp. --)
16028+
description: ResolvedPrincipal is a principal returned to an API caller.
1599316029
RespondActivityTaskCanceledByIdRequest:
1599416030
type: object
1599516031
properties:

‎temporal/api/activity/v1/message.proto‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,21 @@ message ActivityExecutionInfo {
203203
// Indicates whether eager execution was requested for this activity and accepted by the server
204204
// for its first task.
205205
bool eager_execution_accepted = 40;
206+
207+
// Authenticated principal by which this activity execution was started.
208+
//
209+
// (-- api-linter: core::0140::prepositions=disabled
210+
// aip.dev/not-precedent: "by" identifies the authenticated actor. --)
211+
temporal.api.common.v1.ResolvedPrincipal started_by_principal = 41;
212+
213+
// Authenticated principal by which this activity execution was closed.
214+
//
215+
// (-- api-linter: core::0140::prepositions=disabled
216+
// aip.dev/not-precedent: "by" identifies the authenticated actor. --)
217+
temporal.api.common.v1.ResolvedPrincipal closed_by_principal = 42;
218+
219+
// Authenticated principal of the worker that most recently interacted with this activity execution.
220+
temporal.api.common.v1.ResolvedPrincipal last_worker_principal = 43;
206221
}
207222

208223
// Limited activity information returned in the list response.

‎temporal/api/common/v1/message.proto‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,19 @@ message Principal {
340340
string name = 2;
341341
}
342342

343+
// ResolvedPrincipal is a principal returned to an API caller.
344+
message ResolvedPrincipal {
345+
// Low-cardinality category of the principal (e.g., "jwt", "users").
346+
string type = 1;
347+
// Identifier within that category (e.g., sub JWT claim, email address).
348+
//
349+
// (-- api-linter: core::0140::prepositions=disabled
350+
// aip.dev/not-precedent: Identifies the principal name snapshot used for this response. --)
351+
// (-- api-linter: core::0142::time-field-type=disabled
352+
// aip.dev/not-precedent: This string is a principal name snapshot, not a timestamp. --)
353+
string name_at_write_time = 2;
354+
}
355+
343356
// Priority contains metadata that controls relative ordering of task processing
344357
// when tasks are backed up in a queue. Initially, Priority will be used in
345358
// matching (workflow and activity) task queues. Later it may be used in history

0 commit comments

Comments
 (0)