Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions browser_tests/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { Topbar } from './components/Topbar'
import type { Position, Size } from './types'
import { NodeReference, SubgraphSlotReference } from './utils/litegraphUtils'
import TaskHistory from './utils/taskHistory'

dotenv.config()

Expand Down Expand Up @@ -116,8 +115,6 @@ class ConfirmDialog {
}

export class ComfyPage {
private _history: TaskHistory | null = null

public readonly url: string
// All canvas position operations are based on default view of canvas.
public readonly canvas: Locator
Expand Down Expand Up @@ -268,11 +265,6 @@ export class ComfyPage {
}
}

setupHistory(): TaskHistory {
this._history ??= new TaskHistory(this)
return this._history
}

async setup({
clearStorage = true,
mockReleases = true
Expand Down
164 changes: 0 additions & 164 deletions browser_tests/fixtures/utils/taskHistory.ts

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/queue/QueueProgressOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ const {
galleryActiveIndex,
galleryItems,
onViewItem: openResultGallery
} = useResultGallery(() => filteredTasks.value)
} = useResultGallery(
() => filteredTasks.value,
// Lazy load full outputs for history items
(url) => api.fetchApi(url)
)

const setExpanded = (expanded: boolean) => {
isExpanded.value = expanded
Expand Down Expand Up @@ -252,7 +256,7 @@ const focusAssetInSidebar = async (item: JobListItem) => {

const inspectJobAsset = wrapWithErrorHandlingAsync(
async (item: JobListItem) => {
openResultGallery(item)
await openResultGallery(item)
await focusAssetInSidebar(item)
}
)
Expand Down
117 changes: 51 additions & 66 deletions src/components/queue/job/JobDetailsPopover.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/vue3-vite'

import type { TaskStatus } from '@/schemas/apiSchema'
import type { JobListItem } from '@/platform/remote/comfyui/jobs/types/jobTypes'
import { useExecutionStore } from '@/stores/executionStore'
import { TaskItemImpl, useQueueStore } from '@/stores/queueStore'

Expand Down Expand Up @@ -37,91 +37,72 @@ function resetStores() {
exec.nodeProgressStatesByPrompt = {}
}

function makePendingTask(
function makeTask(
id: string,
index: number,
createTimeMs?: number
priority: number,
overrides: Omit<Partial<JobListItem>, 'id' | 'priority'> &
Pick<JobListItem, 'status' | 'create_time' | 'update_time'>
): TaskItemImpl {
const extraData = {
client_id: 'c1',
...(typeof createTimeMs === 'number' ? { create_time: createTimeMs } : {})
const job: JobListItem = {
id,
priority,
last_state_update: null,
...overrides
}
return new TaskItemImpl('Pending', [index, id, {}, extraData, []])
return new TaskItemImpl(job)
}
Comment on lines +40 to +53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

update_time and last_state_update are not defined in JobListItem schema.

The makeTask helper uses update_time (line 44) and last_state_update (line 49), but these fields are not defined in zRawJobListItem in jobTypes.ts. While .passthrough() allows extra fields at runtime, TypeScript won't recognize them, and the explicit type annotation on line 43-44 requiring update_time will cause type errors.

Either add these fields to the zRawJobListItem schema if they're part of the API, or remove them from the story helpers if they're not needed.

#!/bin/bash
# Verify if update_time or last_state_update are used elsewhere in the codebase
rg -n "update_time|last_state_update" --type=ts -g '!node_modules' | head -30
🤖 Prompt for AI Agents
In src/components/queue/job/JobDetailsPopover.stories.ts around lines 40 to 53,
the makeTask helper sets update_time and last_state_update on the JobListItem
but those fields are not declared in the project's zRawJobListItem schema,
causing TypeScript type errors; either add update_time and last_state_update to
the zRawJobListItem/type definitions if these fields are returned by the API
(update the zod schema and corresponding TS types) or remove/stop using these
fields in the story helper and any callers so JobListItem only contains declared
properties; pick one approach and apply the change consistently across the story
helper and related tests/examples.


function makePendingTask(
id: string,
priority: number,
createTimeMs: number
): TaskItemImpl {
return makeTask(id, priority, {
status: 'pending',
create_time: createTimeMs,
update_time: createTimeMs
})
}

function makeRunningTask(
id: string,
index: number,
createTimeMs?: number
priority: number,
createTimeMs: number
): TaskItemImpl {
const extraData = {
client_id: 'c1',
...(typeof createTimeMs === 'number' ? { create_time: createTimeMs } : {})
}
return new TaskItemImpl('Running', [index, id, {}, extraData, []])
return makeTask(id, priority, {
status: 'in_progress',
create_time: createTimeMs,
update_time: createTimeMs
})
}

function makeRunningTaskWithStart(
id: string,
index: number,
priority: number,
startedSecondsAgo: number
): TaskItemImpl {
const start = Date.now() - startedSecondsAgo * 1000
const status: TaskStatus = {
status_str: 'success',
completed: false,
messages: [['execution_start', { prompt_id: id, timestamp: start } as any]]
}
return new TaskItemImpl(
'Running',
[index, id, {}, { client_id: 'c1', create_time: start - 5000 }, []],
status
)
return makeTask(id, priority, {
status: 'in_progress',
create_time: start - 5000,
update_time: start
})
}

function makeHistoryTask(
id: string,
index: number,
durationSec: number,
priority: number,
_durationSec: number,
ok: boolean,
errorMessage?: string
): TaskItemImpl {
const start = Date.now() - durationSec * 1000 - 1000
const end = start + durationSec * 1000
const messages: TaskStatus['messages'] = ok
? [
['execution_start', { prompt_id: id, timestamp: start } as any],
['execution_success', { prompt_id: id, timestamp: end } as any]
]
: [
['execution_start', { prompt_id: id, timestamp: start } as any],
[
'execution_error',
{
prompt_id: id,
timestamp: end,
node_id: '1',
node_type: 'Node',
executed: [],
exception_message:
errorMessage || 'Demo error: Node failed during execution',
exception_type: 'RuntimeError',
traceback: [],
current_inputs: {},
current_outputs: {}
} as any
]
]
const status: TaskStatus = {
status_str: ok ? 'success' : 'error',
completed: true,
messages
}
return new TaskItemImpl(
'History',
[index, id, {}, { client_id: 'c1', create_time: start }, []],
status
)
const now = Date.now()
return makeTask(id, priority, {
status: ok ? 'completed' : 'failed',
create_time: now,
update_time: now,
error_message: errorMessage
})
}

export const Queued: Story = {
Expand All @@ -140,8 +121,12 @@ export const Queued: Story = {
makePendingTask(jobId, queueIndex, Date.now() - 90_000)
]
// Add some other pending jobs to give context
queue.pendingTasks.push(makePendingTask('job-older-1', 100))
queue.pendingTasks.push(makePendingTask('job-older-2', 101))
queue.pendingTasks.push(
makePendingTask('job-older-1', 100, Date.now() - 60_000)
)
queue.pendingTasks.push(
makePendingTask('job-older-2', 101, Date.now() - 30_000)
)

// Queued at (in metadata on prompt[4])

Expand Down
Loading