@@ -444,9 +444,8 @@ describe("Tier EP — the execution protocol", () => {
444444
445445 const run = ( doc : string ) =>
446446 function * ( ) : Operation < string > {
447- return String (
448- yield * collect ( yield * execute ( { ...inlineSource ( doc ) , stream : new InMemoryStream ( ) } ) ) ,
449- ) ;
447+ const stream = yield * useJournalStream ( "<eval>" ) ;
448+ return String ( yield * collect ( yield * execute ( { ...inlineSource ( doc ) , stream } ) ) ) ;
450449 } ;
451450 const first = yield * spawn ( run ( "# First\n" ) ) ;
452451 const second = yield * spawn ( run ( "# Second\n" ) ) ;
@@ -598,7 +597,7 @@ describe("Tier EP — the execution protocol", () => {
598597 }
599598
600599 const execution = yield * executeInstalled (
601- { ...inlineSource ( scenario . doc ) , stream : new InMemoryStream ( ) } ,
600+ { ...inlineSource ( scenario . doc ) , stream : yield * useJournalStream ( "<eval>" ) } ,
602601 [
603602 {
604603 * install ( ) : Operation < void > {
@@ -625,18 +624,16 @@ describe("Tier EP — the execution protocol", () => {
625624 yield * scoped ( function * ( ) {
626625 const run = ( name : string ) =>
627626 function * ( ) : Operation < void > {
628- const execution = yield * executeInstalled (
629- { ...inlineSource ( DOC ) , stream : new InMemoryStream ( ) } ,
630- [
631- {
632- * install ( ) : Operation < void > {
633- yield * ensure ( ( ) => {
634- finalized . push ( name ) ;
635- } ) ;
636- } ,
627+ const stream = yield * useJournalStream ( "<eval>" ) ;
628+ const execution = yield * executeInstalled ( { ...inlineSource ( DOC ) , stream } , [
629+ {
630+ * install ( ) : Operation < void > {
631+ yield * ensure ( ( ) => {
632+ finalized . push ( name ) ;
633+ } ) ;
637634 } ,
638- ] ,
639- ) ;
635+ } ,
636+ ] ) ;
640637 yield * execution ;
641638 } ;
642639 const first = yield * spawn ( run ( "first" ) ) ;
@@ -864,14 +861,15 @@ describe("Tier EP — the execution protocol", () => {
864861 // public chain finishes, and each one materially affects execution — so the
865862 // accepted snapshot is what the assertions read, not the edited original.
866863 it ( "EP26: the accepted options are a detached snapshot" , function * ( ) {
864+ const stream = yield * useJournalStream ( "<eval>" ) ;
867865 // Control: replacing the same fields *before* delegating still works.
868866 const replaced = yield * scoped ( function * ( ) {
869867 yield * Execution . around ( {
870868 * execute ( [ request ] , next ) {
871869 yield * next ( request . withOptions ( { ...request . options , ...inlineSource ( "# Control\n" ) } ) ) ;
872870 } ,
873871 } ) ;
874- return yield * collect ( yield * execute ( { ...inlineSource ( DOC ) , stream : new InMemoryStream ( ) } ) ) ;
872+ return yield * collect ( yield * execute ( { ...inlineSource ( DOC ) , stream } ) ) ;
875873 } ) ;
876874 expect ( String ( replaced ) ) . toContain ( "Control" ) ;
877875
@@ -1082,7 +1080,7 @@ describe("Tier EP — the execution protocol", () => {
10821080 } ) ;
10831081 }
10841082 const execution = yield * executeInstalled (
1085- { ...inlineSource ( DOC ) , stream : new InMemoryStream ( ) } ,
1083+ { ...inlineSource ( DOC ) , stream : yield * useJournalStream ( "<eval>" ) } ,
10861084 [
10871085 {
10881086 * install ( ) : Operation < void > {
@@ -1516,7 +1514,7 @@ describe("Tier EP — the execution protocol", () => {
15161514 yield * scoped ( function * ( ) {
15171515 const retained : InvocationObservers = { observed : ( ) => seen . push ( "observed:A" ) } ;
15181516 const replaced = yield * executeObserved (
1519- { ...inlineSource ( DOC ) , stream : new InMemoryStream ( ) } ,
1517+ { ...inlineSource ( DOC ) , stream : yield * useJournalStream ( "<eval>" ) } ,
15201518 [ ] ,
15211519 retained ,
15221520 ) ;
@@ -1542,9 +1540,10 @@ describe("Tier EP — the execution protocol", () => {
15421540 } ,
15431541 } ) ;
15441542
1545- const start = ( name : string , observing : { resolve ( ) : void } ) =>
1546- executeObserved (
1547- { ...inlineSource ( DOC ) , stream : new InMemoryStream ( ) } ,
1543+ function * start ( name : string , observing : { resolve ( ) : void } ) {
1544+ const stream = yield * useJournalStream ( "<eval>" ) ;
1545+ return yield * executeObserved (
1546+ { ...inlineSource ( DOC ) , stream } ,
15481547 [
15491548 {
15501549 * install ( ) : Operation < void > {
@@ -1561,6 +1560,7 @@ describe("Tier EP — the execution protocol", () => {
15611560 } ,
15621561 } ,
15631562 ) ;
1563+ }
15641564
15651565 const first = yield * start ( "first" , observingFirst ) ;
15661566 yield * reachedFirst . operation ;
@@ -1859,6 +1859,7 @@ describe("Tier EP — the execution protocol", () => {
18591859 * and none of those may decide what the document was.
18601860 */
18611861describe ( "Tier DP — the document protocol" , ( ) => {
1862+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
18621863 /** `<Mutate />` — edits the caller's own containers while the document runs. */
18631864 function useMutate ( edit : ( ) => void ) : Operation < void > {
18641865 return registerComponents ( [
@@ -2155,6 +2156,7 @@ describe("Tier DP — the document protocol", () => {
21552156
21562157 function side ( index : number ) : Operation < string > {
21572158 return scoped ( function * ( ) {
2159+ const stream = yield * useJournalStream ( "<eval>" ) ;
21582160 yield * useMark ( expanded ) ;
21592161 yield * Execution . around ( {
21602162 * document ( [ request ] , next ) {
@@ -2165,11 +2167,7 @@ describe("Tier DP — the document protocol", () => {
21652167 yield * next ( request ) ;
21662168 } ,
21672169 } ) ;
2168- return String (
2169- yield * collect (
2170- yield * execute ( { ...inlineSource ( "<Mark />\n" ) , stream : new InMemoryStream ( ) } ) ,
2171- ) ,
2172- ) ;
2170+ return String ( yield * collect ( yield * execute ( { ...inlineSource ( "<Mark />\n" ) , stream } ) ) ) ;
21732171 } ) ;
21742172 }
21752173
@@ -2292,6 +2290,7 @@ describe("Tier DP — the document protocol", () => {
22922290 ] . join ( "\n" ) ;
22932291
22942292 const captured : Array < Record < string , Json > > = [ ] ;
2293+ const stream = yield * useJournalStream ( "<eval>" ) ;
22952294 const output = yield * scoped ( function * ( ) {
22962295 yield * registerComponents ( [
22972296 {
@@ -2310,9 +2309,7 @@ describe("Tier DP — the document protocol", () => {
23102309 yield * next ( request . withProps ( props ) ) ;
23112310 } ,
23122311 } ) ;
2313- return String (
2314- yield * collect ( yield * execute ( { ...inlineSource ( source ) , stream : new InMemoryStream ( ) } ) ) ,
2315- ) ;
2312+ return String ( yield * collect ( yield * execute ( { ...inlineSource ( source ) , stream } ) ) ) ;
23162313 } ) ;
23172314
23182315 // Carried as data: not dropped, and not installed as the copy's prototype.
@@ -2334,6 +2331,7 @@ describe("Tier DP — the document protocol", () => {
23342331 } ,
23352332 ) ;
23362333
2334+ const stream = yield * useJournalStream ( "<eval>" ) ;
23372335 const output = yield * scoped ( function * ( ) {
23382336 yield * Execution . around ( {
23392337 * document ( [ request ] , next ) {
@@ -2342,9 +2340,7 @@ describe("Tier DP — the document protocol", () => {
23422340 yield * next ( request . withProps ( { } ) ) ;
23432341 } ,
23442342 } ) ;
2345- return yield * collect (
2346- yield * execute ( { ...inlineSource ( DOC ) , stream : new InMemoryStream ( ) } ) ,
2347- ) ;
2343+ return yield * collect ( yield * execute ( { ...inlineSource ( DOC ) , stream } ) ) ;
23482344 } ) ;
23492345
23502346 expect ( refusals . length ) . toEqual ( 1 ) ;
@@ -2413,6 +2409,7 @@ describe("Tier DP — the document protocol", () => {
24132409 for ( const attack of attacks ) {
24142410 const refusals : unknown [ ] = [ ] ;
24152411 const output = yield * scoped ( function * ( ) {
2412+ const stream = yield * useJournalStream ( "<eval>" ) ;
24162413 yield * useMutate ( ( ) => { } ) ;
24172414 yield * Execution . around ( {
24182415 * document ( [ request ] , next ) {
@@ -2428,11 +2425,7 @@ describe("Tier DP — the document protocol", () => {
24282425 yield * next ( current ) ;
24292426 } ,
24302427 } ) ;
2431- return String (
2432- yield * collect (
2433- yield * execute ( { ...inlineSource ( PROPS_DOC ) , stream : new InMemoryStream ( ) } ) ,
2434- ) ,
2435- ) ;
2428+ return String ( yield * collect ( yield * execute ( { ...inlineSource ( PROPS_DOC ) , stream } ) ) ) ;
24362429 } ) ;
24372430
24382431 expect ( refusals [ 0 ] ) . toBeInstanceOf ( DocumentProtocolError ) ;
@@ -2533,6 +2526,7 @@ describe("Tier DP — the document protocol", () => {
25332526
25342527 for ( const scenario of cases ) {
25352528 const result = yield * scoped ( function * ( ) {
2529+ const stream = yield * useJournalStream ( "<eval>" ) ;
25362530 if ( scenario . canonical !== undefined ) {
25372531 yield * useBoom ( scenario . canonical ) ;
25382532 }
@@ -2554,7 +2548,7 @@ describe("Tier DP — the document protocol", () => {
25542548 } ) ;
25552549 const source =
25562550 scenario . canonical !== undefined ? BOOM_DOC : scenario . failing ? FAILING_DOC : DOC ;
2557- return yield * yield * execute ( { ...inlineSource ( source ) , stream : new InMemoryStream ( ) } ) ;
2551+ return yield * yield * execute ( { ...inlineSource ( source ) , stream } ) ;
25582552 } ) ;
25592553 scenario . expect ( result ) ;
25602554 }
0 commit comments