@@ -695,7 +695,7 @@ describe("minimal live Sidekick ACP attachment", () => {
695695 expect ( one . held . fake . prompts ) . toHaveLength ( one . baselineTurns + 3 ) ;
696696 } ) ;
697697
698- it ( "1006 E3/E4/E7: passive Journal reads match the component route across cold three-page navigation " , function * ( ) {
698+ it ( "1006 E3/E4/E7: passive Journal reads match component, attachment and CLI for shell pages and saved Prompt errors " , function * ( ) {
699699 const text = "A🦊" . repeat ( 7000 ) ;
700700 let launches = 0 ;
701701 const one = yield * world ( {
@@ -719,6 +719,13 @@ describe("minimal live Sidekick ACP attachment", () => {
719719 throw submitted . error ;
720720 }
721721 expect ( ( yield * submitted . value . join ( ) ) . ok ) . toBe ( false ) ;
722+ one . held . fake . script ( { reply : "partial reply" , failure : "controlled Prompt failure" } ) ;
723+ const failedPrompt = yield * one . held . session . submit ( '<Prompt text="record a failure" />' ) ;
724+ if ( ! failedPrompt . ok ) {
725+ throw failedPrompt . error ;
726+ }
727+ expect ( ( yield * failedPrompt . value . join ( ) ) . ok ) . toBe ( false ) ;
728+ expect ( one . held . session . model . entries ) . toHaveLength ( 2 ) ;
722729 const before = yield * readTextFile ( one . held . execution . stream . path ) ;
723730 const beforeChat = yield * records ( one . held . execution ) ;
724731 const calls = one . held . fake . prompts . length ;
@@ -753,6 +760,33 @@ describe("minimal live Sidekick ACP attachment", () => {
753760 ) ,
754761 ) . toEqual ( component . value ) ;
755762 }
763+ const failureQuery = ".records[] | select(.prompt == 1) | .promptError" ;
764+ const failure = yield * reads . inspectJournal ( { entry : 2 , yq : failureQuery } ) ;
765+ if ( ! failure . ok ) {
766+ throw failure . error ;
767+ }
768+ expect ( failure . value ) . toMatchObject ( { value : { message : "controlled Prompt failure" } } ) ;
769+ expect (
770+ pageSchema . parse (
771+ yield * requestAttachment ( one . path , {
772+ method : "entry" ,
773+ entry : 2 ,
774+ view : "journal" ,
775+ yq : failureQuery ,
776+ } ) ,
777+ ) ,
778+ ) . toEqual ( failure . value ) ;
779+ const reopenedFailure = yield * one . held . repository . open ( one . held . execution . id ) ;
780+ const coldFailure = yield * openReplSession ( { execution : reopenedFailure } ) ;
781+ if ( ! coldFailure . ok ) {
782+ throw coldFailure . error ;
783+ }
784+ expect (
785+ yield * rootReads ( coldFailure . value , one . held . profile ) . inspectJournal ( {
786+ entry : 2 ,
787+ yq : failureQuery ,
788+ } ) ,
789+ ) . toEqual ( failure ) ;
756790 let yq : string | null = ".records[1].exec.stdout" ;
757791 let collected = "" ;
758792 let count = 0 ;
@@ -833,6 +867,8 @@ describe("minimal live Sidekick ACP attachment", () => {
833867 expect ( Request . safeParse ( { method : "entry" , entry : 1 , view : "source" , yq : "." } ) . success ) . toBe (
834868 false ,
835869 ) ;
870+ const afterLater = yield * readTextFile ( one . held . execution . stream . path ) ;
871+ expect ( one . held . session . model . entries ) . toHaveLength ( 3 ) ;
836872 const cli = cliCommand ( [
837873 "sidekick" ,
838874 "read" ,
@@ -851,6 +887,29 @@ describe("minimal live Sidekick ACP attachment", () => {
851887 } ) . join ( ) ;
852888 expect ( actual . code ) . toBe ( 0 ) ;
853889 expect ( JSON . parse ( actual . stdout ) ) . toEqual ( { value : 1 , next : null , prev : null , last : null } ) ;
890+ const promptCli = cliCommand ( [
891+ "sidekick" ,
892+ "read" ,
893+ "--attach" ,
894+ one . path ,
895+ "entry" ,
896+ "2" ,
897+ "journal" ,
898+ "--yq" ,
899+ failureQuery ,
900+ ] ) ;
901+ const actualFailure = yield * exec ( promptCli . command , {
902+ arguments : promptCli . arguments ,
903+ cwd : one . held . workspace ,
904+ env : { HOME : one . home , PATH : process . env . PATH ?? "" , DENO_DIR : process . env . DENO_DIR ?? "" } ,
905+ } ) . join ( ) ;
906+ expect ( actualFailure . code ) . toBe ( 0 ) ;
907+ expect ( pageSchema . parse ( JSON . parse ( actualFailure . stdout ) ) ) . toEqual ( failure . value ) ;
908+ expect ( yield * readTextFile ( one . held . execution . stream . path ) ) . toBe ( afterLater ) ;
909+ expect ( one . held . session . model . entries ) . toHaveLength ( 3 ) ;
910+ expect ( one . held . fake . prompts ) . toHaveLength ( calls ) ;
911+ expect ( launches ) . toBe ( 1 ) ;
912+ expect ( yield * records ( one . held . execution ) ) . toEqual ( beforeChat ) ;
854913 } ) ;
855914
856915 it ( "A1/A3: the actual embedded provider keeps serial attachment identity and completing RPC metadata" , function * ( ) {
0 commit comments