diff --git a/browser_tests/tests/propertiesPanel/PropertiesPanelHelper.ts b/browser_tests/tests/propertiesPanel/PropertiesPanelHelper.ts index 25fa4ac4e7b..2a72ddd0ec1 100644 --- a/browser_tests/tests/propertiesPanel/PropertiesPanelHelper.ts +++ b/browser_tests/tests/propertiesPanel/PropertiesPanelHelper.ts @@ -84,7 +84,7 @@ export class PropertiesPanelHelper { } get errorsTabIcon(): Locator { - return this.root.locator('nav i[class*="lucide--octagon-alert"]') + return this.errorsTab.getByTestId('panel-tab-icon') } get viewAllSettingsButton(): Locator { diff --git a/browser_tests/tests/propertiesPanel/errorsTab.spec.ts b/browser_tests/tests/propertiesPanel/errorsTab.spec.ts index a215569ca45..aa0772ac267 100644 --- a/browser_tests/tests/propertiesPanel/errorsTab.spec.ts +++ b/browser_tests/tests/propertiesPanel/errorsTab.spec.ts @@ -19,6 +19,8 @@ test.describe('Errors tab - common', { tag: '@ui' }, () => { const panel = new PropertiesPanelHelper(comfyPage.page) await expect(panel.errorsTabIcon).toBeVisible() + // Missing resources alone are setup warnings, not blocking errors. + await expect(panel.errorsTabIcon).toHaveAccessibleName('Setup required') }) test('Should not show Errors tab when setting is disabled', async ({ diff --git a/browser_tests/tests/propertiesPanel/errorsTabModeAware.spec.ts b/browser_tests/tests/propertiesPanel/errorsTabModeAware.spec.ts index 9fb8d7f2a77..a9b336ed684 100644 --- a/browser_tests/tests/propertiesPanel/errorsTabModeAware.spec.ts +++ b/browser_tests/tests/propertiesPanel/errorsTabModeAware.spec.ts @@ -313,13 +313,13 @@ test.describe('Errors tab - Mode-aware errors', { tag: '@ui' }, () => { await expect( strip, 'The strip count is scoped to the selection, diverging from the global reference badge' - ).toContainText('1 error') + ).toContainText('1 issue') await comfyPage.canvas.click() await expect( strip, 'Deselecting swaps the always-visible strip back to the summary' - ).toContainText('2 nodes — 1 error') + ).toContainText('2 nodes — 1 item') await expectReferenceBadge(missingModelGroup, 2) }) }) @@ -421,12 +421,12 @@ test.describe('Errors tab - Mode-aware errors', { tag: '@ui' }, () => { TestIds.propertiesPanel.selectionContextStrip ) await expect(strip).toBeVisible() - await expect(strip).toContainText('1 error') + await expect(strip).toContainText('1 issue') await expect(mediaRows).toHaveCount(2) await comfyPage.canvas.click({ position: { x: 400, y: 600 } }) // Deselecting swaps the always-visible strip back to the summary - await expect(strip).toContainText('2 nodes — 2 errors') + await expect(strip).toContainText('2 nodes — 2 items') await expect(mediaRows).toHaveCount(2) }) }) @@ -451,7 +451,7 @@ test.describe('Errors tab - Mode-aware errors', { tag: '@ui' }, () => { ) await expect(missingNodeCard).toBeVisible() await expect(mediaRow).toBeVisible() - await expect(strip).toContainText('2 nodes — 2 errors') + await expect(strip).toContainText('2 nodes — 2 items') const mediaNode = await comfyPage.nodeOps.getNodeRefById('10') // The node sits near the canvas top where overlays intercept clicks @@ -463,14 +463,14 @@ test.describe('Errors tab - Mode-aware errors', { tag: '@ui' }, () => { await expect(missingNodeCard).toBeHidden() await expect(mediaRow).toBeVisible() await expect(mediaRow).toHaveAttribute('aria-current', 'true') - await expect(strip).toContainText('1 error') + await expect(strip).toContainText('1 issue') await comfyPage.canvas.click({ position: { x: 400, y: 600 } }) // Emphasis ends: the collapsed group re-expands and the strip // returns to the workflow summary await expect(missingNodeCard).toBeVisible() await expect(mediaRow).not.toHaveAttribute('aria-current', 'true') - await expect(strip).toContainText('2 nodes — 2 errors') + await expect(strip).toContainText('2 nodes — 2 items') }) }) diff --git a/packages/design-system/src/css/style.css b/packages/design-system/src/css/style.css index 3d62d10b075..1ab1e6e4e33 100644 --- a/packages/design-system/src/css/style.css +++ b/packages/design-system/src/css/style.css @@ -52,6 +52,7 @@ --color-gold-500: #fdab34; --color-gold-600: #fd9903; --color-gold-700: #c77700; + --color-gold-800: #8c6a38; --color-credit: #ddbd31; @@ -235,6 +236,8 @@ --inverted-background-hover: var(--color-charcoal-600); --warning-background: var(--color-gold-400); --warning-background-hover: var(--color-gold-500); + --warning-foreground: var(--color-gold-800); + --warning-on-background: var(--color-charcoal-800); --success-background: var(--color-jade-600); --border-default: var(--color-smoke-600); --border-subtle: var(--color-smoke-400); @@ -388,6 +391,8 @@ --inverted-background-hover: var(--color-smoke-200); --warning-background: var(--color-gold-600); --warning-background-hover: var(--color-gold-500); + --warning-foreground: var(--color-gold-600); + --warning-on-background: var(--color-charcoal-800); --success-background: var(--color-jade-600); --border-default: var(--color-charcoal-200); --border-subtle: var(--color-charcoal-300); @@ -563,6 +568,8 @@ --color-inverted-background-hover: var(--inverted-background-hover); --color-warning-background: var(--warning-background); --color-warning-background-hover: var(--warning-background-hover); + --color-warning-foreground: var(--warning-foreground); + --color-warning-on-background: var(--warning-on-background); --color-success-background: var(--success-background); --color-border-default: var(--border-default); --color-border-subtle: var(--border-subtle); diff --git a/src/components/actionbar/ComfyRunButton/ComfyQueueButton.test.ts b/src/components/actionbar/ComfyRunButton/ComfyQueueButton.test.ts index 0aa8155658e..83640e9fdb2 100644 --- a/src/components/actionbar/ComfyRunButton/ComfyQueueButton.test.ts +++ b/src/components/actionbar/ComfyRunButton/ComfyQueueButton.test.ts @@ -1,4 +1,6 @@ import { createTestingPinia } from '@pinia/testing' +import PrimeVue from 'primevue/config' +import Tooltip from 'primevue/tooltip' import { describe, expect, it, vi } from 'vitest' import { nextTick } from 'vue' import { createI18n } from 'vue-i18n' @@ -46,6 +48,7 @@ const i18n = createI18n({ en: { menu: { run: 'Run', + runOptions: 'Run options', disabledTooltip: 'Disabled tooltip', onChange: 'On Change', onChangeTooltip: 'On change tooltip', @@ -157,9 +160,9 @@ function renderQueueButton( const result = render(ComfyQueueButton, { props, global: { - plugins: [pinia, i18n], + plugins: [PrimeVue, pinia, i18n], directives: { - tooltip: () => {} + tooltip: Tooltip }, stubs } @@ -222,6 +225,21 @@ describe('ComfyQueueButton', () => { } ) + it('keeps Run enabled with the missing-resource warning and tooltip', async () => { + const { user } = renderQueueButton() + useMissingModelStore().missingModelCandidates = [missingModelCandidate] + await nextTick() + + const queueButton = screen.getByTestId('queue-button') + expect(queueButton).toBeEnabled() + + await user.hover(queueButton) + + expect(await screen.findByRole('tooltip')).toHaveTextContent( + 'Workflow contains missing resources' + ) + }) + it('keeps the play icon for non-missing errors', async () => { renderQueueButton() useExecutionErrorStore().recordPromptError({ diff --git a/src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue b/src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue index 467673423ed..95af4cc3b08 100644 --- a/src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue +++ b/src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue @@ -31,7 +31,7 @@ size="unset" :disabled="Boolean(paymentRecoveryLock)" :class="queueMenuTriggerClass" - :aria-label="t('menu.run')" + :aria-label="t('menu.runOptions')" data-testid="queue-mode-menu-trigger" > diff --git a/src/components/error/ErrorOverlay.test.ts b/src/components/error/ErrorOverlay.test.ts index be7237a9d32..67a35e7ea6d 100644 --- a/src/components/error/ErrorOverlay.test.ts +++ b/src/components/error/ErrorOverlay.test.ts @@ -134,6 +134,7 @@ describe('ErrorOverlay', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Execution failed', count: 1, @@ -171,6 +172,7 @@ describe('ErrorOverlay', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Execution failed', count: 1, diff --git a/src/components/error/useErrorOverlayState.test.ts b/src/components/error/useErrorOverlayState.test.ts index deae2a183aa..8dfaa2b63d0 100644 --- a/src/components/error/useErrorOverlayState.test.ts +++ b/src/components/error/useErrorOverlayState.test.ts @@ -115,6 +115,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Execution failed', count: 1, @@ -146,6 +147,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Required input is missing', count: 1, @@ -186,6 +188,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Friendly validation title', count: 1, @@ -225,6 +228,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Generation failed', count: 1, @@ -297,6 +301,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'missing_media', + severity: 'missing', groupKey: 'missing_media', displayTitle: 'Media input missing', displayMessage: 'A required media input has no file selected.', @@ -357,6 +362,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'missing_model', + severity: 'missing', groupKey: 'missing_model', displayTitle: 'Missing Models', displayMessage: 'Import a model, or open the node to replace it.', @@ -382,6 +388,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:required_input_missing', displayTitle: 'Missing connection', displayMessage: 'Required input slots have no connection feeding them.', @@ -449,6 +456,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'missing_model', + severity: 'missing', groupKey: 'missing_model', displayTitle: 'Missing Models', displayMessage: 'Import a model, or open the node to replace it.', @@ -488,6 +496,7 @@ describe('useErrorOverlayState', () => { mockAllErrorGroups.value = [ { type: 'execution', + severity: 'error', groupKey: 'execution:KSampler', displayTitle: 'Execution failed', displayMessage: 'First group message', @@ -503,6 +512,7 @@ describe('useErrorOverlayState', () => { }, { type: 'execution', + severity: 'error', groupKey: 'execution:CLIPTextEncode', displayTitle: 'Invalid CLIP input', displayMessage: 'Second group message', diff --git a/src/components/rightSidePanel/RightSidePanel.vue b/src/components/rightSidePanel/RightSidePanel.vue index 342aee2c73d..fa64615d2e4 100644 --- a/src/components/rightSidePanel/RightSidePanel.vue +++ b/src/components/rightSidePanel/RightSidePanel.vue @@ -41,6 +41,7 @@ import { } from './shared' import SubgraphEditor from './subgraph/SubgraphEditor.vue' import TabErrors from './errors/TabErrors.vue' +import { useHasBlockingError } from './errors/useHasBlockingError' const canvasStore = useCanvasStore() const executionErrorStore = useExecutionErrorStore() @@ -124,7 +125,10 @@ function handleTabChange(newTab: RightSidePanelTab) { type RightSidePanelTabList = Array<{ label: () => string value: RightSidePanelTab - icon?: string + icon?: { + className: string + label: () => string + } }> const hasDirectNodeError = computed(() => @@ -189,6 +193,8 @@ const hasPendingErrorScanSelected = computed(() => { }) }) +const hasBlockingError = useHasBlockingError() + const tabs = computed(() => { const list: RightSidePanelTabList = [] @@ -200,7 +206,24 @@ const tabs = computed(() => { list.push({ label: () => t('rightSidePanel.errors'), value: 'errors', - icon: 'icon-[lucide--octagon-alert] bg-node-stroke-error ml-1' + // No icon while the tab is only retained by a pending scan: with both + // severities absent there is no state for it to describe. + icon: hasRelevantErrors.value + ? { + className: cn( + 'ml-1', + hasBlockingError.value + ? 'icon-[lucide--octagon-alert] bg-node-stroke-error' + : 'icon-[lucide--triangle-alert] bg-warning-foreground' + ), + label: () => + t( + hasBlockingError.value + ? 'rightSidePanel.severityErrorLabel' + : 'rightSidePanel.severitySetupLabel' + ) + } + : undefined }) } @@ -382,8 +405,10 @@ function handleTitleCancel() { {{ tab.label() }} diff --git a/src/components/rightSidePanel/errors/ErrorCardSection.vue b/src/components/rightSidePanel/errors/ErrorCardSection.vue index e27dd5abff2..6e9186af51b 100644 --- a/src/components/rightSidePanel/errors/ErrorCardSection.vue +++ b/src/components/rightSidePanel/errors/ErrorCardSection.vue @@ -9,7 +9,16 @@ @click="collapse = !collapse" > {{ count }} @@ -53,14 +62,17 @@ import { useI18n } from 'vue-i18n' import { cn } from '@comfyorg/tailwind-utils' import TransitionCollapse from '@/components/rightSidePanel/layout/TransitionCollapse.vue' +import type { ErrorGroupSeverity } from '@/components/rightSidePanel/errors/types' const { title, count, + severity, class: className } = defineProps<{ title: string count: number + severity: ErrorGroupSeverity class?: string }>() diff --git a/src/components/rightSidePanel/errors/ErrorGroupList.test.ts b/src/components/rightSidePanel/errors/ErrorGroupList.test.ts index 9c7dba9ea66..019672447f9 100644 --- a/src/components/rightSidePanel/errors/ErrorGroupList.test.ts +++ b/src/components/rightSidePanel/errors/ErrorGroupList.test.ts @@ -6,6 +6,7 @@ import PrimeVue from 'primevue/config' import { beforeEach, describe, expect, it, vi } from 'vitest' import { testI18n } from '@/components/searchbox/v2/__test__/testUtils' +import { useMissingModelStore } from '@/platform/missingModel/missingModelStore' import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' import { useExecutionErrorStore } from '@/stores/executionErrorStore' import { isLGraphNode } from '@/utils/litegraphUtil' @@ -220,7 +221,7 @@ describe('ErrorGroupList selection emphasis', () => { unknown >([SAMPLER_NODE]) await waitFor(() => { - expect(strip).toHaveTextContent('SamplerNode — 1 error') + expect(strip).toHaveTextContent('SamplerNode — 1 issue') }) canvasStore.selectedItems = fromAny< @@ -228,7 +229,7 @@ describe('ErrorGroupList selection emphasis', () => { unknown >([SAMPLER_NODE, LOADER_NODE]) await waitFor(() => { - expect(strip).toHaveTextContent('2 nodes selected — 2 errors') + expect(strip).toHaveTextContent('2 nodes selected — 2 issues') }) canvasStore.selectedItems = [] @@ -237,6 +238,33 @@ describe('ErrorGroupList selection emphasis', () => { }) }) + it('labels a missing-only selection as an issue', async () => { + const pinia = createPinia() + useMissingModelStore(pinia).setMissingModels([ + { + nodeId: '1', + nodeType: 'CheckpointLoaderSimple', + widgetName: 'ckpt_name', + name: 'missing.safetensors', + isMissing: true, + isAssetSupported: false + } + ]) + renderList(pinia) + const canvasStore = useCanvasStore(pinia) + + canvasStore.selectedItems = fromAny< + typeof canvasStore.selectedItems, + unknown + >([SAMPLER_NODE]) + + const strip = screen.getByTestId('selection-context-strip') + await waitFor(() => { + expect(strip).toHaveTextContent('SamplerNode — 1 issue') + }) + expect(strip).not.toHaveTextContent(/\berrors?\b/i) + }) + it('preserves special characters in execution item accessible names', () => { const nodeDisplayName = 'A & B ' vi.mocked(getNodeByExecutionId).mockImplementation((_, nodeId) => diff --git a/src/components/rightSidePanel/errors/ErrorGroupList.vue b/src/components/rightSidePanel/errors/ErrorGroupList.vue index 91129b21671..79724918193 100644 --- a/src/components/rightSidePanel/errors/ErrorGroupList.vue +++ b/src/components/rightSidePanel/errors/ErrorGroupList.vue @@ -29,26 +29,70 @@ class="overflow-hidden rounded-lg border border-secondary-background" > - - - {{ totalErrorCount }} - - - - - {{ t('rightSidePanel.errorsDetected', totalErrorCount) }} + + + + {{ + t('rightSidePanel.severityCountsStatus', { + errors: errorCount, + setup: missingCount + }) + }} - - {{ t('rightSidePanel.resolveBeforeRun') }} + + {{ hero.count }} + + + + {{ hero.title }} + + + {{ hero.description }} + + + + + + {{ chip.label }} + + @@ -77,14 +121,24 @@ + + + {{ t('rightSidePanel.noneSearchDesc') }} + + - filteredGroups.value.reduce((sum, group) => sum + group.count, 0) +const errorCount = computed(() => + filteredGroups.value + .filter((group) => group.severity === 'error') + .reduce((sum, group) => sum + group.count, 0) +) +const missingCount = computed(() => + filteredGroups.value + .filter((group) => group.severity === 'missing') + .reduce((sum, group) => sum + group.count, 0) +) +const hasMixedSeverity = computed( + () => errorCount.value > 0 && missingCount.value > 0 +) + +const severityTotals = computed(() => { + const totals: Record = { error: 0, missing: 0 } + for (const group of allErrorGroups.value) { + totals[group.severity] += group.count + } + return totals +}) + +const severityFilter = ref(null) +// Workflow-wide, not search-scoped: a search emptying one severity must not +// disable an engaged filter. +const hasMixedSeverityTotals = computed( + () => severityTotals.value.error > 0 && severityTotals.value.missing > 0 +) +const activeSeverityFilter = computed(() => + hasMixedSeverityTotals.value ? severityFilter.value : null ) +const visibleGroups = computed(() => { + const severity = activeSeverityFilter.value + if (!severity) return filteredGroups.value + return filteredGroups.value.filter((group) => group.severity === severity) +}) + +function toggleSeverityFilter(severity: ErrorGroupSeverity) { + severityFilter.value = severityFilter.value === severity ? null : severity +} + +/** + * Dedupes the Set-valued computed (fresh reference per recompute) so the + * watchers below only fire when the matched membership changes. + */ +const selectionEmphasisSignature = computed(() => + hasSelection.value + ? [ + ...selectionMatchedGroupKeys.value, + ...selectionMatchedCardIds.value, + ...selectionMatchedAssetNodeIds.value + ] + .sort() + .join('\n') + : '' +) + +/** Issue identity per severity — membership, so same-count replacements are visible. */ +const severityIssueKeys = computed>>( + () => ({ + error: new Set( + allErrorGroups.value + .filter((group) => group.type === 'execution') + .flatMap((group) => + group.cards.flatMap((card) => + card.errors.map( + (error, index) => + `${group.groupKey}|${card.id}|${error.message}#${index}` + ) + ) + ) + ), + missing: new Set([ + ...missingPackGroups.value.flatMap((pack) => + pack.nodeTypes.map( + (nodeType) => + `pack|${pack.packId}|${typeof nodeType === 'string' ? nodeType : `${nodeType.type}|${nodeType.nodeId}`}` + ) + ), + ...swapNodeGroups.value.flatMap((swap) => + swap.nodeTypes.map( + (nodeType) => + `swap|${swap.type}|${typeof nodeType === 'string' ? nodeType : nodeType.nodeId}` + ) + ), + ...missingModelGroups.value.flatMap((group) => + group.models.flatMap((model) => + model.referencingNodes.map( + (ref) => + `model|${group.directory}|${model.name}|${ref.nodeId}|${ref.widgetName}` + ) + ) + ), + ...missingMediaGroups.value.flatMap((group) => + group.items.flatMap((item) => + item.referencingNodes.map( + (ref) => + `media|${group.mediaType}|${item.name}|${ref.nodeId}|${ref.widgetName}` + ) + ) + ) + ]) + }) +) + +// Release-only, never auto-select; an unchanged selection does not release, +// since engaging the filter against it is the user's explicit call. +watch(severityIssueKeys, (next, prev) => { + const active = severityFilter.value + if (!active) return + const hidden = HIDDEN_BY_FILTER[active] + const hiddenGainedMember = [...next[hidden]].some( + (key) => !prev[hidden].has(key) + ) + if (hiddenGainedMember || next[active].size === 0) { + severityFilter.value = null + } +}) + +watch(selectionEmphasisSignature, () => { + const active = severityFilter.value + if (!active) return + const matchedKeys = selectionMatchedGroupKeys.value + if (matchedKeys.size === 0) return + const hidden = HIDDEN_BY_FILTER[active] + const selectionHasHiddenSeverity = allErrorGroups.value.some( + (group) => matchedKeys.has(group.groupKey) && group.severity === hidden + ) + if (selectionHasHiddenSeverity) severityFilter.value = null +}) + +const hero = computed(() => { + if (hasMixedSeverity.value) { + const total = errorCount.value + missingCount.value + return { + count: total, + countClass: 'text-base-foreground', + title: t('rightSidePanel.issuesDetected', total), + description: t('rightSidePanel.resolveBeforeRun') + } + } + if (missingCount.value > 0) { + return { + count: missingCount.value, + countClass: 'text-warning-foreground', + title: t('rightSidePanel.setupRequired'), + description: t('rightSidePanel.finishSetupBeforeRun') + } + } + return { + count: errorCount.value, + countClass: 'text-destructive-background-hover', + title: t('rightSidePanel.errorsDetected', errorCount.value), + description: t('rightSidePanel.resolveErrorsBeforeRun') + } +}) + +const severityChips = computed(() => [ + { + severity: 'error' as const, + active: activeSeverityFilter.value === 'error', + label: + activeSeverityFilter.value === 'error' + ? t('rightSidePanel.errorsFilterActive', errorCount.value) + : t('rightSidePanel.errorsFilter', errorCount.value) + }, + { + severity: 'missing' as const, + active: activeSeverityFilter.value === 'missing', + label: t('rightSidePanel.setupFilter', missingCount.value) + } +]) const hasSelectionEmphasis = computed( () => hasSelection.value && selectionErrorCount.value > 0 @@ -465,11 +722,14 @@ const selectionStripNodeLabel = computed( // The strip is a status line, not a view of the current filter — summary // numbers are workflow-wide, never search-filtered. -const workflowErrorCount = computed(() => - allErrorGroups.value.reduce((sum, group) => sum + group.count, 0) +const workflowErrorCount = computed( + () => severityTotals.value.error + severityTotals.value.missing ) +const workflowBlockingErrorCount = computed(() => severityTotals.value.error) +const hasErrorSeverity = computed(() => severityTotals.value.error > 0) +const hasMissingSeverity = computed(() => severityTotals.value.missing > 0) -const strip = computed(() => { +const strip = computed(() => { if (hasSelectionEmphasis.value) { return { keypath: @@ -480,14 +740,31 @@ const strip = computed(() => { count: selectionErrorCount.value } } + if (hasErrorSeverity.value && hasMissingSeverity.value) { + return { + keypath: + errorNodeCount.value === 0 + ? 'rightSidePanel.errorsSummary' + : 'rightSidePanel.nodesAffected', + nodes: errorNodeCount.value, + count: + errorNodeCount.value === 0 + ? workflowBlockingErrorCount.value + : errorNodeCount.value + } + } + const keypaths = hasErrorSeverity.value + ? SUMMARY_KEYPATHS.error + : SUMMARY_KEYPATHS.setup + const nodeCountKey = + errorNodeCount.value === 0 + ? 'none' + : errorNodeCount.value === 1 + ? 'single' + : 'multiple' + return { - keypath: - errorNodeCount.value === 0 - ? // Node-less errors (e.g. prompt-level) would read as "0 nodes" - 'rightSidePanel.errorsSummary' - : errorNodeCount.value === 1 - ? 'rightSidePanel.errorNodeSummary' - : 'rightSidePanel.errorNodesSummary', + keypath: keypaths[nodeCountKey], nodes: errorNodeCount.value, count: workflowErrorCount.value } @@ -497,16 +774,6 @@ function isCardInSelection(cardId: string): boolean { return selectionMatchedCardIds.value.has(cardId) } -/** - * Dedupes the Set-valued computed (fresh reference per recompute) so the - * emphasis watcher below only fires when the matched membership changes. - */ -const selectionEmphasisSignature = computed(() => - hasSelection.value - ? Array.from(selectionMatchedGroupKeys.value).sort().join('\n') - : '' -) - /** * Selection acts as emphasis, not a filter: expand the groups containing * the selected nodes' errors and collapse the rest. When the emphasis ends diff --git a/src/components/rightSidePanel/errors/TabErrors.test.ts b/src/components/rightSidePanel/errors/TabErrors.test.ts index e79bf3661c8..6237aa61116 100644 --- a/src/components/rightSidePanel/errors/TabErrors.test.ts +++ b/src/components/rightSidePanel/errors/TabErrors.test.ts @@ -2,19 +2,28 @@ import { createTestingPinia } from '@pinia/testing' import type { TestingPinia } from '@pinia/testing' import { render, screen, within } from '@testing-library/vue' import userEvent from '@testing-library/user-event' +import { fromAny } from '@total-typescript/shoehorn' import PrimeVue from 'primevue/config' import { beforeEach, describe, expect, it, vi } from 'vitest' +import { nextTick } from 'vue' import { createI18n } from 'vue-i18n' -import TabErrors from './TabErrors.vue' + +import RightSidePanel from '@/components/rightSidePanel/RightSidePanel.vue' +import { useSettingStore } from '@/platform/settings/settingStore' import { useMissingMediaStore } from '@/platform/missingMedia/missingMediaStore' import { useMissingModelStore } from '@/platform/missingModel/missingModelStore' import type { MissingMediaCandidate } from '@/platform/missingMedia/types' import type { MissingModelCandidate } from '@/platform/missingModel/types' import { useMissingNodesErrorStore } from '@/platform/nodeReplacement/missingNodesErrorStore' +import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' import { useExecutionErrorStore } from '@/stores/executionErrorStore' import type { MissingNodeType } from '@/types/comfy' +import { LGraphNode } from '@/lib/litegraph/src/litegraph' +import { toNodeId } from '@/types/nodeId' import { nodeError, validationError } from '@/utils/__tests__/nodeErrorHelpers' +import TabErrors from './TabErrors.vue' + const { mockFocusNode, mockRefreshMissingModels } = vi.hoisted(() => ({ mockFocusNode: vi.fn(), mockRefreshMissingModels: vi.fn() @@ -31,7 +40,9 @@ vi.mock('@/scripts/app', () => ({ })) vi.mock('@/utils/graphTraversalUtil', () => ({ + collectAllNodes: vi.fn(() => []), getNodeByExecutionId: vi.fn(), + getActiveGraphNodeIds: vi.fn(() => new Set()), getRootParentNode: vi.fn(() => null), forEachNode: vi.fn(), mapAllNodes: vi.fn(() => []) @@ -87,10 +98,29 @@ describe('TabErrors.vue', () => { getHelpAction: 'Get Help' }, rightSidePanel: { - noErrors: 'No errors', + noErrors: 'No issues', noneSearchDesc: 'No results found', errorsDetected: 'Error detected | Errors detected', resolveBeforeRun: 'Resolve before running the workflow', + issuesDetected: 'Issue detected | Issues detected', + resolveErrorsBeforeRun: + 'Resolve errors before running the workflow', + setupRequired: 'Setup required', + finishSetupBeforeRun: 'Finish setup before running the workflow', + severityCountsStatus: '{errors} blocking, {setup} setup required', + errorsFilter: '{count} Error | {count} Errors', + errorsFilterActive: + '{count} Error detected | {count} Errors detected', + setupFilter: '{count} Setup required', + setupSummary: '{count} item | {count} items', + setupNodeSummary: + '{nodes} node — {count} item | {nodes} node — {count} items', + setupNodesSummary: + '{nodes} nodes — {count} item | {nodes} nodes — {count} items', + nodesAffected: '{count} node affected | {count} nodes affected', + errorsSummary: '{count} error | {count} errors', + severityErrorLabel: 'Blocking errors', + severitySetupLabel: 'Setup required', expand: 'Expand', collapse: 'Collapse', errorHelp: 'Error help', @@ -140,9 +170,36 @@ describe('TabErrors.vue', () => { return { user } } - it('renders "no errors" state when store is empty', () => { + function renderRightSidePanel(seed: (pinia: TestingPinia) => void) { + const pinia = createTestingPinia({ + createSpy: vi.fn, + stubActions: false + }) + useSettingStore(pinia).settingValues['Comfy.RightSidePanel.ShowErrorsTab'] = + true + seed(pinia) + render(RightSidePanel, { + global: { + plugins: [PrimeVue, i18n, pinia], + stubs: { + EditableText: true, + TabErrors: true, + TabGlobalParameters: true, + TabNodes: true, + TabGlobalSettings: true, + TabSettings: true, + TabInfo: true, + TabNormalInputs: true, + TabSubgraphInputs: true, + SubgraphEditor: true + } + } + }) + } + + it('renders "no issues" state when store is empty', () => { renderComponent() - expect(screen.getByText('No errors')).toBeInTheDocument() + expect(screen.getByText('No issues')).toBeInTheDocument() }) it('renders prompt-level errors with resolved display message', async () => { @@ -172,9 +229,12 @@ describe('TabErrors.vue', () => { '1': 'KSampler', '2': 'CLIP Text Encode' } - return { + return fromAny< + NonNullable>, + unknown + >({ title: titles[String(nodeId)] ?? '' - } as ReturnType + }) }) const { user } = renderComponent((pinia) => { @@ -214,13 +274,21 @@ describe('TabErrors.vue', () => { }) expect(screen.getByText('Missing connection')).toBeInTheDocument() - expect( - within(screen.getByTestId('error-group-execution')).getByText('3') - ).toBeInTheDocument() + const sectionBadge = within( + screen.getByTestId('error-group-execution') + ).getByTestId('error-section-count-badge') + expect(sectionBadge).toHaveTextContent('3') + expect(sectionBadge).toHaveAttribute('data-severity', 'error') expect( within(screen.getByTestId('errors-summary-hero')).getByText('3') ).toBeInTheDocument() + expect( + screen.queryByTestId('errors-summary-filters') + ).not.toBeInTheDocument() expect(screen.getByText('Errors detected')).toBeInTheDocument() + expect( + screen.getByText('Resolve errors before running the workflow') + ).toBeInTheDocument() expect( screen.getAllByText( 'Required input slots have no connection feeding them.' @@ -275,9 +343,11 @@ describe('TabErrors.vue', () => { it('renders runtime execution errors from WebSocket', async () => { const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') - vi.mocked(getNodeByExecutionId).mockReturnValue({ - title: 'KSampler' - } as ReturnType) + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'KSampler' + }) + ) const { user } = renderComponent((pinia) => { useExecutionErrorStore(pinia).recordExecutionError({ @@ -366,9 +436,11 @@ describe('TabErrors.vue', () => { it('renders a single runtime error in the normal execution group', async () => { const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') - vi.mocked(getNodeByExecutionId).mockReturnValue({ - title: 'KSampler' - } as ReturnType) + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'KSampler' + }) + ) renderComponent((pinia) => { useExecutionErrorStore(pinia).recordExecutionError({ @@ -442,12 +514,68 @@ describe('TabErrors.vue', () => { ]) }) + const sectionBadge = within( + screen.getByTestId('error-group-missing-model') + ).getByTestId('error-section-count-badge') + expect(sectionBadge).toHaveTextContent('2') + expect(sectionBadge).toHaveAttribute('data-severity', 'missing') + const hero = screen.getByTestId('errors-summary-hero') + expect(within(hero).getByText('2')).toBeInTheDocument() + expect(within(hero).getByText('Setup required')).toBeInTheDocument() expect( - within(screen.getByTestId('error-group-missing-model')).getByText('2') + within(hero).getByText('Finish setup before running the workflow') ).toBeInTheDocument() expect( - within(screen.getByTestId('errors-summary-hero')).getByText('2') - ).toBeInTheDocument() + screen.queryByTestId('errors-summary-filters') + ).not.toBeInTheDocument() + expect(screen.getByTestId('selection-context-strip')).toHaveTextContent( + '2 nodes — 2 items' + ) + }) + + it('omits the node count from setup context with no known node ids', () => { + renderComponent((pinia) => { + useMissingNodesErrorStore(pinia).setMissingNodeTypes([ + 'MissingNodeA', + 'MissingNodeB' + ]) + useMissingModelStore(pinia).setMissingModels([ + { + nodeType: 'CheckpointLoaderSimple', + widgetName: 'ckpt_name', + name: 'workflow-model.safetensors', + isMissing: true, + isAssetSupported: false + } + ]) + }) + + const contextStrip = screen.getByTestId('selection-context-strip') + expect(contextStrip).toHaveTextContent('2 items') + expect(contextStrip).not.toHaveTextContent('0 nodes') + }) + + it('uses an error count for mixed context with no known node ids', () => { + renderComponent((pinia) => { + useMissingModelStore(pinia).setMissingModels([ + { + nodeType: 'CheckpointLoaderSimple', + widgetName: 'ckpt_name', + name: 'workflow-model.safetensors', + isMissing: true, + isAssetSupported: false + } + ]) + useExecutionErrorStore(pinia).recordPromptError({ + type: 'prompt_no_outputs', + message: 'No outputs', + details: '' + }) + }) + + expect(screen.getByTestId('selection-context-strip')).toHaveTextContent( + '1 error' + ) }) it('renders missing model display message below the section title', () => { @@ -498,9 +626,12 @@ describe('TabErrors.vue', () => { '3': 'First Loader', '4': 'Second Loader' } - return { + return fromAny< + NonNullable>, + unknown + >({ title: titles[String(nodeId)] ?? '' - } as ReturnType + }) }) const { user } = renderComponent((pinia) => { @@ -539,11 +670,13 @@ describe('TabErrors.vue', () => { expect(mockFocusNode.mock.calls.at(-1)?.[0]).toBe('4') }) - it('sums the summary hero count across error types', async () => { + it('totals mixed severities in the hero and splits them into filter chips', async () => { const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') - vi.mocked(getNodeByExecutionId).mockReturnValue({ - title: 'Node' - } as ReturnType) + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) renderComponent((pinia) => { useExecutionErrorStore(pinia).recordNodeErrors({ @@ -599,10 +732,569 @@ describe('TabErrors.vue', () => { ]) }) - // 3 validation items + 2 missing media references + const hero = screen.getByTestId('errors-summary-hero') + expect(within(hero).getByText('5')).toBeInTheDocument() + expect(within(hero).getByText('Issues detected')).toBeInTheDocument() + expect(screen.getByTestId('errors-summary-filter-error')).toHaveTextContent( + '3 Errors' + ) + expect( + screen.getByTestId('errors-summary-filter-missing') + ).toHaveTextContent('2 Setup required') + expect( + within(hero).getByText('3 blocking, 2 setup required') + ).toBeInTheDocument() + + const contextStrip = screen.getByTestId('selection-context-strip') + expect(contextStrip).toHaveTextContent('4 nodes affected') + expect(contextStrip).not.toHaveTextContent(/errors/i) + }) + + it('releases the filter when a hidden issue is replaced by another', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) + + let executionErrorStore!: ReturnType + renderComponent((pinia) => { + executionErrorStore = useExecutionErrorStore(pinia) + executionErrorStore.recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + useMissingMediaStore(pinia).setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + const user = userEvent.setup() + const missingChip = screen.getByTestId('errors-summary-filter-missing') + await user.click(missingChip) + expect(missingChip).toHaveAttribute('aria-pressed', 'true') + expect( + screen.queryByTestId('error-group-execution') + ).not.toBeInTheDocument() + + // Hidden issue replaced in one update: the error total stays 1, but the + // new issue must not stay silently filtered out. + executionErrorStore.recordNodeErrors({ + '5': nodeError( + [ + validationError( + 'required_input_missing', + 'clip', + {}, + 'Required input is missing', + 'Input: clip' + ) + ], + 'CLIPTextEncode' + ) + }) + await nextTick() + + expect(screen.getByTestId('errors-summary-filter-missing')).toHaveAttribute( + 'aria-pressed', + 'false' + ) + expect(screen.getByTestId('error-group-execution')).toBeInTheDocument() + }) + + it('releases the filter when a hidden file gains another referencing node', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) + + let mediaStore!: ReturnType + renderComponent((pinia) => { + useExecutionErrorStore(pinia).recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + mediaStore = useMissingMediaStore(pinia) + mediaStore.setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + const user = userEvent.setup() + const errorChip = screen.getByTestId('errors-summary-filter-error') + await user.click(errorChip) + expect( + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() + + // Same file, new referencing node: the name-level identity is unchanged + // but a new hidden row appeared, so the filter must release. + mediaStore.setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + }, + { + nodeId: '4', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + await nextTick() + + expect(errorChip).toHaveAttribute('aria-pressed', 'false') + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + }) + + it('shows only the chosen severity while its filter chip is pressed', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) + + renderComponent((pinia) => { + useExecutionErrorStore(pinia).recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + useMissingMediaStore(pinia).setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + expect(screen.getByTestId('error-group-execution')).toBeInTheDocument() + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + + const user = userEvent.setup() + const errorChip = screen.getByTestId('errors-summary-filter-error') + await user.click(errorChip) + + expect(errorChip).toHaveAttribute('aria-pressed', 'true') + expect(errorChip).toHaveTextContent('1 Error detected') + expect(screen.getByTestId('error-group-execution')).toBeInTheDocument() expect( - within(screen.getByTestId('errors-summary-hero')).getByText('5') + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() + expect( + within(screen.getByTestId('errors-summary-hero')).getByText('2') ).toBeInTheDocument() + + await user.click(errorChip) + + expect(errorChip).toHaveAttribute('aria-pressed', 'false') + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + }) + + it('releases the filter when the hidden severity gains a new entry', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) + + let mediaStore!: ReturnType + renderComponent((pinia) => { + useExecutionErrorStore(pinia).recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + mediaStore = useMissingMediaStore(pinia) + mediaStore.setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + const user = userEvent.setup() + const errorChip = screen.getByTestId('errors-summary-filter-error') + await user.click(errorChip) + expect( + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() + + mediaStore.setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + }, + { + nodeId: '4', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'b.png', + isMissing: true + } + ]) + await nextTick() + + expect(errorChip).toHaveAttribute('aria-pressed', 'false') + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + }) + + it('releases the filter when the selection carries the hidden severity', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockImplementation((_, executionId) => + fromAny>, unknown>({ + id: String(executionId), + title: 'Node' + }) + ) + + let canvasStore!: ReturnType + let executionErrorStore!: ReturnType + renderComponent((pinia) => { + canvasStore = useCanvasStore(pinia) + executionErrorStore = useExecutionErrorStore(pinia) + executionErrorStore.recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + useMissingMediaStore(pinia).setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + }, + { + nodeId: '4', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'b.png', + isMissing: true + } + ]) + }) + + const user = userEvent.setup() + const errorChip = screen.getByTestId('errors-summary-filter-error') + await user.click(errorChip) + expect( + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() + + const missingMediaNode = new LGraphNode('LoadImage') + missingMediaNode.id = toNodeId(3) + canvasStore.selectedItems = [missingMediaNode] + await nextTick() + + expect(errorChip).toHaveAttribute('aria-pressed', 'false') + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + }) + + it('holds an engaged filter until the selection membership changes', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockImplementation((_, executionId) => + fromAny>, unknown>({ + id: String(executionId), + title: 'Node' + }) + ) + + let canvasStore!: ReturnType + let executionErrorStore!: ReturnType + renderComponent((pinia) => { + canvasStore = useCanvasStore(pinia) + executionErrorStore = useExecutionErrorStore(pinia) + executionErrorStore.recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + useMissingMediaStore(pinia).setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + const missingMediaNode = new LGraphNode('LoadImage') + missingMediaNode.id = toNodeId(3) + canvasStore.selectedItems = [missingMediaNode] + await nextTick() + + const user = userEvent.setup() + const errorChip = screen.getByTestId('errors-summary-filter-error') + await user.click(errorChip) + expect(errorChip).toHaveAttribute('aria-pressed', 'true') + + // Unrelated store churn recomputes the selection-scoped Set with + // identical membership; the engaged filter must survive it. + executionErrorStore.recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ), + '5': nodeError( + [ + validationError( + 'required_input_missing', + 'clip', + {}, + 'Required input is missing', + 'Input: clip' + ) + ], + 'CLIPTextEncode' + ) + }) + await nextTick() + + expect(errorChip).toHaveAttribute('aria-pressed', 'true') + expect( + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() + }) + + it('releases the filter when its own severity empties', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) + + let executionErrorStore!: ReturnType + renderComponent((pinia) => { + executionErrorStore = useExecutionErrorStore(pinia) + executionErrorStore.recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + useMissingMediaStore(pinia).setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + const user = userEvent.setup() + await user.click(screen.getByTestId('errors-summary-filter-error')) + + executionErrorStore.recordNodeErrors(null) + await nextTick() + + // The filtered severity emptied, so the filter let go instead of lying + // in wait; a later error must not silently hide the missing group again. + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + executionErrorStore.recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + await nextTick() + + expect(screen.getByTestId('error-group-missing-media')).toBeInTheDocument() + expect(screen.getByTestId('errors-summary-filter-error')).toHaveAttribute( + 'aria-pressed', + 'false' + ) + }) + + it('keeps the engaged filter through a search that empties it', async () => { + const { getNodeByExecutionId } = await import('@/utils/graphTraversalUtil') + vi.mocked(getNodeByExecutionId).mockReturnValue( + fromAny>, unknown>({ + title: 'Node' + }) + ) + + renderComponent((pinia) => { + useExecutionErrorStore(pinia).recordNodeErrors({ + '1': nodeError( + [ + validationError( + 'required_input_missing', + 'model', + {}, + 'Required input is missing', + 'Input: model' + ) + ], + 'KSampler' + ) + }) + useMissingMediaStore(pinia).setMissingMedia([ + { + nodeId: '3', + nodeType: 'LoadImage', + widgetName: 'image', + mediaType: 'image', + name: 'a.png', + isMissing: true + } + ]) + }) + + const user = userEvent.setup() + await user.click(screen.getByTestId('errors-summary-filter-error')) + + // A query matching nothing in the filtered severity must show the + // no-results state, not fall back to the severity the user excluded — + // and the pressed chip must stay mounted as the release control. + await user.type(screen.getByRole('textbox'), 'zzz') + expect(screen.getByText('No results found')).toBeInTheDocument() + expect( + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() + expect(screen.getByTestId('errors-summary-filter-error')).toHaveAttribute( + 'aria-pressed', + 'true' + ) + + await user.clear(screen.getByRole('textbox')) + expect(screen.getByTestId('error-group-execution')).toBeInTheDocument() + expect(screen.getByTestId('errors-summary-filter-error')).toHaveAttribute( + 'aria-pressed', + 'true' + ) + expect( + screen.queryByTestId('error-group-missing-media') + ).not.toBeInTheDocument() }) it('renders swap node rows below the section display message', () => { @@ -656,4 +1348,36 @@ describe('TabErrors.vue', () => { expect(screen.getByTestId('missing-model-actions')).toBeInTheDocument() expect(screen.getByRole('button', { name: /Download all/ })).toBeVisible() }) + + it('uses the setup glyph and accessible name for missing resources', () => { + renderRightSidePanel((pinia) => { + useMissingModelStore(pinia).setMissingModels([ + { + nodeId: '1', + nodeType: 'CheckpointLoaderSimple', + widgetName: 'ckpt_name', + name: 'missing.safetensors', + isMissing: true, + isAssetSupported: false + } + ]) + }) + + const icon = screen.getByTestId('panel-tab-icon') + expect(icon).toHaveAccessibleName('Setup required') + }) + + it('uses error severity for an unabsorbed node validation error', () => { + renderRightSidePanel((pinia) => { + useExecutionErrorStore(pinia).recordNodeErrors({ + '1': nodeError( + [validationError('value_not_in_list', 'ckpt_name')], + 'CheckpointLoaderSimple' + ) + }) + }) + + const icon = screen.getByTestId('panel-tab-icon') + expect(icon).toHaveAccessibleName('Blocking errors') + }) }) diff --git a/src/components/rightSidePanel/errors/types.ts b/src/components/rightSidePanel/errors/types.ts index f5a3810f070..544b8eac903 100644 --- a/src/components/rightSidePanel/errors/types.ts +++ b/src/components/rightSidePanel/errors/types.ts @@ -19,6 +19,8 @@ export interface ErrorCardData { errors: ErrorItem[] } +export type ErrorGroupSeverity = 'error' | 'missing' + interface ErrorGroupBase extends Omit { /** Stable structural key used for rendering, collapse state, and cache identity. */ groupKey: string @@ -26,6 +28,7 @@ interface ErrorGroupBase extends Omit { displayTitle: string count: number priority: number + severity: ErrorGroupSeverity } export type ErrorGroup = diff --git a/src/components/rightSidePanel/errors/useErrorGroups.test.ts b/src/components/rightSidePanel/errors/useErrorGroups.test.ts index 9f2de184a17..0c985951e85 100644 --- a/src/components/rightSidePanel/errors/useErrorGroups.test.ts +++ b/src/components/rightSidePanel/errors/useErrorGroups.test.ts @@ -423,6 +423,43 @@ describe('useErrorGroups', () => { expect(swapIdx).toBeLessThan(missingIdx) }) + it('places every error-severity group before missing-severity groups', async () => { + const { store, groups } = createErrorGroups() + const missingNodesStore = useMissingNodesErrorStore() + store.recordPromptError({ + type: 'prompt_no_outputs', + message: 'No outputs', + details: '' + }) + store.recordNodeErrors({ + '1': nodeError([validationError('required_input_missing', 'model')]) + }) + store.surfaceMissingModels([ + makeModel('model.safetensors', { nodeId: '2' }) + ]) + store.surfaceMissingMedia([makeMedia('portrait.png', { nodeId: '3' })]) + missingNodesStore.setMissingNodeTypes([ + makeMissingNodeType('MissingNode', { + nodeId: '4', + cnrId: 'missing-pack' + }) + ]) + await nextTick() + + const errorIndices = groups.allErrorGroups.value.flatMap( + (group, index) => (group.severity === 'error' ? [index] : []) + ) + const missingIndices = groups.allErrorGroups.value.flatMap( + (group, index) => (group.severity === 'missing' ? [index] : []) + ) + + expect(errorIndices.length).toBeGreaterThan(0) + expect(missingIndices.length).toBeGreaterThan(0) + expect(Math.max(...errorIndices)).toBeLessThan( + Math.min(...missingIndices) + ) + }) + it('uses fallback catalog grouping for unknown node validation errors', async () => { const { store, groups } = createErrorGroups() store.recordNodeErrors({ diff --git a/src/components/rightSidePanel/errors/useErrorGroups.ts b/src/components/rightSidePanel/errors/useErrorGroups.ts index 66549b0b8a8..34cdccdbdd0 100644 --- a/src/components/rightSidePanel/errors/useErrorGroups.ts +++ b/src/components/rightSidePanel/errors/useErrorGroups.ts @@ -151,6 +151,7 @@ function toSortedGroups(groupsMap: Map): ErrorGroup[] { const cards = Array.from(groupData.cards.values()).sort(compareNodeId) return { type: 'execution' as const, + severity: 'error' as const, groupKey: `execution:${rawGroupKey}`, displayTitle: groupData.displayTitle, displayMessage: groupData.displayMessage, @@ -614,6 +615,7 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { if (swapCount > 0) { groups.push({ type: 'swap_nodes' as const, + severity: 'missing' as const, groupKey: 'swap_nodes', count: swapCount, priority: 0, @@ -629,6 +631,7 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { if (packCount > 0) { groups.push({ type: 'missing_node' as const, + severity: 'missing' as const, groupKey: 'missing_node', count: packCount, priority: 1, @@ -657,6 +660,7 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { return [ { type: 'missing_model' as const, + severity: 'missing' as const, groupKey: 'missing_model', count, priority: 2, @@ -682,6 +686,7 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { return [ { type: 'missing_media' as const, + severity: 'missing' as const, groupKey: 'missing_media', count: totalRows, priority: 3, @@ -752,6 +757,7 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { return [ { type: 'missing_model' as const, + severity: 'missing' as const, groupKey: 'missing_model', count, priority: 2, @@ -773,6 +779,7 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { return [ { type: 'missing_media' as const, + severity: 'missing' as const, groupKey: 'missing_media', count: totalRows, priority: 3, @@ -794,10 +801,10 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { processExecutionError(groupsMap) return [ + ...toSortedGroups(groupsMap), ...buildMissingNodeGroups(), ...buildMissingModelGroups(), - ...buildMissingMediaGroups(), - ...toSortedGroups(groupsMap) + ...buildMissingMediaGroups() ] }) @@ -816,12 +823,12 @@ export function useErrorGroups(searchQuery: MaybeRefOrGetter) { processExecutionError(groupsMap, true) return [ + ...toSortedGroups(groupsMap), ...buildMissingNodeGroups((nodeTypes) => someNodeTypeInSelection(nodeTypes, selectionMatchedAssetNodeIds.value) ), ...buildMissingModelGroupsForSelection(), - ...buildMissingMediaGroupsForSelection(), - ...toSortedGroups(groupsMap) + ...buildMissingMediaGroupsForSelection() ] }) diff --git a/src/components/rightSidePanel/errors/useHasBlockingError.ts b/src/components/rightSidePanel/errors/useHasBlockingError.ts new file mode 100644 index 00000000000..a51d19f3302 --- /dev/null +++ b/src/components/rightSidePanel/errors/useHasBlockingError.ts @@ -0,0 +1,25 @@ +import { computed } from 'vue' + +import { useExecutionErrorStore } from '@/stores/executionErrorStore' +import { tryNormalizeNodeExecutionId } from '@/types/nodeIdentification' + +export function useHasBlockingError() { + const executionErrorStore = useExecutionErrorStore() + + return computed(() => { + if (executionErrorStore.lastPromptError) return true + if ( + executionErrorStore.lastExecutionError && + tryNormalizeNodeExecutionId( + executionErrorStore.lastExecutionError.node_id + ) + ) { + return true + } + + return Object.entries(executionErrorStore.surfacedNodeErrors ?? {}).some( + ([nodeId, nodeError]) => + !!tryNormalizeNodeExecutionId(nodeId) && nodeError.errors.length > 0 + ) + }) +} diff --git a/src/locales/en/main.json b/src/locales/en/main.json index b417a114d87..be32e7ab615 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -1113,6 +1113,7 @@ "runWorkflowFront": "Run workflow (Queue at front)", "runWorkflowMissingResources": "Workflow contains missing resources.", "run": "Run", + "runOptions": "Run options", "stopRunInstant": "Stop Run (Instant)", "stopRunInstantTooltip": "Stop running", "execute": "Execute", @@ -2364,8 +2365,8 @@ "fileLoadError": "Unable to find workflow in {fileName}", "a1111CoreNodesUnavailable": "Could not load the workflow because this ComfyUI installation is missing core nodes. Check that the backend started correctly.", "dropFileError": "Unable to process dropped item: {error}", - "missingMediaVerificationFailed": "Failed to verify missing media. Some inputs may not be shown in the Errors tab.", - "missingModelVerificationFailed": "Failed to verify missing models. Some models may not be shown in the Errors tab.", + "missingMediaVerificationFailed": "Failed to verify missing media. Some inputs may not be shown in the Issues tab.", + "missingModelVerificationFailed": "Failed to verify missing models. Some models may not be shown in the Issues tab.", "interrupted": "Execution has been interrupted", "pendingTasksDeleted": "Pending tasks deleted", "nothingToGroup": "Nothing to group", @@ -4214,18 +4215,32 @@ "fallbackNodeTitle": "Node", "hideAdvancedInputsButton": "Hide advanced inputs", "hideAdvancedShort": "Hide advanced", - "errors": "Errors", - "noErrors": "No errors", + "errors": "Issues", + "noErrors": "No issues", "errorsDetected": "Error detected | Errors detected", - "selectedNodeErrors": "{node} — {count} error | {node} — {count} errors", - "selectedNodesErrors": "{nodes} nodes selected — {count} error | {nodes} nodes selected — {count} errors", + "selectedNodeErrors": "{node} — {count} issue | {node} — {count} issues", + "selectedNodesErrors": "{nodes} nodes selected — {count} issue | {nodes} nodes selected — {count} issues", "errorNodeSummary": "{nodes} node — {count} error | {nodes} node — {count} errors", "errorNodesSummary": "{nodes} nodes — {count} error | {nodes} nodes — {count} errors", "errorsSummary": "{count} error | {count} errors", "resolveBeforeRun": "Resolve before running the workflow", + "issuesDetected": "Issue detected | Issues detected", + "resolveErrorsBeforeRun": "Resolve errors before running the workflow", + "setupRequired": "Setup required", + "finishSetupBeforeRun": "Finish setup before running the workflow", + "severityCountsStatus": "{errors} blocking, {setup} setup required", + "errorsFilter": "{count} Error | {count} Errors", + "errorsFilterActive": "{count} Error detected | {count} Errors detected", + "setupFilter": "{count} Setup required", + "setupSummary": "{count} item | {count} items", + "setupNodeSummary": "{nodes} node — {count} item | {nodes} node — {count} items", + "setupNodesSummary": "{nodes} nodes — {count} item | {nodes} nodes — {count} items", + "nodesAffected": "{count} node affected | {count} nodes affected", + "severityErrorLabel": "Blocking errors", + "severitySetupLabel": "Setup required", "expand": "Expand", "collapse": "Collapse", - "executionErrorOccurred": "An error occurred during execution. Check the Errors tab for details.", + "executionErrorOccurred": "An error occurred during execution. Check the Issues tab for details.", "errorLog": "Error log", "findOnGithubTooltip": "Search GitHub issues for related problems", "getHelpTooltip": "Report this error and we'll help you resolve it", diff --git a/src/locales/en/settings.json b/src/locales/en/settings.json index 1028b58bfb4..d98b3a74e42 100644 --- a/src/locales/en/settings.json +++ b/src/locales/en/settings.json @@ -367,8 +367,8 @@ "tooltip": "The maximum number of tasks added to the queue at one button click" }, "Comfy_RightSidePanel_ShowErrorsTab": { - "name": "Show errors tab in side panel", - "tooltip": "When enabled, an errors tab is displayed in the right side panel to show workflow execution errors at a glance." + "name": "Show issues tab in side panel", + "tooltip": "When enabled, the Issues tab is displayed in the right side panel to show blocking errors and missing resources that need setup." }, "Comfy_Sidebar_Location": { "name": "Sidebar location", diff --git a/src/platform/missingMedia/missingMediaPipeline.ts b/src/platform/missingMedia/missingMediaPipeline.ts index 46d1b80e097..e8050e23116 100644 --- a/src/platform/missingMedia/missingMediaPipeline.ts +++ b/src/platform/missingMedia/missingMediaPipeline.ts @@ -72,7 +72,7 @@ export async function runMissingMediaPipeline({ severity: 'warn', summary: st( 'toastMessages.missingMediaVerificationFailed', - 'Failed to verify missing media. Some inputs may not be shown in the Errors tab.' + 'Failed to verify missing media. Some inputs may not be shown in the Issues tab.' ), life: 5000 }) diff --git a/src/platform/missingModel/missingModelPipeline.ts b/src/platform/missingModel/missingModelPipeline.ts index 61aac8e3950..768550f8643 100644 --- a/src/platform/missingModel/missingModelPipeline.ts +++ b/src/platform/missingModel/missingModelPipeline.ts @@ -173,7 +173,7 @@ export async function runMissingModelPipeline({ severity: 'warn', summary: st( 'toastMessages.missingModelVerificationFailed', - 'Failed to verify missing models. Some models may not be shown in the Errors tab.' + 'Failed to verify missing models. Some models may not be shown in the Issues tab.' ), life: 5000 }) diff --git a/src/platform/settings/constants/coreSettings.ts b/src/platform/settings/constants/coreSettings.ts index 3bf106bbaab..5e9dcc82c06 100644 --- a/src/platform/settings/constants/coreSettings.ts +++ b/src/platform/settings/constants/coreSettings.ts @@ -1307,9 +1307,9 @@ export const CORE_SETTINGS: SettingParams[] = [ { id: 'Comfy.RightSidePanel.ShowErrorsTab', category: ['Comfy', 'Error System'], - name: 'Show errors tab in side panel', + name: 'Show issues tab in side panel', tooltip: - 'When enabled, an errors tab is displayed in the right side panel to show workflow execution errors at a glance.', + 'When enabled, the Issues tab is displayed in the right side panel to show blocking errors and missing resources that need setup.', type: 'boolean', defaultValue: true, experimental: true,