Skip to content

feat: Add getImportFailInfoBulk function to comfyManagerService#4626

Closed
viva-jinyi wants to merge 1 commit intomainfrom
feat/update-bulk-import-fail-service
Closed

feat: Add getImportFailInfoBulk function to comfyManagerService#4626
viva-jinyi wants to merge 1 commit intomainfrom
feat/update-bulk-import-fail-service

Conversation

@viva-jinyi
Copy link
Member

@viva-jinyi viva-jinyi commented Jul 31, 2025

Summary

Adds support for the new bulk import failure info API endpoint in the ComfyUI Manager service.

Changes

  • New API Route: Added IMPORT_FAIL_INFO_BULK = 'v2/customnode/import_fail_info_bulk'
  • New Function: Implemented getImportFailInfoBulk() with proper validation and error handling
  • Type Safety: Added temporary type definitions (to be replaced with generated types)
  • Documentation: Included comprehensive JSDoc documentation

Implementation Details

  • Follows existing service patterns for error handling and request execution
  • Validates that either cnr_ids or urls arrays are provided
  • Returns a dictionary mapping each ID/URL to its import failure info (or null)
  • Includes proper TypeScript typing and error messages

Dependencies

This PR is prepared for the bulk API endpoint that is being implemented in ComfyUI-Manager:

Next Steps

Once the ComfyUI-Manager PR is merged:

  1. Run the manager types update action
  2. Replace temporary types with auto-generated ones from OpenAPI spec
  3. The function will be ready for use

Usage Example

const { getImportFailInfoBulk } = useComfyManagerService()

// Check multiple CNR IDs
const result = await getImportFailInfoBulk({
  cnr_ids: ['pack1', 'pack2', 'pack3']
})

// Check repository URLs
const result = await getImportFailInfoBulk({
  urls: ['https://github.com/user/repo1', 'https://github.com/user/repo2']
})

┆Issue is synchronized with this Notion page by Unito

- Added new bulk API endpoint route for v2/customnode/import_fail_info_bulk
- Implemented getImportFailInfoBulk function with proper validation and error handling
- Added temporary type definitions (to be replaced with generated types after ComfyUI-Manager PR merge)
- Includes JSDoc documentation and follows existing service patterns
- Validates that either cnr_ids or urls arrays are provided

This prepares the frontend for the new bulk import failure info API endpoint.
Once the ComfyUI-Manager PR is merged and types are generated, the temporary types
will be replaced with the auto-generated ones from the OpenAPI specification.
@github-actions
Copy link

github-actions bot commented Jul 31, 2025

⚠️ Warnings

⚠️ Warning: E2E Test Coverage Missing

If this PR modifies behavior that can be covered by browser-based E2E tests, those tests are required. PRs lacking applicable test coverage may not be reviewed until added. Please add or update browser tests to ensure code quality and prevent regressions.

⚠️ Warning: Visual Documentation Missing

If this PR changes user-facing behavior, visual proof (screen recording or screenshot) is required. PRs without applicable visual documentation may not be reviewed until provided.
You can add it by:

  • GitHub: Drag & drop media directly into the PR description

  • YouTube: Include a link to a short demo

@viva-jinyi viva-jinyi self-assigned this Jul 31, 2025
@christian-byrne christian-byrne added area:manager claude-review Add to trigger a PR code review from Claude Code labels Aug 4, 2025
@claude
Copy link

claude bot commented Aug 4, 2025

Claude finished @viva-jinyi's task —— View job


Comprehensive PR Review

Todo List:

  • Read comprehensive PR review instructions
  • Initialize environment and get PR context
  • Analyze the modified comfyManagerService.ts file thoroughly
  • Post individual inline comments for any issues found
  • Generate comprehensive summary

Review Complete!

Comprehensive PR Review

This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.

Review Summary

