@@ -368,32 +368,40 @@ describe("node host MCP manager", () => {
368368 } ) ;
369369
370370 it ( "isolates an oversized multi-page catalog at the accumulated byte ceiling" , async ( ) => {
371- const largeTool = {
372- ...tool ( "large" ) ,
373- inputSchema : { type : "object" as const , description : "x" . repeat ( 6 * 1024 * 1024 ) } ,
374- } ;
375- const oversized = createClient ( {
376- list : async ( params ) =>
377- params ?. cursor ? { tools : [ largeTool ] } : { tools : [ largeTool ] , nextCursor : "next" } ,
378- } ) ;
379- const healthy = createClient ( { tools : [ tool ( "search" ) ] } ) ;
380- const warn = vi . fn ( ) ;
381- const manager = await startNodeHostMcpManager (
382- { oversized : { command : "oversized" } , healthy : { command : "healthy" } } ,
383- {
384- createClient : ( serverName ) => ( serverName === "oversized" ? oversized : healthy ) ,
385- resolveTransport : ( ) => transport ,
386- warn,
387- } ,
388- ) ;
371+ // Large-page byte counting must not spend this unrelated wall-clock deadline;
372+ // the preceding case separately proves strict catalog timeout enforcement.
373+ vi . useFakeTimers ( ) ;
374+ vi . setSystemTime ( 1_000 ) ;
375+ try {
376+ const largeTool = {
377+ ...tool ( "large" ) ,
378+ inputSchema : { type : "object" as const , description : "x" . repeat ( 6 * 1024 * 1024 ) } ,
379+ } ;
380+ const oversized = createClient ( {
381+ list : async ( params ) =>
382+ params ?. cursor ? { tools : [ largeTool ] } : { tools : [ largeTool ] , nextCursor : "next" } ,
383+ } ) ;
384+ const healthy = createClient ( { tools : [ tool ( "search" ) ] } ) ;
385+ const warn = vi . fn ( ) ;
386+ const manager = await startNodeHostMcpManager (
387+ { oversized : { command : "oversized" } , healthy : { command : "healthy" } } ,
388+ {
389+ createClient : ( serverName ) => ( serverName === "oversized" ? oversized : healthy ) ,
390+ resolveTransport : ( ) => transport ,
391+ warn,
392+ } ,
393+ ) ;
389394
390- expect ( oversized . listTools ) . toHaveBeenCalledTimes ( 2 ) ;
391- expect ( oversized . close ) . toHaveBeenCalledOnce ( ) ;
392- expect ( warn ) . toHaveBeenCalledOnce ( ) ;
393- expect ( warn ) . toHaveBeenCalledWith ( expect . stringMatching ( / l i s t i n g e x c e e d e d \d + b y t e s / u) ) ;
394- expect ( manager . descriptors . map ( ( descriptor ) => descriptor . name ) ) . toEqual ( [ "healthy_search" ] ) ;
395+ expect ( oversized . listTools ) . toHaveBeenCalledTimes ( 2 ) ;
396+ expect ( oversized . close ) . toHaveBeenCalledOnce ( ) ;
397+ expect ( warn ) . toHaveBeenCalledOnce ( ) ;
398+ expect ( warn ) . toHaveBeenCalledWith ( expect . stringMatching ( / l i s t i n g e x c e e d e d \d + b y t e s / u) ) ;
399+ expect ( manager . descriptors . map ( ( descriptor ) => descriptor . name ) ) . toEqual ( [ "healthy_search" ] ) ;
395400
396- await manager . close ( ) ;
401+ await manager . close ( ) ;
402+ } finally {
403+ vi . useRealTimers ( ) ;
404+ }
397405 } ) ;
398406
399407 it ( "isolates a listing that exceeds the retained candidate ceiling" , async ( ) => {
0 commit comments