LCOV - code coverage report
Current view: top level - src/platform/openOnCloud - cloudWorkflowCheck.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 50.0 % 6 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { CompatibilityModel } from '@comfyorg/ingest-types'
       2              : 
       3              : export interface CloudWorkflowGaps {
       4              :   nodePacks: string[]
       5              :   models: CompatibilityModel[]
       6              : }
       7              : 
       8              : export type CloudWorkflowVerdict =
       9              :   | { kind: 'canOpen' }
      10              :   | { kind: 'missing'; gaps: CloudWorkflowGaps }
      11              : 
      12              : export type CloudWorkflowCheckResult =
      13              :   | CloudWorkflowVerdict
      14              :   | { kind: 'unreadableModelLoader'; nodeType: string }
      15              :   | null
      16              : 
      17              : export type CloudWorkflowCheckState =
      18              :   | { phase: 'idle' }
      19              :   | { phase: 'checking'; run: number }
      20              :   | { phase: 'failed'; nodeType?: string }
      21              :   | { phase: 'answered'; verdict: CloudWorkflowVerdict }
      22              : 
      23              : export type CloudWorkflowCheckEvent =
      24              :   | { type: 'invalidated' }
      25              :   | { type: 'started'; run: number }
      26              :   | { type: 'failed'; run: number; nodeType?: string }
      27              :   | { type: 'answered'; run: number; verdict: CloudWorkflowVerdict }
      28              : 
      29            1 : export function reduceCloudWorkflowCheck(
      30              :   state: CloudWorkflowCheckState,
      31              :   event: CloudWorkflowCheckEvent
      32              : ): CloudWorkflowCheckState {
      33            1 :   switch (event.type) {
      34              :     case 'invalidated':
      35            1 :       return state.phase === 'idle' ? state : { phase: 'idle' }
      36              :     case 'started':
      37            0 :       return { phase: 'checking', run: event.run }
      38              :     case 'failed':
      39            0 :       return state.phase === 'checking' && state.run === event.run
      40              :         ? { phase: 'failed', nodeType: event.nodeType }
      41              :         : state
      42              :     case 'answered':
      43            0 :       return state.phase === 'checking' && state.run === event.run
      44              :         ? { phase: 'answered', verdict: event.verdict }
      45              :         : state
      46              :   }
      47              : }
        

Generated by: LCOV version 2.0-1