@atolis-hq/wake 0.3.21 → 0.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/integrations/github/application/inbound-review-signals.js +4 -0
- package/dist/src/orchestration/domain/operator-retry-policy.js +8 -5
- package/dist/src/orchestration/domain/signal-policy.js +9 -1
- package/dist/src/orchestration/domain/workflow-instance-events.js +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActivityOutcomeKind, ReviewActorKind, ReviewDecisionKind, ReviewerAuthorizationSource, createPullRequestService, } from '../../../activities/index.js';
|
|
2
|
+
import { ApprovalAuthorityKind } from '../../../orchestration/index.js';
|
|
2
3
|
import { BuiltInResourceKind, ResourceCorrelationRole, ResourceStreamKind, resourceId, } from '../../../resources/index.js';
|
|
3
4
|
import { UnknownGitHubIdentity } from '../contracts/vocabulary.js';
|
|
4
5
|
import { commandContext } from './inbound-context.js';
|
|
@@ -143,6 +144,9 @@ async function applyWorkflowSignal(input) {
|
|
|
143
144
|
evidenceId: event.eventId,
|
|
144
145
|
},
|
|
145
146
|
providerEventId: event.eventId,
|
|
147
|
+
...(event.payload.actor.kind === ReviewActorKind.Human
|
|
148
|
+
? { authority: { kind: ApprovalAuthorityKind.Human } }
|
|
149
|
+
: {}),
|
|
146
150
|
}, commandContext(event));
|
|
147
151
|
}
|
|
148
152
|
else if (resumeBlockedOnChanges) {
|
|
@@ -5,14 +5,17 @@ import { ActivityActivationStatus, WorkflowStatus } from '../contracts/vocabular
|
|
|
5
5
|
import { activation, nextOrdinal, stateDraft } from './decision-events.js';
|
|
6
6
|
export function isOperatorRetryEligible(view) {
|
|
7
7
|
const pending = view.pendingActivation;
|
|
8
|
-
|
|
9
|
-
view.blockReason === 'unconfigured outcome failed' &&
|
|
8
|
+
const eligibleActivation = view.status === WorkflowStatus.Blocked &&
|
|
10
9
|
pending !== undefined &&
|
|
11
10
|
pending.status === ActivityActivationStatus.Completed &&
|
|
12
11
|
pending.supplemental !== true &&
|
|
13
12
|
pending.followOnIndex === undefined &&
|
|
14
|
-
view.
|
|
15
|
-
|
|
13
|
+
view.acceptedOutcomes.includes(pending.activationId);
|
|
14
|
+
if (!eligibleActivation || pending === undefined)
|
|
15
|
+
return false;
|
|
16
|
+
return ((view.blockReason === 'unconfigured outcome failed' &&
|
|
17
|
+
view.lastOutcome?.kind === ActivityOutcomeKind.Failed) ||
|
|
18
|
+
view.executionFailure?.activationId === pending.activationId);
|
|
16
19
|
}
|
|
17
20
|
export function isChangesResumeEligible(view) {
|
|
18
21
|
const pending = view.pendingActivation;
|
|
@@ -32,7 +35,7 @@ export function requestOperatorRetry(definition, state, input) {
|
|
|
32
35
|
if (!isOperatorRetryEligible(state))
|
|
33
36
|
return {
|
|
34
37
|
kind: 'ignored',
|
|
35
|
-
reason: 'workflow is not blocked for
|
|
38
|
+
reason: 'workflow is not blocked for a retryable failed stage',
|
|
36
39
|
};
|
|
37
40
|
const stage = definition.stages[stageName(state.currentStage)];
|
|
38
41
|
const events = [
|
|
@@ -52,7 +52,10 @@ function signalRejectionReason(state, input) {
|
|
|
52
52
|
if (state.acceptedSignalIds.includes(signal.providerEventId))
|
|
53
53
|
return 'provider signal was already accepted';
|
|
54
54
|
const expected = state.waitingFor;
|
|
55
|
-
if (
|
|
55
|
+
if (expected === undefined)
|
|
56
|
+
return 'WorkflowInstance is not waiting for a signal';
|
|
57
|
+
if (state.status !== WorkflowStatus.Waiting &&
|
|
58
|
+
!isBlockedHumanAuthorizedWait(state, signal, expected))
|
|
56
59
|
return 'WorkflowInstance is not waiting for a signal';
|
|
57
60
|
if (!matchesExpectation(signal, expected))
|
|
58
61
|
return 'signal does not match the current expectation';
|
|
@@ -66,6 +69,11 @@ function signalRejectionReason(state, input) {
|
|
|
66
69
|
return 'watch-gate signal outcome is neither done nor rejected';
|
|
67
70
|
return null;
|
|
68
71
|
}
|
|
72
|
+
function isBlockedHumanAuthorizedWait(state, signal, expected) {
|
|
73
|
+
return (state.status === WorkflowStatus.Blocked &&
|
|
74
|
+
signal.authority?.kind === ApprovalAuthorityKind.Human &&
|
|
75
|
+
expected.from?.some((authority) => authority.kind === ApprovalAuthorityKind.Human) === true);
|
|
76
|
+
}
|
|
69
77
|
function signalAuthorityAccepted(signal, expected, consent) {
|
|
70
78
|
if (expected.from === undefined)
|
|
71
79
|
return true;
|
|
@@ -58,6 +58,7 @@ function applyActivityFact(state, event) {
|
|
|
58
58
|
return;
|
|
59
59
|
case OrchestrationEventType.ActivityExecutionFailed:
|
|
60
60
|
state.acceptedOutcomes.push(event.payload.activationId);
|
|
61
|
+
state.executionFailure = event.payload;
|
|
61
62
|
updateActivationStatus(state, event.payload.activationId, ActivityActivationStatus.Completed);
|
|
62
63
|
return;
|
|
63
64
|
case OrchestrationEventType.ActivityWaiting:
|
|
@@ -234,6 +235,7 @@ export function immutableWorkflowInstanceView(state) {
|
|
|
234
235
|
? {}
|
|
235
236
|
: { pendingActivation: state.pendingActivation }),
|
|
236
237
|
...(state.lastOutcome === undefined ? {} : { lastOutcome: state.lastOutcome }),
|
|
238
|
+
...(state.executionFailure === undefined ? {} : { executionFailure: state.executionFailure }),
|
|
237
239
|
...(state.waitingFor === undefined ? {} : { waitingFor: state.waitingFor }),
|
|
238
240
|
};
|
|
239
241
|
}
|