Skip to content

Comments

[feat] Add bulk import failure info API endpoint#2035

Merged
ltdrdata merged 3 commits intoComfy-Org:draft-v4from
viva-jinyi:feat/import-fail-info-bulk-api
Jul 29, 2025
Merged

[feat] Add bulk import failure info API endpoint#2035
ltdrdata merged 3 commits intoComfy-Org:draft-v4from
viva-jinyi:feat/import-fail-info-bulk-api

Conversation

@viva-jinyi
Copy link
Member

Summary

Add bulk API endpoint for import failure information to reduce API calls from N to 1 for performance optimization.

Changes

  • New endpoint: /v2/customnode/import_fail_info_bulk
  • Added to both: glob and legacy manager servers for compatibility
  • Input validation: Supports cnr_ids and/or urls arrays
  • Error handling: Maintains same pattern as original import_fail_info API
  • Performance: Reduces potential 100+ API calls to single bulk request

API Details

POST /v2/customnode/import_fail_info_bulk
{
  "cnr_ids": ["package1", "package2", ...],
  "urls": ["https://github.com/...", ...]
}

Returns object with package IDs/URLs as keys and import failure info as values.

Test plan

  • Verify bulk API processes multiple cnr_ids correctly
  • Test with intentionally broken custom nodes to generate import failures
  • Confirm both legacy and current manager versions work
  • Validate error handling for invalid inputs

🤖 Generated with Claude Code

- Add import_fail_info_bulk endpoint to both glob and legacy manager servers
- Supports bulk processing of cnr_ids and urls arrays in single request
- Maintains same error handling pattern as original import_fail_info API
- Reduces API calls from N to 1 for conflict detection optimization
- Validates input parameters and provides proper error responses

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

Co-Authored-By: Claude <noreply@anthropic.com>
@viva-jinyi viva-jinyi marked this pull request as ready for review July 27, 2025 09:13
@christian-byrne
Copy link
Contributor

christian-byrne commented Jul 27, 2025

After merging, we will need to follow this process:

On ComfyUI-Manager>main:

  1. Update https://github.com/Comfy-Org/ComfyUI-Manager/blob/main/openapi.yaml with the new path. Add the return type to the components section and the route to the paths section

On ComfyUI-Manager>draft-v4:

  1. Rebase draft-v4 onto main to get the updated openapi in draft-v4
  2. Re-generate the data models following the process described here: https://github.com/Comfy-Org/ComfyUI-Manager/blob/draft-v4/comfyui_manager/data_models/README.md.
  3. Update the route handler to use the new data models for request/response validation, similar to other v2 routes

On ComfyUI_frontend:

  1. Trigger this action manually to update the ComfyUI-Manager types https://github.com/Comfy-Org/ComfyUI_frontend/actions/workflows/update-manager-types.yaml. Important: in the dropdown, select manager/compatibility as the target branch
  2. Approve and merge the PR that is automatically made
  3. Update the getImportFailInfoBulk function in comfyManagerService.ts to use the generated types.

Context: the openapi yaml is the source of truth for the types of data going back and forth between frontend client and ComfyUI-Manager server. We only need to change that then both the server and client generate the types both, ensuring type consistency is always maintained.

Comment on lines 1664 to 1675
# Basic validation - ensure we have either cnr_ids or urls
if not isinstance(json_data, dict):
return web.Response(status=400, text="Request body must be a JSON object")

if "cnr_ids" not in json_data and "urls" not in json_data:
return web.Response(
status=400, text="Either 'cnr_ids' or 'urls' field is required"
)

results = {}

if "cnr_ids" in json_data:
Copy link
Contributor

Choose a reason for hiding this comment

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

After generating the data models, we can use the Pydantic built-in validation 👍

@ltdrdata ltdrdata merged commit 60746c6 into Comfy-Org:draft-v4 Jul 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants