@atolis-hq/wake 0.4.37 → 0.4.38
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/orchestration/application/orchestration-service.js +1 -1
- package/dist/src/orchestration/application/watch-reactor.js +11 -0
- package/dist/src/orchestration/contracts/event-decoder.d.ts +1 -0
- package/dist/src/orchestration/contracts/event-decoder.js +1 -0
- package/dist/src/orchestration/contracts/events.d.ts +2 -0
- package/dist/src/orchestration/contracts/views.d.ts +1 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +1 -0
- package/package.json +1 -1
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.38";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -154,7 +154,7 @@ export class OrchestrationService {
|
|
|
154
154
|
throw new GroupBudgetExtensionIneligibleError('Workflow has no durable gate definition to extend');
|
|
155
155
|
const group = childOrchestrationGroupStream(parent.orchestrationGroupId, exhausted.watchId);
|
|
156
156
|
await this.claims.grantBudget(group, exhausted.requestId, context, authority);
|
|
157
|
-
await this.waitForSignal(parent.workflowInstanceId, parent.waitingFor, context);
|
|
157
|
+
await this.waitForSignal(parent.workflowInstanceId, { ...parent.waitingFor, suppressWatchDispatch: true }, context);
|
|
158
158
|
return this.requestChild({
|
|
159
159
|
...exhausted,
|
|
160
160
|
workflowName,
|
|
@@ -11,6 +11,8 @@ const reconciliationCheckpoint = 'reconciler:orchestration.watch';
|
|
|
11
11
|
const noWatchEventTypes = () => [];
|
|
12
12
|
export function createWatchReactor(orchestration, watchEventTypes = noWatchEventTypes, runs) {
|
|
13
13
|
const react = async (event, context) => {
|
|
14
|
+
if (suppressesWatchDispatch(event))
|
|
15
|
+
return;
|
|
14
16
|
await dispatch(orchestration, runs, event, context, await orchestration.listWatchMatches(event, context));
|
|
15
17
|
};
|
|
16
18
|
return {
|
|
@@ -45,6 +47,10 @@ export function createWatchReconciler(orchestration, journal, checkpoints, runs)
|
|
|
45
47
|
]));
|
|
46
48
|
let reconciled = 0;
|
|
47
49
|
for (const event of events) {
|
|
50
|
+
if (suppressesWatchDispatch(event)) {
|
|
51
|
+
await checkpoints.save(reconciliationCheckpoint, event.globalPosition);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
48
54
|
const context = reactorCommandContext(event, ApprovalAuthorityKind.Watch, 'watch-reactor');
|
|
49
55
|
const matches = (await Promise.all((await orchestration.listWatchMatches(event, context)).map(async (match) => {
|
|
50
56
|
const watches = waiting.get(match.parent.workflowInstanceId);
|
|
@@ -63,6 +69,11 @@ export function createWatchReconciler(orchestration, journal, checkpoints, runs)
|
|
|
63
69
|
},
|
|
64
70
|
};
|
|
65
71
|
}
|
|
72
|
+
function suppressesWatchDispatch(event) {
|
|
73
|
+
const owned = selectOrchestrationEvent(event);
|
|
74
|
+
return (owned?.event.eventType === OrchestrationEventType.SignalWaitStarted &&
|
|
75
|
+
owned.event.payload.suppressWatchDispatch === true);
|
|
76
|
+
}
|
|
66
77
|
async function dispatch(orchestration, runs, event, context, matches) {
|
|
67
78
|
const causalCycle = orchestrationCausalCycleId(selectOrchestrationEvent(event));
|
|
68
79
|
const sourceWorkflowInstanceId = await resolveTriggerWorkflowInstanceId(event, runs);
|
|
@@ -71,6 +71,7 @@ export declare const activityRequestedSchema: z.ZodObject<{
|
|
|
71
71
|
}, z.core.$strict>;
|
|
72
72
|
export declare const expectationSchema: z.ZodObject<{
|
|
73
73
|
signalKind: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").SignalName, string>>;
|
|
74
|
+
suppressWatchDispatch: z.ZodOptional<z.ZodLiteral<true>>;
|
|
74
75
|
resourceId: z.ZodOptional<z.ZodString>;
|
|
75
76
|
revision: z.ZodOptional<z.ZodString>;
|
|
76
77
|
from: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -121,6 +121,7 @@ const resourceTransitionSchema = z
|
|
|
121
121
|
export const expectationSchema = z
|
|
122
122
|
.object({
|
|
123
123
|
signalKind: brandedStringSchema(signalName),
|
|
124
|
+
suppressWatchDispatch: z.literal(true).optional(),
|
|
124
125
|
resourceId: z.string().optional(),
|
|
125
126
|
revision: z.string().optional(),
|
|
126
127
|
from: z.array(approvalAuthoritySchema).min(1).optional(),
|
|
@@ -187,6 +187,8 @@ export interface ActivityRequestedPayload {
|
|
|
187
187
|
}
|
|
188
188
|
export interface SignalExpectation {
|
|
189
189
|
readonly signalKind: SignalName;
|
|
190
|
+
/** Re-arm a blocked gate without treating its wait event as a new watch trigger. */
|
|
191
|
+
readonly suppressWatchDispatch?: true | undefined;
|
|
190
192
|
readonly resourceId?: string | undefined;
|
|
191
193
|
readonly revision?: string | undefined;
|
|
192
194
|
readonly from?: readonly ApprovalAuthority[] | undefined;
|
|
@@ -17,6 +17,7 @@ export interface ActivityActivationView {
|
|
|
17
17
|
}
|
|
18
18
|
export interface SignalExpectationView {
|
|
19
19
|
readonly signalKind: SignalName;
|
|
20
|
+
readonly suppressWatchDispatch?: true;
|
|
20
21
|
readonly intentEventId?: string;
|
|
21
22
|
readonly resourceId?: string;
|
|
22
23
|
readonly revision?: string;
|
|
@@ -177,6 +177,7 @@ function applySignalWaitStarted(state, event) {
|
|
|
177
177
|
state.status = orchestrationStatusTransitions[OrchestrationEventType.SignalWaitStarted];
|
|
178
178
|
state.waitingFor = {
|
|
179
179
|
signalKind: event.payload.signalKind,
|
|
180
|
+
...(event.payload.suppressWatchDispatch === true ? { suppressWatchDispatch: true } : {}),
|
|
180
181
|
...(event.payload.resourceId === undefined ? {} : { resourceId: event.payload.resourceId }),
|
|
181
182
|
...(event.payload.revision === undefined ? {} : { revision: event.payload.revision }),
|
|
182
183
|
...(event.payload.from === undefined ? {} : { from: event.payload.from }),
|