@@ -223,102 +223,6 @@ describe("evaluateChannelHealth", () => {
223223 expect ( evaluation ) . toEqual ( { healthy : true , reason : "healthy" } ) ;
224224 } ) ;
225225
226- it ( "flags polling startups that explicitly remain disconnected after grace" , ( ) => {
227- const evaluation = evaluateChannelHealth (
228- {
229- running : true ,
230- connected : false ,
231- enabled : true ,
232- configured : true ,
233- mode : "polling" ,
234- lastStartAt : 0 ,
235- lastConnectedAt : null ,
236- lastEventAt : null ,
237- lastTransportActivityAt : null ,
238- } ,
239- {
240- channelId : "telegram" ,
241- now : 100_000 ,
242- channelConnectGraceMs : 10_000 ,
243- staleEventThresholdMs : 30_000 ,
244- } ,
245- ) ;
246- expect ( evaluation ) . toEqual ( { healthy : false , reason : "disconnected" } ) ;
247- } ) ;
248-
249- it ( "keeps polling channels healthy during the connect grace before getUpdates succeeds" , ( ) => {
250- const evaluation = evaluateChannelHealth (
251- {
252- running : true ,
253- connected : false ,
254- enabled : true ,
255- configured : true ,
256- mode : "polling" ,
257- lastStartAt : 95_000 ,
258- lastConnectedAt : null ,
259- lastTransportActivityAt : null ,
260- } ,
261- {
262- channelId : "telegram" ,
263- now : 100_000 ,
264- channelConnectGraceMs : 10_000 ,
265- staleEventThresholdMs : 30_000 ,
266- } ,
267- ) ;
268- expect ( evaluation ) . toEqual ( { healthy : true , reason : "startup-connect-grace" } ) ;
269- } ) ;
270-
271- it ( "does not flag stale-startup when the polling channel has a prior successful connect" , ( ) => {
272- const evaluation = evaluateChannelHealth (
273- {
274- running : true ,
275- connected : true ,
276- enabled : true ,
277- configured : true ,
278- mode : "polling" ,
279- lastStartAt : 0 ,
280- lastConnectedAt : 50_000 ,
281- lastTransportActivityAt : null ,
282- } ,
283- {
284- channelId : "telegram" ,
285- now : 100_000 ,
286- channelConnectGraceMs : 10_000 ,
287- staleEventThresholdMs : 30_000 ,
288- } ,
289- ) ;
290- expect ( evaluation ) . toEqual ( { healthy : true , reason : "healthy" } ) ;
291- } ) ;
292-
293- it ( "flags polling startups with inherited connected:true and no transport activity" , ( ) => {
294- // Defense in depth: notePollingStart now explicitly clears connected, so
295- // the normal startup-hang path falls through `connected === false` above.
296- // This case covers a future code path that forgets to clear connected:true
297- // on lifecycle start; the inherited true plus null lastConnectedAt plus
298- // null lastTransportActivityAt past the grace still means the channel
299- // never reached its first transport event.
300- const evaluation = evaluateChannelHealth (
301- {
302- running : true ,
303- connected : true ,
304- enabled : true ,
305- configured : true ,
306- mode : "polling" ,
307- lastStartAt : 0 ,
308- lastConnectedAt : null ,
309- lastEventAt : null ,
310- lastTransportActivityAt : null ,
311- } ,
312- {
313- channelId : "telegram" ,
314- now : 100_000 ,
315- channelConnectGraceMs : 10_000 ,
316- staleEventThresholdMs : 30_000 ,
317- } ,
318- ) ;
319- expect ( evaluation ) . toEqual ( { healthy : false , reason : "stale-socket" } ) ;
320- } ) ;
321-
322226 it ( "keeps quiet telegram webhooks healthy when they do not publish transport tracking" , ( ) => {
323227 const evaluation = evaluateChannelHealth (
324228 {
0 commit comments