Add ComfyUI node compatibility checker#973
Conversation
Scan workflow templates against a local ComfyUI object registry to flag stale node inputs, deprecated nodes, and removed API model options before templates break at runtime.
📝 WalkthroughWalkthroughAdds a ComfyUI workflow compatibility validator CLI and an npm script to run it. The script loads node metadata, scans template JSON workflows, checks node/input/combo compatibility, and reports issues. ChangesComfyUI node compatibility validation
Sequence Diagram(s)sequenceDiagram
participant main as main()
participant build_specs as build_specs(...)
participant build_specs_from_object_info as build_specs_from_object_info(...)
participant workflow_nodes as workflow_nodes(...)
participant check_node as check_node(...)
participant print_report as print_report(...)
main->>build_specs: load ComfyUI node specs and warnings
alt object_info source selected
main->>build_specs_from_object_info: load NodeSpec map from JSON
else local checkout source selected
main->>build_specs: load NodeSpec map from nodes.py
end
main->>workflow_nodes: extract nodes from each workflow JSON
main->>check_node: validate node types, inputs, and combos
main->>print_report: render aggregated issues and warnings
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/validate/check_comfyui_node_compat.py`:
- Line 33: The hardcoded personal default in DEFAULT_COMFYUI_DIR should be
removed because it breaks other users and leaks a username. Update
check_comfyui_node_compat.py to derive paths through scripts/lib/paths.py or
require an explicit source instead of defaulting to
/Users/linmoumou/Documents/Github/ComfyUI; then make main() validate that one of
--comfyui-dir, --object-info-url, or --object-info-json is provided before any
filesystem access.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c59da490-9dc7-4e8d-8041-aad64879bb52
📒 Files selected for processing (2)
package.jsonscripts/validate/check_comfyui_node_compat.py
| from locale_index_files import TEMPLATES_NON_WORKFLOW_FILES # noqa: E402 | ||
| from paths import TEMPLATES_DIR # noqa: E402 | ||
|
|
||
| DEFAULT_COMFYUI_DIR = Path("/Users/linmoumou/Documents/Github/ComfyUI") |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Drop the hardcoded personal path default — it strands every other user (and leaks a username).
DEFAULT_COMFYUI_DIR points at /Users/linmoumou/..., so anyone who doesn't pass --comfyui-dir (and isn't linmoumou) hits a FileNotFoundError at Line 117. It also bakes a personal directory/username into a committed tool. Per the coding guideline for scripts/validate/**/*.py, derive paths via scripts/lib/paths.py rather than hardcoding — no need to drive yourself round the bend over one stray path.
Consider defaulting to None and requiring one of the three sources explicitly, or deriving from an env var / REPO_ROOT.
🔧 Sketch: require an explicit source instead of a personal default
-DEFAULT_COMFYUI_DIR = Path("/Users/linmoumou/Documents/Github/ComfyUI")
+# Resolve via env var, falling back to a repo-relative sibling checkout.
+DEFAULT_COMFYUI_DIR = Path(os.environ["COMFYUI_DIR"]) if os.environ.get("COMFYUI_DIR") else NoneIf kept as None, validate in main() that at least one of --comfyui-dir, --object-info-url, or --object-info-json resolves before building specs.
As per coding guidelines: "derive the repo root via scripts/lib/paths.py instead of hardcoding paths".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/validate/check_comfyui_node_compat.py` at line 33, The hardcoded
personal default in DEFAULT_COMFYUI_DIR should be removed because it breaks
other users and leaks a username. Update check_comfyui_node_compat.py to derive
paths through scripts/lib/paths.py or require an explicit source instead of
defaulting to /Users/linmoumou/Documents/Github/ComfyUI; then make main()
validate that one of --comfyui-dir, --object-info-url, or --object-info-json is
provided before any filesystem access.
Sources: Coding guidelines, Linters/SAST tools
Summary
scripts/validate/check_comfyui_node_compat.pyto scan templates against a local ComfyUI node registry or/object_infoendpointnpm run validate:comfyui-nodesas a convenience commandTest plan
python3 scripts/validate/check_comfyui_node_compat.py --help--object-info-url http://127.0.0.1:8188/object_info