@agoric/async-flow 0.1.1-dev-e3b41dc.0 → 0.1.1-dev-442f07c.0
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/docs/async-flow-states.key +0 -0
- package/docs/async-flow-states.md +2 -1
- package/docs/async-flow-states.png +0 -0
- package/package.json +8 -8
- package/src/async-flow.d.ts.map +1 -1
- package/src/async-flow.js +45 -1
- package/src/types.d.ts +1 -0
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +1 -0
- package/test/_utils.js +22 -0
- package/test/async-flow-crank.test.js +4 -6
- package/test/async-flow-early-completion.test.js +28 -8
- package/test/async-flow-no-this.js +2 -4
- package/test/async-flow.test.js +13 -5
- package/test/bad-host.test.js +13 -3
|
Binary file
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
- ***Replaying***. To start ***Replaying***, the activation first translates the saved activation arguments from host to guest, invokes the guest function, and starts the membrane replaying from its durable log. The replay is finished when the last log entry has been replayed. Once replaying is finished, the activation has caught up and transitions back to ***Running***.
|
|
12
12
|
|
|
13
|
-
- ***Failed***. If during the ***Replaying*** state
|
|
13
|
+
- ***Failed***. If the guest activation misbehaves during the ***Replaying*** state (by failing to exactly produce its previously logged behavior) or during the ***Running*** state (by an invalid or unsupported interaction with the `asyncFlow` mechanism), it goes into the inactive ***Failed*** state, with a diagnostic explaining how the replay failed, so it can be repaired by another future upgrade. As of the next reincarnation, the failure status is cleared and it starts ***Replaying***, then ***Running*** again, hoping not to fail this time. If replay or running failed because the previous guest async function misbehaved, then to make progress, an upgrade needs to replace the function with one which behaves correctly. If a ***Replaying*** or ***Running*** guest failed because of a failure of the `asyncFlow` mechanism, whether a bug or merely hitting a case that is not yet implemented, then an upgrade needs to replace the relevant part of the `asyncFlow`'s mechanism.
|
|
14
14
|
|
|
15
15
|
- ***Done***. The guest async function invocation returned a promise for its eventual outcome. Once that promise settles, we assume that the job of the guest activation is done. It then goes into a durably ***Done*** state, dropping all its bookkeeping beyond just remembering the corresponding settled outcome vow, and that it is ***Done***. The replay logs and membrane state of this activation are dropped, to be garbage collected.
|
|
16
|
+
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/async-flow",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-442f07c.0+442f07c",
|
|
4
4
|
"description": "Upgrade async functions at await points by replay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/Agoric/agoric-sdk",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"author": "Agoric",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/store": "0.9.3-dev-
|
|
30
|
-
"@agoric/vow": "0.1.1-dev-
|
|
27
|
+
"@agoric/base-zone": "0.1.1-dev-442f07c.0+442f07c",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-442f07c.0+442f07c",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-442f07c.0+442f07c",
|
|
30
|
+
"@agoric/vow": "0.1.1-dev-442f07c.0+442f07c",
|
|
31
31
|
"@endo/common": "^1.2.5",
|
|
32
32
|
"@endo/errors": "^1.2.5",
|
|
33
33
|
"@endo/eventual-send": "^1.2.5",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@endo/promise-kit": "^1.1.5"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
41
|
-
"@agoric/zone": "0.2.3-dev-
|
|
40
|
+
"@agoric/swingset-vat": "0.32.3-dev-442f07c.0+442f07c",
|
|
41
|
+
"@agoric/zone": "0.2.3-dev-442f07c.0+442f07c",
|
|
42
42
|
"@endo/env-options": "^1.1.6",
|
|
43
43
|
"ava": "^5.3.0",
|
|
44
44
|
"tsd": "^0.31.1"
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"typeCoverage": {
|
|
63
63
|
"atLeast": 77.29
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "442f07c8f0af03281b52b90e90c27131eef6f331"
|
|
66
66
|
}
|
package/src/async-flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-flow.d.ts","sourceRoot":"","sources":["async-flow.js"],"names":[],"mappings":"AAgDO,iDAHI,IAAI;
|
|
1
|
+
{"version":3,"file":"async-flow.d.ts","sourceRoot":"","sources":["async-flow.js"],"names":[],"mappings":"AAgDO,iDAHI,IAAI;gCAgDF,IAAI,OACJ,MAAM,kBACN,cAAc;qBACC,OAAO;;;YA4BzB;;eAEG;4BADU,SAAS;YAkCtB;;;;;eAKG;;;;;;;;;;;;;;;;;gBA4TmB,CAAC,SAAlB,cAAgB,QAClB,IAAI,OACJ,MAAM,aACN,CAAC;qBACc,OAAO;sBACpB,OAAO,CAAC,CAAC;;;;;;;;EAsDvB;6BAIY,UAAU,aAlfZ,IAAI;gCAgDF,IAAI,OACJ,MAAM,kBACN,cAAc;qBACC,OAAO;;;YA4BzB;;eAEG;4BADU,SAAS;YAkCtB;;;;;eAKG;;;;;;;;;;;;;;;;;gBA4TmB,CAAC,SAAlB,cAAgB,QAClB,IAAI,OACJ,MAAM,aACN,CAAC;qBACc,OAAO;sBACpB,OAAO,CAAC,CAAC;;;;;;;;EA0DsB;6BAIjC,cAAc,CAAC,gBAAgB,CAAC;+BAIhC,UAAU,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;2BAIjD,UAAU,CAAC,gBAAgB,CAAC;wBAI5B,YAAY,CAAC,MAAM,CAAC;0BAjiBV,mBAAmB;wCACoD,iBAAiB;oCAAjB,iBAAiB;+BAAjB,iBAAiB;4BAAjB,iBAAiB"}
|
package/src/async-flow.js
CHANGED
|
@@ -55,6 +55,9 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
55
55
|
{ vowTools },
|
|
56
56
|
),
|
|
57
57
|
makeBijection = prepareBijection(outerZone, unwrap),
|
|
58
|
+
panicHandler = err => {
|
|
59
|
+
throw err;
|
|
60
|
+
},
|
|
58
61
|
} = outerOptions;
|
|
59
62
|
const { watch, makeVowKit } = vowTools;
|
|
60
63
|
|
|
@@ -247,6 +250,12 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
247
250
|
guestResultP,
|
|
248
251
|
gFulfillment => {
|
|
249
252
|
if (bijection.hasGuest(guestResultP)) {
|
|
253
|
+
!log.isReplaying() ||
|
|
254
|
+
panic(
|
|
255
|
+
makeError(
|
|
256
|
+
X`guest fulfilled with ${gFulfillment} before finishing replay`,
|
|
257
|
+
),
|
|
258
|
+
);
|
|
250
259
|
outcomeKit.resolver.resolve(
|
|
251
260
|
membrane.guestToHost(gFulfillment),
|
|
252
261
|
);
|
|
@@ -262,11 +271,46 @@ export const prepareAsyncFlowTools = (outerZone, outerOptions = {}) => {
|
|
|
262
271
|
// in the `guestResultP` being absent from the bijection,
|
|
263
272
|
// so this leave the outcome vow unsettled, as it must.
|
|
264
273
|
if (bijection.hasGuest(guestResultP)) {
|
|
274
|
+
!log.isReplaying() ||
|
|
275
|
+
panic(
|
|
276
|
+
makeError(
|
|
277
|
+
X`guest rejected with ${guestReason} before finishing replay`,
|
|
278
|
+
),
|
|
279
|
+
);
|
|
265
280
|
outcomeKit.resolver.reject(membrane.guestToHost(guestReason));
|
|
266
281
|
admin.complete();
|
|
267
282
|
}
|
|
268
283
|
},
|
|
269
|
-
)
|
|
284
|
+
)
|
|
285
|
+
.then(
|
|
286
|
+
() => {
|
|
287
|
+
if (flow.getFlowState() === 'Failed') {
|
|
288
|
+
// If the flow fails, we need to trigger the panic handler with
|
|
289
|
+
// the failure.
|
|
290
|
+
throw flow.getOptFatalProblem();
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
maybePanicReason => {
|
|
294
|
+
if (flow.getFlowState() === 'Failed') {
|
|
295
|
+
const err = flow.getOptFatalProblem();
|
|
296
|
+
// TODO: Annotate maybePanicReason robustly with err if it
|
|
297
|
+
// is indeed not the same as one we already threw from
|
|
298
|
+
// panic.
|
|
299
|
+
throw err;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Definitely not a reason from an existing panic, so raise a new panic.
|
|
303
|
+
const err = makeError(
|
|
304
|
+
X`internal: unexpected error in guest completion handling ${maybePanicReason}`,
|
|
305
|
+
);
|
|
306
|
+
try {
|
|
307
|
+
panic(err);
|
|
308
|
+
} catch (_e) {
|
|
309
|
+
throw err;
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
)
|
|
313
|
+
.catch(panicHandler);
|
|
270
314
|
},
|
|
271
315
|
wake() {
|
|
272
316
|
const { facets } = this;
|
package/src/types.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export type PreparationOptions = {
|
|
|
55
55
|
makeLogStore?: (() => LogStore) | undefined;
|
|
56
56
|
makeBijection?: (() => Bijection) | undefined;
|
|
57
57
|
endowmentTools?: EndowmentTools;
|
|
58
|
+
panicHandler?: (e: any) => void;
|
|
58
59
|
};
|
|
59
60
|
export type OutcomeKind = 'return' | 'throw';
|
|
60
61
|
export type Outcome = {
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAA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EE,EAAE,EAAE,cAAc;IAClB,GAAG,EAAE,OAAO;IACZ,WAAW,EAAE,IAAI;CAClB,GACD,CAAC,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAC/C;IACE,EAAE,EAAE,WAAW;IACf,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,WAAW,GAAG,SAAS;IAChC,IAAI,EAAE,IAAI,EAAE;IACZ,SAAS,EAAE,MAAM;CAClB,GACD;IACE,EAAE,EAAE,eAAe;IACnB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,WAAW,GAAG,SAAS;IAChC,IAAI,EAAE,IAAI,EAAE;IACZ,SAAS,EAAE,MAAM;CAClB,GACD;IACE,EAAE,EAAE,WAAW;IACf,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,WAAW,GAAG,SAAS;IAChC,IAAI,EAAE,IAAI,EAAE;IACZ,SAAS,EAAE,MAAM;CAClB,GACD,CAAC,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GACpD,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -96,6 +96,7 @@ export type PreparationOptions = {
|
|
|
96
96
|
makeLogStore?: (() => LogStore) | undefined;
|
|
97
97
|
makeBijection?: (() => Bijection) | undefined;
|
|
98
98
|
endowmentTools?: EndowmentTools;
|
|
99
|
+
panicHandler?: (e: any) => void;
|
|
99
100
|
};
|
|
100
101
|
export type OutcomeKind = 'return' | 'throw';
|
|
101
102
|
|
package/test/_utils.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { prepareAsyncFlowTools } from '../src/async-flow.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
5
|
+
* @import {PreparationOptions} from '../src/types.js';
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {*} t
|
|
10
|
+
* @param {Zone} zone
|
|
11
|
+
* @param {PreparationOptions} [opts]
|
|
12
|
+
*/
|
|
13
|
+
export const prepareTestAsyncFlowTools = (t, zone, opts) => {
|
|
14
|
+
const {
|
|
15
|
+
panicHandler = e => {
|
|
16
|
+
t.log('Panic handler called', e);
|
|
17
|
+
t.fail('Unexpected panic');
|
|
18
|
+
},
|
|
19
|
+
} = opts || {};
|
|
20
|
+
return prepareAsyncFlowTools(zone, { panicHandler, ...opts });
|
|
21
|
+
};
|
|
22
|
+
harden(prepareTestAsyncFlowTools);
|
|
@@ -14,12 +14,10 @@ import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js';
|
|
|
14
14
|
import { prepareVowTools } from '@agoric/vow';
|
|
15
15
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { prepareTestAsyncFlowTools } from './_utils.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @import {PromiseKit} from '@endo/promise-kit'
|
|
21
20
|
* @import {Zone} from '@agoric/base-zone'
|
|
22
|
-
* @import {Ephemera} from './types.js';
|
|
23
21
|
*/
|
|
24
22
|
|
|
25
23
|
const neverSettlesP = new Promise(() => {});
|
|
@@ -30,7 +28,7 @@ const neverSettlesP = new Promise(() => {});
|
|
|
30
28
|
*/
|
|
31
29
|
const testPlay1 = async (t, zone) => {
|
|
32
30
|
const vowTools = prepareVowTools(zone);
|
|
33
|
-
const { asyncFlow } =
|
|
31
|
+
const { asyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
34
32
|
vowTools,
|
|
35
33
|
});
|
|
36
34
|
|
|
@@ -48,7 +46,7 @@ const testPlay1 = async (t, zone) => {
|
|
|
48
46
|
*/
|
|
49
47
|
const testPlay2 = async (t, zone) => {
|
|
50
48
|
const vowTools = prepareVowTools(zone);
|
|
51
|
-
const { asyncFlow } =
|
|
49
|
+
const { asyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
52
50
|
vowTools,
|
|
53
51
|
});
|
|
54
52
|
|
|
@@ -63,7 +61,7 @@ const testPlay2 = async (t, zone) => {
|
|
|
63
61
|
*/
|
|
64
62
|
const testPlay3 = async (t, zone) => {
|
|
65
63
|
const vowTools = prepareVowTools(zone);
|
|
66
|
-
const { asyncFlow, allWokenP } =
|
|
64
|
+
const { asyncFlow, allWokenP } = prepareTestAsyncFlowTools(t, zone, {
|
|
67
65
|
vowTools,
|
|
68
66
|
});
|
|
69
67
|
|
|
@@ -15,7 +15,7 @@ import { isVow } from '@agoric/vow/src/vow-utils.js';
|
|
|
15
15
|
import { prepareVowTools } from '@agoric/vow';
|
|
16
16
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { prepareTestAsyncFlowTools } from './_utils.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @import {Zone} from '@agoric/base-zone';
|
|
@@ -59,7 +59,7 @@ const firstLogLen = 7;
|
|
|
59
59
|
const testFirstPlay = async (t, zone) => {
|
|
60
60
|
t.log('firstPlay started');
|
|
61
61
|
const vowTools = prepareVowTools(zone);
|
|
62
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
62
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
63
63
|
vowTools,
|
|
64
64
|
});
|
|
65
65
|
const makeOrchestra = prepareOrchestra(zone);
|
|
@@ -134,12 +134,24 @@ const testFirstPlay = async (t, zone) => {
|
|
|
134
134
|
*
|
|
135
135
|
* @param {any} t
|
|
136
136
|
* @param {Zone} zone
|
|
137
|
+
* @param {unknown} [rejection]
|
|
137
138
|
*/
|
|
138
|
-
const testBadShortReplay = async (t, zone) => {
|
|
139
|
+
const testBadShortReplay = async (t, zone, rejection) => {
|
|
139
140
|
t.log('badShortReplay started');
|
|
140
141
|
const vowTools = prepareVowTools(zone);
|
|
141
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
142
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
142
143
|
vowTools,
|
|
144
|
+
panicHandler: e => {
|
|
145
|
+
t.throws(
|
|
146
|
+
() => {
|
|
147
|
+
throw e;
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
message:
|
|
151
|
+
/^guest (fulfilled with "bad"|rejected with "\[Error: replayProblem\]") before finishing replay$/,
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
},
|
|
143
155
|
});
|
|
144
156
|
prepareOrchestra(zone);
|
|
145
157
|
const { when } = vowTools;
|
|
@@ -149,8 +161,12 @@ const testBadShortReplay = async (t, zone) => {
|
|
|
149
161
|
|
|
150
162
|
const { guestMethod } = {
|
|
151
163
|
async guestMethod(_gOrch7, _g1, _p3) {
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
resolveStep(eventLoopIteration()); // resolveStep(true) is too fast.
|
|
165
|
+
if (rejection) {
|
|
166
|
+
t.log(' badShortReplay rejecting');
|
|
167
|
+
throw rejection;
|
|
168
|
+
}
|
|
169
|
+
t.log(' badShortReplay return early');
|
|
154
170
|
return 'bad';
|
|
155
171
|
},
|
|
156
172
|
};
|
|
@@ -174,7 +190,7 @@ const testBadShortReplay = async (t, zone) => {
|
|
|
174
190
|
await promiseStep;
|
|
175
191
|
|
|
176
192
|
const replayProblem = flow.getOptFatalProblem();
|
|
177
|
-
t.log(' badShortReplay
|
|
193
|
+
t.log(' badShortReplay replayProblem', replayProblem);
|
|
178
194
|
t.true(replayProblem instanceof Error);
|
|
179
195
|
|
|
180
196
|
const outcome = when(outcomeV);
|
|
@@ -190,7 +206,7 @@ const testBadShortReplay = async (t, zone) => {
|
|
|
190
206
|
t.log('badShortReplay done');
|
|
191
207
|
};
|
|
192
208
|
|
|
193
|
-
test.serial
|
|
209
|
+
test.serial('test durable async-flow early completion', async t => {
|
|
194
210
|
annihilate();
|
|
195
211
|
const zone1 = makeDurableZone(getBaggage(), 'durableRoot');
|
|
196
212
|
await testFirstPlay(t, zone1);
|
|
@@ -200,4 +216,8 @@ test.serial.failing('test durable async-flow early completion', async t => {
|
|
|
200
216
|
nextLife();
|
|
201
217
|
const zone2a = makeDurableZone(getBaggage(), 'durableRoot');
|
|
202
218
|
await testBadShortReplay(t, zone2a);
|
|
219
|
+
|
|
220
|
+
nextLife();
|
|
221
|
+
const zone2b = makeDurableZone(getBaggage(), 'durableRoot');
|
|
222
|
+
await testBadShortReplay(t, zone2b, Error('replayProblem'));
|
|
203
223
|
});
|
|
@@ -7,12 +7,10 @@ import { makeHeapZone } from '@agoric/zone/heap.js';
|
|
|
7
7
|
import { makeVirtualZone } from '@agoric/zone/virtual.js';
|
|
8
8
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { prepareTestAsyncFlowTools } from './_utils.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @import {Zone} from '@agoric/base-zone';
|
|
14
|
-
* @import {Vow, VowTools} from '@agoric/vow'
|
|
15
|
-
* @import {AsyncFlow} from '../src/async-flow.js'
|
|
16
14
|
*/
|
|
17
15
|
|
|
18
16
|
const { apply } = Reflect;
|
|
@@ -23,7 +21,7 @@ const { apply } = Reflect;
|
|
|
23
21
|
*/
|
|
24
22
|
const testPlay = async (t, zone) => {
|
|
25
23
|
const vowTools = prepareVowTools(zone);
|
|
26
|
-
const { asyncFlow } =
|
|
24
|
+
const { asyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
27
25
|
vowTools,
|
|
28
26
|
});
|
|
29
27
|
|
package/test/async-flow.test.js
CHANGED
|
@@ -17,7 +17,7 @@ import { makeHeapZone } from '@agoric/zone/heap.js';
|
|
|
17
17
|
import { makeVirtualZone } from '@agoric/zone/virtual.js';
|
|
18
18
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { prepareTestAsyncFlowTools } from './_utils.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @import {AsyncFlow} from '../src/async-flow.js'
|
|
@@ -62,7 +62,7 @@ const firstLogLen = 7;
|
|
|
62
62
|
const testFirstPlay = async (t, zone) => {
|
|
63
63
|
t.log('firstPlay started');
|
|
64
64
|
const vowTools = prepareVowTools(zone);
|
|
65
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
65
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
66
66
|
vowTools,
|
|
67
67
|
});
|
|
68
68
|
const makeOrchestra = prepareOrchestra(zone);
|
|
@@ -139,8 +139,16 @@ const testFirstPlay = async (t, zone) => {
|
|
|
139
139
|
const testBadReplay = async (t, zone) => {
|
|
140
140
|
t.log('badReplay started');
|
|
141
141
|
const vowTools = prepareVowTools(zone);
|
|
142
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
142
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
143
143
|
vowTools,
|
|
144
|
+
panicHandler: e => {
|
|
145
|
+
t.throws(
|
|
146
|
+
() => {
|
|
147
|
+
throw e;
|
|
148
|
+
},
|
|
149
|
+
{ message: /^replay 3:/ },
|
|
150
|
+
);
|
|
151
|
+
},
|
|
144
152
|
});
|
|
145
153
|
prepareOrchestra(zone);
|
|
146
154
|
const { when } = vowTools;
|
|
@@ -206,7 +214,7 @@ const testBadReplay = async (t, zone) => {
|
|
|
206
214
|
const testGoodReplay = async (t, zone) => {
|
|
207
215
|
t.log('goodReplay started');
|
|
208
216
|
const vowTools = prepareVowTools(zone);
|
|
209
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
217
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
210
218
|
vowTools,
|
|
211
219
|
});
|
|
212
220
|
prepareOrchestra(zone, 2); // Note change in new behavior
|
|
@@ -310,7 +318,7 @@ const testGoodReplay = async (t, zone) => {
|
|
|
310
318
|
const testAfterPlay = async (t, zone) => {
|
|
311
319
|
t.log('testAfterPlay started');
|
|
312
320
|
const vowTools = prepareVowTools(zone);
|
|
313
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
321
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
314
322
|
vowTools,
|
|
315
323
|
});
|
|
316
324
|
prepareOrchestra(zone);
|
package/test/bad-host.test.js
CHANGED
|
@@ -15,7 +15,7 @@ import { makeHeapZone } from '@agoric/zone/heap.js';
|
|
|
15
15
|
import { makeVirtualZone } from '@agoric/zone/virtual.js';
|
|
16
16
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { prepareTestAsyncFlowTools } from './_utils.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @import {PromiseKit} from '@endo/promise-kit'
|
|
@@ -51,8 +51,16 @@ const prepareBadHost = zone =>
|
|
|
51
51
|
const testBadHostFirstPlay = async (t, zone) => {
|
|
52
52
|
t.log('badHost firstPlay started');
|
|
53
53
|
const vowTools = prepareVowTools(zone);
|
|
54
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
54
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
55
55
|
vowTools,
|
|
56
|
+
panicHandler: e => {
|
|
57
|
+
t.throws(
|
|
58
|
+
() => {
|
|
59
|
+
throw e;
|
|
60
|
+
},
|
|
61
|
+
{ message: '[3]: [0]: cannot yet send guest promises "[Promise]"' },
|
|
62
|
+
);
|
|
63
|
+
},
|
|
56
64
|
});
|
|
57
65
|
const makeBadHost = prepareBadHost(zone);
|
|
58
66
|
const { makeVowKit } = vowTools;
|
|
@@ -103,6 +111,8 @@ const testBadHostFirstPlay = async (t, zone) => {
|
|
|
103
111
|
// Notice that the bad call was not recorded in the log
|
|
104
112
|
]);
|
|
105
113
|
t.log('badHost firstPlay done');
|
|
114
|
+
// Allow panicHandler to be called.
|
|
115
|
+
await eventLoopIteration();
|
|
106
116
|
};
|
|
107
117
|
|
|
108
118
|
/**
|
|
@@ -112,7 +122,7 @@ const testBadHostFirstPlay = async (t, zone) => {
|
|
|
112
122
|
const testBadHostReplay1 = async (t, zone) => {
|
|
113
123
|
t.log('badHost replay1 started');
|
|
114
124
|
const vowTools = prepareVowTools(zone);
|
|
115
|
-
const { asyncFlow, adminAsyncFlow } =
|
|
125
|
+
const { asyncFlow, adminAsyncFlow } = prepareTestAsyncFlowTools(t, zone, {
|
|
116
126
|
vowTools,
|
|
117
127
|
});
|
|
118
128
|
prepareBadHost(zone);
|