1414 * looks at.
1515 */
1616
17- import { describe , it } from "@executablemd/test-support/bdd" ;
17+ import { beforeEach , describe , it } from "@executablemd/test-support/bdd" ;
1818import { expect } from "@executablemd/test-support/expect" ;
19+ import { journalBeforeEach , useJournalStream } from "@executablemd/test-support/failure-journal" ;
1920import { ensure , resource , scoped , spawn , suspend , until , withResolvers } from "effection" ;
2021import type { Operation , Result } from "effection" ;
2122import { exists , writeTextFile } from "@effectionx/fs" ;
@@ -755,6 +756,7 @@ const QUESTION =
755756 '<Elicit schema={{ type: "object", properties: { decision: { type: "string" } }, required: ["decision"], additionalProperties: false }} as="answer">Continue?</Elicit>' ;
756757
757758describe ( "how a REPL entry gets its issues" , ( ) => {
759+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
758760 it ( "E1: composes public middleware once, under the key the request itself names" , ( ) =>
759761 captureReplEntry (
760762 {
@@ -844,7 +846,7 @@ describe("how a REPL entry gets its issues", () => {
844846 QUESTION ,
845847 ] . join ( "\n" ) ;
846848
847- const first = execution ( "execution-1" ) ;
849+ const first = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
848850 const left = yield * submit ( fixture , two , first , {
849851 host : entryHost ( fixture , seen ) ,
850852 leave : true ,
@@ -873,7 +875,7 @@ describe("how a REPL entry gets its issues", () => {
873875
874876 // Another execution's first entry, with identical text: its own owner, its
875877 // own sites, its own issues.
876- const other = execution ( "execution-2" ) ;
878+ const other = { id : "execution-2" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
877879 yield * submit ( fixture , two , other , { host : entryHost ( fixture , seen ) , leave : true } ) ;
878880 expect ( fixture . server . issues . length ) . toBe ( 4 ) ;
879881 const everything = bodies ( fixture . server ) ;
@@ -886,7 +888,7 @@ describe("how a REPL entry gets its issues", () => {
886888 it ( "E2: a successor entry of one execution is not the entry before it" , function * ( ) : Operation < void > {
887889 const fixture = yield * useFixture ( ) ;
888890 const seen = counted ( ) ;
889- const run = execution ( "execution-1" ) ;
891+ const run = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
890892
891893 yield * scoped ( function * ( ) : Operation < void > {
892894 yield * useNodeReplHost ( run . id ) ;
@@ -918,19 +920,29 @@ describe("how a REPL entry gets its issues", () => {
918920
919921 it ( "E2: no replaceable answer moves the owner, the site or the key" , function * ( ) : Operation < void > {
920922 const fixture = yield * useFixture ( ) ;
921- const plain = yield * submit ( fixture , FILES_ONE , execution ( "execution-1" ) , {
922- host : entryHost ( fixture , counted ( ) ) ,
923- } ) ;
923+ const plain = yield * submit (
924+ fixture ,
925+ FILES_ONE ,
926+ { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ,
927+ {
928+ host : entryHost ( fixture , counted ( ) ) ,
929+ } ,
930+ ) ;
924931 expect ( plain . outcome ?. ok ) . toBe ( true ) ;
925932
926933 // The same entry of a second execution, with a middleware that rewrites
927934 // the issue it is handed. What it sends changes and what names the work
928935 // does not: the site is the same site, and only the owner differs, because
929936 // the execution does.
930- const second = yield * submit ( fixture , FILES_ONE , execution ( "execution-2" ) , {
931- host : entryHost ( fixture , counted ( ) ) ,
932- installations : [ observingChain ( { calls : [ ] } , "Rewritten" ) ] ,
933- } ) ;
937+ const second = yield * submit (
938+ fixture ,
939+ FILES_ONE ,
940+ { id : "execution-2" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ,
941+ {
942+ host : entryHost ( fixture , counted ( ) ) ,
943+ installations : [ observingChain ( { calls : [ ] } , "Rewritten" ) ] ,
944+ } ,
945+ ) ;
934946 expect ( second . outcome ?. ok ) . toBe ( true ) ;
935947
936948 const site = ( events : readonly DurableEvent [ ] ) : string | undefined =>
@@ -1069,7 +1081,7 @@ describe("how a REPL entry gets its issues", () => {
10691081 const fixture = yield * useFixture ( ) ;
10701082 const seen = counted ( ) ;
10711083 const source = [ FILES_ONE , QUESTION ] . join ( "\n" ) ;
1072- const run = execution ( "execution-1" ) ;
1084+ const run = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
10731085
10741086 const left = yield * submit ( fixture , source , run , {
10751087 host : entryHost ( fixture , seen ) ,
@@ -1204,7 +1216,7 @@ describe("how a REPL entry gets its issues", () => {
12041216
12051217 it ( "E5: a settled history installs no issue host and reaches nothing" , function * ( ) : Operation < void > {
12061218 const fixture = yield * useFixture ( ) ;
1207- const run = execution ( "execution-1" ) ;
1219+ const run = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
12081220 const ran = yield * submit ( fixture , FILES_ONE , run , { host : entryHost ( fixture , counted ( ) ) } ) ;
12091221 expect ( ran . outcome ?. ok ) . toBe ( true ) ;
12101222 const before = paths ( fixture . server ) . length ;
@@ -1295,20 +1307,31 @@ describe("how a REPL entry gets its issues", () => {
12951307
12961308 // Neither form: the entry's own implementation refuses this, which is what
12971309 // makes the next run's success evidence that a different component ran.
1298- const refused = yield * submit ( fixture , '<Issue as="local" />' , execution ( "execution-1" ) , {
1299- host : entryHost ( fixture , counted ( ) ) ,
1300- includes : [ local ] ,
1301- } ) ;
1310+ const localSource = '<Issue as="local" />' ;
1311+ const refused = yield * submit (
1312+ fixture ,
1313+ localSource ,
1314+ { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ,
1315+ {
1316+ host : entryHost ( fixture , counted ( ) ) ,
1317+ includes : [ local ] ,
1318+ } ,
1319+ ) ;
13021320 expect ( refused . outcome ?. ok ) . toBe ( false ) ;
13031321 expect ( String ( refused . outcome ?. ok === false ? refused . outcome . error . message : "" ) ) . toContain (
13041322 "either reads an issue" ,
13051323 ) ;
13061324
13071325 yield * writeTextFile ( join ( local , "Issue.md" ) , "a repository component ran\n" ) ;
1308- const overridden = yield * submit ( fixture , '<Issue as="local" />' , execution ( "execution-2" ) , {
1309- host : entryHost ( fixture , counted ( ) ) ,
1310- includes : [ local ] ,
1311- } ) ;
1326+ const overridden = yield * submit (
1327+ fixture ,
1328+ localSource ,
1329+ { id : "execution-2" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ,
1330+ {
1331+ host : entryHost ( fixture , counted ( ) ) ,
1332+ includes : [ local ] ,
1333+ } ,
1334+ ) ;
13121335
13131336 // A repository file outranks a registered default, and this one is a
13141337 // default — so the entry's implementation is not reached, files nothing and
@@ -1320,7 +1343,7 @@ describe("how a REPL entry gets its issues", () => {
13201343
13211344 it ( "E5: a frozen position installs no issue host and reaches nothing" , function * ( ) : Operation < void > {
13221345 const fixture = yield * useFixture ( ) ;
1323- const run = execution ( "execution-1" ) ;
1346+ const run = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
13241347 const passive = counted ( ) ;
13251348
13261349 const marker = yield * scoped ( function * ( ) : Operation < string > {
@@ -1380,7 +1403,7 @@ describe("how a REPL entry gets its issues", () => {
13801403 QUESTION ,
13811404 ] . join ( "\n" ) ;
13821405
1383- const run = execution ( "execution-1" ) ;
1406+ const run = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
13841407 const left = yield * submit ( fixture , source , run , {
13851408 host : entryHost ( fixture , seen ) ,
13861409 installations : [ answeringChain ( chain , ANSWERED ) ] ,
@@ -1441,7 +1464,7 @@ describe("how a REPL entry gets its issues", () => {
14411464 QUESTION ,
14421465 ] . join ( "\n" ) ;
14431466
1444- const run = execution ( "execution-1" ) ;
1467+ const run = { id : "execution-1" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ;
14451468 const left = yield * submit ( fixture , source , run , {
14461469 host : entryHost ( fixture , seen ) ,
14471470 leave : true ,
@@ -1605,7 +1628,10 @@ describe("how a REPL entry gets its issues", () => {
16051628
16061629 // No entry host: `<Issue>` is still declared by the Plugin for this
16071630 // command, and reaching it is the ordinary missing-provider refusal.
1608- const without = yield * submit ( fixture , FILES_ONE , execution ( "execution-1" ) ) ;
1631+ const without = yield * submit ( fixture , FILES_ONE , {
1632+ id : "execution-1" ,
1633+ stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) ,
1634+ } ) ;
16091635 expect ( without . outcome ?. ok ) . toBe ( false ) ;
16101636 expect ( String ( without . outcome ?. ok === false ? without . outcome . error . message : "" ) ) . toContain (
16111637 "no Issue provider is installed" ,
@@ -1615,9 +1641,14 @@ describe("how a REPL entry gets its issues", () => {
16151641
16161642 // With one, the entry's own implementation answers instead — one retained
16171643 // record, and one issue at the tracker.
1618- const with_ = yield * submit ( fixture , FILES_ONE , execution ( "execution-2" ) , {
1619- host : entryHost ( fixture , seen ) ,
1620- } ) ;
1644+ const with_ = yield * submit (
1645+ fixture ,
1646+ FILES_ONE ,
1647+ { id : "execution-2" , stream : yield * useJournalStream ( INLINE_SOURCE_PATH ) } ,
1648+ {
1649+ host : entryHost ( fixture , seen ) ,
1650+ } ,
1651+ ) ;
16211652 expect ( with_ . outcome ?. ok ) . toBe ( true ) ;
16221653 expect ( issueRecords ( with_ . events ) . length ) . toBe ( 1 ) ;
16231654 expect ( urls ( with_ . events ) ) . toEqual ( [ `${ TRACKER } /issues/1` ] ) ;
0 commit comments