@@ -359,82 +359,74 @@ describe("CL-8979 large-file pagination", () => {
359359 expect ( String ( res . content ) ) . not . toContain ( "scan limit" ) ;
360360 } ) ;
361361
362- test (
363- "chains plain path+offset continuation on one path through to the last line" ,
364- async ( ) => {
365- const name = "cl8979-chain.txt" ;
366- await bigFixture ( name ) ;
367- const run = chainRunner ( ) ;
368- const collected : string [ ] = [ ] ;
369- let offset = 0 ;
370- let hops = 0 ;
371- for ( ; ; ) {
372- const result = await run ( `chain-${ hops } ` , {
373- path : name ,
374- limit : 200 ,
375- offset,
376- } ) ;
377- hops += 1 ;
378- const content = String ( result . content ) ;
379- expect ( result . isError ) . toBeFalsy ( ) ;
380- expect ( content ) . not . toContain ( "scan limit" ) ;
381- collected . push ( ...bodyRows ( content ) ) ;
382- const next = continueOffset ( content ) ;
383- if ( next === null ) break ;
384- offset = next ;
385- expect ( hops ) . toBeLessThan ( 2000 ) ;
386- }
387- expect ( hops ) . toBeGreaterThan ( 1 ) ;
388- expect ( collected . length ) . toBe ( BIG_LINES ) ;
389- expect ( collected ) . toEqual (
390- Array . from ( { length : BIG_LINES } , ( _ , i ) => bigRow ( i ) ) ,
391- ) ;
392- } ,
393- 120_000 ,
394- ) ;
395-
396- test (
397- "chains cursor resumption on a blob past the scan ceiling without re-scanning" ,
398- async ( ) => {
399- const rows = Array . from ( { length : BIG_LINES } , ( _ , i ) => bigRow ( i ) ) ;
400- const bytes = new TextEncoder ( ) . encode ( `${ rows . join ( "\n" ) } \n` ) ;
401- const run = blobChainRunner ( async ( key ) => {
402- if ( key === "cl8979-blob" ) return bytes ;
403- throw new Error ( `missing ${ key } ` ) ;
362+ test ( "chains plain path+offset continuation on one path through to the last line" , async ( ) => {
363+ const name = "cl8979-chain.txt" ;
364+ await bigFixture ( name ) ;
365+ const run = chainRunner ( ) ;
366+ const collected : string [ ] = [ ] ;
367+ let offset = 0 ;
368+ let hops = 0 ;
369+ for ( ; ; ) {
370+ const result = await run ( `chain-${ hops } ` , {
371+ path : name ,
372+ limit : 200 ,
373+ offset,
404374 } ) ;
405- const collected : string [ ] = [ ] ;
406- let path = "tool-output:///cl8979-blob" ;
407- let hops = 0 ;
408- let sawOffsetFooter = false ;
409- let sawCursorAlias = false ;
410- for ( ; ; ) {
411- const result = await run ( `blob-${ hops } ` , { path, limit : 200 } ) ;
412- hops += 1 ;
413- const content = String ( result . content ) ;
414- expect ( result . isError ) . toBeFalsy ( ) ;
415- expect ( content ) . not . toContain ( "scan limit" ) ;
416- collected . push ( ...bodyRows ( content ) ) ;
417- const cursor = / U s e p a t h = " ( t o o l - o u t p u t : \/ \/ \/ [ ^ " ] + ) " / . exec ( content ) ;
418- const offset = continueOffset ( content ) ;
419- if ( offset !== null ) {
420- sawOffsetFooter = true ;
421- path = "tool-output:///cl8979-blob" ;
422- }
423- if ( cursor !== null ) {
424- sawCursorAlias = true ;
425- path = cursor [ 1 ] as string ;
426- }
427- if ( offset === null && cursor === null ) break ;
428- expect ( hops ) . toBeLessThan ( 2000 ) ;
375+ hops += 1 ;
376+ const content = String ( result . content ) ;
377+ expect ( result . isError ) . toBeFalsy ( ) ;
378+ expect ( content ) . not . toContain ( "scan limit" ) ;
379+ collected . push ( ...bodyRows ( content ) ) ;
380+ const next = continueOffset ( content ) ;
381+ if ( next === null ) break ;
382+ offset = next ;
383+ expect ( hops ) . toBeLessThan ( 2000 ) ;
384+ }
385+ expect ( hops ) . toBeGreaterThan ( 1 ) ;
386+ expect ( collected . length ) . toBe ( BIG_LINES ) ;
387+ expect ( collected ) . toEqual (
388+ Array . from ( { length : BIG_LINES } , ( _ , i ) => bigRow ( i ) ) ,
389+ ) ;
390+ } , 120_000 ) ;
391+
392+ test ( "chains cursor resumption on a blob past the scan ceiling without re-scanning" , async ( ) => {
393+ const rows = Array . from ( { length : BIG_LINES } , ( _ , i ) => bigRow ( i ) ) ;
394+ const bytes = new TextEncoder ( ) . encode ( `${ rows . join ( "\n" ) } \n` ) ;
395+ const run = blobChainRunner ( async ( key ) => {
396+ if ( key === "cl8979-blob" ) return bytes ;
397+ throw new Error ( `missing ${ key } ` ) ;
398+ } ) ;
399+ const collected : string [ ] = [ ] ;
400+ let path = "tool-output:///cl8979-blob" ;
401+ let hops = 0 ;
402+ let sawOffsetFooter = false ;
403+ let sawCursorAlias = false ;
404+ for ( ; ; ) {
405+ const result = await run ( `blob-${ hops } ` , { path, limit : 200 } ) ;
406+ hops += 1 ;
407+ const content = String ( result . content ) ;
408+ expect ( result . isError ) . toBeFalsy ( ) ;
409+ expect ( content ) . not . toContain ( "scan limit" ) ;
410+ collected . push ( ...bodyRows ( content ) ) ;
411+ const cursor = / U s e p a t h = " ( t o o l - o u t p u t : \/ \/ \/ [ ^ " ] + ) " / . exec ( content ) ;
412+ const offset = continueOffset ( content ) ;
413+ if ( offset !== null ) {
414+ sawOffsetFooter = true ;
415+ path = "tool-output:///cl8979-blob" ;
429416 }
430- expect ( hops ) . toBeGreaterThan ( 1 ) ;
431- expect ( sawOffsetFooter ) . toBe ( true ) ;
432- expect ( sawCursorAlias ) . toBe ( true ) ;
433- expect ( collected . length ) . toBe ( BIG_LINES ) ;
434- expect ( collected [ BIG_LINES - 1 ] ) . toBe ( bigRow ( BIG_LINES - 1 ) ) ;
435- } ,
436- 120_000 ,
437- ) ;
417+ if ( cursor !== null ) {
418+ sawCursorAlias = true ;
419+ path = cursor [ 1 ] as string ;
420+ }
421+ if ( offset === null && cursor === null ) break ;
422+ expect ( hops ) . toBeLessThan ( 2000 ) ;
423+ }
424+ expect ( hops ) . toBeGreaterThan ( 1 ) ;
425+ expect ( sawOffsetFooter ) . toBe ( true ) ;
426+ expect ( sawCursorAlias ) . toBe ( true ) ;
427+ expect ( collected . length ) . toBe ( BIG_LINES ) ;
428+ expect ( collected [ BIG_LINES - 1 ] ) . toBe ( bigRow ( BIG_LINES - 1 ) ) ;
429+ } , 120_000 ) ;
438430
439431 test ( "windows an overlong single file line so the tail is reachable" , async ( ) => {
440432 const payload = `HEAD-${ "y" . repeat ( 100_000 ) } -TAIL` ;
0 commit comments