feat(validate): report partner_nodes (paid) + spends_credits in comfy validate (BE-4328) - #590
feat(validate): report partner_nodes (paid) + spends_credits in comfy validate (BE-4328)#590mattmillerai wants to merge 2 commits into
Conversation
… validate (BE-4328) comfy validate now previews credit spend read-only: after the graph is loaded (and any UI->API conversion has run), it detects partner-API (paid) nodes with the same authoritative api_node:true / partner-category detection comfy run uses, and adds two always-present payload fields: partner_nodes (sorted list, [] when none) and spends_credits (bool). Pretty mode prints an informational yellow line after the verdict when non-empty. Detection stays advisory — no exit-code change, no gate (the enforcement gate lives in comfy run). Offline --input mode is unchanged: detection is a pure function over the loaded object_info and fails open (empty list) when the flags are absent.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
Found 2 finding(s).
| Severity | Count |
|---|---|
| 🟡 Medium | 1 |
| 🟢 Low | 1 |
Panel: 5/8 reviewers contributed findings.
Reviewers that did not contribute: kimi-k2.5:adversarial (empty), claude-opus-4-8-thinking-xhigh:edge-case (parse_error), kimi-k2.5:edge-case (empty)
…328) Partner-node class_type strings come from the workflow / object_info and can contain Rich-markup metacharacters (e.g. `[/yellow]` or `Node[Paid]`). Interpolated raw into the paid-nodes advisory f-string, an odd name raised MarkupError and crashed `comfy validate` in pretty mode. Escape each name with rich.markup.escape before joining. Adds a pretty-mode regression test. Addresses cursor-review finding (raised by 4 of 8 reviewers). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ELI-5
Before you run a workflow,
comfy validatetells you if it's structurally OK. But some nodes are "partner-API" (paid) nodes — running them spends Comfy credits. Until nowvalidatenever told you that; the only way to find out was to try torunit and hit a credential error. This PR makesvalidatepreview the spend: it now reports which paid nodes a workflow uses (partner_nodes) and a simplespends_creditsyes/no flag, so an agent (or a human) can answer "will this cost me credits?" without running anything. It's purely informational — it never changes whether validation passes.What changed
comfy validatenow, after loading the graph (and after any UI→API conversion), runs the same partner-node detectioncomfy runalready uses — the authoritativeapi_node: trueflag fromobject_info, with apartner/...category-prefix fallback (_detect_partner_nodes, reused fromcomfy_cli/command/run/preflight.py). Two fields are added to the emitted payload:partner_nodes— sorted list of the workflow's partner-API node class_types. Always present;[]when none.spends_credits—bool(partner_nodes).In pretty (non-
--json) mode, when non-empty, a yellow line prints after the valid/invalid verdict:Both fields are documented in a new
comfy validate --jsonsection indocs/json-output.md.Advisory only — this is pure visibility. No exit-code change, no gate; validate stays advisory and the enforcement gate remains in
comfy run(this ticket is independent of that gate). Detection runs over the loadedobject_info, so offline--inputmode works unchanged and fails open (empty list) when the object_info lacksapi_nodeflags — the same posturecomfy runtakes.Tests
Extended
tests/comfy_cli/command/test_validate_command.py(11 pass):api_node: truenode →partner_nodescontains it,spends_creditstrue, exit 0 (otherwise-valid).partner_nodes: [],spends_credits: false.partner/video/…, noapi_nodeflag) → detected.errorsandpartner_nodespresent, exit 1 (from the error, not the partner node).Also verified
tests/comfy_cli/command/test_run.py,cql/test_engine.py,test_run_template.py, andtests/comfy_cli/output/(envelope schemas) all still pass;ruff check+ruff format --checkclean.Judgment calls
_detect_partner_nodes— imported fromcomfy_cli.command.run.preflightexactly as the ticket specified (also re-exported fromcomfy_cli.command.run), keeping one source of truth for detection acrossrunandvalidate.docs/json-output.mdhad no existingvalidatesection (the doc iscomfy run-centric and never documented validate's payload). Rather than document just the two fields in a non-existent section, I added a concisecomfy validate --jsonsection covering the full validate payload (including the pre-existingconverted_from_ui/converted_node_countfields), with the two new fields called out.