@@ -86,17 +86,42 @@ describe("evaluateChannelHealth", () => {
8686 expect ( evaluation ) . toEqual ( { healthy : false , reason : "stuck" } ) ;
8787 } ) ;
8888
89- it ( "flags a hung run as stuck once its start ages past the threshold despite a fresh heartbeat" , ( ) => {
89+ it ( "flags a hung run masking a disconnected transport as stuck despite a fresh heartbeat" , ( ) => {
9090 const now = 30 * 60_000 ;
9191 const evaluation = evaluateHealth (
9292 activeRunAccount ( now - 1_000 , {
93+ connected : false ,
9394 activeRunStartedAt : now - 26 * 60_000 ,
9495 } ) ,
9596 { now } ,
9697 ) ;
9798 expect ( evaluation ) . toEqual ( { healthy : false , reason : "stuck" } ) ;
9899 } ) ;
99100
101+ it ( "keeps a connected run healthy past the threshold while its heartbeat stays fresh" , ( ) => {
102+ const now = 30 * 60_000 ;
103+ const evaluation = evaluateHealth (
104+ activeRunAccount ( now - 1_000 , {
105+ connected : true ,
106+ activeRunStartedAt : now - 26 * 60_000 ,
107+ } ) ,
108+ { now } ,
109+ ) ;
110+ expect ( evaluation ) . toEqual ( { healthy : true , reason : "busy" } ) ;
111+ } ) ;
112+
113+ it ( "keeps a run without transport reporting healthy past the threshold while its heartbeat stays fresh" , ( ) => {
114+ const now = 30 * 60_000 ;
115+ const evaluation = evaluateHealth (
116+ activeRunAccount ( now - 1_000 , {
117+ connected : undefined ,
118+ activeRunStartedAt : now - 26 * 60_000 ,
119+ } ) ,
120+ { now } ,
121+ ) ;
122+ expect ( evaluation ) . toEqual ( { healthy : true , reason : "busy" } ) ;
123+ } ) ;
124+
100125 it ( "keeps a short-lived run healthy when both start and activity are recent" , ( ) => {
101126 const now = 30 * 60_000 ;
102127 const evaluation = evaluateHealth (
0 commit comments