feat: add essentials_category to nodes and blueprints for Essentials tab#12573
feat: add essentials_category to nodes and blueprints for Essentials tab#12573
Conversation
Add ESSENTIALS_CATEGORY or essentials_category to 12 node classes and all 36 blueprint JSONs. Update SubgraphEntry TypedDict and subgraph_manager to extract and pass through the field. Fixes COM-15221 Amp-Thread-ID: https://ampcode.com/threads/T-019c83de-f7ab-7779-a451-0ba5940b56a9
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThree node classes in 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment Tip You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.Change the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/subgraph_manager.py (1)
106-115: Avoid swallowing blueprint parse errors silently.
The blanketexcept Exception: passmakes JSON/IO issues hard to diagnose. Consider narrowing the exception and logging at least at debug level.💡 Suggested tweak
+import logging ... +logger = logging.getLogger(__name__)- except Exception: - pass + except (OSError, json.JSONDecodeError) as exc: + logger.debug("Failed to read essentials_category from %s: %s", file, exc)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/subgraph_manager.py` around lines 106 - 115, The try/except is currently swallowing all errors when reading/parsing blueprint files; change the block around opening/parsing the file (the with open(...) as f, json.load into bp_data, subgraphs extraction and setting entry['essentials_category']) to catch specific errors (json.JSONDecodeError and OSError) and log the exception at debug or warning level (e.g., logger.debug or logger.warning) including the filename and error details, while allowing truly unexpected exceptions to propagate (or re-raise them) so they are not silently ignored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/subgraph_manager.py`:
- Around line 106-115: The try/except is currently swallowing all errors when
reading/parsing blueprint files; change the block around opening/parsing the
file (the with open(...) as f, json.load into bp_data, subgraphs extraction and
setting entry['essentials_category']) to catch specific errors
(json.JSONDecodeError and OSError) and log the exception at debug or warning
level (e.g., logger.debug or logger.warning) including the filename and error
details, while allowing truly unexpected exceptions to propagate (or re-raise
them) so they are not silently ignored.
## Summary Wire `essentials_category` through from backend to the Essentials tab UI. Creates a single source of truth for node categorization and ordering. ### Changes **New file — `src/constants/essentialsNodes.ts`:** - Single source of truth: `ESSENTIALS_NODES` (ordered nodes per category), `ESSENTIALS_CATEGORIES` (folder display order), `ESSENTIALS_CATEGORY_MAP` (flat lookup), `TOOLKIT_NOVEL_NODE_NAMES` (telemetry), `TOOLKIT_BLUEPRINT_MODULES` **Refactored files:** - `src/types/nodeSource.ts`: Removed inline `ESSENTIALS_CATEGORY_MOCK`, imports `ESSENTIALS_CATEGORY_MAP` from centralized constants - `src/services/nodeOrganizationService.ts`: Removed inline `NODE_ORDER_BY_FOLDER`, imports `ESSENTIALS_NODES` and `ESSENTIALS_CATEGORIES` - `src/constants/toolkitNodes.ts`: Re-exports from `essentialsNodes.ts` instead of maintaining a separate list **Subgraph passthrough:** - `src/stores/subgraphStore.ts`: Passes `essentials_category` from `GlobalSubgraphData` and extracts it from `definitions.subgraphs[0]` as fallback - `src/platform/workflow/validation/schemas/workflowSchema.ts`: Added `essentials_category` to `SubgraphDefinitionBase` and `zSubgraphDefinition` **Tests:** - `src/constants/essentialsNodes.test.ts`: 6 tests validating no duplicates, complete coverage, basics exclusion - `src/stores/subgraphStore.test.ts`: 2 tests for essentials_category passthrough All 43 relevant tests pass. Typecheck, lint, format clean. **Depends on:** Comfy-Org/ComfyUI#12573 Fixes COM-15221 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9091-feat-wire-essentials_category-for-Essentials-tab-display-30f6d73d3650814ab3d4c06b451c273b) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
## Summary Wire `essentials_category` through from backend to the Essentials tab UI. Creates a single source of truth for node categorization and ordering. ### Changes **New file — `src/constants/essentialsNodes.ts`:** - Single source of truth: `ESSENTIALS_NODES` (ordered nodes per category), `ESSENTIALS_CATEGORIES` (folder display order), `ESSENTIALS_CATEGORY_MAP` (flat lookup), `TOOLKIT_NOVEL_NODE_NAMES` (telemetry), `TOOLKIT_BLUEPRINT_MODULES` **Refactored files:** - `src/types/nodeSource.ts`: Removed inline `ESSENTIALS_CATEGORY_MOCK`, imports `ESSENTIALS_CATEGORY_MAP` from centralized constants - `src/services/nodeOrganizationService.ts`: Removed inline `NODE_ORDER_BY_FOLDER`, imports `ESSENTIALS_NODES` and `ESSENTIALS_CATEGORIES` - `src/constants/toolkitNodes.ts`: Re-exports from `essentialsNodes.ts` instead of maintaining a separate list **Subgraph passthrough:** - `src/stores/subgraphStore.ts`: Passes `essentials_category` from `GlobalSubgraphData` and extracts it from `definitions.subgraphs[0]` as fallback - `src/platform/workflow/validation/schemas/workflowSchema.ts`: Added `essentials_category` to `SubgraphDefinitionBase` and `zSubgraphDefinition` **Tests:** - `src/constants/essentialsNodes.test.ts`: 6 tests validating no duplicates, complete coverage, basics exclusion - `src/stores/subgraphStore.test.ts`: 2 tests for essentials_category passthrough All 43 relevant tests pass. Typecheck, lint, format clean. **Depends on:** Comfy-Org/ComfyUI#12573 Fixes COM-15221 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9091-feat-wire-essentials_category-for-Essentials-tab-display-30f6d73d3650814ab3d4c06b451c273b) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/subgraph_manager.py (1)
107-116: Avoid swallowing all exceptions during blueprint parsing.
except Exception: passcan hide unexpected bugs and makes failures untraceable. Please narrow the exception types and log parse failures.🔧 Suggested patch
+import logging import os import json @@ +logger = logging.getLogger(__name__) + class SubgraphManager: @@ - try: + try: with open(file, 'r', encoding='utf-8') as f: bp_data = json.load(f) subgraphs = bp_data.get('definitions', {}).get('subgraphs', []) - if subgraphs: + if subgraphs and isinstance(subgraphs[0], dict): ec = subgraphs[0].get('essentials_category') - if ec: + if isinstance(ec, str) and ec: entry['essentials_category'] = ec - except Exception: - pass + except (OSError, json.JSONDecodeError, TypeError, AttributeError) as exc: + logger.warning( + "Failed to read essentials_category from blueprint '%s': %s", + file, + exc, + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/subgraph_manager.py` around lines 107 - 116, The current try/except around reading and parsing blueprint JSON (the with open(file, 'r', ...) block that creates bp_data, subgraphs, and sets entry['essentials_category']) swallows all exceptions; change it to catch and handle specific exceptions (FileNotFoundError, PermissionError, UnicodeDecodeError, json.JSONDecodeError) and only those related to I/O/parsing, and log failures with a descriptive message and the filename/entry id using the module logger instead of silently passing; do not catch Exception broadly so other bugs surface.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/subgraph_manager.py`:
- Around line 107-116: The current try/except around reading and parsing
blueprint JSON (the with open(file, 'r', ...) block that creates bp_data,
subgraphs, and sets entry['essentials_category']) swallows all exceptions;
change it to catch and handle specific exceptions (FileNotFoundError,
PermissionError, UnicodeDecodeError, json.JSONDecodeError) and only those
related to I/O/parsing, and log failures with a descriptive message and the
filename/entry id using the module logger instead of silently passing; do not
catch Exception broadly so other bugs surface.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6c8be10f-8b62-4283-a9d5-4e9879237a71
📒 Files selected for processing (7)
app/subgraph_manager.pycomfy_api_nodes/nodes_kling.pycomfy_extras/nodes_audio.pycomfy_extras/nodes_images.pycomfy_extras/nodes_post_processing.pycomfy_extras/nodes_video.pynodes.py
…subgraph changes Frontend will own blueprint categorization separately.
Summary
Add
essentials_category/ESSENTIALS_CATEGORYto 12 node classes and all 36 blueprint JSONs so the frontend Essentials tab can categorize and order them correctly.Changes
Node classes (12 total):
nodes.py: LoadImage, SaveImage, PreviewImage, LoadImageMasknodes_post_processing.py: ImageBlend, ImageCropV2, ImageScaleBynodes_video.py: Video Slicenodes_audio.py: EmptyLatentAudio, SaveAudioMP3nodes_images.py: ImageCompare (via nodes_image_compare.py)nodes_recraft.py: RecraftVectorizeImageNodenodes_kling.py: KlingOmniProEditVideoNodeBlueprints (36 JSONs):
essentials_categoryfield todefinitions.subgraphs[0]in every blueprintBackend plumbing:
app/subgraph_manager.py: Addedessentials_categorytoSubgraphEntryTypedDict and extraction logic inget_blueprint_subgraphsFixes COM-15221
API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms