@@ -9,14 +9,10 @@ import { describe, expect, it, vi } from "vitest";
99import {
1010 GATEWAY_READY_OUTPUT_MAX_CHARS ,
1111 MEMORY_SEARCH_PROBE_QUERY ,
12- MEMORY_SEARCH_RESPONSE_MAX_BYTES ,
1312 classifyMemorySearchInvokeResponse ,
1413 hasChildExited ,
1514 invokeMemorySearch ,
1615 parseArgs ,
17- parseNonNegativeInteger ,
18- readBoundedResponseText ,
19- readPositiveNumber ,
2016 stopGatewayWithRuntime ,
2117 updateGatewayReadyOutputState ,
2218 waitForGatewayReady ,
@@ -41,23 +37,6 @@ async function listen(server: Server): Promise<number> {
4137}
4238
4339describe ( "check-memory-fd-repro" , ( ) => {
44- it ( "parses file, fd, and timing limits as strict integers" , ( ) => {
45- expect ( parseNonNegativeInteger ( "0" , "limit" ) ) . toBe ( 0 ) ;
46- expect ( parseNonNegativeInteger ( " 42 " , "limit" ) ) . toBe ( 42 ) ;
47- expect ( readPositiveNumber ( "1" , "limit" ) ) . toBe ( 1 ) ;
48-
49- expect ( ( ) => parseNonNegativeInteger ( "1.5" , "limit" ) ) . toThrow (
50- "limit must be a non-negative integer" ,
51- ) ;
52- expect ( ( ) => parseNonNegativeInteger ( "1e3" , "limit" ) ) . toThrow (
53- "limit must be a non-negative integer" ,
54- ) ;
55- expect ( ( ) => parseNonNegativeInteger ( "10files" , "limit" ) ) . toThrow (
56- "limit must be a non-negative integer" ,
57- ) ;
58- expect ( ( ) => readPositiveNumber ( "0" , "limit" ) ) . toThrow ( "limit must be greater than 0" ) ;
59- } ) ;
60-
6140 it ( "rejects loose numeric environment limits before generating files" , ( ) => {
6241 expect (
6342 withEnv (
@@ -384,44 +363,4 @@ describe("check-memory-fd-repro", () => {
384363 expect ( state . readySeen ) . toBe ( true ) ;
385364 expect ( state . tail ) . toBe ( "w output" ) ;
386365 } ) ;
387-
388- it ( "reads memory_search response bodies under the byte cap" , async ( ) => {
389- await expect (
390- readBoundedResponseText (
391- new Response ( "ok" ) ,
392- "memory_search" ,
393- MEMORY_SEARCH_RESPONSE_MAX_BYTES ,
394- ) ,
395- ) . resolves . toBe ( "ok" ) ;
396- } ) ;
397-
398- it ( "rejects oversized memory_search response bodies from content-length" , async ( ) => {
399- const response = new Response ( "ignored" , {
400- headers : { "content-length" : String ( MEMORY_SEARCH_RESPONSE_MAX_BYTES + 1 ) } ,
401- } ) ;
402-
403- await expect (
404- readBoundedResponseText ( response , "memory_search" , MEMORY_SEARCH_RESPONSE_MAX_BYTES ) ,
405- ) . rejects . toThrow (
406- `memory_search response body exceeded ${ MEMORY_SEARCH_RESPONSE_MAX_BYTES } bytes` ,
407- ) ;
408- } ) ;
409-
410- it ( "stops reading memory_search response streams after the byte cap" , async ( ) => {
411- const chunk = new Uint8Array ( MEMORY_SEARCH_RESPONSE_MAX_BYTES + 1 ) ;
412- const response = new Response (
413- new ReadableStream ( {
414- start ( controller ) {
415- controller . enqueue ( chunk ) ;
416- controller . close ( ) ;
417- } ,
418- } ) ,
419- ) ;
420-
421- await expect (
422- readBoundedResponseText ( response , "memory_search" , MEMORY_SEARCH_RESPONSE_MAX_BYTES ) ,
423- ) . rejects . toThrow (
424- `memory_search response body exceeded ${ MEMORY_SEARCH_RESPONSE_MAX_BYTES } bytes` ,
425- ) ;
426- } ) ;
427366} ) ;
0 commit comments