PR: feat: Add getImportFailInfoBulk function to comfyManagerService (#4626)
Impact: 45 additions, 0 deletions across 1 file

Issue Distribution

  • Critical: 0
  • High: 2
  • Medium: 2
  • Low: 1

Category Breakdown

  • Architecture: 1 issue (validation inconsistency)
  • Code Quality: 4 issues (internationalization violations, missing documentation)
  • Security: 0 issues
  • Performance: 0 issues

Key Findings

Architecture & Design

The implementation follows established service patterns well, using the existing executeRequest helper and error handling patterns. However, there's a validation inconsistency where the client duplicates server-side validation logic, creating potential maintenance issues.

Code Quality

The main concern is internationalization compliance. According to CLAUDE.md line 35, all user-facing strings must use vue-i18n, but this implementation includes hard-coded error messages. This violates the project's strict internationalization requirements.

Integration Points

The function integrates well with the existing service architecture and follows the established conventions for:

  • Error handling with executeRequest
  • Type safety with proper TypeScript interfaces
  • API client usage patterns
  • AbortSignal support for cancellation

Positive Observations

  • Excellent API Design: The function signature is clean and follows TypeScript best practices
  • Proper Error Handling: Uses the established executeRequest pattern with route-specific error messages
  • Good Documentation: JSDoc is comprehensive and explains parameters, return values, and usage
  • Type Safety: Includes proper TypeScript interfaces (temporary, to be replaced with generated types)
  • Consistent Patterns: Follows the same patterns as other service functions
  • Request Cancellation: Proper AbortSignal support
  • Validation: Includes client-side validation for required parameters

Required Changes Before Merge

  1. Fix Internationalization Violations (High Priority): Replace all hard-coded strings with i18n keys
  2. Resolve Validation Logic Duplication (Medium Priority): Decide whether to handle validation client-side or server-side, not both

Optional Improvements

  • Add JSDoc documentation to the temporary type interfaces
  • Consider adding unit tests to cover the new functionality

References

Next Steps

  1. Address internationalization issues before merge - this is a hard requirement per project guidelines
  2. Consider the architectural feedback about validation logic duplication
  3. Add translations to src/locales/en/main.json for all user-facing strings
  4. Run npm run typecheck and npm run lint after changes

This is a comprehensive automated review. The internationalization issue is critical and must be addressed before merge.


) => {
const errorContext = 'Fetching bulk import failure information'
const routeSpecificErrors = {
400: 'Bad Request: Either cnr_ids or urls field is required'
Copy link

Choose a reason for hiding this comment

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

[quality] high Priority\n\nIssue: Hard-coded error message violates internationalization requirements\nContext: According to CLAUDE.md line 35, all user-facing strings must use vue-i18n - no hard-coded text in services/utilities\nSuggestion: Replace with i18n key and add translation entry in src/locales/en/main.json


// Validate that at least one field is provided
if (!params.cnr_ids?.length && !params.urls?.length) {
throw new Error('Either cnr_ids or urls field is required')
Copy link

Choose a reason for hiding this comment

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

[quality] high Priority\n\nIssue: Hard-coded error message violates internationalization requirements\nContext: According to CLAUDE.md line 35, all user-facing strings must use vue-i18n - no hard-coded text in services/utilities\nSuggestion: Replace with i18n key and add translation entry in src/locales/en/main.json

params: ImportFailInfoBulkRequest,
signal?: AbortSignal
) => {
const errorContext = 'Fetching bulk import failure information'
Copy link

Choose a reason for hiding this comment

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

[quality] medium Priority\n\nIssue: Hard-coded error message violates internationalization requirements\nContext: According to CLAUDE.md line 35, all user-facing strings must use vue-i18n - no hard-coded text in services/utilities\nSuggestion: Replace with i18n key and add translation entry in src/locales/en/main.json

}

// Validate that at least one field is provided
if (!params.cnr_ids?.length && !params.urls?.length) {
Copy link

Choose a reason for hiding this comment

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

[architecture] medium Priority\n\nIssue: Validation logic inconsistency between client and server\nContext: Client throws error before making API call, but the API also handles 400 errors for the same validation. This creates potential race conditions and inconsistent error handling paths\nSuggestion: Either handle all validation on the server side and let the API return 400, or ensure client validation exactly matches server validation rules


// TODO: These types will be auto-generated once ComfyUI-Manager types are updated
// After the ComfyUI-Manager PR is merged and types are generated, replace these with the generated types
interface ImportFailInfoBulkRequest {
Copy link

Choose a reason for hiding this comment

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

[quality] low Priority\n\nIssue: Missing JSDoc documentation for type interfaces\nContext: While the function has good JSDoc, the temporary type interfaces lack documentation explaining their structure and usage\nSuggestion: Add JSDoc comments to ImportFailInfoBulkRequest, ImportFailInfoItem, and ImportFailInfoBulkResponse interfaces

@viva-jinyi viva-jinyi closed this Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:manager claude-review Add to trigger a PR code review from Claude Code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants