@@ -164,14 +164,6 @@ function writtenHtml(): string {
164164 return value ;
165165}
166166
167- function sessionDataFromHtml ( html : string ) : Record < string , unknown > {
168- const match = html . match ( / i d = " s e s s i o n - d a t a " [ ^ > ] * > ( [ ^ < ] + ) < / ) ;
169- if ( ! match ) {
170- throw new Error ( "Expected session-data script in exported HTML" ) ;
171- }
172- return JSON . parse ( Buffer . from ( match [ 1 ] . trim ( ) , "base64" ) . toString ( "utf-8" ) ) ;
173- }
174-
175167describe ( "buildExportSessionReply" , ( ) => {
176168 afterEach ( ( ) => {
177169 vi . useRealTimers ( ) ;
@@ -369,54 +361,4 @@ describe("buildExportSessionReply", () => {
369361 ) ;
370362 expect ( reply . text ) . not . toMatch ( / U n e x p e c t e d | S y n t a x E r r o r | p o s i t i o n / i) ;
371363 } ) ;
372-
373- it ( "warns when the session only contains user messages (backend-delegated transcript)" , async ( ) => {
374- hoisted . sessionTranscriptContent = [
375- JSON . stringify ( { type : "session" , version : 3 , id : "session-1" } ) ,
376- JSON . stringify ( {
377- type : "message" ,
378- id : "entry-1" ,
379- timestamp : "2026-05-16T00:00:00.000Z" ,
380- message : { role : "user" , content : "hello" } ,
381- } ) ,
382- JSON . stringify ( {
383- type : "message" ,
384- id : "entry-2" ,
385- timestamp : "2026-05-16T00:00:01.000Z" ,
386- message : { role : "user" , content : "world" } ,
387- } ) ,
388- ] . join ( "\n" ) ;
389-
390- const reply = await buildExportSessionReply ( makeParams ( ) ) ;
391-
392- expect ( reply . text ) . toContain ( "backend runtime" ) ;
393- expect ( reply . text ) . toContain ( "not included in this export" ) ;
394- const data = sessionDataFromHtml ( writtenHtml ( ) ) ;
395- expect ( typeof data . warning ) . toBe ( "string" ) ;
396- expect ( data . warning ) . toContain ( "backend runtime" ) ;
397- } ) ;
398-
399- it ( "does not warn when the transcript includes assistant messages" , async ( ) => {
400- hoisted . sessionTranscriptContent = [
401- JSON . stringify ( { type : "session" , version : 3 , id : "session-1" } ) ,
402- JSON . stringify ( {
403- type : "message" ,
404- id : "entry-1" ,
405- timestamp : "2026-05-16T00:00:00.000Z" ,
406- message : { role : "user" , content : "hello" } ,
407- } ) ,
408- JSON . stringify ( {
409- type : "message" ,
410- id : "entry-2" ,
411- timestamp : "2026-05-16T00:00:01.000Z" ,
412- message : { role : "assistant" , content : "hi" } ,
413- } ) ,
414- ] . join ( "\n" ) ;
415-
416- const reply = await buildExportSessionReply ( makeParams ( ) ) ;
417-
418- expect ( reply . text ) . not . toContain ( "backend runtime" ) ;
419- expect ( reply . text ) . not . toContain ( "not included in this export" ) ;
420- expect ( sessionDataFromHtml ( writtenHtml ( ) ) . warning ) . toBeUndefined ( ) ;
421- } ) ;
422364} ) ;
0 commit comments