1414 */
1515
1616import { beforeAll , beforeEach , describe , it } from "@executablemd/test-support/bdd" ;
17- import { journalBeforeEach } from "@executablemd/test-support/failure-journal" ;
17+ import { journalBeforeEach , useJournalStream } from "@executablemd/test-support/failure-journal" ;
1818import { expect } from "@executablemd/test-support/expect" ;
1919import { race , scoped , sleep , until as untilResolved , useScope , withResolvers } from "effection" ;
2020import type { Operation , Result , Stream } from "effection" ;
@@ -474,8 +474,8 @@ function installations(): readonly ExecutionInstallation[] {
474474 return [ { components : agentIdentityComponents ( ) } ] ;
475475}
476476
477- function execution ( ) : ReplExecution {
478- return { id : "agent-interface" , stream : new InMemoryStream ( [ ] ) } ;
477+ function execution ( stream : InMemoryStream ) : ReplExecution {
478+ return { id : "agent-interface" , stream } ;
479479}
480480
481481/** The session, or the refusal that means there is nothing to drive. */
@@ -935,27 +935,29 @@ function* asking(
935935 script : Record < string , Script > ,
936936 permissionMode : PermissionMode = "approve-reads" ,
937937 source : string = THREE_SPAWNS ,
938- holder = execution ( ) ,
938+ holder ?: ReplExecution ,
939939) : Operation < {
940940 readonly session : ReplSession ;
941941 readonly stub : Stub ;
942942 readonly holder : ReplExecution ;
943943} > {
944+ const actualHolder = holder ?? execution ( yield * useJournalStream ( INLINE_SOURCE_PATH ) ) ;
944945 const stub = createStub ( script ) ;
945946 yield * useStub ( stub ) ;
946947 const session = granted (
947948 yield * submitReplEntry ( {
948- execution : holder ,
949+ execution : actualHolder ,
949950 installations : installations ( ) ,
950951 generated : ordinaryGeneratedSelection ( ) ,
951952 permissionMode,
952953 source,
953954 } ) ,
954955 ) ;
955- return { session, stub, holder } ;
956+ return { session, stub, holder : actualHolder } ;
956957}
957958
958959describe ( "U1 — one chronology, filtered, undisturbed by the background" , ( ) => {
960+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
959961 beforeAll ( ( ) => useTempFileCompiler ( ) ) ;
960962
961963 it ( "U1: retained, streaming and queued turns show together, in scheduling order" , ( ) =>
@@ -3518,6 +3520,7 @@ function onePromptAt(text: string): string {
35183520}
35193521
35203522describe ( "U1 — a row's rectangle does not bound its text (#875 R1)" , ( ) => {
3523+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
35213524 beforeAll ( ( ) => useTempFileCompiler ( ) ) ;
35223525
35233526 /** A prompt longer than any sidebar this product draws. */
@@ -3578,11 +3581,12 @@ describe("U1 — a row's rectangle does not bound its text (#875 R1)", () => {
35783581
35793582describe ( "U9 — two entries whose Prompts share one durable name" , ( ) => {
35803583 beforeAll ( ( ) => useTempFileCompiler ( ) ) ;
3584+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
35813585
35823586 it ( "U9: each entry's turn shows once and resolves to its own record" , function * ( ) {
35833587 const stub = createStub ( { two : { unrecorded : true } } ) ;
35843588 yield * useStub ( stub ) ;
3585- const holder = execution ( ) ;
3589+ const holder = execution ( yield * useJournalStream ( INLINE_SOURCE_PATH ) ) ;
35863590 const session = granted (
35873591 yield * submitReplEntry ( {
35883592 execution : holder ,
@@ -3676,6 +3680,7 @@ function* catalogLabel(view: ReplView, entry: string): Operation<string> {
36763680
36773681describe ( "EU1 — selecting an entry moves the transcript locus and nothing else" , ( ) => {
36783682 beforeAll ( ( ) => useTempFileCompiler ( ) ) ;
3683+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
36793684
36803685 /** Two entries, each with one recorded turn in one provider conversation. */
36813686 function * twoRecordedEntries ( ) : Operation < {
@@ -3685,7 +3690,7 @@ describe("EU1 — selecting an entry moves the transcript locus and nothing else
36853690 } > {
36863691 const stub = createStub ( { two : { unrecorded : true } } ) ;
36873692 yield * useStub ( stub ) ;
3688- const holder = execution ( ) ;
3693+ const holder = execution ( yield * useJournalStream ( INLINE_SOURCE_PATH ) ) ;
36893694 const session = granted (
36903695 yield * submitReplEntry ( {
36913696 execution : holder ,
@@ -4049,6 +4054,7 @@ describe("EU1 — selecting an entry moves the transcript locus and nothing else
40494054 */
40504055describe ( "U2 — a pending permission announces itself without taking the screen" , ( ) => {
40514056 beforeAll ( ( ) => useTempFileCompiler ( ) ) ;
4057+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
40524058
40534059 it ( "UI14: the frame says a permission waits in Sessions, and changes no route or focus" , function * ( ) {
40544060 const { session } = yield * asking ( {
@@ -4282,6 +4288,7 @@ describe("U2 — a draft outlives a permission and is still editable", () => {
42824288 * Both profiles, because wide-only evidence is what let the medium case through.
42834289 */
42844290describe ( "Tier BP4 — the widened sidebar holds its longest rows whole" , ( ) => {
4291+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
42854292 /** The longest state this product writes for a turn, and the widest control. */
42864293 const LONGEST_STATE = "completed, not recorded yet" ;
42874294 const FILTERED = "All conversations (filtered)" ;
@@ -4362,6 +4369,7 @@ describe("Tier BP4 — the widened sidebar holds its longest rows whole", () =>
43624369
43634370describe ( "PV2: Transcript groups and logical reveal" , ( ) => {
43644371 beforeAll ( ( ) => useTempFileCompiler ( ) ) ;
4372+ beforeEach ( journalBeforeEach ( OWNER ) ) ;
43654373 it ( "choices and a permission child contain arrows; hidden turns mount only when revealed" , function * ( ) {
43664374 const scripts = Object . fromEntries (
43674375 Array . from ( { length : 10 } , ( _ , at ) : [ string , Script ] => [
0 commit comments