Skip to content

Commit 9213ec3

Browse files
Add new fields to event group getters
Signed-off-by: Adhitya Mamallan <[email protected]>
1 parent 01b2226 commit 9213ec3

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

src/views/workflow-history/helpers/get-history-group-from-events/__tests__/get-activity-group-from-events.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ describe('getActivityGroupFromEvents', () => {
395395
expect(group.eventsMetadata[1].summaryFields).toEqual([
396396
'heartbeatDetails',
397397
'lastHeartbeatTime',
398+
'attempt',
398399
]);
399400

400401
// The completed event should also have summaryFields
@@ -522,6 +523,7 @@ describe('getActivityGroupFromEvents', () => {
522523
expect(pendingStartEventMetadata?.summaryFields).toEqual([
523524
'lastFailureReason',
524525
'lastFailureDetails',
526+
'attempt',
525527
]);
526528

527529
// Other events should not have the same summaryFields

src/views/workflow-history/helpers/get-history-group-from-events/__tests__/get-decision-group-from-events.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ describe('getDecisionGroupFromEvents', () => {
370370
);
371371
expect(scheduledEventMetadata?.summaryFields).toEqual([
372372
'startToCloseTimeoutSeconds',
373+
'attempt',
373374
]);
374375

375376
// Other events should not have summaryFields
@@ -380,4 +381,27 @@ describe('getDecisionGroupFromEvents', () => {
380381
expect(metadata.summaryFields).toBeUndefined();
381382
});
382383
});
384+
385+
it('should include summaryFields for pending decision start events', () => {
386+
const events: ExtendedDecisionHistoryEvent[] = [
387+
scheduleDecisionTaskEvent,
388+
pendingDecisionTaskStartEvent,
389+
];
390+
const group = getDecisionGroupFromEvents(events);
391+
392+
// The pending start event should have summaryFields
393+
const pendingStartEventMetadata = group.eventsMetadata.find(
394+
(metadata) => metadata.label === 'Starting'
395+
);
396+
expect(pendingStartEventMetadata?.summaryFields).toEqual(['attempt']);
397+
398+
// Other events should not have the same summaryFields
399+
const scheduledEventMetadata = group.eventsMetadata.find(
400+
(metadata) => metadata.label === 'Scheduled'
401+
);
402+
expect(scheduledEventMetadata?.summaryFields).toEqual([
403+
'startToCloseTimeoutSeconds',
404+
'attempt',
405+
]);
406+
});
383407
});

src/views/workflow-history/helpers/get-history-group-from-events/__tests__/get-single-event-group-from-events.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ describe('getSingleEventGroupFromEvents', () => {
186186
expect(eventMetadata.summaryFields).toEqual([
187187
'input',
188188
'executionStartToCloseTimeoutSeconds',
189+
'attempt',
189190
]);
190191
});
191192

src/views/workflow-history/helpers/get-history-group-from-events/get-activity-group-from-events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,12 @@ export default function getActivityGroupFromEvents(
165165
pendingActivityTaskStartEventAttributes: [
166166
'lastFailureReason',
167167
'lastFailureDetails',
168+
'attempt',
168169
],
169170
activityTaskStartedEventAttributes: [
170171
'heartbeatDetails',
171172
'lastHeartbeatTime',
173+
'attempt',
172174
],
173175
activityTaskCompletedEventAttributes: ['result'],
174176
activityTaskFailedEventAttributes: ['details', 'reason'],

src/views/workflow-history/helpers/get-history-group-from-events/get-decision-group-from-events.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ export default function getDecisionGroupFromEvents(
122122

123123
const eventToSummaryFields: HistoryGroupEventToSummaryFieldsMap<DecisionHistoryGroup> =
124124
{
125-
decisionTaskScheduledEventAttributes: ['startToCloseTimeoutSeconds'],
125+
decisionTaskScheduledEventAttributes: [
126+
'startToCloseTimeoutSeconds',
127+
'attempt',
128+
],
129+
pendingDecisionTaskStartEventAttributes: ['attempt'],
126130
};
127131

128132
return {

src/views/workflow-history/helpers/get-history-group-from-events/get-single-event-group-from-events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export default function getSingleEventGroupFromEvents(
9999
workflowExecutionStartedEventAttributes: [
100100
'input',
101101
'executionStartToCloseTimeoutSeconds',
102+
'attempt',
102103
],
103104
workflowExecutionCompletedEventAttributes: ['result'],
104105
workflowExecutionFailedEventAttributes: ['details', 'reason'],

0 commit comments

Comments
 (0)