Skip to content

Conversation

@ric-yu
Copy link

@ric-yu ric-yu commented Dec 4, 2025

Summary

Migrate frontend from legacy /history, /history_v2, and /queue endpoints to the unified /jobs API with memory optimization and lazy loading.

This is PR 2 of 3 - Core migration, depends on PR 1.

Changes

  • What:

    • Replace api.getQueue() and api.getHistory() implementations to use Jobs API fetchers
    • Implement lazy loading for workflow and full outputs via /jobs/{id} endpoint in useJobMenu
    • Add TaskItemImpl class wrapping JobListItem for queue store compatibility
    • Rename reconcileHistory to reconcileJobs for clarity
    • Use execution_start_time and execution_end_time from API for execution timing
    • Use workflowId from job instead of nested workflow.id
    • Update useJobMenu to fetch job details on demand (openJobWorkflow, exportJobWorkflow)
  • Breaking: Requires backend Jobs API support (ComfyUI with /jobs endpoint)

Review Focus

  1. Lazy loading in useJobMenu: openJobWorkflow and exportJobWorkflow now fetch from API on demand instead of accessing taskRef.workflow
  2. TaskItemImpl wrapper: Adapts JobListItem to existing queue store interface
  3. Error reporting: Uses execution_error field from API for rich error dialogs
  4. Memory optimization: Only fetches full job details when needed

Files Changed

  • src/scripts/api.ts - Updated getQueue() and getHistory() to use Jobs API
  • src/stores/queueStore.ts - Added TaskItemImpl, updated to use JobListItem
  • src/composables/useJobMenu.ts - Lazy loading for workflow access
  • src/composables/useJobList.ts - Updated types
  • Various test files updated

Dependencies

Next PR

  • PR 3: Remove legacy history code and unused types

┆Issue is synchronized with this Notion page by Unito

@ric-yu ric-yu requested a review from a team as a code owner December 4, 2025 23:55
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jobs-api-pr2-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Dec 4, 2025
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

🎭 Playwright Test Results

⚠️ Tests passed with flaky tests

⏰ Completed at: 12/05/2025, 10:11:45 PM UTC

📈 Summary

  • Total Tests: 494
  • Passed: 480 ✅
  • Failed: 0
  • Flaky: 4 ⚠️
  • Skipped: 10 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 471 / ❌ 0 / ⚠️ 4 / ⏭️ 10
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 6 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 12/05/2025, 10:02:44 PM UTC

🔗 Links


🎉 Your Storybook is ready for review!

@ric-yu ric-yu force-pushed the jobs-api-pr1-infrastructure branch from de0d169 to 5cb2579 Compare December 5, 2025 00:07
@ric-yu ric-yu force-pushed the jobs-api-pr2-migration branch from a1869fe to d38a8a6 Compare December 5, 2025 00:08
@ric-yu ric-yu force-pushed the jobs-api-pr1-infrastructure branch from 5cb2579 to 0a619ec Compare December 5, 2025 00:30
@ric-yu ric-yu force-pushed the jobs-api-pr2-migration branch 2 times, most recently from eb0ca33 to 5ef30f3 Compare December 5, 2025 00:42
@ric-yu ric-yu force-pushed the jobs-api-pr2-migration branch from b457e64 to 1b94732 Compare December 5, 2025 21:50
ric-yu and others added 4 commits December 5, 2025 14:01
Adds Jobs API types, fetchers, and new API methods without breaking existing code.
This is the foundation for migrating from legacy /history and /queue endpoints
to the unified /jobs endpoint.

New files:
- src/platform/remote/comfyui/jobs/types/jobTypes.ts - Zod schemas for Jobs API
- src/platform/remote/comfyui/jobs/fetchers/fetchJobs.ts - Fetchers for /jobs endpoint
- src/platform/remote/comfyui/jobs/index.ts - Barrel exports
- tests-ui/tests/platform/remote/comfyui/jobs/fetchers/fetchJobs.test.ts

API additions (non-breaking):
- api.getQueueFromJobsApi() - Queue from /jobs endpoint
- api.getHistoryFromJobsApi() - History from /jobs endpoint
- api.getJobDetail() - Full job details including workflow and outputs

Part of Jobs API migration. See docs/JOBS_API_MIGRATION_PLAN.md for details.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Adds Jobs API types, fetchers, and new API methods without breaking existing code.
This is the foundation for migrating from legacy /history and /queue endpoints
to the unified /jobs endpoint.

New files:
- src/platform/remote/comfyui/jobs/types/jobTypes.ts - Zod schemas for Jobs API
- src/platform/remote/comfyui/jobs/fetchers/fetchJobs.ts - Fetchers for /jobs endpoint
- src/platform/remote/comfyui/jobs/index.ts - Barrel exports
- tests-ui/tests/platform/remote/comfyui/jobs/fetchers/fetchJobs.test.ts

API additions (non-breaking):
- api.getQueueFromJobsApi() - Queue from /jobs endpoint
- api.getHistoryFromJobsApi() - History from /jobs endpoint
- api.getJobDetail() - Full job details including workflow and outputs

Part of Jobs API migration. See docs/JOBS_API_MIGRATION_PLAN.md for details.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This PR switches the frontend from legacy /history and /queue endpoints
to the unified /jobs API.

Key changes:
- Rewrite TaskItemImpl in queueStore.ts to wrap JobListItem
- Update api.ts getQueue()/getHistory() to use Jobs API
- Update all queue composables (useJobList, useJobMenu, useResultGallery)
- Update useJobErrorReporting to use execution_error.exception_message
- Update JobGroupsList.vue workflowId access
- Update reconciliation.ts to work with JobListItem
- Update all related tests

Breaking changes:
- getQueue() now returns JobListItem[] instead of legacy tuple format
- getHistory() now returns JobListItem[] instead of HistoryTaskItem[]
- TaskItemImpl.outputs now lazily loads via loadFullOutputs()

Part of Jobs API migration. Depends on PR 1 (jobs-api-pr1-infrastructure).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ric-yu ric-yu force-pushed the jobs-api-pr2-migration branch from 1b94732 to f1999c3 Compare December 5, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants